Function gifski::c_api::gifski_add_frame_rgba

source ·
#[no_mangle]
pub unsafe extern "C" fn gifski_add_frame_rgba(
    handle: *const GifskiHandle,
    frame_number: u32,
    width: u32,
    height: u32,
    pixels: *const RGBA8,
    presentation_timestamp: f64
) -> GifskiError
Expand description

Pixels is an array width×height×4 bytes large. The array is copied, so you can free/reuse it immediately.

Presentation timestamp (PTS) is time in seconds, since start of the file (at 0), when this frame is to be displayed. For a 20fps video it could be frame_number/20.0. Frames with duplicate or out-of-order PTS will be skipped.

The first frame should have PTS=0. If the first frame has PTS > 0, it’ll be used as a delay after the last frame.

Colors are in sRGB, uncorrelated RGBA, with alpha byte last.

This function may block and wait until the frame is processed. Make sure to call gifski_set_write_callback or gifski_set_file_output first to avoid a deadlock.

Returns 0 (GIFSKI_OK) on success, and non-0 GIFSKI_* constant on error.