public final class GifFrameBlock extends RasterCachedImage implements IGifBlock, IAnimationFrame
Gif frame block.
Modifier and Type | Field and Description |
---|---|
static int |
EXTENSION_LABEL
Block extension label.
|
static int |
IMAGE_DESCRIPTOR_SIZE
The image descriptor size.
|
Constructor and Description |
---|
GifFrameBlock(InputStream stream)
Initializes a new instance of the
GifFrameBlock class. |
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(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(com.aspose.ms.System.IO.Stream stream) |
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. |
Modifier and Type | Method and Description |
---|---|
void |
adjustBrightness(int brightness)
Adjust of a brightness for image.
|
static byte |
createFlags(IColorPalette colorPalette,
boolean isPaletteSorted,
boolean isGifFrameInterlaced)
Creates the flags.
|
int |
getBitsPerPixel()
Gets the image bits per pixel count.
|
static IColorPalette |
getColorPalette(IColorPalette framePalette,
IColorPalette containerPalette)
Gets the associated color palette.
|
GifGraphicsControlBlock |
getControlBlock()
Gets the graphics control block associated with this block.
|
long |
getFileFormat()
Gets a value of file format
|
byte |
getFlags()
Gets or sets the flags.
|
int |
getFrameLeft()
Gets the left.
|
int |
getFrameTime()
Gets the duration.
|
int |
getFrameTop()
Converts to p.
|
byte |
getGifFrameBitsPerPixel()
Gets or sets the GIF frame bits per pixel.
|
int |
getHeight()
Gets the image height.
|
boolean |
getInterlaced()
Gets or sets a value indicating whether this
GifFrameBlock is interlaced. |
int |
getLeft()
Gets or sets the left image location.
|
int |
getTop()
Gets or sets the top image location.
|
Color |
getTransparentColor()
Gets the transparent color of frame block.
|
int |
getWidth()
Gets the image width.
|
boolean |
hasTransparentColor()
Gets a value indicating whether frame block has transparent color.
|
boolean |
isPaletteSorted()
Gets or sets a value indicating whether color palette is sorted.
|
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.
|
void |
replaceNonTransparentColors(int newColorArgb)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges.
|
void |
setFlags(byte value)
Gets or sets the flags.
|
void |
setGifFrameBitsPerPixel(byte value)
Gets or sets the GIF frame bits per pixel.
|
void |
setInterlaced(boolean value)
Gets or sets a value indicating whether this
GifFrameBlock is interlaced. |
void |
setLeft(int value)
Gets or sets the left image location.
|
void |
setPaletteSorted(boolean value)
Gets or sets a value indicating whether color palette is sorted.
|
void |
setTop(int value)
Gets or sets the top image location.
|
void |
setTransparentColor(boolean value)
Gets a value indicating whether frame block has transparent color.
|
void |
setTransparentColor(Color value)
Gets the transparent color of frame block.
|
adjustContrast, adjustGamma, adjustGamma, binarizeBradley, binarizeBradley, binarizeFixed, binarizeOtsu, cacheData, crop, dither, grayscale, isCached, resize, resize, rotate, rotateFlip
crop, dither, filter, getArgb32Pixel, getDefaultArgb32Pixels, getDefaultPixels, getDefaultRawData, getDefaultRawData, getHorizontalResolution, getImageOpacity, getModifyDate, getPixel, getPremultiplyComponents, getRawCustomColorConverter, getRawDataFormat, getRawDataSettings, getRawFallbackIndex, getRawIndexedColorConverter, getRawLineSize, getSkewAngle, getUpdateXmpData, getUseRawData, getVerticalResolution, getXmpData, hasAlpha, isRawDataAvailable, loadArgb32Pixels, loadArgb64Pixels, loadCmyk32Pixels, loadCmykPixels, loadPartialArgb32Pixels, loadPartialPixels, loadPixels, loadRawData, loadRawData, normalizeAngle, normalizeAngle, readArgb32ScanLine, readScanLine, replaceColor, replaceNonTransparentColors, rotate, saveArgb32Pixels, saveCmyk32Pixels, saveCmykPixels, savePixels, saveRawData, setArgb32Pixel, setHorizontalResolution, setPalette, setPixel, setPremultiplyComponents, setRawCustomColorConverter, setRawFallbackIndex, setRawIndexedColorConverter, setResolution, setUpdateXmpData, setUseRawData, setVerticalResolution, setXmpData, toBitmap, writeArgb32ScanLine, writeScanLine
canLoad, canLoad, canLoad, canLoad, canSave, create, getBackgroundColor, getBounds, getBufferSizeHint, getContainer, getDefaultOptions, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getOriginalOptions, getPalette, getProgressEventHandler, getProgressEventHandlerInfo, getProportionalHeight, getProportionalWidth, getSize, hasBackgroundColor, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBackgroundColor, setBufferSizeHint, setInterruptMonitor, setPalette
getDataStreamContainer, save, save, save, save
close, dispose, getDisposed
public static final int EXTENSION_LABEL
Block extension label.
public static final int IMAGE_DESCRIPTOR_SIZE
The image descriptor size.
public GifFrameBlock(int width, int height)
Initializes a new instance of the GifFrameBlock
class.
width
- The image width.height
- The image height.The following example shows how to compose an animated GIF image from individual GIF blocks.
String dir = "c:\\temp\\"; // Create a GIF image 100 x 100 px. // The first block is fully black by default. com.aspose.imaging.fileformats.gif.blocks.GifFrameBlock firstBlock = new com.aspose.imaging.fileformats.gif.blocks.GifFrameBlock(100, 100); com.aspose.imaging.fileformats.gif.GifImage gifImage = new com.aspose.imaging.fileformats.gif.GifImage(firstBlock); try { // The first circle is red com.aspose.imaging.brushes.SolidBrush brush1 = new com.aspose.imaging.brushes.SolidBrush(com.aspose.imaging.Color.getRed()); // The second circle is black com.aspose.imaging.brushes.SolidBrush brush2 = new com.aspose.imaging.brushes.SolidBrush(com.aspose.imaging.Color.getBlack()); // Gradually increase the angle of the red arc shape. for (int angle = 10; angle <= 360; angle += 10) { com.aspose.imaging.fileformats.gif.blocks.GifFrameBlock block = new com.aspose.imaging.fileformats.gif.blocks.GifFrameBlock(100, 100); com.aspose.imaging.Graphics gr = new com.aspose.imaging.Graphics(block); gr.fillPie(brush1, block.getBounds(), 0, angle); gifImage.addBlock(block); } // Gradually increase the angle of the black arc and wipe out the red arc. for (int angle = 10; angle <= 360; angle += 10) { com.aspose.imaging.fileformats.gif.blocks.GifFrameBlock block = new com.aspose.imaging.fileformats.gif.blocks.GifFrameBlock(100, 100); com.aspose.imaging.Graphics gr = new com.aspose.imaging.Graphics(block); gr.fillPie(brush2, block.getBounds(), 0, angle); gr.fillPie(brush1, block.getBounds(), angle, 360 - angle); gifImage.addBlock(block); } gifImage.save(dir + "animated_radar.gif"); } finally { firstBlock.dispose(); gifImage.dispose(); }
public GifFrameBlock(int left, int top, int width, int height)
Initializes a new instance of the GifFrameBlock
class.
left
- The left image position.top
- The top image position.width
- The image width.height
- The image height.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.
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.public GifFrameBlock(RasterImage image)
Initializes a new instance of the GifFrameBlock
class.
image
- The image to initialize frame pixel and palette data with.public GifFrameBlock(RasterImage image, int left, int top)
Initializes a new instance of the GifFrameBlock
class.
image
- The image to initialize frame pixel and palette data with.left
- The left image position.top
- The top image position.public GifFrameBlock(RasterImage image, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
Initializes a new instance of the GifFrameBlock
class.
image
- The image to initialize frame pixel and palette data with.left
- The left image position.top
- The top image position.isPaletteSorted
- if set to true
the color palette is sorted.isGifFrameInterlaced
- if set to true
the GIF frame is interlaced.lzwCodeSize
- The bits per pixel.public GifFrameBlock(InputStream stream)
Initializes a new instance of the GifFrameBlock
class.
stream
- The stream to load an image from and initialize frame pixel and palette data with.public GifFrameBlock(com.aspose.ms.System.IO.Stream stream)
public GifFrameBlock(InputStream stream, int left, int top)
Initializes a new instance of the GifFrameBlock
class.
stream
- The stream to load an image from and initialize frame pixel and palette data with.left
- The left image position.top
- The top image position.public GifFrameBlock(InputStream stream, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
Initializes a new instance of the GifFrameBlock
class.
stream
- The stream to load an image from and initialize frame pixel and palette data with.left
- The left image position.top
- The top image position.isPaletteSorted
- if set to true
the color palette is sorted.isGifFrameInterlaced
- if set to true
the GIF frame is interlaced.lzwCodeSize
- The bits per pixel.public GifFrameBlock(String path)
Initializes a new instance of the GifFrameBlock
class.
path
- The path to load an image from and initialize frame pixel and palette data with.public GifFrameBlock(String path, int left, int top)
Initializes a new instance of the GifFrameBlock
class.
path
- The path to load an image from and initialize frame pixel and palette data with.left
- The left image position.top
- The top image position.public GifFrameBlock(String path, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
Initializes a new instance of the GifFrameBlock
class.
path
- The path to load an image from and initialize frame pixel and palette data with.left
- The left image position.top
- The top image position.isPaletteSorted
- if set to true
the color palette is sorted.isGifFrameInterlaced
- if set to true
the GIF frame is interlaced.lzwCodeSize
- The bits per pixel.public static IColorPalette getColorPalette(IColorPalette framePalette, IColorPalette containerPalette)
Gets the associated color palette.
framePalette
- The frame palette.containerPalette
- The container palette.public static byte createFlags(IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced)
Creates the flags.
colorPalette
- The color palette.isPaletteSorted
- if set to true
the colors in color palette are sorted.isGifFrameInterlaced
- if set to true
the GIF frame image is interlaced.public long getFileFormat()
Gets a value of file format
getFileFormat
in class Image
public int getWidth()
Gets the image width.
getWidth
in interface IObjectWithBounds
getWidth
in class Image
public int getHeight()
Gets the image height.
getHeight
in interface IObjectWithBounds
getHeight
in class Image
public int getBitsPerPixel()
Gets the image bits per pixel count.
getBitsPerPixel
in class Image
public final int getFrameTime()
Gets the duration.
Value: The duration.<autogeneratedoc></autogeneratedoc>
getFrameTime
in interface IAnimationFrame
public boolean getInterlaced()
Gets or sets a value indicating whether this GifFrameBlock
is interlaced.
true
if interlaced; otherwise, false
.public void setInterlaced(boolean value)
Gets or sets a value indicating whether this GifFrameBlock
is interlaced.
value
- true
if interlaced; otherwise, false
.public boolean isPaletteSorted()
Gets or sets a value indicating whether color palette is sorted.
true
if color palette is sorted; otherwise, false
.public void setPaletteSorted(boolean value)
Gets or sets a value indicating whether color palette is sorted.
value
- true
if color palette is sorted; otherwise, false
.public byte getGifFrameBitsPerPixel()
Gets or sets the GIF frame bits per pixel.
public void setGifFrameBitsPerPixel(byte value)
Gets or sets the GIF frame bits per pixel.
value
- The GIF frame bits per pixel.public int getLeft()
Gets or sets the left image location.
public void setLeft(int value)
Gets or sets the left image location.
value
- The left image location.public int getTop()
Gets or sets the top image location.
public void setTop(int value)
Gets or sets the top image location.
value
- The top image location.public final int getFrameTop()
Converts to p.
Value: The top.<autogeneratedoc></autogeneratedoc>
getFrameTop
in interface IAnimationFrame
public final int getFrameLeft()
Gets the left.
Value: The left.<autogeneratedoc></autogeneratedoc>
getFrameLeft
in interface IAnimationFrame
public byte getFlags()
Gets or sets the flags.
public void setFlags(byte value)
Gets or sets the flags.
value
- The flags.public GifGraphicsControlBlock getControlBlock()
Gets the graphics control block associated with this block.
public boolean hasTransparentColor()
Gets a value indicating whether frame block has transparent color.
hasTransparentColor
in class RasterImage
public void setTransparentColor(boolean value)
Gets a value indicating whether frame block has transparent color.
setTransparentColor
in class RasterImage
public Color getTransparentColor()
Gets the transparent color of frame block.
getTransparentColor
in class RasterImage
public void setTransparentColor(Color value)
Gets the transparent color of frame block.
setTransparentColor
in class RasterImage
public void adjustBrightness(int brightness)
Adjust of a brightness for image.
adjustBrightness
in class RasterCachedImage
brightness
- Brightness value.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.
replaceColor
in class RasterImage
oldColorArgb
- Old color ARGB value to be replaced.oldColorDiff
- Allowed difference in old color to be able to widen replaced color tone.newColorArgb
- New color ARGB value to replace old color with.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.
replaceNonTransparentColors
in class RasterImage
newColorArgb
- New color ARGB value to replace non transparent colors with.