lv_draw.h

API reference for lv_draw.h

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

Functions

lv_draw_get_unit_count

Get the total number of draw units.

 
uint32_t lv_draw_get_unit_count(void)

lv_draw_get_available_task

If there is only one draw unit check the first draw task if it's available. If there are multiple draw units call lv_draw_get_next_available_task to find a task.

 
lv_draw_task_t * lv_draw_get_available_task(lv_layer_t *layer, lv_draw_task_t *t_prev, uint8_t draw_unit_id)
Parameters
NameTypeDescription
layerlv_layer_t *the draw layer to search in
t_prevlv_draw_task_t *continue searching from this task
draw_unit_iduint8_tcheck the task where preferred_draw_unit_id equals this value or LV_DRAW_UNIT_NONE

Returns: lv_draw_task_t * — an available draw task or NULL if there is not any

lv_draw_get_next_available_task

Find and available draw task

 
lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t *layer, lv_draw_task_t *t_prev, uint8_t draw_unit_id)
Parameters
NameTypeDescription
layerlv_layer_t *the draw layer to search in
t_prevlv_draw_task_t *continue searching from this task
draw_unit_iduint8_tcheck the task where preferred_draw_unit_id equals this value or LV_DRAW_UNIT_NONE

Returns: lv_draw_task_t * — an available draw task or NULL if there is not any

lv_draw_get_dependent_count

Tell how many draw task are waiting to be drawn on the area of t_check. It can be used to determine if a GPU shall combine many draw tasks into one or not. If a lot of tasks are waiting for the current ones it makes sense to draw them one-by-one to not block the dependent tasks' rendering

 
uint32_t lv_draw_get_dependent_count(lv_draw_task_t *t_check)
Parameters
NameTypeDescription
t_checklv_draw_task_t *the task whose dependent tasks shall be counted

Returns: uint32_t — number of tasks depending on t_check

lv_draw_task_get_type

Get the type of a draw task

 
lv_draw_task_type_t lv_draw_task_get_type(const lv_draw_task_t *t)
Parameters
NameTypeDescription
tconst lv_draw_task_t *the draw task to get the type of

Returns: lv_draw_task_type_t — the draw task type

lv_draw_task_get_draw_dsc

Get the draw descriptor of a draw task

 
void * lv_draw_task_get_draw_dsc(const lv_draw_task_t *t)
Parameters
NameTypeDescription
tconst lv_draw_task_t *the draw task to get the draw descriptor of

Returns: void * — a void pointer to the draw descriptor

lv_draw_task_get_area

Get the draw area of a draw task

 
void lv_draw_task_get_area(const lv_draw_task_t *t, lv_area_t *area)
Parameters
NameTypeDescription
tconst lv_draw_task_t *the draw task to get the draw area of
arealv_area_t *the destination where the draw area will be stored

Enums

lv_draw_task_type_t

NameValue
LV_DRAW_TASK_TYPE_NONE0
LV_DRAW_TASK_TYPE_FILL
LV_DRAW_TASK_TYPE_BORDER
LV_DRAW_TASK_TYPE_BOX_SHADOW
LV_DRAW_TASK_TYPE_LETTER
LV_DRAW_TASK_TYPE_LABEL
LV_DRAW_TASK_TYPE_IMAGE
LV_DRAW_TASK_TYPE_LAYER
LV_DRAW_TASK_TYPE_LINE
LV_DRAW_TASK_TYPE_ARC
LV_DRAW_TASK_TYPE_TRIANGLE
LV_DRAW_TASK_TYPE_MASK_RECTANGLE
LV_DRAW_TASK_TYPE_MASK_BITMAP
LV_DRAW_TASK_TYPE_BLUR
LV_DRAW_TASK_TYPE_VECTOR
LV_DRAW_TASK_TYPE_3D
Used by 1 function
  • lv_draw_add_task — param type

lv_draw_task_state_t

NameDescription
LV_DRAW_TASK_STATE_BLOCKEDWaiting for an other task to be finished. For example in case of LV_DRAW_TASK_TYPE_LAYER (used to blend a layer) is blocked until all the draw tasks of the layer is rendered.
LV_DRAW_TASK_STATE_WAITINGThe draw task is added to the layers list and waits to be rendered.
LV_DRAW_TASK_STATE_QUEUEDThe draw task is added to the command queue of the draw unit. As the queued task are executed in order it's possible to queue multiple draw task (for the same draw unit) even if they are depending on each other. Therefore lv_draw_get_available_task and lv_draw_get_next_available_task can return draw task for the same draw unit even if a dependent draw task is not finished ready yet.
LV_DRAW_TASK_STATE_IN_PROGRESSThe draw task is being rendered. This draw task needs to be finished before lv_draw_get_available_task and lv_draw_get_next_available_task would return any depending draw tasks.
LV_DRAW_TASK_STATE_FINISHEDThe draw task is rendered. It will be removed from the draw task list of the layer and freed automatically.

Structs

struct

_lv_layer_t

MemberTypeDescription
draw_buflv_draw_buf_t *Target draw buffer of the layer
draw_task_headlv_draw_task_t *Linked list of draw tasks
parentlv_layer_t *Parent layer
nextlv_layer_t *Next layer
user_datavoid *User data
buf_arealv_area_tThe absolute coordinates of the buffer
phy_clip_arealv_area_tThe physical clipping area relative to the display
_clip_arealv_area_tNEVER USE IT DRAW UNITS. USED INTERNALLY DURING DRAW TASK CREATION. The current clip area with absolute coordinates, always the same or smaller than buf_area Can be set before new draw tasks are added to indicate the clip area of the draw tasks. Therefore lv_draw_add_task() always saves it in the new draw task to know the clip area when the draw task was added. During drawing the draw units also sees the saved clip_area and should use it during drawing. During drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks.
partial_y_offsetint32_tPartial y offset
recolorlv_color32_tRecolor of the layer
color_formatlv_color_format_tThe color format of the layer. LV_COLOR_FORMAT_...
all_tasks_addedboolFlag indicating all tasks are added
opalv_opa_tOpacity of the layer
struct

lv_draw_dsc_base_t

MemberTypeDescription
objlv_obj_t *The widget for which draw descriptor was created
partuint32_tThe widget part for which draw descriptor was created
id1uint32_tA widget type specific ID (e.g. table row index). See the docs of the given widget.
id2uint32_tA widget type specific ID (e.g. table column index). See the docs of the given widget.
layerlv_layer_t *The target layer
drop_shadow_ofs_xint16_tDrop shadow offset in X
drop_shadow_ofs_yint16_tDrop shadow offset in Y
drop_shadow_colorlv_color_tDrop shadow color
drop_shadow_opalv_opa_tDrop shadow opacity
drop_shadow_blur_radiusint32_tDrop shadow blur radius
drop_shadow_qualitylv_blur_quality_tDrop shadow blur quality
dsc_sizesize_tSize of the specific draw descriptor into which this base descriptor is embedded
user_datavoid *Any custom user data
Used by 2 functions
  • lv_draw_layer_create_drop_shadow — param base
  • lv_draw_layer_finish_drop_shadow — param base

Macros

LV_DRAW_UNIT_NONE

 
#define LV_DRAW_UNIT_NONE 0

Modified by NXP in 2024

LV_DRAW_UNIT_IDLE

 
#define LV_DRAW_UNIT_IDLE -1

The draw unit is idle, new dispatching might be requested to try again

Dependencies

How is this guide?

Last updated on

On this page