Show / Hide Table of Contents

Class GifEncoder

Encodes multiple images as an animated gif to a stream.
ALWAYS ALWAYS 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
System.Object
GifEncoder
Implements
System.IDisposable
Namespace: Eco.Simulation.WorldLayers.History
Assembly: Eco.Simulation.dll
Syntax
public sealed class GifEncoder : Object, IDisposable

Constructors

GifEncoder(Stream, Nullable<Int32>)

Declaration
public GifEncoder(Stream stream, Nullable<int> repeatCount = null)
Parameters
Type Name Description
System.IO.Stream stream

The stream that will be written to.

System.Nullable<System.Int32> repeatCount

Sets the repeat count for this gif or null to use default.

Fields

ColorBlockLength

Declaration
public const int ColorBlockLength = 768
Field Value
Type Description
System.Int32

ColorBlockPosition

Declaration
public const long ColorBlockPosition = 13L
Field Value
Type Description
System.Int64

GrayColorTable

Declaration
public static readonly byte[] GrayColorTable
Field Value
Type Description
System.Byte[]

ShareGlobalColorTable

Declaration
public bool ShareGlobalColorTable
Field Value
Type Description
System.Boolean

Properties

FrameDelay

Declaration
public TimeSpan FrameDelay { get; set; }
Property Value
Type Description
System.TimeSpan

Methods

AddComment(Byte[])

Declaration
public void AddComment(byte[] comment)
Parameters
Type Name Description
System.Byte[] comment

AddComment(String)

Declaration
public void AddComment(string comment)
Parameters
Type Name Description
System.String comment

AddFrame(Byte[], Byte[], Int32, Int32, Int32, Int32, Nullable<TimeSpan>)

Adds a frame to this animation.

Declaration
public void AddFrame(byte[] frame, byte[] colorTable, int width, int height, int x = 0, int y = 0, Nullable<TimeSpan> frameDelay = null)
Parameters
Type Name Description
System.Byte[] frame

The frame byte array to add.

System.Byte[] colorTable

The color table byte array.

System.Int32 width

Sets the width for this gif or null to use the first frame's width.

System.Int32 height

Sets the height for this gif or null to use the first frame's height.

System.Int32 x

The positioning x offset this image should be displayed at.

System.Int32 y

The positioning y offset this image should be displayed at.

System.Nullable<System.TimeSpan> frameDelay

The frame delay or null for default.

Dispose()

Declaration
public void Dispose()

ReOpen()

Declaration
public void ReOpen()

UpdateGlobalColorTable(Byte[])

Declaration
public void UpdateGlobalColorTable(byte[] colorTable)
Parameters
Type Name Description
System.Byte[] colorTable

Implements

System.IDisposable
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾