[−][src]Module gifski::c_api
How to use from C
gifski *g = gifski_new(&(GifskiSettings){});
gifski_set_file_output(g, "file.gif");
for(int i=0; i < frames; i++) {
int res = gifski_add_frame_rgba(g, i, width, height, buffer, 5);
if (res != GIFSKI_OK) break;
}
int res = gifski_finish(g);
if (res != GIFSKI_OK) return;
It's safe and efficient to call gifski_add_frame_*
in a loop as fast as you can get frames,
because it blocks and waits until previous frames are written.
To cancel processing, make progress callback return 0 and call gifski_finish()
. The write callback
may still be called between the cancellation and gifski_finish()
returning.
Structs
ARGB8 | |
GifskiHandle | Opaque handle used in methods. Note that the handle pointer is actually |
GifskiHandleInternal | |
GifskiSettings | Settings for creating a new encoder instance. See |
Functions
gifski_add_frame_argb⚠ | Same as |
gifski_add_frame_png_file⚠ | File path must be valid UTF-8. This function is asynchronous. |
gifski_add_frame_rgb⚠ | Same as |
gifski_add_frame_rgba⚠ | Pixels is an array width×height×4 bytes large. The array is copied, so you can free/reuse it immediately. |
gifski_finish⚠ | The last step: |
gifski_new⚠ | Call to start the process |
gifski_set_file_output⚠ | Start writing to the |
gifski_set_progress_callback⚠ | Get a callback for frame processed, and abort processing if desired. |
gifski_set_write_callback⚠ | Start writing via callback (any buffer, file, whatever you want). This has to be called before any frames are added. This call will not block. |