lv_draw.h
API reference for lv_draw.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)| Name | Type | Description |
|---|---|---|
layer | lv_layer_t * | the draw layer to search in |
t_prev | lv_draw_task_t * | continue searching from this task |
draw_unit_id | uint8_t | check 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)| Name | Type | Description |
|---|---|---|
layer | lv_layer_t * | the draw layer to search in |
t_prev | lv_draw_task_t * | continue searching from this task |
draw_unit_id | uint8_t | check 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)| Name | Type | Description |
|---|---|---|
t_check | lv_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)| Name | Type | Description |
|---|---|---|
t | const 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)| Name | Type | Description |
|---|---|---|
t | const 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)| Name | Type | Description |
|---|---|---|
t | const lv_draw_task_t * | the draw task to get the draw area of |
area | lv_area_t * | the destination where the draw area will be stored |
Enums
lv_draw_task_type_t
| Name | Value |
|---|---|
LV_DRAW_TASK_TYPE_NONE | 0 |
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— paramtype
lv_draw_task_state_t
| Name | Description |
|---|---|
LV_DRAW_TASK_STATE_BLOCKED | Waiting 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_WAITING | The draw task is added to the layers list and waits to be rendered. |
LV_DRAW_TASK_STATE_QUEUED | The 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_PROGRESS | The 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_FINISHED | The draw task is rendered. It will be removed from the draw task list of the layer and freed automatically. |
Structs
_lv_layer_t
| Member | Type | Description |
|---|---|---|
draw_buf | lv_draw_buf_t * | Target draw buffer of the layer |
draw_task_head | lv_draw_task_t * | Linked list of draw tasks |
parent | lv_layer_t * | Parent layer |
next | lv_layer_t * | Next layer |
user_data | void * | User data |
buf_area | lv_area_t | The absolute coordinates of the buffer |
phy_clip_area | lv_area_t | The physical clipping area relative to the display |
_clip_area | lv_area_t | NEVER 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_offset | int32_t | Partial y offset |
recolor | lv_color32_t | Recolor of the layer |
color_format | lv_color_format_t | The color format of the layer. LV_COLOR_FORMAT_... |
all_tasks_added | bool | Flag indicating all tasks are added |
opa | lv_opa_t | Opacity of the layer |
lv_draw_dsc_base_t
| Member | Type | Description |
|---|---|---|
obj | lv_obj_t * | The widget for which draw descriptor was created |
part | uint32_t | The widget part for which draw descriptor was created |
id1 | uint32_t | A widget type specific ID (e.g. table row index). See the docs of the given widget. |
id2 | uint32_t | A widget type specific ID (e.g. table column index). See the docs of the given widget. |
layer | lv_layer_t * | The target layer |
drop_shadow_ofs_x | int16_t | Drop shadow offset in X |
drop_shadow_ofs_y | int16_t | Drop shadow offset in Y |
drop_shadow_color | lv_color_t | Drop shadow color |
drop_shadow_opa | lv_opa_t | Drop shadow opacity |
drop_shadow_blur_radius | int32_t | Drop shadow blur radius |
drop_shadow_quality | lv_blur_quality_t | Drop shadow blur quality |
dsc_size | size_t | Size of the specific draw descriptor into which this base descriptor is embedded |
user_data | void * | Any custom user data |
Used by 2 functions
lv_draw_layer_create_drop_shadow— parambaselv_draw_layer_finish_drop_shadow— parambase
Macros
LV_DRAW_UNIT_NONE
#define LV_DRAW_UNIT_NONE 0Modified by NXP in 2024
LV_DRAW_UNIT_IDLE
#define LV_DRAW_UNIT_IDLE -1The draw unit is idle, new dispatching might be requested to try again
Dependencies
Indirect dependencies
lv_anim.hlv_area.hlv_array.hlv_assert.hlv_bidi.hlv_color.hlv_color_op.hlv_conf_kconfig.hlv_ext_data.hlv_flex.hlv_font.hlv_fs.hlv_grad.hlv_grid.hlv_image_dsc.hlv_layout.hlv_ll.hlv_log.hlv_math.hlv_mem.hlv_palette.hlv_profiler_builtin.hlv_sprintf.hlv_string.hlv_style_gen.hlv_symbol_def.hlv_tick.hlv_timer.h
How is this guide?
Last updated on