1 /**
2  * @file lv_animimg.h
3  *
4  */
5 
6 #ifndef LV_ANIM_IMG_H
7 #define LV_ANIM_IMG_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../../../lvgl.h"
17 
18 #if LV_USE_ANIMIMG != 0
19 
20 /*Testing of dependencies*/
21 #if LV_USE_IMG == 0
22 #error "lv_animimg: lv_img is required. Enable it in lv_conf.h (LV_USE_IMG 1)"
23 #endif
24 
25 /*********************
26  *      DEFINES
27  *********************/
28 
29 /**********************
30  *      TYPEDEFS
31  **********************/
32 
33 extern const lv_obj_class_t lv_animimg_class;
34 
35 /*Data of image*/
36 typedef struct {
37     lv_img_t img;
38     lv_anim_t anim;
39     /*picture sequence */
40     const void ** dsc;
41     int8_t  pic_count;
42 } lv_animimg_t;
43 
44 
45 /*Image parts*/
46 enum {
47     LV_ANIM_IMG_PART_MAIN,
48 };
49 typedef uint8_t lv_animimg_part_t;
50 
51 /**********************
52  * GLOBAL PROTOTYPES
53  **********************/
54 
55 /**
56  * Create an animation image objects
57  * @param parent pointer to an object, it will be the parent of the new button
58  * @return pointer to the created animation image object
59  */
60 lv_obj_t * lv_animimg_create(lv_obj_t * parent);
61 
62 /*=====================
63  * Setter functions
64  *====================*/
65 
66 /**
67  * Set the image animation images source.
68  * @param img pointer to an animation image object
69  * @param dsc pointer to a series images
70  * @param num images' number
71  */
72 void lv_animimg_set_src(lv_obj_t * img, const void * dsc[], uint8_t num);
73 
74 /**
75  * Startup the image animation.
76  * @param obj pointer to an animation image object
77  */
78 void lv_animimg_start(lv_obj_t * obj);
79 
80 /**
81  * Set the image animation duration time. unit:ms
82  * @param img pointer to an animation image object
83  */
84 void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration);
85 
86 /**
87  * Set the image animation reapeatly play times.
88  * @param img pointer to an animation image object
89  * @param count the number of times to repeat the animation
90  */
91 void lv_animimg_set_repeat_count(lv_obj_t * img, uint16_t count);
92 
93 /*=====================
94  * Getter functions
95  *====================*/
96 
97 #endif /*LV_USE_ANIMIMG*/
98 
99 #ifdef __cplusplus
100 } /* extern "C" */
101 #endif
102 
103 #endif /*LV_ANIM_IMG_H*/
104