1 /** 2 * @file lv_draw_sw.h 3 * 4 */ 5 6 #ifndef LV_DRAW_SW_H 7 #define LV_DRAW_SW_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../lv_draw.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 #include "../../osal/lv_os.h" 23 24 #include "../lv_draw_vector.h" 25 #include "../lv_draw_triangle.h" 26 #include "../lv_draw_label.h" 27 #include "../lv_draw_image.h" 28 #include "../lv_draw_line.h" 29 #include "../lv_draw_arc.h" 30 #include "lv_draw_sw_utils.h" 31 32 /********************* 33 * DEFINES 34 *********************/ 35 36 /********************** 37 * GLOBAL PROTOTYPES 38 **********************/ 39 40 /** 41 * Initialize the SW renderer. Called in internally. 42 * It creates as many SW renderers as defined in LV_DRAW_SW_DRAW_UNIT_CNT 43 */ 44 void lv_draw_sw_init(void); 45 46 /** 47 * Deinitialize the SW renderers 48 */ 49 void lv_draw_sw_deinit(void); 50 51 /** 52 * Fill an area using SW render. Handle gradient and radius. 53 * @param draw_unit pointer to a draw unit 54 * @param dsc the draw descriptor 55 * @param coords the coordinates of the rectangle 56 */ 57 void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, lv_draw_fill_dsc_t * dsc, const lv_area_t * coords); 58 59 /** 60 * Draw border with SW render. 61 * @param draw_unit pointer to a draw unit 62 * @param dsc the draw descriptor 63 * @param coords the coordinates of the rectangle 64 */ 65 void lv_draw_sw_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_t * dsc, const lv_area_t * coords); 66 67 /** 68 * Draw box shadow with SW render. 69 * @param draw_unit pointer to a draw unit 70 * @param dsc the draw descriptor 71 * @param coords the coordinates of the rectangle for which the box shadow should be drawn 72 */ 73 void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_dsc_t * dsc, const lv_area_t * coords); 74 75 /** 76 * Draw an image with SW render. It handles image decoding, tiling, transformations, and recoloring. 77 * @param draw_unit pointer to a draw unit 78 * @param draw_dsc the draw descriptor 79 * @param coords the coordinates of the image 80 */ 81 void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, 82 const lv_area_t * coords); 83 84 void lv_draw_sw_letter(lv_draw_unit_t * draw_unit, const lv_draw_letter_dsc_t * dsc, const lv_area_t * coords); 85 86 /** 87 * Draw a label with SW render. 88 * @param draw_unit pointer to a draw unit 89 * @param dsc the draw descriptor 90 * @param coords the coordinates of the label 91 */ 92 void lv_draw_sw_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc, const lv_area_t * coords); 93 94 /** 95 * Draw an arc with SW render. 96 * @param draw_unit pointer to a draw unit 97 * @param dsc the draw descriptor 98 * @param coords the coordinates of the arc 99 */ 100 void lv_draw_sw_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc, const lv_area_t * coords); 101 102 /** 103 * Draw a line with SW render. 104 * @param draw_unit pointer to a draw unit 105 * @param dsc the draw descriptor 106 */ 107 void lv_draw_sw_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * dsc); 108 109 /** 110 * Blend a layer with SW render 111 * @param draw_unit pointer to a draw unit 112 * @param draw_dsc the draw descriptor 113 * @param coords the coordinates of the layer 114 */ 115 void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, const lv_area_t * coords); 116 117 /** 118 * Draw a triangle with SW render. 119 * @param draw_unit pointer to a draw unit 120 * @param dsc the draw descriptor 121 */ 122 void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_t * dsc); 123 124 /** 125 * Mask out a rectangle with radius from a current layer 126 * @param draw_unit pointer to a draw unit 127 * @param dsc the draw descriptor 128 * @param coords the coordinates of the mask 129 */ 130 void lv_draw_sw_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_rect_dsc_t * dsc, const lv_area_t * coords); 131 132 /** 133 * Used internally to get a transformed are of an image 134 * @param draw_unit pointer to a draw unit 135 * @param dest_area area to calculate, i.e. get this area from the transformed image 136 * @param src_buf source buffer 137 * @param src_w source buffer width in pixels 138 * @param src_h source buffer height in pixels 139 * @param src_stride source buffer stride in bytes 140 * @param draw_dsc draw descriptor 141 * @param sup supplementary data 142 * @param cf color format of the source buffer 143 * @param dest_buf the destination buffer 144 */ 145 void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_area, const void * src_buf, 146 int32_t src_w, int32_t src_h, int32_t src_stride, 147 const lv_draw_image_dsc_t * draw_dsc, const lv_draw_image_sup_t * sup, lv_color_format_t cf, void * dest_buf); 148 149 #if LV_USE_VECTOR_GRAPHIC && LV_USE_THORVG 150 /** 151 * Draw vector graphics with SW render. 152 * @param draw_unit pointer to a draw unit 153 * @param dsc the draw descriptor 154 */ 155 void lv_draw_sw_vector(lv_draw_unit_t * draw_unit, const lv_draw_vector_task_dsc_t * dsc); 156 #endif 157 158 /*********************** 159 * GLOBAL VARIABLES 160 ***********************/ 161 162 /********************** 163 * MACROS 164 **********************/ 165 166 #include "blend/lv_draw_sw_blend.h" 167 168 #endif /*LV_USE_DRAW_SW*/ 169 170 #ifdef __cplusplus 171 } /*extern "C"*/ 172 #endif 173 174 #endif /*LV_DRAW_SW_H*/ 175