GifFrameBlock
Inheritance: java.lang.Object, com.aspose.imaging.DisposableObject, com.aspose.imaging.DataStreamSupporter, com.aspose.imaging.Image, com.aspose.imaging.RasterImage, com.aspose.imaging.RasterCachedImage
All Implemented Interfaces: com.aspose.imaging.fileformats.gif.IGifBlock, com.aspose.imaging.IAnimationFrame, com.aspose.fileformats.core.interfaces.IInterlaced
public final class GifFrameBlock extends RasterCachedImage implements IGifBlock, IAnimationFrame, IInterlaced
Gif frame block.
Constructors
Fields
Field | Description |
---|---|
EXTENSION_LABEL | Block extension label. |
IMAGE_DESCRIPTOR_SIZE | The image descriptor size. |
Methods
Method | Description |
---|---|
getColorPalette(IColorPalette framePalette, IColorPalette containerPalette) | Gets the associated color palette. |
createFlags(IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced) | Creates the flags. |
getFileFormat() | Gets a value of file format |
getWidth() | Gets the image width. |
getHeight() | Gets the image height. |
getBitsPerPixel() | Gets the image bits per pixel count. |
getFrameTime() | Gets the duration. |
setFrameTime(int value) | Sets the duration. |
getInterlaced() | Gets or sets a value indicating whether this GifFrameBlock is interlaced. |
isInterlaced() | Gets a value indicating whether this image instance is interlaced. |
setInterlaced(boolean value) | Gets or sets a value indicating whether this GifFrameBlock is interlaced. |
isPaletteSorted() | Gets or sets a value indicating whether color palette is sorted. |
setPaletteSorted(boolean value) | Gets or sets a value indicating whether color palette is sorted. |
getGifFrameBitsPerPixel() | Gets or sets the GIF frame bits per pixel. |
setGifFrameBitsPerPixel(byte value) | Gets or sets the GIF frame bits per pixel. |
getLeft() | Gets or sets the left image location. |
setLeft(int value) | Gets or sets the left image location. |
getTop() | Gets or sets the top image location. |
setTop(int value) | Gets or sets the top image location. |
getFrameTop() | Converts to p. |
getFrameLeft() | Gets the left. |
getDisposalMethod() | Gets the disposal method. |
getFlags() | Gets or sets the flags. |
setFlags(byte value) | Gets or sets the flags. |
isUseAlphaBlending() | Gets a value indicating whether [use alpha blending]. |
getControlBlock() | Gets the graphics control block associated with this block. |
hasTransparentColor() | Gets a value indicating whether frame block has transparent color. |
getTransparentColor() | Gets the transparent color of frame block. |
setTransparentColor(boolean value) | Gets a value indicating whether frame block has transparent color. |
setTransparentColor(Color value) | Gets the transparent color of frame block. |
getBackgroundColor() | Gets a value for the background color. |
setBackgroundColor(Color value) | Sets a value for the background color. |
getOriginalOptions() | Gets the options based on the original file settings. |
adjustBrightness(int brightness) | Adjust of a brightness for image. |
replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb) | Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges. |
replaceNonTransparentColors(int newColorArgb) | Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. |
getFullFrame() | Gets the full frame. |
resize(int newWidth, int newHeight, ImageResizeSettings imageResizeSettings) | Resizes this RasterCachedImage instance. |
GifFrameBlock(int width, int height)
public GifFrameBlock(int width, int height)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
width | int | The image width. |
height | int | The image height. |
GifFrameBlock(int left, int top, int width, int height)
public GifFrameBlock(int left, int top, int width, int height)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
left | int | The left image position. |
top | int | The top image position. |
width | int | The image width. |
height | int | The image height. |
GifFrameBlock(int left, int top, int width, int height, IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte bitsPerPixel)
public GifFrameBlock(int left, int top, int width, int height, IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte bitsPerPixel)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
left | int | The left image position. |
top | int | The top image position. |
width | int | The image Width. |
height | int | The image Height. |
colorPalette | IColorPalette | The color palette. |
isPaletteSorted | boolean | if set to true the color palette is sorted. |
isGifFrameInterlaced | boolean | if set to true the GIF frame is interlaced. |
bitsPerPixel | byte | The bits per pixel. |
GifFrameBlock(RasterImage image)
public GifFrameBlock(RasterImage image)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
image | RasterImage | The image to initialize frame pixel and palette data with. |
GifFrameBlock(RasterImage image, int left, int top)
public GifFrameBlock(RasterImage image, int left, int top)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
image | RasterImage | The image to initialize frame pixel and palette data with. |
left | int | The left image position. |
top | int | The top image position. |
GifFrameBlock(RasterImage image, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
public GifFrameBlock(RasterImage image, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
image | RasterImage | The image to initialize frame pixel and palette data with. |
left | int | The left image position. |
top | int | The top image position. |
isPaletteSorted | boolean | if set to true the color palette is sorted. |
isGifFrameInterlaced | boolean | if set to true the GIF frame is interlaced. |
lzwCodeSize | byte | The bits per pixel. |
GifFrameBlock(InputStream stream)
public GifFrameBlock(InputStream stream)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The stream to load an image from and initialize frame pixel and palette data with. |
GifFrameBlock(System.IO.Stream stream)
public GifFrameBlock(System.IO.Stream stream)
Parameters:
Parameter | Type | Description |
---|---|---|
stream | com.aspose.ms.System.IO.Stream |
GifFrameBlock(InputStream stream, int left, int top)
public GifFrameBlock(InputStream stream, int left, int top)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The stream to load an image from and initialize frame pixel and palette data with. |
left | int | The left image position. |
top | int | The top image position. |
GifFrameBlock(InputStream stream, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
public GifFrameBlock(InputStream stream, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The stream to load an image from and initialize frame pixel and palette data with. |
left | int | The left image position. |
top | int | The top image position. |
isPaletteSorted | boolean | if set to true the color palette is sorted. |
isGifFrameInterlaced | boolean | if set to true the GIF frame is interlaced. |
lzwCodeSize | byte | The bits per pixel. |
GifFrameBlock(String path)
public GifFrameBlock(String path)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
path | java.lang.String | The path to load an image from and initialize frame pixel and palette data with. |
GifFrameBlock(String path, int left, int top)
public GifFrameBlock(String path, int left, int top)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
path | java.lang.String | The path to load an image from and initialize frame pixel and palette data with. |
left | int | The left image position. |
top | int | The top image position. |
GifFrameBlock(String path, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
public GifFrameBlock(String path, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
Initializes a new instance of the GifFrameBlock
class.
Parameters:
Parameter | Type | Description |
---|---|---|
path | java.lang.String | The path to load an image from and initialize frame pixel and palette data with. |
left | int | The left image position. |
top | int | The top image position. |
isPaletteSorted | boolean | if set to true the color palette is sorted. |
isGifFrameInterlaced | boolean | if set to true the GIF frame is interlaced. |
lzwCodeSize | byte | The bits per pixel. |
EXTENSION_LABEL
public static final int EXTENSION_LABEL
Block extension label.
IMAGE_DESCRIPTOR_SIZE
public static final int IMAGE_DESCRIPTOR_SIZE
The image descriptor size.
getColorPalette(IColorPalette framePalette, IColorPalette containerPalette)
public static IColorPalette getColorPalette(IColorPalette framePalette, IColorPalette containerPalette)
Gets the associated color palette.
Parameters:
Parameter | Type | Description |
---|---|---|
framePalette | IColorPalette | The frame palette. |
containerPalette | IColorPalette | The container palette. |
Returns: IColorPalette - The color palette.
createFlags(IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced)
public static byte createFlags(IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced)
Creates the flags.
Parameters:
Parameter | Type | Description |
---|---|---|
colorPalette | IColorPalette | The color palette. |
isPaletteSorted | boolean | if set to true the colors in color palette are sorted. |
isGifFrameInterlaced | boolean | if set to true the GIF frame image is interlaced. |
Returns: byte - The created flags.
getFileFormat()
public long getFileFormat()
Gets a value of file format
Returns: long
getWidth()
public int getWidth()
Gets the image width.
Returns: int - The image width.
getHeight()
public int getHeight()
Gets the image height.
Returns: int - The image height.
getBitsPerPixel()
public int getBitsPerPixel()
Gets the image bits per pixel count.
Returns: int - The image bits per pixel count.
getFrameTime()
public int getFrameTime()
Gets the duration.
Value: The duration, in milliseconds.
Returns: int - the duration.
setFrameTime(int value)
public void setFrameTime(int value)
Sets the duration.
Value: The duration, in milliseconds.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | the duration. |
getInterlaced()
public boolean getInterlaced()
Gets or sets a value indicating whether this GifFrameBlock
is interlaced.
Returns:
boolean - true
if interlaced; otherwise, false
.
isInterlaced()
public boolean isInterlaced()
Gets a value indicating whether this image instance is interlaced.
Value: true
if this image instance is interlaced; otherwise, false
.
Returns: boolean - a value indicating whether this image instance is interlaced.
setInterlaced(boolean value)
public void setInterlaced(boolean value)
Gets or sets a value indicating whether this GifFrameBlock
is interlaced.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | true if interlaced; otherwise, false . |
isPaletteSorted()
public boolean isPaletteSorted()
Gets or sets a value indicating whether color palette is sorted.
Returns:
boolean - true
if color palette is sorted; otherwise, false
.
setPaletteSorted(boolean value)
public void setPaletteSorted(boolean value)
Gets or sets a value indicating whether color palette is sorted.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | true if color palette is sorted; otherwise, false . |
getGifFrameBitsPerPixel()
public byte getGifFrameBitsPerPixel()
Gets or sets the GIF frame bits per pixel.
Returns: byte - The GIF frame bits per pixel.
setGifFrameBitsPerPixel(byte value)
public void setGifFrameBitsPerPixel(byte value)
Gets or sets the GIF frame bits per pixel.
Parameters:
Parameter | Type | Description |
---|---|---|
value | byte | The GIF frame bits per pixel. |
getLeft()
public int getLeft()
Gets or sets the left image location.
Returns: int - The left image location.
setLeft(int value)
public void setLeft(int value)
Gets or sets the left image location.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | The left image location. |
getTop()
public int getTop()
Gets or sets the top image location.
Returns: int - The top image location.
setTop(int value)
public void setTop(int value)
Gets or sets the top image location.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | The top image location. |
getFrameTop()
public int getFrameTop()
Converts to p.
Value: The top.
Returns: int
getFrameLeft()
public int getFrameLeft()
Gets the left.
Value: The left.
Returns: int - the left.
getDisposalMethod()
public int getDisposalMethod()
Gets the disposal method.
Returns: int - the disposal method.
getFlags()
public byte getFlags()
Gets or sets the flags.
Returns: byte - The flags.
setFlags(byte value)
public void setFlags(byte value)
Gets or sets the flags.
Parameters:
Parameter | Type | Description |
---|---|---|
value | byte | The flags. |
isUseAlphaBlending()
public boolean isUseAlphaBlending()
Gets a value indicating whether [use alpha blending].
Value: true
if [use alpha blending]; otherwise, false
.
Returns: boolean - a value indicating whether [use alpha blending].
getControlBlock()
public GifGraphicsControlBlock getControlBlock()
Gets the graphics control block associated with this block.
Returns: GifGraphicsControlBlock - The control block.
hasTransparentColor()
public boolean hasTransparentColor()
Gets a value indicating whether frame block has transparent color.
Returns: boolean
getTransparentColor()
public Color getTransparentColor()
Gets the transparent color of frame block.
Returns: Color
setTransparentColor(boolean value)
public void setTransparentColor(boolean value)
Gets a value indicating whether frame block has transparent color.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setTransparentColor(Color value)
public void setTransparentColor(Color value)
Gets the transparent color of frame block.
Parameters:
Parameter | Type | Description |
---|---|---|
value | Color |
getBackgroundColor()
public Color getBackgroundColor()
Gets a value for the background color.
Returns: Color - a value for the background color.
setBackgroundColor(Color value)
public void setBackgroundColor(Color value)
Sets a value for the background color.
Parameters:
Parameter | Type | Description |
---|---|---|
value | Color | a value for the background color. |
getOriginalOptions()
public ImageOptionsBase getOriginalOptions()
Gets the options based on the original file settings. This can be helpful to keep bit-depth and other parameters of the original image unchanged. For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the DataStreamSupporter.save(String) method, the output PNG image with 8-bit per pixel will be produced. To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass them to the Image.save(String, ImageOptionsBase) method as the second parameter.
Returns: ImageOptionsBase - The options based on the original file settings.
adjustBrightness(int brightness)
public void adjustBrightness(int brightness)
Adjust of a brightness for image.
Parameters:
Parameter | Type | Description |
---|---|---|
brightness | int | Brightness value. |
replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
public void replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
Parameters:
Parameter | Type | Description |
---|---|---|
oldColorArgb | int | Old color ARGB-value to be replaced. |
oldColorDiff | byte | Allowed difference in old color to be able to widen replaced color tone. |
newColorArgb | int | New color ARGB-value to replace old color with. |
replaceNonTransparentColors(int newColorArgb)
public void replaceNonTransparentColors(int newColorArgb)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. Note: if you use it on images without transparency, all colors will be replaced with a single one.
Parameters:
Parameter | Type | Description |
---|---|---|
newColorArgb | int | New color ARGB-value to replace non-transparent colors with. |
getFullFrame()
public RasterImage getFullFrame()
Gets the full frame.
Returns: RasterImage - he RasterImage with full frame
resize(int newWidth, int newHeight, ImageResizeSettings imageResizeSettings)
public void resize(int newWidth, int newHeight, ImageResizeSettings imageResizeSettings)
Resizes this RasterCachedImage instance.
Parameters:
Parameter | Type | Description |
---|---|---|
newWidth | int | New width. |
newHeight | int | New height. |
imageResizeSettings | ImageResizeSettings | Resize settings. |