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