1 /**
2  * @file lv_gpu_stm32_dma2d.h
3  *
4  */
5 
6 #ifndef LV_GPU_STM32_DMA2D_H
7 #define LV_GPU_STM32_DMA2D_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../lv_misc/lv_area.h"
17 #include "../lv_misc/lv_color.h"
18 
19 /*********************
20  *      DEFINES
21  *********************/
22 
23 #define LV_DMA2D_ARGB8888 0
24 #define LV_DMA2D_RGB888 1
25 #define LV_DMA2D_RGB565 2
26 #define LV_DMA2D_ARGB1555 3
27 #define LV_DMA2D_ARGB4444 4
28 
29 /**********************
30  *      TYPEDEFS
31  **********************/
32 
33 /**********************
34  * GLOBAL PROTOTYPES
35  **********************/
36 
37 /**
38  * Turn on the peripheral and set output color mode, this only needs to be done once
39  */
40 void lv_gpu_stm32_dma2d_init(void);
41 
42 /**
43  * Fill an area in the buffer with a color
44  * @param buf a buffer which should be filled
45  * @param buf_w width of the buffer in pixels
46  * @param color fill color
47  * @param fill_w width to fill in pixels (<= buf_w)
48  * @param fill_h height to fill in pixels
49  * @note `buf_w - fill_w` is offset to the next line after fill
50  */
51 void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, lv_coord_t fill_w,
52                              lv_coord_t fill_h);
53 
54 
55 /**
56  * Fill an area in the buffer with a color but take into account a mask which describes the opacity of each pixel
57  * @param buf a buffer which should be filled using a mask
58  * @param buf_w width of the buffer in pixels
59  * @param color fill color
60  * @param mask 0..255 values describing the opacity of the corresponding pixel. It's width is `fill_w`
61  * @param opa overall opacity. 255 in `mask` should mean this opacity.
62  * @param fill_w width to fill in pixels (<= buf_w)
63  * @param fill_h height to fill in pixels
64  * @note `buf_w - fill_w` is offset to the next line after fill
65  */
66 void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask,
67                                   lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h);
68 
69 /**
70  * Copy a map (typically RGB image) to a buffer
71  * @param buf a buffer where map should be copied
72  * @param buf_w width of the buffer in pixels
73  * @param map an "image" to copy
74  * @param map_w width of the map in pixels
75  * @param copy_w width of the area to copy in pixels (<= buf_w)
76  * @param copy_h height of the area to copy in pixels
77  * @note `map_w - fill_w` is offset to the next line after copy
78  */
79 void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w,
80                              lv_coord_t copy_w, lv_coord_t copy_h);
81 /**
82  * Blend a map (e.g. ARGB image or RGB image with opacity) to a buffer
83  * @param buf a buffer where `map` should be copied
84  * @param buf_w width of the buffer in pixels
85  * @param map an "image" to copy
86  * @param opa opacity of `map`
87  * @param map_w width of the map in pixels
88  * @param copy_w width of the area to copy in pixels (<= buf_w)
89  * @param copy_h height of the area to copy in pixels
90  * @note `map_w - fill_w` is offset to the next line after copy
91  */
92 void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa,
93                               lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
94 /**********************
95  *      MACROS
96  **********************/
97 
98 #ifdef __cplusplus
99 } /* extern "C" */
100 #endif
101 
102 #endif /*LV_GPU_STM32_DMA2D_H*/
103