1 /** 2 * @file lv_draw_layer.h 3 * 4 */ 5 6 #ifndef LV_DRAW_LAYER_H 7 #define LV_DRAW_LAYER_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../lv_conf_internal.h" 17 18 /********************* 19 * DEFINES 20 *********************/ 21 22 /********************** 23 * TYPEDEFS 24 **********************/ 25 struct _lv_draw_ctx_t; 26 struct _lv_draw_layer_ctx_t; 27 28 typedef enum { 29 LV_DRAW_LAYER_FLAG_NONE, 30 LV_DRAW_LAYER_FLAG_HAS_ALPHA, 31 LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE, 32 } lv_draw_layer_flags_t; 33 34 /********************** 35 * GLOBAL PROTOTYPES 36 **********************/ 37 38 /** 39 * Create a new layer context. It is used to start and independent rendering session 40 * with the current draw_ctx 41 * @param draw_ctx pointer to the current draw context 42 * @param layer_area the coordinates of the layer 43 * @param flags OR-ed flags from @lv_draw_layer_flags_t 44 * @return pointer to the layer context, or NULL on error 45 */ 46 struct _lv_draw_layer_ctx_t * lv_draw_layer_create(struct _lv_draw_ctx_t * draw_ctx, const lv_area_t * layer_area, 47 lv_draw_layer_flags_t flags); 48 49 /** 50 * Adjust the layer_ctx and/or draw_ctx based on the `layer_ctx->area_act`. 51 * It's called only if flags has `LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE` 52 * @param draw_ctx pointer to the current draw context 53 * @param layer_ctx pointer to a layer context 54 * @param flags OR-ed flags from @lv_draw_layer_flags_t 55 */ 56 void lv_draw_layer_adjust(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx, 57 lv_draw_layer_flags_t flags); 58 59 /** 60 * Blend a rendered layer to `layer_ctx->area_act` 61 * @param draw_ctx pointer to the current draw context 62 * @param layer_ctx pointer to a layer context 63 * @param draw_dsc pointer to an image draw descriptor 64 */ 65 void lv_draw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx, 66 lv_draw_img_dsc_t * draw_dsc); 67 68 /** 69 * Destroy a layer context. 70 * @param draw_ctx pointer to the current draw context 71 * @param layer_ctx pointer to a layer context 72 */ 73 void lv_draw_layer_destroy(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx); 74 75 /********************** 76 * MACROS 77 **********************/ 78 79 #ifdef __cplusplus 80 } /*extern "C"*/ 81 #endif 82 83 #endif /*LV_DRAW_LAYER_H*/ 84