gif_save_buffer

This function saves out a GIF animation.

You supply the GIF index (as returned by the function gif_open) and the function will return a 1 byte-aligned grow buffer with the GIF data. Note that the final GIF data will have been palletized using the Universal 884 Palette (see here for more information).

NOTE This function closes the handle to the GIF image. This means that after saving you cannot use this GIF ID again and you'll need to open a new GIF using gif_open.

 

Syntax:

gif_save_buffer(gif_index);

ArgumentTypeDescription
gif_indexGIF IDThe ID of the GIF to save

 

Returns:

Buffer

 

Example:

if (save_gif == true)
{
    if (count == 0)
    {
        gif_image = gif_open(room_width, room_height);
    }
    else if (count < 30)
    {
        gif_add_surface(gif_image, application_surface, 6/100);
    }
    else
    {
        global.capture_buff = gif_save_buffer(gif_image);
        count = 0;
        save_gif = false;
    }
    count++;
}

The above code will create a GIF image file with 30 frames taken from the application surface and then save it to a buffer.