C# 클래스 ScreenToGif.Encoding.AnimatedGifEncoder

Animated Gif Encoder Class
상속: IDisposable
파일 보기 프로젝트 열기: dbremner/ScreenToGif 1 사용 예제들

공개 메소드들

메소드 설명
AddFrame ( Image im, int x, int y ) : bool

Adds next GIF frame. The frame is not written immediately, but is actually deferred until the next frame is received so that timing data can be inserted. Invoking finish() flushes all frames. If setSize was not invoked, the size of the first image is used for all subsequent frames.

Dispose ( ) : void
Finish ( ) : bool

Flushes any pending data and closes output file. If writing to an OutputStream, the stream is not closed.

SetDelay ( int ms ) : void

Sets the delay time between each frame, or changes it for subsequent frames (applies to last frame added).

SetDispose ( int code ) : void

Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default is 0 if no transparent color has been set, otherwise 2.

SetFrameRate ( float fps ) : void

Sets frame rate in frames per second. Equivalent to SetDelay(1000/fps).

SetQuality ( int quality ) : void

Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by the GIF specification). Lower values (minimum = 1) produce better colors, but slow processing significantly. 10 is the default, and produces good color mapping at reasonable speeds. Values greater than 20 do not yield significant improvements in speed.

SetRepeat ( int iter ) : void

Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play indefinitely. Must be invoked before the first image is added.

SetSize ( int w, int h ) : void

Sets the GIF frame size. The default size is the size of the first frame added if this method is not invoked.

SetTransparent ( Color c ) : void

Sets the transparent color for the last added frame and any subsequent frames. Since all colors are subject to modification in the quantization process, the color in the final palette for each frame closest to the given color becomes the transparent color for that frame. May be set to null to indicate no transparent color.

Start ( FileStream os ) : bool

Initiates GIF file creation on the given stream. The stream is not closed automatically.

Start ( String file ) : bool

Initiates writing of a GIF file with the specified name.

StringToByteArray ( String hex ) : byte[]

Converts a String to a byte Array.

비공개 메소드들

메소드 설명
AnalyzePixels ( ) : void

Analyzes image colors and creates color map.

FindClosest ( Color c ) : int

Returns index of palette color closest to given color.

GetImagePixels ( ) : void

Extracts image pixels into byte array "pixels".

WriteComment ( string comment ) : void

Writes the comment for the animation.

WriteGraphicCtrlExt ( ) : void

Writes Graphic Control Extension.

WriteImageDesc ( int width, int heigth, int x, int y ) : void

Writes Image Descriptor.

WriteLsd ( ) : void

Writes Logical Screen Descriptor

WriteNetscapeExt ( ) : void

Writes Netscape application extension to define the repeat count.

WritePalette ( ) : void

Writes color table.

WritePixels ( int width, int height ) : void

Encodes and writes pixel data.

WriteShort ( int value ) : void

Write 16-bit value to output stream, LSB first.

WriteString ( String s ) : void

Writes string to output stream.

메소드 상세

AddFrame() 공개 메소드

Adds next GIF frame. The frame is not written immediately, but is actually deferred until the next frame is received so that timing data can be inserted. Invoking finish() flushes all frames. If setSize was not invoked, the size of the first image is used for all subsequent frames.
public AddFrame ( Image im, int x, int y ) : bool
im Image BufferedImage containing frame to write.
x int The horizontal position of the frame
y int The vertical position of the frame
리턴 bool

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

Finish() 공개 메소드

Flushes any pending data and closes output file. If writing to an OutputStream, the stream is not closed.
public Finish ( ) : bool
리턴 bool

SetDelay() 공개 메소드

Sets the delay time between each frame, or changes it for subsequent frames (applies to last frame added).
public SetDelay ( int ms ) : void
ms int Delay time in milliseconds
리턴 void

SetDispose() 공개 메소드

Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default is 0 if no transparent color has been set, otherwise 2.
public SetDispose ( int code ) : void
code int Disposal code.
리턴 void

SetFrameRate() 공개 메소드

Sets frame rate in frames per second. Equivalent to SetDelay(1000/fps).
public SetFrameRate ( float fps ) : void
fps float Frame rate (frames per second)
리턴 void

SetQuality() 공개 메소드

Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by the GIF specification). Lower values (minimum = 1) produce better colors, but slow processing significantly. 10 is the default, and produces good color mapping at reasonable speeds. Values greater than 20 do not yield significant improvements in speed.
public SetQuality ( int quality ) : void
quality int Quality value greater than 0.
리턴 void

SetRepeat() 공개 메소드

Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play indefinitely. Must be invoked before the first image is added.
public SetRepeat ( int iter ) : void
iter int Number of iterations.
리턴 void

SetSize() 공개 메소드

Sets the GIF frame size. The default size is the size of the first frame added if this method is not invoked.
public SetSize ( int w, int h ) : void
w int The frame width.
h int The frame weight.
리턴 void

SetTransparent() 공개 메소드

Sets the transparent color for the last added frame and any subsequent frames. Since all colors are subject to modification in the quantization process, the color in the final palette for each frame closest to the given color becomes the transparent color for that frame. May be set to null to indicate no transparent color.
public SetTransparent ( Color c ) : void
c Color Color to be treated as transparent on display.
리턴 void

Start() 공개 메소드

Initiates GIF file creation on the given stream. The stream is not closed automatically.
public Start ( FileStream os ) : bool
os System.IO.FileStream OutputStream on which GIF images are written.
리턴 bool

Start() 공개 메소드

Initiates writing of a GIF file with the specified name.
public Start ( String file ) : bool
file String String containing output file name.
리턴 bool

StringToByteArray() 공개 정적인 메소드

Converts a String to a byte Array.
public static StringToByteArray ( String hex ) : byte[]
hex String The string to convert
리턴 byte[]