com.aspose.imaging.fileformats.gif.blocks
Class GifFrameBlock

java.lang.Object
  extended by com.aspose.imaging.DisposableObject
      extended by com.aspose.imaging.DataStreamSupporter
          extended by com.aspose.imaging.Image
              extended by com.aspose.imaging.RasterImage
                  extended by com.aspose.imaging.fileformats.gif.blocks.GifFrameBlock
All Implemented Interfaces:
IGifBlock, IObjectWithBounds

public class GifFrameBlock
extends RasterImage
implements IGifBlock

Gif frame block.


Field Summary
static int ExtensionLabel
           Block extension label.
static int ImageDescriptorSize
           The image descriptor size.
 
Constructor Summary
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(Stream dataStream, int left, int top, int width, int height, IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte bitsPerPixel)
           Initializes a new instance of the GifFrameBlock class.
 
Method Summary
static byte createFlags(IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced)
           Creates the flags.
 void flush()
           Flushes all the cached data directly to the object's stream.
 int getBitsPerPixel()
           Gets the image bits per pixel count.
 byte getFlags()
           Gets the flags.
 byte getGifFrameBitsPerPixel()
           Gets the GIF frame bits per pixel.
 int getHeight()
           Gets the image height.
 java.lang.String getImageLoaderDescriptorName()
           Gets the name of the image loader descriptor.
 boolean getInterlaced()
           Gets a value indicating whether this GifFrameBlock is interlaced.
 int getLeft()
           Gets the left image location.
 int getTop()
           Gets the top image location.
 int getWidth()
           Gets the image width.
 boolean isChanged()
           Gets a value indicating whether block has changed and requires save.
 void isChanged(boolean value)
           Sets a value indicating whether block has changed and requires save.
 boolean isPaletteSorted()
           Gets a value indicating whether color palette is sorted.
 void isPaletteSorted(boolean value)
           Sets a value indicating whether color palette is sorted.
protected  Color[] loadPixelsInternal(Rectangle rectangle)
           Loads pixels (format specific method).
protected  void onPaletteChanged(IColorPalette oldPalette, IColorPalette newPalette)
           Called when palette is changed.
protected  void releaseManagedResources()
           Releases the managed resources.
 void resize(int newWidth, int newHeight, int resizeType)
           Resizes the GifFrameBlock to a new dimensions.
 void save(java.io.InputStream stream)
           Saves the object's data to the InputStream.
 void save(java.lang.String filePath)
           Saves the object's data to the specified file location.
protected  void savePixelsInternal(Rectangle rectangle, Color[] pixels)
           Saves pixels (format specific method).
 void setFlags(byte value)
           Sets the flags.
 void setGifFrameBitsPerPixel(byte value)
           Sets the GIF frame bits per pixel.
 void setInterlaced(boolean value)
           Sets a value indicating whether this GifFrameBlock is interlaced.
 void setLeft(int value)
           Sets the left image location.
 void setTop(int value)
           Sets the top image location.
 
Methods inherited from class com.aspose.imaging.RasterImage
getHorizontalResolution, getPixel, getVerticalResolution, loadPixels, readScanLine, rotateFlip, rotateFlip, savePixels, setHorizontalResolution, setPalette, setPixel, setResolution, setVerticalResolution, writeScanLine
 
Methods inherited from class com.aspose.imaging.Image
canLoad, canLoad, canLoad, canLoad, canSave, create, getBounds, getContainer, getFileFormat, getFileFormat, getFitRectangle, getFitRectangle, getFittingRectangle, getFittingRectangle, getPalette, getSize, getUseCompactPalette, load, load, onCompactPaletteUsageChanged, onPaletteChanging, resize, save, save, save, setContainer, setPalette, setUseCompactPalette
 
Methods inherited from class com.aspose.imaging.DataStreamSupporter
getDataStreamContainer, onDataStreamContainerChanging, setDataStreamContainer
 
Methods inherited from class com.aspose.imaging.DisposableObject
dispose, getDisposed, releaseUnmanagedResources, verifyNotDisposed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ExtensionLabel

public static final int ExtensionLabel

Block extension label.

See Also:
Constant Field Values

ImageDescriptorSize

public static final int ImageDescriptorSize

The image descriptor size.

See Also:
Constant Field Values
Constructor Detail

GifFrameBlock

public GifFrameBlock(int width,
                     int height)

Initializes a new instance of the GifFrameBlock class.

Parameters:
width - The image width.
height - The image height.

GifFrameBlock

public GifFrameBlock(int left,
                     int top,
                     int width,
                     int height)

Initializes a new instance of the GifFrameBlock class.

Parameters:
left - The left image position.
top - The top image position.
width - The image width.
height - The image height.

GifFrameBlock

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:
left - The left image position.
top - The top image position.
width - The image width.
height - The image height.
colorPalette - The color palette.
isPaletteSorted - if set to true the color palette is sorted.
isGifFrameInterlaced - if set to true the GIF frame is interlaced.
bitsPerPixel - The bits per pixel.

GifFrameBlock

public GifFrameBlock(Stream dataStream,
                     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:
dataStream - The data stream. The pixel data will be loaded from this stream.
left - The left image position.
top - The top image position.
width - The image width.
height - The image height.
colorPalette - The color palette.
isPaletteSorted - if set to true the color palette is sorted.
isGifFrameInterlaced - if set to true the GIF frame is interlaced.
bitsPerPixel - The bits per pixel.
Method Detail

createFlags

public static byte createFlags(IColorPalette colorPalette,
                               boolean isPaletteSorted,
                               boolean isGifFrameInterlaced)

Creates the flags.

Parameters:
colorPalette - The color palette.
isPaletteSorted - if set to true the colors in color palette are sorted.
isGifFrameInterlaced - if set to true the GIF frmae image is interlaced.
Returns:
The created flags.

flush

public void flush()

Flushes all the cached data directly to the object's stream.

Overrides:
flush in class DataStreamSupporter

getBitsPerPixel

public int getBitsPerPixel()

Gets the image bits per pixel count.

Value: The image bits per pixel count.

Specified by:
getBitsPerPixel in class Image

getFlags

public byte getFlags()

Gets the flags.

Value: The flags.


getGifFrameBitsPerPixel

public byte getGifFrameBitsPerPixel()

Gets the GIF frame bits per pixel.

Value: The GIF frame bits per pixel.


getHeight

public int getHeight()

Gets the image height.

Value: The image height.

Specified by:
getHeight in interface IObjectWithBounds
Specified by:
getHeight in class Image

getImageLoaderDescriptorName

public java.lang.String getImageLoaderDescriptorName()

Gets the name of the image loader descriptor.

Value: The name of the image loader descriptor.

Specified by:
getImageLoaderDescriptorName in class Image

getInterlaced

public boolean getInterlaced()

Gets a value indicating whether this GifFrameBlock is interlaced.

Value: true if interlaced; otherwise, false.


getLeft

public int getLeft()

Gets the left image location.

Value: The left image location.


getTop

public int getTop()

Gets the top image location.

Value: The top image location.


getWidth

public int getWidth()

Gets the image width.

Value: The image width.

Specified by:
getWidth in interface IObjectWithBounds
Specified by:
getWidth in class Image

isChanged

public boolean isChanged()

Gets a value indicating whether block has changed and requires save.

Value: true if block has changed; otherwise, false.

Specified by:
isChanged in interface IGifBlock

isChanged

public void isChanged(boolean value)

Sets a value indicating whether block has changed and requires save.

Value: true if block has changed; otherwise, false.

Specified by:
isChanged in interface IGifBlock

isPaletteSorted

public boolean isPaletteSorted()

Gets a value indicating whether color palette is sorted.

Value: true if color palette is sorted; otherwise, false.


isPaletteSorted

public void isPaletteSorted(boolean value)

Sets a value indicating whether color palette is sorted.

Value: true if color palette is sorted; otherwise, false.


loadPixelsInternal

protected Color[] loadPixelsInternal(Rectangle rectangle)

Loads pixels (format specific method).

Specified by:
loadPixelsInternal in class RasterImage
Parameters:
rectangle - The rectangle to load pixels from.
Returns:
The loaded pixels array.

onPaletteChanged

protected void onPaletteChanged(IColorPalette oldPalette,
                                IColorPalette newPalette)

Called when palette is changed.

Overrides:
onPaletteChanged in class Image
Parameters:
oldPalette - The old palette.
newPalette - The new palette.

releaseManagedResources

protected void releaseManagedResources()

Releases the managed resources. Make sure no unmanaged resources are released here, since they may have been already released.

Overrides:
releaseManagedResources in class RasterImage

resize

public void resize(int newWidth,
                   int newHeight,
                   int resizeType)

Resizes the GifFrameBlock to a new dimensions.

Overrides:
resize in class RasterImage
Parameters:
newWidth - The new width.
newHeight - The new height.
resizeType - The resize type.

save

public void save(java.io.InputStream stream)

Saves the object's data to the InputStream.

Specified by:
save in interface IGifBlock
Overrides:
save in class DataStreamSupporter
Parameters:
stream - The stream to save the object's data to.

save

public void save(java.lang.String filePath)

Saves the object's data to the specified file location.

Overrides:
save in class DataStreamSupporter
Parameters:
filePath - The file path to save the object's data to.

savePixelsInternal

protected void savePixelsInternal(Rectangle rectangle,
                                  Color[] pixels)

Saves pixels (format specific method).

Specified by:
savePixelsInternal in class RasterImage
Parameters:
rectangle - The rectangle to save pixels to.
pixels - The pixels array.

setFlags

public void setFlags(byte value)

Sets the flags.

Value: The flags.


setGifFrameBitsPerPixel

public void setGifFrameBitsPerPixel(byte value)

Sets the GIF frame bits per pixel.

Value: The GIF frame bits per pixel.


setInterlaced

public void setInterlaced(boolean value)

Sets a value indicating whether this GifFrameBlock is interlaced.

Value: true if interlaced; otherwise, false.


setLeft

public void setLeft(int value)

Sets the left image location.

Value: The left image location.


setTop

public void setTop(int value)

Sets the top image location.

Value: The top image location.