1 /** 2 * @file lv_animimage.h 3 * 4 */ 5 6 #ifndef LV_ANIMIMAGE_H 7 #define LV_ANIMIMAGE_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../image/lv_image.h" 17 #include "../../misc/lv_types.h" 18 19 #if LV_USE_ANIMIMG != 0 20 21 /*Testing of dependencies*/ 22 #if LV_USE_IMAGE == 0 23 #error "lv_animimg: lv_img is required. Enable it in lv_conf.h (LV_USE_IMAGE 1)" 24 #endif 25 26 /********************* 27 * DEFINES 28 *********************/ 29 30 /********************** 31 * TYPEDEFS 32 **********************/ 33 34 #if LV_USE_OBJ_PROPERTY 35 enum { 36 LV_PROPERTY_ID2(ANIMIMAGE, SRC, LV_PROPERTY_TYPE_POINTER, LV_PROPERTY_TYPE_INT, 0), 37 LV_PROPERTY_ID(ANIMIMAGE, DURATION, LV_PROPERTY_TYPE_INT, 1), 38 LV_PROPERTY_ID(ANIMIMAGE, REPEAT_COUNT, LV_PROPERTY_TYPE_INT, 2), 39 LV_PROPERTY_ID(ANIMIMAGE, SRC_COUNT, LV_PROPERTY_TYPE_INT, 3), 40 LV_PROPERTY_ANIMIMAGE_END, 41 }; 42 #endif 43 44 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_animimg_class; 45 46 /** Image parts */ 47 typedef enum { 48 LV_ANIM_IMAGE_PART_MAIN, 49 } 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[], size_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 * @param duration the duration in milliseconds 84 */ 85 void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration); 86 87 /** 88 * Set the image animation repeatedly play times. 89 * @param img pointer to an animation image object 90 * @param count the number of times to repeat the animation 91 */ 92 void lv_animimg_set_repeat_count(lv_obj_t * img, uint32_t count); 93 94 /*===================== 95 * Getter functions 96 *====================*/ 97 98 /** 99 * Get the image animation images source. 100 * @param img pointer to an animation image object 101 * @return a pointer that will point to a series images 102 */ 103 const void ** lv_animimg_get_src(lv_obj_t * img); 104 105 /** 106 * Get the image animation images source. 107 * @param img pointer to an animation image object 108 * @return the number of source images 109 */ 110 uint8_t lv_animimg_get_src_count(lv_obj_t * img); 111 112 /** 113 * Get the image animation duration time. unit:ms 114 * @param img pointer to an animation image object 115 * @return the animation duration time 116 */ 117 uint32_t lv_animimg_get_duration(lv_obj_t * img); 118 119 /** 120 * Get the image animation repeat play times. 121 * @param img pointer to an animation image object 122 * @return the repeat count 123 */ 124 uint32_t lv_animimg_get_repeat_count(lv_obj_t * img); 125 126 /** 127 * Get the image animation underlying animation. 128 * @param img pointer to an animation image object 129 * @return the animation reference 130 */ 131 lv_anim_t * lv_animimg_get_anim(lv_obj_t * img); 132 133 #endif /*LV_USE_ANIMIMG*/ 134 135 #ifdef __cplusplus 136 } /* extern "C" */ 137 #endif 138 139 #endif /*LV_ANIMIMAGE_H*/ 140