A gif format encoder.
This only deals with the encoding (writing) and not reading of gif files (see format).
Ported from https://github.com/Chman/Moments
Haxe port by KeyMaster-
with contributions by underscorediscovery
LICENSE: The individual files are licensed accordingly.
REQUIREMENTS: Haxe 3.2, no dependencies
Please note the code is currently being made more flexible and will change slightly. See snowkit#1
Specifically - instead of this code handling the file IO, it would defer the work to the using code to allow the encoding to remain adaptible to various frameworks, platforms and data transports.
Create an instance of the GifEncoder class
var encoder = new GifEncoder(repeat, quality, true);
Start encoding
//see also startOutput
encoder.startFile(filePath);
Add frames to the gif
//RGB information is in UInt8Array format,
//Which can be created with UInt8Array.fromBytes/fromArray
//for haxe.io.Bytes or Array types
var frame = {
width: frameWidth,
height: frameHeight,
data: new haxe.io.UInt8Array(frameWidth * frameHeight * 3)
}
encoder.addFrame(frame);
//Configure the last added frame
//see also setFramerate
encoder.setDelay( microseconds );
End encoding
encoder.finish();