TODO: remove support for transparency until it's understood better?
Class AnimatedGifEncoder - Encodes a GIF file consisting of one or
more frames.
Instantiate the encoder using the constructor, call the AddFrame to add
as many GifFrames as desired, then call the WriteToStream or WriteToFile
method to create the animation.
No copyright asserted on the source code of this class. May be used
for any purpose, however, refer to the Unisys LZW patent for restrictions
on use of the associated LZWEncoder class. Please forward any corrections
to kweiner@fmsware.com.
@author Kevin Weiner, FM Software
@version 1.03 November 2003
Modified by Phil Garcia (phil@thinkedge.com)
1. Add support to output the Gif to a MemoryStream (9/2/2005)
Modified by Simon Bridewell, June-August 2009:
Downloaded from
http://www.thinkedge.com/BlogEngine/file.axd?file=NGif_src2.zip
* Corrected FxCop code analysis errors.
* Documentation comments converted to .net XML comments.
* Refactored so that all properties are set in the constructor.
* Writing of GIF components to the output stream delegated to the
classes for those components.
* Added option to use a global colour table instead of local colour tables.
* Added support for colour tables with fewer than 256 colours
* Colour quantization only performed for animations with more than
256 colours.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public class AnimatedGifEncoder : GifComponent
Public Class AnimatedGifEncoder _ Inherits GifComponent
public ref class AnimatedGifEncoder : public GifComponent
Members
All Members | Constructors | Methods | Properties | ||
Icon | Member | Description |
---|---|---|
AnimatedGifEncoder()()() |
Default constructor.
Sets repeat count to 0 (repeat indefinitely)
Sets colour table strategy to UseGlobal
Sets image quantization quality to 10.
Screen size defaults to size of first frame.
| |
AddFrame(GifFrame) |
Adds a frame to the animation.
| |
ColourQuality |
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.
Defaults to 1 if less than 1.
| |
ColourTableStrategy |
Indicates whether the animation will contain a single global colour
table for all frames (UseGlobal) or a local colour table for each
frame (UseLocal)
| |
ComponentStatus |
Gets the status of this component, consisting of its error state
and any associated error message.
(Inherited from GifComponent.) | |
ConsolidatedState |
Gets the combined error states of this component and all its child
components.
(Inherited from GifComponent.) | |
Equals(Object) | (Inherited from Object.) | |
ErrorMessage |
Gets any error message associated with the component's error state.
(Inherited from GifComponent.) | |
ErrorState |
Gets the member of the Gif.Components.ErrorState enumeration held
within the ComponentStatus property.
(Inherited from GifComponent.) | |
Finalize()()() | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode()()() | Serves as a hash function for a particular type. GetHashCode()()() is suitable for use in hashing algorithms and data structures like a hash table. (Inherited from Object.) | |
GetType()()() | Gets the Type of the current instance. (Inherited from Object.) | |
LogicalScreenSize |
The size, in pixels, of the animated GIF file.
If this property is not set before the animation is encoder, the
size of the first frame to be added will be used.
| |
MemberwiseClone()()() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
RepeatCount |
The number of times to repeat the animation.
0 to repeat indefinitely.
-1 to not repeat.
Defaults to -1 if less than -1.
| |
SetStatus(ErrorState, String) |
Sets the ComponentStatus property of thie GifComponent.
(Inherited from GifComponent.) | |
TestState(ErrorState) |
Tests whether the error state of this component or any of its member
components contains the supplied member of the ErrorState
enumeration.
(Inherited from GifComponent.) | |
ToString()()() |
Gets a string representation of the error status of this component
and its subcomponents.
(Inherited from GifComponent.) | |
Transparent |
Gets and sets the transparent color for the next 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 Color.Empty to indicate no transparent color.
| |
WriteToFile(String) |
Writes an animated GIF file to the supplied file name.
| |
WriteToStream(Stream) |
Writes the GIF animation to the supplied stream.
(Overrides GifComponent.WriteToStream(Stream).) |
Inheritance Hierarchy
Object | ||
GifComponent | ||
AnimatedGifEncoder |