RasterImageResourceBase
Inheritance: java.lang.Object
All Implemented Interfaces: com.groupdocs.editor.htmlcss.resources.images.IImageResource
public abstract class RasterImageResourceBase implements IImageResource
Base class for any supported raster image with fixed name, dimensions, aspect ratio, type, size, and content.
Constructors
Constructor | Description |
---|---|
RasterImageResourceBase() |
Fields
Field | Description |
---|---|
Disposed |
Methods
Method | Description |
---|---|
getName() | Returns name of this raster image. |
getFilenameWithExtension() | Returns correct filename of this raster image, which consists of name and extension. |
getLinearDimensions() | Returns linear dimensions of this raster image (width and height) |
getAspectRatio() | Returns an aspect ratio of this image as the width-to-height relation |
getLength() | Returns the length of this raster image file in bytes |
getByteContent() | Returns content of this raster image as byte stream |
getTextContent() | Returns content of this raster image as base64-encoded string |
save(String fullPathToFile) | Saves this raster image to the specified file |
generateBitmap() | Generates and returns a new instance of the ‘System.Drawing.Bitmap’ from this raster image. |
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. |
equals(IHtmlResource other) | Checks this instance with specified on reference equality. |
dispose() | Disposes this raster image, disposing its content and making most methods and properties non-working |
isDisposed() | Determines whether this raster image is disposed or not |
getType() | In implementing type should return information about type of the raster image |
RasterImageResourceBase()
public RasterImageResourceBase()
Disposed
public final Event<EventHandler> Disposed
getName()
public final String getName()
Returns name of this raster image. Usually doesn’t contain filename extension and theoretically can differ from filename.
Returns: java.lang.String
getFilenameWithExtension()
public final String getFilenameWithExtension()
Returns correct filename of this raster image, which consists of name and extension. Theoretically can differ from the name.
Returns: java.lang.String
getLinearDimensions()
public final Dimensions getLinearDimensions()
Returns linear dimensions of this raster image (width and height)
Returns: Dimensions
getAspectRatio()
public final Ratio getAspectRatio()
Returns an aspect ratio of this image as the width-to-height relation
Returns: Ratio
getLength()
public final int getLength()
Returns the length of this raster image file in bytes
Returns: int -
getByteContent()
public final InputStream getByteContent()
Returns content of this raster image as byte stream
Returns: java.io.InputStream -
getTextContent()
public final String getTextContent()
Returns content of this raster image as base64-encoded string
Returns: java.lang.String -
save(String fullPathToFile)
public final void save(String fullPathToFile)
Saves this raster image to the specified file
Parameters:
Parameter | Type | Description |
---|---|---|
fullPathToFile | java.lang.String | Full path to the file, which will be created or rewritten |
generateBitmap()
public final BufferedImage generateBitmap()
Generates and returns a new instance of the ‘System.Drawing.Bitmap’ from this raster image.
Returns: java.awt.image.BufferedImage - New instance of ‘System.Drawing.Bitmap’
‘System.Drawing.Bitmap’ is not cached and thus will be generated every time this method will be called
reduceToNewHeight(int targetHeightInPixels)
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.
Parameters:
Parameter | Type | Description |
---|---|---|
targetHeightInPixels | int | Height of the desired image in pixels. Should be strictly lesser than original height. |
Returns: RasterImageResourceBase - New instance with specified height, that is inheritor of RasterImageResourceBase
equals(IHtmlResource other)
public final boolean equals(IHtmlResource other)
Checks this instance with specified on reference equality.
Parameters:
Parameter | Type | Description |
---|---|---|
other | IHtmlResource | Other IHtmlResource inheritor |
Returns: boolean - True if are equal, false if are unequal
dispose()
public final void dispose()
Disposes this raster image, disposing its content and making most methods and properties non-working
isDisposed()
public final boolean isDisposed()
Determines whether this raster image is disposed or not
Returns: boolean -
getType()
public abstract ImageType getType()
In implementing type should return information about type of the raster image
Returns: ImageType -