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

ConstructorDescription
GifFrameBlock(int width, int height)Initializes a new instance of the GifFrameBlock class.
GifFrameBlock(int left, int top, int width, int height)Initializes a new instance of the GifFrameBlock class.
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.
GifFrameBlock(RasterImage image)Initializes a new instance of the GifFrameBlock class.
GifFrameBlock(RasterImage image, int left, int top)Initializes a new instance of the GifFrameBlock class.
GifFrameBlock(RasterImage image, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)Initializes a new instance of the GifFrameBlock class.
GifFrameBlock(InputStream stream)Initializes a new instance of the GifFrameBlock class.
GifFrameBlock(System.IO.Stream stream)
GifFrameBlock(InputStream stream, int left, int top)Initializes a new instance of the GifFrameBlock class.
GifFrameBlock(InputStream stream, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)Initializes a new instance of the GifFrameBlock class.
GifFrameBlock(String path)Initializes a new instance of the GifFrameBlock class.
GifFrameBlock(String path, int left, int top)Initializes a new instance of the GifFrameBlock class.
GifFrameBlock(String path, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)Initializes a new instance of the GifFrameBlock class.

Fields

FieldDescription
EXTENSION_LABELBlock extension label.
IMAGE_DESCRIPTOR_SIZEThe image descriptor size.

Methods

MethodDescription
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.
setInterlaced(boolean value)Gets or sets a value indicating whether this GifFrameBlock is interlaced.
isInterlaced()Gets a value indicating whether this image instance 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.
setTransparentColor(boolean value)Gets a value indicating whether frame block has transparent color.
getTransparentColor()Gets the transparent color of frame block.
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.

GifFrameBlock(int width, int height)

public GifFrameBlock(int width, int height)

Initializes a new instance of the GifFrameBlock class.

Parameters:

ParameterTypeDescription
widthintThe image width.
heightintThe 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:

ParameterTypeDescription
leftintThe left image position.
topintThe top image position.
widthintThe image width.
heightintThe 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:

ParameterTypeDescription
leftintThe left image position.
topintThe top image position.
widthintThe image Width.
heightintThe image Height.
colorPaletteIColorPaletteThe color palette.
isPaletteSortedbooleanif set to true the color palette is sorted.
isGifFrameInterlacedbooleanif set to true the GIF frame is interlaced.
bitsPerPixelbyteThe bits per pixel.

GifFrameBlock(RasterImage image)

public GifFrameBlock(RasterImage image)

Initializes a new instance of the GifFrameBlock class.

Parameters:

ParameterTypeDescription
imageRasterImageThe 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:

ParameterTypeDescription
imageRasterImageThe image to initialize frame pixel and palette data with.
leftintThe left image position.
topintThe 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:

ParameterTypeDescription
imageRasterImageThe image to initialize frame pixel and palette data with.
leftintThe left image position.
topintThe top image position.
isPaletteSortedbooleanif set to true the color palette is sorted.
isGifFrameInterlacedbooleanif set to true the GIF frame is interlaced.
lzwCodeSizebyteThe bits per pixel.

GifFrameBlock(InputStream stream)

public GifFrameBlock(InputStream stream)

Initializes a new instance of the GifFrameBlock class.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe 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:

ParameterTypeDescription
streamcom.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:

ParameterTypeDescription
streamjava.io.InputStreamThe stream to load an image from and initialize frame pixel and palette data with.
leftintThe left image position.
topintThe 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:

ParameterTypeDescription
streamjava.io.InputStreamThe stream to load an image from and initialize frame pixel and palette data with.
leftintThe left image position.
topintThe top image position.
isPaletteSortedbooleanif set to true the color palette is sorted.
isGifFrameInterlacedbooleanif set to true the GIF frame is interlaced.
lzwCodeSizebyteThe bits per pixel.

GifFrameBlock(String path)

public GifFrameBlock(String path)

Initializes a new instance of the GifFrameBlock class.

Parameters:

ParameterTypeDescription
pathjava.lang.StringThe 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:

ParameterTypeDescription
pathjava.lang.StringThe path to load an image from and initialize frame pixel and palette data with.
leftintThe left image position.
topintThe 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:

ParameterTypeDescription
pathjava.lang.StringThe path to load an image from and initialize frame pixel and palette data with.
leftintThe left image position.
topintThe top image position.
isPaletteSortedbooleanif set to true the color palette is sorted.
isGifFrameInterlacedbooleanif set to true the GIF frame is interlaced.
lzwCodeSizebyteThe 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:

ParameterTypeDescription
framePaletteIColorPaletteThe frame palette.
containerPaletteIColorPaletteThe 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:

ParameterTypeDescription
colorPaletteIColorPaletteThe color palette.
isPaletteSortedbooleanif set to true the colors in color palette are sorted.
isGifFrameInterlacedbooleanif 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:

ParameterTypeDescription
valueintthe duration.

getInterlaced()

public boolean getInterlaced()

Gets or sets a value indicating whether this GifFrameBlock is interlaced.

Returns: boolean - true if interlaced; otherwise, false.

setInterlaced(boolean value)

public void setInterlaced(boolean value)

Gets or sets a value indicating whether this GifFrameBlock is interlaced.

Parameters:

ParameterTypeDescription
valuebooleantrue 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.

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:

ParameterTypeDescription
valuebooleantrue 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:

ParameterTypeDescription
valuebyteThe 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:

ParameterTypeDescription
valueintThe 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:

ParameterTypeDescription
valueintThe 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:

ParameterTypeDescription
valuebyteThe 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

setTransparentColor(boolean value)

public void setTransparentColor(boolean value)

Gets a value indicating whether frame block has transparent color.

Parameters:

ParameterTypeDescription
valueboolean

getTransparentColor()

public Color getTransparentColor()

Gets the transparent color of frame block.

Returns: Color

setTransparentColor(Color value)

public void setTransparentColor(Color value)

Gets the transparent color of frame block.

Parameters:

ParameterTypeDescription
valueColor

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:

ParameterTypeDescription
valueColora 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:

ParameterTypeDescription
brightnessintBrightness 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:

ParameterTypeDescription
oldColorArgbintOld color ARGB-value to be replaced.
oldColorDiffbyteAllowed difference in old color to be able to widen replaced color tone.
newColorArgbintNew 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:

ParameterTypeDescription
newColorArgbintNew color ARGB-value to replace non-transparent colors with.

getFullFrame()

public RasterImage getFullFrame()

Gets the full frame.

Returns: RasterImage - he RasterImage with full frame