libnsgif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Typedefs | Enumerations | Functions
libnsgif.h File Reference
#include <stdbool.h>
#include <inttypes.h>

Go to the source code of this file.

Data Structures

struct  gif_frame
 
struct  gif_bitmap_callback_vt
 
struct  gif_animation
 

Typedefs

typedef struct gif_frame gif_frame
 
typedef void *(* gif_bitmap_cb_create )(int width, int height)
 
typedef void(* gif_bitmap_cb_destroy )(void *bitmap)
 
typedef unsigned char *(* gif_bitmap_cb_get_buffer )(void *bitmap)
 
typedef void(* gif_bitmap_cb_set_opaque )(void *bitmap, bool opaque)
 
typedef bool(* gif_bitmap_cb_test_opaque )(void *bitmap)
 
typedef void(* gif_bitmap_cb_modified )(void *bitmap)
 
typedef struct
gif_bitmap_callback_vt 
gif_bitmap_callback_vt
 
typedef struct gif_animation gif_animation
 

Enumerations

enum  gif_result {
  GIF_WORKING = 1, GIF_OK = 0, GIF_INSUFFICIENT_FRAME_DATA = -1, GIF_FRAME_DATA_ERROR = -2,
  GIF_INSUFFICIENT_DATA = -3, GIF_DATA_ERROR = -4, GIF_INSUFFICIENT_MEMORY = -5, GIF_FRAME_NO_DISPLAY = -6,
  GIF_END_OF_FRAME = -7
}
 

Functions

void gif_create (gif_animation *gif, gif_bitmap_callback_vt *bitmap_callbacks)
 
gif_result gif_initialise (gif_animation *gif, size_t size, unsigned char *data)
 
gif_result gif_decode_frame (gif_animation *gif, unsigned int frame)
 
void gif_finalise (gif_animation *gif)
 

Detailed Description

Interface to progressive animated GIF file decoding.

Typedef Documentation

typedef struct gif_animation gif_animation

GIF animation data

Bitmap callbacks function table

typedef void*(* gif_bitmap_cb_create)(int width, int height)
typedef void(* gif_bitmap_cb_destroy)(void *bitmap)
typedef unsigned char*(* gif_bitmap_cb_get_buffer)(void *bitmap)
typedef void(* gif_bitmap_cb_modified)(void *bitmap)
typedef void(* gif_bitmap_cb_set_opaque)(void *bitmap, bool opaque)
typedef bool(* gif_bitmap_cb_test_opaque)(void *bitmap)
typedef struct gif_frame gif_frame

GIF frame data

Enumeration Type Documentation

enum gif_result
Enumerator
GIF_WORKING 
GIF_OK 
GIF_INSUFFICIENT_FRAME_DATA 
GIF_FRAME_DATA_ERROR 
GIF_INSUFFICIENT_DATA 
GIF_DATA_ERROR 
GIF_INSUFFICIENT_MEMORY 
GIF_FRAME_NO_DISPLAY 
GIF_END_OF_FRAME 

Function Documentation

void gif_create ( gif_animation gif,
gif_bitmap_callback_vt bitmap_callbacks 
)

Initialises necessary gif_animation members.

gif_result gif_decode_frame ( gif_animation gif,
unsigned int  frame 
)

Decodes a GIF frame.

Returns
Error return value. If a frame does not contain any image data, GIF_OK is returned and gif->current_error is set to GIF_FRAME_NO_DISPLAY
  • GIF_FRAME_DATA_ERROR for GIF frame data error
  • GIF_INSUFFICIENT_FRAME_DATA for insufficient data to complete the frame
  • GIF_DATA_ERROR for GIF error (invalid frame header)
  • GIF_INSUFFICIENT_DATA for insufficient data to do anything
  • GIF_INSUFFICIENT_MEMORY for insufficient memory to process
  • GIF_OK for successful decoding
void gif_finalise ( gif_animation gif)

Releases any workspace held by a gif

gif_result gif_initialise ( gif_animation gif,
size_t  size,
unsigned char *  data 
)

Initialises any workspace held by the animation and attempts to decode any information that hasn't already been decoded. If an error occurs, all previously decoded frames are retained.

Returns
Error return value.
  • GIF_FRAME_DATA_ERROR for GIF frame data error
  • GIF_INSUFFICIENT_FRAME_DATA for insufficient data to process any more frames
  • GIF_INSUFFICIENT_MEMORY for memory error
  • GIF_DATA_ERROR for GIF error
  • GIF_INSUFFICIENT_DATA for insufficient data to do anything
  • GIF_OK for successful decoding
  • GIF_WORKING for successful decoding if more frames are expected