1 /**
2  * @file lv_rlottie.h
3  *
4  */
5 
6 #ifndef LV_RLOTTIE_H
7 #define LV_RLOTTIE_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../../../lvgl.h"
17 #if LV_USE_RLOTTIE
18 
19 /*********************
20  *      DEFINES
21  *********************/
22 
23 /**********************
24  *      TYPEDEFS
25  **********************/
26 typedef enum {
27     LV_RLOTTIE_CTRL_FORWARD  = 0,
28     LV_RLOTTIE_CTRL_BACKWARD = 1,
29     LV_RLOTTIE_CTRL_PAUSE    = 2,
30     LV_RLOTTIE_CTRL_PLAY     = 0, /* Yes, play = 0 is the default mode */
31     LV_RLOTTIE_CTRL_LOOP     = 8,
32 } lv_rlottie_ctrl_t;
33 
34 /** definition in lottieanimation_capi.c */
35 struct Lottie_Animation_S;
36 typedef struct {
37     lv_img_t img_ext;
38     struct Lottie_Animation_S * animation;
39     lv_timer_t * task;
40     lv_img_dsc_t imgdsc;
41     size_t total_frames;
42     size_t current_frame;
43     size_t framerate;
44     uint32_t * allocated_buf;
45     size_t allocated_buffer_size;
46     size_t scanline_width;
47     lv_rlottie_ctrl_t play_ctrl;
48     size_t dest_frame;
49 } lv_rlottie_t;
50 
51 extern const lv_obj_class_t lv_rlottie_class;
52 
53 /**********************
54  * GLOBAL PROTOTYPES
55  **********************/
56 
57 lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent, lv_coord_t width, lv_coord_t height, const char * path);
58 
59 lv_obj_t * lv_rlottie_create_from_raw(lv_obj_t * parent, lv_coord_t width, lv_coord_t height,
60                                       const char * rlottie_desc);
61 
62 void lv_rlottie_set_play_mode(lv_obj_t * rlottie, const lv_rlottie_ctrl_t ctrl);
63 void lv_rlottie_set_current_frame(lv_obj_t * rlottie, const size_t goto_frame);
64 
65 /**********************
66  *      MACROS
67  **********************/
68 
69 #endif /*LV_USE_RLOTTIE*/
70 
71 #ifdef __cplusplus
72 } /* extern "C" */
73 #endif
74 
75 #endif /*LV_RLOTTIE_H*/
76