[]
Allows creating a multi-frame GIF file.
public class GcGifWriter : IDisposable
Initializes a new instance of GcGifWriter class and sets the output stream.
public GcGifWriter(Stream stream, bool ownStream = false)
stream
System.IO.StreamThe output stream.
ownStream
boolIndicates whether the output stream should be disposed together with GcGifWriter.
Initializes a new instance of GcGifWriter class and sets the output file.
public GcGifWriter(string filePath)
filePath
stringFull path to the output file.
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; }
Gets or sets the optional GIF comment.
public string Comment { get; set; }
Gets or sets the encoding for the Comment string, Encoding.UTF8 is used by default.
public Encoding CommentEncoding { get; set; }
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; }
Gets or sets the raw ICC profile data for the frames.
public byte[] IccProfileData { get; set; }
Gets a value indicating whether the GcGifWriter has been disposed of.
public bool IsDisposed { get; }
Gets or sets the height, in pixels, of the Logical Screen where the frames will be rendered.
public int LogicalScreenHeight { get; set; }
Get or sets the width, in pixels, of the Logical Screen where the frames will be rendered.
public int LogicalScreenWidth { get; set; }
Gets or sets the number of iterations the animated GIF should be executed. 0 means infinite loop.
public int LoopCount { get; set; }
Gets the index of the next frame to be added.
public int NextFrameIndex { get; }
Gets or sets the quotient of the pixel's width over its height.
public float PixelAspectRatio { get; set; }
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)
bitmap
BilevelBitmapThe source BilevelBitmap.
x
intThe x-coordinate of the frame on the Logical Screen.
y
intThe y-coordinate of the frame on the Logical Screen.
disposalMethod
GifDisposalMethodSpecifies the way in which the frame has to be treated after being displayed.
delayTime
intThe number of hundredths (1/100) of a second to wait before continuing.
userInput
boolIndicates whether or not user input is expected before continuing.
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)
bitmap
GcBitmapThe source GcBitmap.
maxColors
intThe maximum number of opaque colors in the palette, from 8 to 256.
x
intThe x-coordinate of the frame on the Logical Screen.
y
intThe y-coordinate of the frame on the Logical Screen.
disposalMethod
GifDisposalMethodSpecifies the way in which the frame has to be treated after being displayed.
delayTime
intThe number of hundredths (1/100) of a second to wait before continuing.
userInput
boolIndicates whether or not user input is expected before continuing.
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)
bitmap
GcBitmapThe source GcBitmap.
palette
uint[]The palette with opaque colors in 32-bit ARGB format. Elements with index 256 and above are ignored.
ditheringMethod
DitheringMethodThe method of two-dimensional error diffusion dithering.
x
intThe x-coordinate of the frame on the Logical Screen.
y
intThe y-coordinate of the frame on the Logical Screen.
disposalMethod
GifDisposalMethodSpecifies the way in which the frame has to be treated after being displayed.
delayTime
intThe number of hundredths (1/100) of a second to wait before continuing.
userInput
boolIndicates whether or not user input is expected before continuing.
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)
bitmap
GrayscaleBitmapThe source GrayscaleBitmap.
x
intThe x-coordinate of the frame on the Logical Screen.
y
intThe y-coordinate of the frame on the Logical Screen.
disposalMethod
GifDisposalMethodSpecifies the way in which the frame has to be treated after being displayed.
delayTime
intThe number of hundredths (1/100) of a second to wait before continuing.
userInput
boolIndicates whether or not user input is expected before continuing.
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)
bitmap
Indexed4bppBitmapThe source Indexed4bppBitmap.
x
intThe x-coordinate of the frame on the Logical Screen.
y
intThe y-coordinate of the frame on the Logical Screen.
disposalMethod
GifDisposalMethodSpecifies the way in which the frame has to be treated after being displayed.
delayTime
intThe number of hundredths (1/100) of a second to wait before continuing.
userInput
boolIndicates whether or not user input is expected before continuing.
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)
bitmap
Indexed8bppBitmapThe source Indexed8bppBitmap.
x
intThe x-coordinate of the frame on the Logical Screen.
y
intThe y-coordinate of the frame on the Logical Screen.
disposalMethod
GifDisposalMethodSpecifies the way in which the frame has to be treated after being displayed.
delayTime
intThe number of hundredths (1/100) of a second to wait before continuing.
userInput
boolIndicates whether or not user input is expected before continuing.
Clean up any resources being used.
public void Dispose()
Performs cleanup operations on managed and unmanaged resources.
protected virtual void Dispose(bool disposing)
disposing
boolPerforms cleanup operations on unmanaged resources.
protected ~GcGifWriter()
Updates the PixelAspectRatio property based on the specified horizontal and vertical resolutions.
public void SetDpi(float dpiX, float dpiY)
dpiX
floatThe horizontal DPI value.
dpiY
floatThe vertical DPI value.