A threaded GIF capture recording helper, wrapping the GIF encoding library into a background thread. Has a max time for fixed length recording, thread safe callbacks for progress and complete state with the gif bytes.
Due to the requirement of threads, this library only works on cpp (maybe neko). note The GIF encoding library this wraps no such requirement.
Created by
haxelib git gifcapture https://github.com/snowkit/gifcapture.git
Add as a library dependency to your project.
The API is documented with more information and usage. Create a recorder:
capture = new GifCapture(width, height, fps, max_time, GifQuality.High, GifRepeat.Infinite);
//Listen for progress from the encoder
capture.onprogress = onprogress;
//Listen for progress completion of the encoder
capture.oncomplete = oncomplete;
Start/pause/reset/commit a recording: Note you can record as much as you like before committing.
// start
recorder.record();
// stop/pause
recorder.pause();
// complete
recorder.commit();
Add frames, with the haxe.io.UInt8Array of bytes, the delay time for the frame to be shown, and the flippedY flag for whether to flip the frame vertically (common requirement for OpenGL captured bytes).
recorder.add_frame(frame_bytes, frame_delay, flippedY);
You must call recorder.update()
to propagate callbacks (frequently, i.e every frame is fine)
recorder.update();
See luxe-gifcapture tests/test_luxe/