lv_draw_sw_mask.h

API reference for lv_draw_sw_mask.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_draw_sw_mask_private.h

Functions

lv_draw_sw_mask_init

 
void lv_draw_sw_mask_init(void)

lv_draw_sw_mask_deinit

 
void lv_draw_sw_mask_deinit(void)

lv_draw_sw_mask_apply

Apply the added buffers on a line. Used internally by the library's drawing routines.

 
lv_draw_sw_mask_res_t lv_draw_sw_mask_apply(void *masks[], lv_opa_t *mask_buf, int32_t abs_x, int32_t abs_y, int32_t len)
Parameters
NameTypeDescription
masksvoid *the masks list to apply, must be ended with NULL pointer in array.
mask_buflv_opa_t *store the result mask here. Has to be len byte long. Should be initialized with 0xFF.
abs_xint32_tabsolute X coordinate where the line to calculate start
abs_yint32_tabsolute Y coordinate where the line to calculate start
lenint32_tlength of the line to calculate (in pixel count)

Returns: lv_draw_sw_mask_res_t — One of these values:

  • LV_DRAW_MASK_RES_FULL_TRANSP: the whole line is transparent. mask_buf is not set to zero
  • LV_DRAW_MASK_RES_FULL_COVER: the whole line is fully visible. mask_buf is unchanged
  • LV_DRAW_MASK_RES_CHANGED: mask_buf has changed, it shows the desired opacity of each pixel in the given line

lv_draw_sw_mask_free_param

Free the data from the parameter. It's called inside lv_draw_sw_mask_remove_id and lv_draw_sw_mask_remove_custom Needs to be called only in special cases when the mask is not added by lv_draw_mask_add and not removed by lv_draw_mask_remove_id or lv_draw_mask_remove_custom

 
void lv_draw_sw_mask_free_param(void *p)
Parameters
NameTypeDescription
pvoid *pointer to a mask parameter

lv_draw_sw_mask_line_points_init

Initialize a line mask from two points.

 
void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t *param, int32_t p1x, int32_t p1y, int32_t p2x, int32_t p2y, lv_draw_sw_mask_line_side_t side)
Parameters
NameTypeDescription
paramlv_draw_sw_mask_line_param_t *pointer to a lv_draw_mask_param_t to initialize
p1xint32_tX coordinate of the first point of the line
p1yint32_tY coordinate of the first point of the line
p2xint32_tX coordinate of the second point of the line
p2yint32_ty coordinate of the second point of the line
sidelv_draw_sw_mask_line_side_tand element of lv_draw_mask_line_side_t to describe which side to keep. With LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT and horizontal line all pixels are kept With LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM and vertical line all pixels are kept

lv_draw_sw_mask_line_angle_init

Initialize a line mask from a point and an angle.

 
void lv_draw_sw_mask_line_angle_init(lv_draw_sw_mask_line_param_t *param, int32_t px, int32_t py, int16_t angle, lv_draw_sw_mask_line_side_t side)
Parameters
NameTypeDescription
paramlv_draw_sw_mask_line_param_t *pointer to a lv_draw_mask_param_t to initialize
pxint32_tX coordinate of a point of the line
pyint32_tX coordinate of a point of the line
angleint16_tright 0 deg, bottom: 90
sidelv_draw_sw_mask_line_side_tan element of lv_draw_mask_line_side_t to describe which side to keep. With LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT and horizontal line all pixels are kept With LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM and vertical line all pixels are kept

lv_draw_sw_mask_angle_init

Initialize an angle mask.

 
void lv_draw_sw_mask_angle_init(lv_draw_sw_mask_angle_param_t *param, int32_t vertex_x, int32_t vertex_y, int32_t start_angle, int32_t end_angle)
Parameters
NameTypeDescription
paramlv_draw_sw_mask_angle_param_t *pointer to a lv_draw_mask_param_t to initialize
vertex_xint32_tX coordinate of the angle vertex (absolute coordinates)
vertex_yint32_tY coordinate of the angle vertex (absolute coordinates)
start_angleint32_tstart angle in degrees. 0 deg on the right, 90 deg, on the bottom
end_angleint32_tend angle

lv_draw_sw_mask_radius_init

Initialize a fade mask.

 
void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t *param, const lv_area_t *rect, int32_t radius, bool inv)
Parameters
NameTypeDescription
paramlv_draw_sw_mask_radius_param_t *pointer to an lv_draw_mask_radius_param_t to initialize
rectconst lv_area_t *coordinates of the rectangle to affect (absolute coordinates)
radiusint32_tradius of the rectangle
invbooltrue: keep the pixels inside the rectangle; keep the pixels outside of the rectangle

lv_draw_sw_mask_fade_init

Initialize a fade mask.

 
void lv_draw_sw_mask_fade_init(lv_draw_sw_mask_fade_param_t *param, const lv_area_t *coords, lv_opa_t opa_top, int32_t y_top, lv_opa_t opa_bottom, int32_t y_bottom)
Parameters
NameTypeDescription
paramlv_draw_sw_mask_fade_param_t *pointer to a lv_draw_mask_param_t to initialize
coordsconst lv_area_t *coordinates of the area to affect (absolute coordinates)
opa_toplv_opa_topacity on the top
y_topint32_tat which coordinate start to change to opacity to opa_bottom
opa_bottomlv_opa_topacity at the bottom
y_bottomint32_tat which coordinate reach opa_bottom.

lv_draw_sw_mask_map_init

Initialize a map mask.

 
void lv_draw_sw_mask_map_init(lv_draw_sw_mask_map_param_t *param, const lv_area_t *coords, const lv_opa_t *map)
Parameters
NameTypeDescription
paramlv_draw_sw_mask_map_param_t *pointer to a lv_draw_mask_param_t to initialize
coordsconst lv_area_t *coordinates of the map (absolute coordinates)
mapconst lv_opa_t *array of bytes with the mask values

Enums

lv_draw_sw_mask_res_t

Name
LV_DRAW_SW_MASK_RES_TRANSP
LV_DRAW_SW_MASK_RES_FULL_COVER
LV_DRAW_SW_MASK_RES_CHANGED
LV_DRAW_SW_MASK_RES_UNKNOWN

lv_draw_sw_mask_type_t

Name
LV_DRAW_SW_MASK_TYPE_LINE
LV_DRAW_SW_MASK_TYPE_ANGLE
LV_DRAW_SW_MASK_TYPE_RADIUS
LV_DRAW_SW_MASK_TYPE_FADE
LV_DRAW_SW_MASK_TYPE_MAP

lv_draw_sw_mask_line_side_t

NameValue
LV_DRAW_SW_MASK_LINE_SIDE_LEFT0
LV_DRAW_SW_MASK_LINE_SIDE_RIGHT
LV_DRAW_SW_MASK_LINE_SIDE_TOP
LV_DRAW_SW_MASK_LINE_SIDE_BOTTOM
Used by 2 functions
  • lv_draw_sw_mask_line_points_init — param side
  • lv_draw_sw_mask_line_angle_init — param side

Typedefs

lv_draw_sw_mask_xcb_t

 
typedef lv_draw_sw_mask_res_t(* lv_draw_sw_mask_xcb_t) (lv_opa_t *mask_buf, int32_t abs_x, int32_t abs_y, int32_t len, void *p)

A common callback type for every mask type. Used internally by the library.

Macros

LV_MASK_ID_INV

 
#define LV_MASK_ID_INV (-1)

LV_MASK_MAX_NUM

 
#define LV_MASK_MAX_NUM 16

Dependencies

How is this guide?

Last updated on

On this page