1 /**
2  * @file lv_draw_sw_utils.h
3  *
4  */
5 
6 #ifndef LV_DRAW_SW_UTILS_H
7 #define LV_DRAW_SW_UTILS_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../../lv_conf_internal.h"
17 #if LV_USE_DRAW_SW
18 
19 #include "../../misc/lv_area.h"
20 #include "../../misc/lv_color.h"
21 #include "../../display/lv_display.h"
22 
23 
24 /*********************
25  *      DEFINES
26  *********************/
27 
28 /**********************
29  * GLOBAL PROTOTYPES
30  **********************/
31 
32 /**
33  * Converts an I1 buffer to ARGB8888 format.
34  * @param buf_i1              pointer to buffer with I1 formatted render
35  * @param buf_argb8888        pointer to buffer for ARGB8888 render
36  * @param width               width in pixels of the area.
37  *                            must be a multiple of 8.
38  * @param height              height in pixels of the area
39  * @param buf_i1_stride       stride of i1 buffer in bytes
40  * @param buf_argb8888_stride stride of argb8888 buffer in bytes
41  * @param index0_color        color of the 0 bits of i1 buf
42  * @param index1_color        color of the 1 bits of i1 buf
43  */
44 void lv_draw_sw_i1_to_argb8888(const void * buf_i1, void * buf_argb8888, uint32_t width, uint32_t height,
45                                uint32_t buf_i1_stride, uint32_t buf_argb8888_stride, uint32_t index0_color, uint32_t index1_color);
46 
47 /**
48  * Swap the upper and lower byte of an RGB565 buffer.
49  * Might be required if a 8bit parallel port or an SPI port send the bytes in the wrong order.
50  * The bytes will be swapped in place.
51  * @param buf           pointer to buffer
52  * @param buf_size_px   number of pixels in the buffer
53  */
54 void lv_draw_sw_rgb565_swap(void * buf, uint32_t buf_size_px);
55 
56 /**
57  * Invert a draw buffer in the I1 color format.
58  * Conventionally, a bit is set to 1 during blending if the luminance is greater than 127.
59  * Depending on the display controller used, you might want to have different behavior.
60  * The inversion will be performed in place.
61  * @param buf          pointer to the buffer to be inverted
62  * @param buf_size     size of the buffer in bytes
63  */
64 void lv_draw_sw_i1_invert(void * buf, uint32_t buf_size);
65 
66 
67 /**
68  * Convert a draw buffer in I1 color format from htiled (row-wise)
69  * to vtiled (column-wise) buffer layout. The conversion assumes that the buffer width
70  * and height is rounded to a multiple of 8.
71  * @param buf           pointer to the buffer to be converted
72  * @param buf_size      size of the buffer in bytes
73  * @param width         width of the buffer
74  * @param height        height of the buffer
75  * @param out_buf       pointer to the output buffer
76  * @param out_buf_size  size of the output buffer in bytes
77  * @param bit_order_lsb bit order of the resulting vtiled buffer
78  */
79 void lv_draw_sw_i1_convert_to_vtiled(const void * buf, uint32_t buf_size, uint32_t width, uint32_t height,
80                                      void * out_buf,
81                                      uint32_t out_buf_size, bool bit_order_lsb);
82 
83 /**
84  * Rotate a buffer into another buffer
85  * @param src           the source buffer
86  * @param dest          the destination buffer
87  * @param src_width     source width in pixels
88  * @param src_height    source height in pixels
89  * @param src_stride     source stride in bytes (number of bytes in a row)
90  * @param dest_stride   destination stride in bytes (number of bytes in a row)
91  * @param rotation      LV_DISPLAY_ROTATION_0/90/180/270
92  * @param color_format  LV_COLOR_FORMAT_RGB565/RGB888/XRGB8888/ARGB8888
93  */
94 void lv_draw_sw_rotate(const void * src, void * dest, int32_t src_width, int32_t src_height, int32_t src_stride,
95                        int32_t dest_stride, lv_display_rotation_t rotation, lv_color_format_t color_format);
96 
97 /***********************
98  * GLOBAL VARIABLES
99  ***********************/
100 
101 /**********************
102  *      MACROS
103  **********************/
104 
105 #endif /*LV_USE_DRAW_SW*/
106 
107 #ifdef __cplusplus
108 } /*extern "C"*/
109 #endif
110 
111 #endif /*LV_DRAW_SW_UTILS_H*/
112