1 /** 2 * @file lv_lottie.h 3 * 4 */ 5 6 #ifndef LV_LOTTIE_H 7 #define LV_LOTTIE_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../../misc/lv_types.h" 17 #if LV_USE_LOTTIE 18 19 /*Testing of dependencies*/ 20 #if LV_USE_CANVAS == 0 21 #error "lv_lottie: lv_canvas is required. Enable it in lv_conf.h (LV_USE_CANVAS 1)" 22 #endif 23 24 #if LV_USE_THORVG == 0 25 #error "lv_lottie: ThorVG is required. Enable it in lv_conf.h (LV_USE_THORVG_INTERNAL/EXTERNAL 1)" 26 #endif 27 28 #include "../../draw/lv_draw_buf.h" 29 30 /********************* 31 * DEFINES 32 *********************/ 33 34 /********************** 35 * TYPEDEFS 36 **********************/ 37 38 /********************** 39 * GLOBAL PROTOTYPES 40 **********************/ 41 42 /** 43 * Create a lottie animation 44 * @param parent pointer to the parent widget 45 * @return pointer to the created Lottie animation widget 46 */ 47 lv_obj_t * lv_lottie_create(lv_obj_t * parent); 48 49 /** 50 * Set a buffer for the animation. It also defines the size of the animation 51 * @param obj pointer to a lottie widget 52 * @param w width of the animation and buffer 53 * @param h height of the animation and buffer 54 * @param buf a static buffer with `width x height x 4` byte size 55 */ 56 void lv_lottie_set_buffer(lv_obj_t * obj, int32_t w, int32_t h, void * buf); 57 58 /** 59 * Set a draw buffer for the animation. It also defines the size of the animation 60 * @param obj pointer to a lottie widget 61 * @param draw_buf an initialized draw buffer with ARGB8888 color format 62 */ 63 void lv_lottie_set_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf); 64 65 /** 66 * Set the source for the animation as an array 67 * @param obj pointer to a lottie widget 68 * @param src the lottie animation converted to an nul terminated array 69 * @param src_size size of the source array in bytes 70 */ 71 void lv_lottie_set_src_data(lv_obj_t * obj, const void * src, size_t src_size); 72 73 /** 74 * Set the source for the animation as a path. 75 * Lottie doesn't use LVGL's File System API. 76 * @param obj pointer to a lottie widget 77 * @param src path to a json file, e.g. "path/to/file.json" 78 */ 79 void lv_lottie_set_src_file(lv_obj_t * obj, const char * src); 80 81 /** 82 * Get the LVGL animation which controls the lottie animation 83 * @param obj pointer to a lottie widget 84 * @return the LVGL animation 85 */ 86 lv_anim_t * lv_lottie_get_anim(lv_obj_t * obj); 87 88 /********************** 89 * GLOBAL VARIABLES 90 **********************/ 91 92 /********************** 93 * MACROS 94 **********************/ 95 96 #endif /*LV_USE_LOTTIE*/ 97 98 #ifdef __cplusplus 99 } /*extern "C"*/ 100 #endif 101 102 #endif /*LV_LOTTIE_H*/ 103