Merge pull request #17 from MichielP1807/master
[gifdec.git] / gifdec.h
blob2bbc9f582058f6366232cc102bf11e7e189f545f
1 #ifndef GIFDEC_H
2 #define GIFDEC_H
4 #include <stdint.h>
5 #include <sys/types.h>
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 typedef struct gd_Palette {
12 int size;
13 uint8_t colors[0x100 * 3];
14 } gd_Palette;
16 typedef struct gd_GCE {
17 uint16_t delay;
18 uint8_t tindex;
19 uint8_t disposal;
20 int input;
21 int transparency;
22 } gd_GCE;
24 typedef struct gd_GIF {
25 int fd;
26 off_t anim_start;
27 uint16_t width, height;
28 uint16_t depth;
29 uint16_t loop_count;
30 gd_GCE gce;
31 gd_Palette *palette;
32 gd_Palette lct, gct;
33 void (*plain_text)(
34 struct gd_GIF *gif, uint16_t tx, uint16_t ty,
35 uint16_t tw, uint16_t th, uint8_t cw, uint8_t ch,
36 uint8_t fg, uint8_t bg
38 void (*comment)(struct gd_GIF *gif);
39 void (*application)(struct gd_GIF *gif, char id[8], char auth[3]);
40 uint16_t fx, fy, fw, fh;
41 uint8_t bgindex;
42 uint8_t *canvas, *frame;
43 } gd_GIF;
45 gd_GIF *gd_open_gif(const char *fname);
46 int gd_get_frame(gd_GIF *gif);
47 void gd_render_frame(gd_GIF *gif, uint8_t *buffer);
48 int gd_is_bgcolor(gd_GIF *gif, uint8_t color[3]);
49 void gd_rewind(gd_GIF *gif);
50 void gd_close_gif(gd_GIF *gif);
52 #ifdef __cplusplus
54 #endif
56 #endif /* GIFDEC_H */