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 /*Image parts*/ 45 enum { 46 LV_ANIM_IMG_PART_MAIN, 47 }; 48 typedef uint8_t lv_animimg_part_t; 49 50 /********************** 51 * GLOBAL PROTOTYPES 52 **********************/ 53 54 /** 55 * Create an animation image objects 56 * @param parent pointer to an object, it will be the parent of the new button 57 * @return pointer to the created animation image object 58 */ 59 lv_obj_t * lv_animimg_create(lv_obj_t * parent); 60 61 /*===================== 62 * Setter functions 63 *====================*/ 64 65 /** 66 * Set the image animation images source. 67 * @param img pointer to an animation image object 68 * @param dsc pointer to a series images 69 * @param num images' number 70 */ 71 void lv_animimg_set_src(lv_obj_t * img, const void * dsc[], uint8_t num); 72 73 /** 74 * Startup the image animation. 75 * @param obj pointer to an animation image object 76 */ 77 void lv_animimg_start(lv_obj_t * obj); 78 79 /** 80 * Set the image animation duration time. unit:ms 81 * @param img pointer to an animation image object 82 */ 83 void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration); 84 85 /** 86 * Set the image animation reapeatly play times. 87 * @param img pointer to an animation image object 88 * @param count the number of times to repeat the animation 89 */ 90 void lv_animimg_set_repeat_count(lv_obj_t * img, uint16_t count); 91 92 /*===================== 93 * Getter functions 94 *====================*/ 95 96 #endif /*LV_USE_ANIMIMG*/ 97 98 #ifdef __cplusplus 99 } /* extern "C" */ 100 #endif 101 102 #endif /*LV_ANIM_IMG_H*/ 103