Table of Contents

Class GifFrameBlock

Namespace
Aspose.Imaging.FileFormats.Gif.Blocks
Assembly
Aspose.Imaging.dll

Gif frame block.

public sealed class GifFrameBlock : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata, IGifBlock, IAnimationFrame
Inheritance
GifFrameBlock
Implements
Inherited Members

Constructors

GifFrameBlock(RasterImage)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(RasterImage image)

Parameters

image RasterImage

The image to initialize frame pixel and palette data with.

GifFrameBlock(RasterImage, ushort, ushort)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(RasterImage image, ushort left, ushort top)

Parameters

image RasterImage

The image to initialize frame pixel and palette data with.

left ushort

The left image position.

top ushort

The top image position.

GifFrameBlock(RasterImage, ushort, ushort, bool, bool, byte)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(RasterImage image, ushort left, ushort top, bool isPaletteSorted, bool isGifFrameInterlaced, byte lzwCodeSize)

Parameters

image RasterImage

The image to initialize frame pixel and palette data with.

left ushort

The left image position.

top ushort

The top image position.

isPaletteSorted bool

if set to true the color palette is sorted.

isGifFrameInterlaced bool

if set to true the GIF frame is interlaced.

lzwCodeSize byte

The bits per pixel.

GifFrameBlock(Stream)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(Stream stream)

Parameters

stream Stream

The stream to load an image from and initialize frame pixel and palette data with.

GifFrameBlock(Stream, ushort, ushort)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(Stream stream, ushort left, ushort top)

Parameters

stream Stream

The stream to load an image from and initialize frame pixel and palette data with.

left ushort

The left image position.

top ushort

The top image position.

GifFrameBlock(Stream, ushort, ushort, bool, bool, byte)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(Stream stream, ushort left, ushort top, bool isPaletteSorted, bool isGifFrameInterlaced, byte lzwCodeSize)

Parameters

stream Stream

The stream to load an image from and initialize frame pixel and palette data with.

left ushort

The left image position.

top ushort

The top image position.

isPaletteSorted bool

if set to true the color palette is sorted.

isGifFrameInterlaced bool

if set to true the GIF frame is interlaced.

lzwCodeSize byte

The bits per pixel.

GifFrameBlock(string)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(string path)

Parameters

path string

The path to load an image from and initialize frame pixel and palette data with.

GifFrameBlock(string, ushort, ushort)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(string path, ushort left, ushort top)

Parameters

path string

The path to load an image from and initialize frame pixel and palette data with.

left ushort

The left image position.

top ushort

The top image position.

GifFrameBlock(string, ushort, ushort, bool, bool, byte)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(string path, ushort left, ushort top, bool isPaletteSorted, bool isGifFrameInterlaced, byte lzwCodeSize)

Parameters

path string

The path to load an image from and initialize frame pixel and palette data with.

left ushort

The left image position.

top ushort

The top image position.

isPaletteSorted bool

if set to true the color palette is sorted.

isGifFrameInterlaced bool

if set to true the GIF frame is interlaced.

lzwCodeSize byte

The bits per pixel.

GifFrameBlock(ushort, ushort)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(ushort width, ushort height)

Parameters

width ushort

The image width.

height ushort

The image height.

GifFrameBlock(ushort, ushort, ushort, ushort)

Initializes a new instance of the GifFrameBlock class.

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

Parameters

left ushort

The left image position.

top ushort

The top image position.

width ushort

The image width.

height ushort

The image height.

GifFrameBlock(ushort, ushort, ushort, ushort, IColorPalette, bool, bool, byte)

Initializes a new instance of the GifFrameBlock class.

public GifFrameBlock(ushort left, ushort top, ushort width, ushort height, IColorPalette colorPalette, bool isPaletteSorted, bool isGifFrameInterlaced, byte bitsPerPixel)

Parameters

left ushort

The left image position.

top ushort

The top image position.

width ushort

The image Width.

height ushort

The image Height.

colorPalette IColorPalette

The color palette.

isPaletteSorted bool

if set to true the color palette is sorted.

isGifFrameInterlaced bool

if set to true the GIF frame is interlaced.

bitsPerPixel byte

The bits per pixel.

Fields

ExtensionLabel

Block extension label.

public const int ExtensionLabel = 44

Field Value

int

ImageDescriptorSize

The image descriptor size.

public const int ImageDescriptorSize = 10

Field Value

int

Properties

BackgroundColor

Gets or sets a value for the background color.

public override Color BackgroundColor { get; set; }

Property Value

Color

BitsPerPixel

Gets the image bits per pixel count.

public override int BitsPerPixel { get; }

Property Value

int

The image bits per pixel count.

ControlBlock

Gets the graphics control block associated with this block.

public GifGraphicsControlBlock ControlBlock { get; }

Property Value

GifGraphicsControlBlock

The control block.

DisposalMethod

Gets the disposal method.

public AnimationDisposalMethods DisposalMethod { get; }

Property Value

AnimationDisposalMethods

The disposal method.

FileFormat

Gets a value of file format

public override FileFormat FileFormat { get; }

Property Value

FileFormat

Flags

Gets or sets the flags.

public byte Flags { get; set; }

Property Value

byte

The flags.

FrameLeft

Gets the left.

public int FrameLeft { get; }

Property Value

int

The left.

FrameTime

Gets or sets the duration.

public int FrameTime { get; set; }

Property Value

int

The duration, in milliseconds.

FrameTop

Converts to p.

public int FrameTop { get; }

Property Value

int

The top.

GifFrameBitsPerPixel

Gets or sets the GIF frame bits per pixel.

public byte GifFrameBitsPerPixel { get; set; }

Property Value

byte

The GIF frame bits per pixel.

HasTransparentColor

Gets a value indicating whether frame block has transparent color.

public override bool HasTransparentColor { get; set; }

Property Value

bool

Height

Gets the image height.

public override int Height { get; }

Property Value

int

The image height.

Interlaced

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

public bool Interlaced { get; set; }

Property Value

bool

true if interlaced; otherwise, false.

IsInterlaced

Gets a value indicating whether this image instance is interlaced.

public bool IsInterlaced { get; }

Property Value

bool

true if this image instance is interlaced; otherwise, false.

IsPaletteSorted

Gets or sets a value indicating whether color palette is sorted.

public bool IsPaletteSorted { get; set; }

Property Value

bool

true if color palette is sorted; otherwise, false.

Left

Gets or sets the left image location.

public ushort Left { get; set; }

Property Value

ushort

The left image location.

Top

Gets or sets the top image location.

public ushort Top { get; set; }

Property Value

ushort

The top image location.

TransparentColor

Gets the transparent color of frame block.

public override Color TransparentColor { get; set; }

Property Value

Color

UseAlphaBlending

Gets a value indicating whether [use alpha blending].

public bool UseAlphaBlending { get; }

Property Value

bool

true if [use alpha blending]; otherwise, false.

Width

Gets the image width.

public override int Width { get; }

Property Value

int

The image width.

Methods

AdjustBrightness(int)

Adjust of a brightness for image.

public override void AdjustBrightness(int brightness)

Parameters

brightness int

Brightness value.

CreateFlags(IColorPalette, bool, bool)

Creates the flags.

public static byte CreateFlags(IColorPalette colorPalette, bool isPaletteSorted, bool isGifFrameInterlaced)

Parameters

colorPalette IColorPalette

The color palette.

isPaletteSorted bool

if set to true the colors in color palette are sorted.

isGifFrameInterlaced bool

if set to true the GIF frame image is interlaced.

Returns

byte

The created flags.

GetColorPalette(IColorPalette, IColorPalette)

Gets the associated color palette.

public static IColorPalette GetColorPalette(IColorPalette framePalette, IColorPalette containerPalette)

Parameters

framePalette IColorPalette

The frame palette.

containerPalette IColorPalette

The container palette.

Returns

IColorPalette

The color palette.

GetFullFrame()

Gets the full frame.

public RasterImage GetFullFrame()

Returns

RasterImage

he RasterImage with full frame

Exceptions

NotImplementedException

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 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 Save(string, ImageOptionsBase) method as the second parameter.

public override ImageOptionsBase GetOriginalOptions()

Returns

ImageOptionsBase

The options based on the original file settings.

OnPaletteChanged(IColorPalette, IColorPalette)

protected override void OnPaletteChanged(IColorPalette oldPalette, IColorPalette newPalette)

Parameters

oldPalette IColorPalette
newPalette IColorPalette

OnPaletteChanging(IColorPalette, IColorPalette)

protected override void OnPaletteChanging(IColorPalette oldPalette, IColorPalette newPalette)

Parameters

oldPalette IColorPalette
newPalette IColorPalette

ReplaceColor(int, byte, int)

Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.

public override void ReplaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)

Parameters

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)

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.

public override void ReplaceNonTransparentColors(int newColorArgb)

Parameters

newColorArgb int

New color ARGB value to replace non transparent colors with.

SaveData(Stream)

protected override void SaveData(Stream stream)

Parameters

stream Stream

UpdateDimensions(int, int)

protected override void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int
newHeight int