C# Class ScreenToGif.FileWriters.GifWriter.GifEncoder

Encodes multiple images as an animated gif to a stream.
ALWAYS wire this up in a "using" block
Disposing the encoder will complete the file.
Uses default .net GIF encoding and adds animation headers.
Inheritance: IDisposable
显示文件 Open project: dbremner/ScreenToGif Class Usage Examples

Public Methods

Method Description
AddFrame ( Image img, int x, int y, System.TimeSpan frameDelay = null ) : void

Adds a frame to this animation.

GifEncoder ( Stream stream, int width = null, int height = null, int repeatCount = null ) : System

Encodes multiple images as an animated gif to a stream.
ALWAYS wire this in a using block
Disposing the encoder will complete the file.
Uses default .net GIF encoding and adds animation headers.

Private Methods

Method Description
IDisposable ( ) : void
InitHeader ( Stream sourceGif, int w, int h ) : void
WriteByte ( int value ) : void
WriteColorTable ( Stream sourceGif ) : void
WriteGraphicControlBlock ( Stream sourceGif, System.TimeSpan frameDelay ) : void
WriteImageBlock ( Stream sourceGif, bool includeColorTable, int x, int y, int h, int w ) : void
WriteShort ( int value ) : void
WriteString ( string value ) : void

Method Details

AddFrame() public method

Adds a frame to this animation.
public AddFrame ( Image img, int x, int y, System.TimeSpan frameDelay = null ) : void
img Image The image to add
x int The positioning x offset this image should be displayed at.
y int The positioning y offset this image should be displayed at.
frameDelay System.TimeSpan The delay of the redraw of the next frame.
return void

GifEncoder() public method

Encodes multiple images as an animated gif to a stream.
ALWAYS wire this in a using block
Disposing the encoder will complete the file.
Uses default .net GIF encoding and adds animation headers.
public GifEncoder ( Stream stream, int width = null, int height = null, int repeatCount = null ) : System
stream Stream The stream that will be written to.
width int Sets the width for this gif or null to use the first frame's width.
height int Sets the height for this gif or null to use the first frame's height.
repeatCount int The repeat count of the animation
return System