1 #ifndef GIFDEC_H
2 #define GIFDEC_H
3 
4 #include <stdint.h>
5 #include "../../../misc/lv_fs.h"
6 
7 #if LV_USE_GIF
8 
9 typedef struct gd_Palette {
10     int size;
11     uint8_t colors[0x100 * 3];
12 } gd_Palette;
13 
14 typedef struct gd_GCE {
15     uint16_t delay;
16     uint8_t tindex;
17     uint8_t disposal;
18     int input;
19     int transparency;
20 } gd_GCE;
21 
22 
23 
24 typedef struct gd_GIF {
25     lv_fs_file_t fd;
26     const char * data;
27     uint8_t is_file;
28     uint32_t f_rw_p;
29     int32_t anim_start;
30     uint16_t width, height;
31     uint16_t depth;
32     uint16_t loop_count;
33     gd_GCE gce;
34     gd_Palette *palette;
35     gd_Palette lct, gct;
36     void (*plain_text)(
37         struct gd_GIF *gif, uint16_t tx, uint16_t ty,
38         uint16_t tw, uint16_t th, uint8_t cw, uint8_t ch,
39         uint8_t fg, uint8_t bg
40     );
41     void (*comment)(struct gd_GIF *gif);
42     void (*application)(struct gd_GIF *gif, char id[8], char auth[3]);
43     uint16_t fx, fy, fw, fh;
44     uint8_t bgindex;
45     uint8_t *canvas, *frame;
46 } gd_GIF;
47 
48 gd_GIF * gd_open_gif_file(const char *fname);
49 
50 gd_GIF * gd_open_gif_data(const void *data);
51 
52 void gd_render_frame(gd_GIF *gif, uint8_t *buffer);
53 
54 int gd_get_frame(gd_GIF *gif);
55 void gd_rewind(gd_GIF *gif);
56 void gd_close_gif(gd_GIF *gif);
57 
58 #endif /*LV_USE_GIF*/
59 
60 #endif /* GIFDEC_H */
61