public abstract class RasterImageResourceBase extends Object implements IImageResource
Base class for any supported raster image with fixed name, dimensions, aspect ratio, type, size, and content.
Modifier and Type | Field and Description |
---|---|
Event<EventHandler> |
Disposed |
Constructor and Description |
---|
RasterImageResourceBase() |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this raster image, disposing its content and making most methods
and properties non-working
|
boolean |
equals(IHtmlResource other)
Checks this instance with specified on reference equality.
|
BufferedImage |
generateBitmap()
Generates and returns a new instance of the 'System.Drawing.Bitmap' from
this raster image.
|
Ratio |
getAspectRatio()
Returns an aspect ratio of this image as the width-to-height relation
|
InputStream |
getByteContent()
Returns content of this raster image as byte stream
|
String |
getFilenameWithExtension()
Returns correct filename of this raster image, which consists of name and
extension.
|
int |
getLength()
Returns the length of this raster image file in bytes
|
Dimensions |
getLinearDimensions()
Returns linear dimensions of this raster image (width and height)
|
String |
getName()
Returns name of this raster image.
|
String |
getTextContent()
Returns content of this raster image as base64-encoded string
|
abstract ImageType |
getType()
In implementing type should return information about type of the raster
image
|
boolean |
isDisposed()
Determines whether this raster image is disposed or not
|
RasterImageResourceBase |
reduceToNewHeight(int targetHeightInPixels)
Creates and returns a new reduced image resource of the same type, but
with specified new reduced height and proportionally reduced width.
|
void |
save(String fullPathToFile)
Saves this raster image to the specified file
|
public final Event<EventHandler> Disposed
public final void dispose()
Disposes this raster image, disposing its content and making most methods and properties non-working
dispose
in interface IDisposable
public final boolean equals(IHtmlResource other)
Checks this instance with specified on reference equality.
other
- Other IHtmlResource inheritorpublic final BufferedImage generateBitmap()
Generates and returns a new instance of the 'System.Drawing.Bitmap' from this raster image.
public final Ratio getAspectRatio()
Returns an aspect ratio of this image as the width-to-height relation
getAspectRatio
in interface IImageResource
public final InputStream getByteContent()
Returns content of this raster image as byte stream
getByteContent
in interface IHtmlResource
public final String getFilenameWithExtension()
Returns correct filename of this raster image, which consists of name and extension. Theoretically can differ from the name.
getFilenameWithExtension
in interface IHtmlResource
public final int getLength()
Returns the length of this raster image file in bytes
public final Dimensions getLinearDimensions()
Returns linear dimensions of this raster image (width and height)
getLinearDimensions
in interface IImageResource
public final String getName()
Returns name of this raster image. Usually doesn't contain filename extension and theoretically can differ from filename.
getName
in interface IHtmlResource
public final String getTextContent()
Returns content of this raster image as base64-encoded string
getTextContent
in interface IHtmlResource
public abstract ImageType getType()
In implementing type should return information about type of the raster image
getType
in interface IHtmlResource
getType
in interface IImageResource
public final boolean isDisposed()
Determines whether this raster image is disposed or not
isDisposed
in interface IAuxDisposable
public RasterImageResourceBase reduceToNewHeight(int targetHeightInPixels)
Creates and returns a new reduced image resource of the same type, but with specified new reduced height and proportionally reduced width.
targetHeightInPixels
- Height of the desired image in pixels. Should
be strictly lesser than original height.public final void save(String fullPathToFile)
Saves this raster image to the specified file
save
in interface IHtmlResource
fullPathToFile
- Full path to the file, which will be created or
rewritten