1 /** 2 * @file lv_draw_sw_mask_private.h 3 * 4 */ 5 6 #ifndef LV_DRAW_SW_MASK_PRIVATE_H 7 #define LV_DRAW_SW_MASK_PRIVATE_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 17 #include "lv_draw_sw_mask.h" 18 19 #if LV_DRAW_SW_COMPLEX 20 21 /********************* 22 * DEFINES 23 *********************/ 24 25 /********************** 26 * TYPEDEFS 27 **********************/ 28 29 typedef struct { 30 uint8_t * buf; 31 lv_opa_t * cir_opa; /**< Opacity of values on the circumference of an 1/4 circle */ 32 uint16_t * x_start_on_y; /**< The x coordinate of the circle for each y value */ 33 uint16_t * opa_start_on_y; /**< The index of `cir_opa` for each y value */ 34 int32_t life; /**< How many times the entry way used */ 35 uint32_t used_cnt; /**< Like a semaphore to count the referencing masks */ 36 int32_t radius; /**< The radius of the entry */ 37 } lv_draw_sw_mask_radius_circle_dsc_t; 38 39 struct _lv_draw_sw_mask_common_dsc_t { 40 lv_draw_sw_mask_xcb_t cb; 41 lv_draw_sw_mask_type_t type; 42 }; 43 44 struct _lv_draw_sw_mask_line_param_t { 45 /** The first element must be the common descriptor */ 46 lv_draw_sw_mask_common_dsc_t dsc; 47 48 struct { 49 /*First point*/ 50 lv_point_t p1; 51 52 /*Second point*/ 53 lv_point_t p2; 54 55 /*Which side to keep?*/ 56 lv_draw_sw_mask_line_side_t side : 3; 57 } cfg; 58 59 /** A point of the line */ 60 lv_point_t origo; 61 62 /** X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y? */ 63 int32_t xy_steep; 64 65 /** Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X? */ 66 int32_t yx_steep; 67 68 /** Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines */ 69 int32_t steep; 70 71 /** Steepness in 1 px in 0..255 range. Used only by flat lines. */ 72 int32_t spx; 73 74 /** 1: It's a flat line? (Near to horizontal) */ 75 uint8_t flat : 1; 76 77 /** Invert the mask. The default is: Keep the left part. 78 *It is used to select left/right/top/bottom */ 79 uint8_t inv: 1; 80 }; 81 82 struct _lv_draw_sw_mask_angle_param_t { 83 /** The first element must be the common descriptor */ 84 lv_draw_sw_mask_common_dsc_t dsc; 85 86 struct { 87 lv_point_t vertex_p; 88 int32_t start_angle; 89 int32_t end_angle; 90 } cfg; 91 92 lv_draw_sw_mask_line_param_t start_line; 93 lv_draw_sw_mask_line_param_t end_line; 94 uint16_t delta_deg; 95 }; 96 97 struct _lv_draw_sw_mask_radius_param_t { 98 /** The first element must be the common descriptor */ 99 lv_draw_sw_mask_common_dsc_t dsc; 100 101 struct { 102 lv_area_t rect; 103 int32_t radius; 104 /** Invert the mask. 0: Keep the pixels inside. */ 105 uint8_t outer: 1; 106 } cfg; 107 108 lv_draw_sw_mask_radius_circle_dsc_t * circle; 109 }; 110 111 struct _lv_draw_sw_mask_fade_param_t { 112 /** The first element must be the common descriptor */ 113 lv_draw_sw_mask_common_dsc_t dsc; 114 115 struct { 116 lv_area_t coords; 117 int32_t y_top; 118 int32_t y_bottom; 119 lv_opa_t opa_top; 120 lv_opa_t opa_bottom; 121 } cfg; 122 123 }; 124 125 struct _lv_draw_sw_mask_map_param_t { 126 /** The first element must be the common descriptor */ 127 lv_draw_sw_mask_common_dsc_t dsc; 128 129 struct { 130 lv_area_t coords; 131 const lv_opa_t * map; 132 } cfg; 133 }; 134 135 typedef lv_draw_sw_mask_radius_circle_dsc_t lv_draw_sw_mask_radius_circle_dsc_arr_t[LV_DRAW_SW_CIRCLE_CACHE_SIZE]; 136 137 /********************** 138 * GLOBAL PROTOTYPES 139 **********************/ 140 141 /** 142 * Called by LVGL the rendering of a screen is ready to clean up 143 * the temporal (cache) data of the masks 144 */ 145 void lv_draw_sw_mask_cleanup(void); 146 147 /********************** 148 * MACROS 149 **********************/ 150 151 #endif /*LV_DRAW_SW_COMPLEX*/ 152 153 #ifdef __cplusplus 154 } /*extern "C"*/ 155 #endif 156 157 #endif /*LV_DRAW_SW_MASK_PRIVATE_H*/ 158