gifdec.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef GIFDEC_H
  2. #define GIFDEC_H
  3. #include <stdint.h>
  4. #define LV_LVGL_H_INCLUDE_SIMPLE 1
  5. #if defined(LV_LVGL_H_INCLUDE_SIMPLE)
  6. #include "lvgl.h"
  7. #else
  8. #include "../lvgl/lvgl.h"
  9. #endif
  10. typedef struct gd_Palette {
  11. int size;
  12. uint8_t colors[0x100 * 3];
  13. } gd_Palette;
  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. typedef struct gd_GIF {
  22. #if LV_USE_FILESYSTEM
  23. lv_fs_file_t * fd;
  24. #endif
  25. const char * data;
  26. uint32_t f_rw_p;
  27. size_t anim_start;
  28. uint16_t width, height;
  29. uint16_t depth;
  30. uint16_t loop_count;
  31. gd_GCE gce;
  32. gd_Palette *palette;
  33. gd_Palette lct, gct;
  34. void (*plain_text)(
  35. struct gd_GIF *gif, uint16_t tx, uint16_t ty,
  36. uint16_t tw, uint16_t th, uint8_t cw, uint8_t ch,
  37. uint8_t fg, uint8_t bg
  38. );
  39. void (*comment)(struct gd_GIF *gif);
  40. void (*application)(struct gd_GIF *gif, char id[8], char auth[3]);
  41. uint16_t fx, fy, fw, fh;
  42. uint8_t bgindex;
  43. uint8_t *canvas, *frame;
  44. } gd_GIF;
  45. gd_GIF *
  46. gd_open_gif_file(const char *fname);
  47. gd_GIF *
  48. gd_open_gif_data(const void *data);
  49. void
  50. gd_render_frame(gd_GIF *gif, uint8_t *buffer);
  51. int gd_get_frame(gd_GIF *gif);
  52. void gd_rewind(gd_GIF *gif);
  53. void gd_close_gif(gd_GIF *gif);
  54. #endif /* GIFDEC_H */