1 /**
2  * @file lv_draw_sw_blend.h
3  *
4  */
5 
6 #ifndef LV_DRAW_SW_BLEND_H
7 #define LV_DRAW_SW_BLEND_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../../misc/lv_color.h"
17 #include "../../misc/lv_area.h"
18 #include "../../misc/lv_style.h"
19 #include "../lv_draw_mask.h"
20 
21 /*********************
22  *      DEFINES
23  *********************/
24 
25 /**********************
26  *      TYPEDEFS
27  **********************/
28 
29 typedef struct {
30     const lv_area_t * blend_area;   /**< The area with absolute coordinates to draw on `draw_ctx->buf`
31                                      *   will be clipped to `draw_ctx->clip_area` */
32     const lv_color_t * src_buf;     /**< Pointer to an image to blend. If set `fill_color` is ignored */
33     lv_color_t color;               /**< Fill color*/
34     lv_opa_t * mask_buf;            /**< NULL if ignored, or an alpha mask to apply on `blend_area`*/
35     lv_draw_mask_res_t mask_res;    /**< The result of the previous mask operation */
36     const lv_area_t * mask_area;    /**< The area of `mask_buf` with absolute coordinates*/
37     lv_opa_t opa;                   /**< The overall opacity*/
38     lv_blend_mode_t blend_mode;     /**< E.g. LV_BLEND_MODE_ADDITIVE*/
39 } lv_draw_sw_blend_dsc_t;
40 
41 struct _lv_draw_ctx_t;
42 
43 /**********************
44  * GLOBAL PROTOTYPES
45  **********************/
46 
47 /**
48  * Call the blend function of the `draw_ctx`.
49  * @param draw_ctx      pointer to a draw context
50  * @param dsc           pointer to an initialized blend descriptor
51  */
52 void lv_draw_sw_blend(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
53 
54 /**
55  * The basic blend function used with software rendering.
56  * @param draw_ctx      pointer to a draw context
57  * @param dsc           pointer to an initialized blend descriptor
58  */
59 LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_basic(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
60 
61 /**********************
62  *      MACROS
63  **********************/
64 
65 #ifdef __cplusplus
66 } /*extern "C"*/
67 #endif
68 
69 #endif /*LV_DRAW_SW_BLEND_H*/
70