[]
        
(Showing Draft Content)

GrapeCity.Documents.Imaging.GcGifWriter

Class GcGifWriter

Namespace
GrapeCity.Documents.Imaging
Assembly
GcDocs.Imaging.dll

Allows creating a multi-frame GIF file.

public class GcGifWriter : IDisposable
Inheritance
object
GcGifWriter
Implements
System.IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

GcGifWriter(Stream, bool)

Initializes a new instance of GcGifWriter class and sets the output stream.

public GcGifWriter(Stream stream, bool ownStream = false)

Parameters

stream System.IO.Stream

The output stream.

ownStream bool

Indicates whether the output stream should be disposed together with GcGifWriter.

GcGifWriter(string)

Initializes a new instance of GcGifWriter class and sets the output file.

public GcGifWriter(string filePath)

Parameters

filePath string

Full path to the output file.

Properties

AllowAddingTransparentColor

Gets or sets a value indicating if a transparent color should be added to the Global and Local Color Tables, if the number of opaque colors is less than 256.

public bool AllowAddingTransparentColor { get; set; }

Property Value

bool

Comment

Gets or sets the optional GIF comment.

public string Comment { get; set; }

Property Value

string

CommentEncoding

Gets or sets the encoding for the Comment string, Encoding.UTF8 is used by default.

public Encoding CommentEncoding { get; set; }

Property Value

System.Text.Encoding

GlobalPalette

Gets or sets the palette with opaque colors in 32-bit ARGB format to be stored as the Global Color Table.

If the palette contains 255 or less elements, the transparent color can be appended to the Global Color Table.

Elements with index 256 and above are ignored.

public uint[] GlobalPalette { get; set; }

Property Value

uint[]

IccProfileData

Gets or sets the raw ICC profile data for the frames. The value should be assigned before appending the first frame.

public byte[] IccProfileData { get; set; }

Property Value

byte[]

IsDisposed

Gets a value indicating whether the GcGifWriter has been disposed of.

public bool IsDisposed { get; }

Property Value

bool

LogicalScreenHeight

Gets or sets the height, in pixels, of the Logical Screen where the frames will be rendered.

public int LogicalScreenHeight { get; set; }

Property Value

int

LogicalScreenWidth

Get or sets the width, in pixels, of the Logical Screen where the frames will be rendered.

public int LogicalScreenWidth { get; set; }

Property Value

int

LoopCount

Gets or sets the number of iterations the animated GIF should be executed. 0 means infinite loop.

public int LoopCount { get; set; }

Property Value

int

NextFrameIndex

Gets the index of the next frame to be added.

public int NextFrameIndex { get; }

Property Value

int

PixelAspectRatio

Gets or sets the quotient of the pixel's width over its height.

public float PixelAspectRatio { get; set; }

Property Value

float

Methods

AppendFrame(BilevelBitmap, int, int, GifDisposalMethod, int, bool)

Writes the specified BilevelBitmap to the output stream as the next frame.

public void AppendFrame(BilevelBitmap bitmap, int x = 0, int y = 0, GifDisposalMethod disposalMethod = GifDisposalMethod.DoNotDispose, int delayTime = 2, bool userInput = false)

Parameters

bitmap BilevelBitmap

The source BilevelBitmap.

x int

The x-coordinate of the frame on the Logical Screen.

y int

The y-coordinate of the frame on the Logical Screen.

disposalMethod GifDisposalMethod

Specifies the way in which the frame has to be treated after being displayed.

delayTime int

The number of hundredths (1/100) of a second to wait before continuing.

userInput bool

Indicates whether or not user input is expected before continuing.

AppendFrame(GcBitmap, int, int, int, GifDisposalMethod, int, bool)

Writes the specified GcBitmap to the output stream as the next frame.

public void AppendFrame(GcBitmap bitmap, int maxColors = 255, int x = 0, int y = 0, GifDisposalMethod disposalMethod = GifDisposalMethod.DoNotDispose, int delayTime = 2, bool userInput = false)

Parameters

bitmap GcBitmap

The source GcBitmap.

maxColors int

The maximum number of opaque colors in the palette, from 8 to 256.

x int

The x-coordinate of the frame on the Logical Screen.

y int

The y-coordinate of the frame on the Logical Screen.

disposalMethod GifDisposalMethod

Specifies the way in which the frame has to be treated after being displayed.

delayTime int

The number of hundredths (1/100) of a second to wait before continuing.

userInput bool

Indicates whether or not user input is expected before continuing.

AppendFrame(GcBitmap, uint[], DitheringMethod, int, int, GifDisposalMethod, int, bool)

Writes the specified GcBitmap to the output stream as the next frame.

public void AppendFrame(GcBitmap bitmap, uint[] palette, DitheringMethod ditheringMethod = DitheringMethod.NoDithering, int x = 0, int y = 0, GifDisposalMethod disposalMethod = GifDisposalMethod.DoNotDispose, int delayTime = 2, bool userInput = false)

Parameters

bitmap GcBitmap

The source GcBitmap.

palette uint[]

The palette with opaque colors in 32-bit ARGB format. Elements with index 256 and above are ignored.

ditheringMethod DitheringMethod

The method of two-dimensional error diffusion dithering.

x int

The x-coordinate of the frame on the Logical Screen.

y int

The y-coordinate of the frame on the Logical Screen.

disposalMethod GifDisposalMethod

Specifies the way in which the frame has to be treated after being displayed.

delayTime int

The number of hundredths (1/100) of a second to wait before continuing.

userInput bool

Indicates whether or not user input is expected before continuing.

AppendFrame(GrayscaleBitmap, int, int, GifDisposalMethod, int, bool)

Writes the specified GrayscaleBitmap to the output stream as the next frame.

public void AppendFrame(GrayscaleBitmap bitmap, int x = 0, int y = 0, GifDisposalMethod disposalMethod = GifDisposalMethod.DoNotDispose, int delayTime = 2, bool userInput = false)

Parameters

bitmap GrayscaleBitmap

The source GrayscaleBitmap.

x int

The x-coordinate of the frame on the Logical Screen.

y int

The y-coordinate of the frame on the Logical Screen.

disposalMethod GifDisposalMethod

Specifies the way in which the frame has to be treated after being displayed.

delayTime int

The number of hundredths (1/100) of a second to wait before continuing.

userInput bool

Indicates whether or not user input is expected before continuing.

AppendFrame(Indexed4bppBitmap, int, int, GifDisposalMethod, int, bool)

Writes the specified Indexed4bppBitmap to the output stream as the next frame.

public void AppendFrame(Indexed4bppBitmap bitmap, int x = 0, int y = 0, GifDisposalMethod disposalMethod = GifDisposalMethod.DoNotDispose, int delayTime = 2, bool userInput = false)

Parameters

bitmap Indexed4bppBitmap

The source Indexed4bppBitmap.

x int

The x-coordinate of the frame on the Logical Screen.

y int

The y-coordinate of the frame on the Logical Screen.

disposalMethod GifDisposalMethod

Specifies the way in which the frame has to be treated after being displayed.

delayTime int

The number of hundredths (1/100) of a second to wait before continuing.

userInput bool

Indicates whether or not user input is expected before continuing.

AppendFrame(Indexed8bppBitmap, int, int, GifDisposalMethod, int, bool)

Writes the specified Indexed8bppBitmap to the output stream as the next frame.

public void AppendFrame(Indexed8bppBitmap bitmap, int x = 0, int y = 0, GifDisposalMethod disposalMethod = GifDisposalMethod.DoNotDispose, int delayTime = 2, bool userInput = false)

Parameters

bitmap Indexed8bppBitmap

The source Indexed8bppBitmap.

x int

The x-coordinate of the frame on the Logical Screen.

y int

The y-coordinate of the frame on the Logical Screen.

disposalMethod GifDisposalMethod

Specifies the way in which the frame has to be treated after being displayed.

delayTime int

The number of hundredths (1/100) of a second to wait before continuing.

userInput bool

Indicates whether or not user input is expected before continuing.

Dispose()

Clean up any resources being used.

public void Dispose()

Dispose(bool)

Performs cleanup operations on managed and unmanaged resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

~GcGifWriter()

Performs cleanup operations on unmanaged resources.

protected ~GcGifWriter()

SetDpi(float, float)

Updates the PixelAspectRatio property based on the specified horizontal and vertical resolutions.

public void SetDpi(float dpiX, float dpiY)

Parameters

dpiX float

The horizontal DPI value.

dpiY float

The vertical DPI value.