lv_draw.h
Defines
-
LV_DRAW_UNIT_ID_ANY
Typedefs
-
typedef struct _lv_draw_task_t lv_draw_task_t
-
typedef struct _lv_draw_unit_t lv_draw_unit_t
-
typedef struct _lv_layer_t lv_layer_t
Enums
-
enum lv_draw_task_type_t
Values:
-
enumerator LV_DRAW_TASK_TYPE_FILL
-
enumerator LV_DRAW_TASK_TYPE_BORDER
-
enumerator LV_DRAW_TASK_TYPE_BOX_SHADOW
-
enumerator LV_DRAW_TASK_TYPE_BG_IMG
-
enumerator LV_DRAW_TASK_TYPE_LABEL
-
enumerator LV_DRAW_TASK_TYPE_IMAGE
-
enumerator LV_DRAW_TASK_TYPE_LAYER
-
enumerator LV_DRAW_TASK_TYPE_LINE
-
enumerator LV_DRAW_TASK_TYPE_ARC
-
enumerator LV_DRAW_TASK_TYPE_TRIANGLE
-
enumerator LV_DRAW_TASK_TYPE_MASK_RECTANGLE
-
enumerator LV_DRAW_TASK_TYPE_MASK_BITMAP
-
enumerator LV_DRAW_TASK_TYPE_FILL
Functions
-
void lv_draw_init(void)
-
void *lv_draw_create_unit(size_t size)
Allocate a new draw unit with the given size and appends it to the list of draw units
- Parameters:
size -- the size to allocate. E.g.
sizeof(my_draw_unit_t)
, where the first element ofmy_draw_unit_t
islv_draw_unit_t
.
-
lv_draw_task_t *lv_draw_add_task(lv_layer_t *layer, const lv_area_t *coords)
-
void lv_draw_finalize_task_creation(lv_layer_t *layer, lv_draw_task_t *t)
-
void lv_draw_dispatch(void)
-
bool lv_draw_dispatch_layer(struct _lv_display_t *disp, lv_layer_t *layer)
-
void lv_draw_dispatch_wait_for_request(void)
Wait for a new dispatch request. It's blocking if
LV_USE_OS == 0
else it yields
-
void lv_draw_dispatch_request(void)
-
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)
Find and available draw task
- Parameters:
layer -- the draw ctx to search in
t_prev -- continue searching from this task
draw_unit_id -- check the task where
preferred_draw_unit_id
equals this value orLV_DRAW_UNIT_ID_ANY
- Returns:
tan available draw task or NULL if there is no any
-
lv_layer_t *lv_draw_layer_create(lv_layer_t *parent_layer, lv_color_format_t color_format, const lv_area_t *area)
Create a new layer on a parent layer
- Parameters:
parent_layer -- the parent layer to which the layer will be merged when it's rendered
color_format -- the color format of the layer
area -- the areas of the layer (absolute coordinates)
- Returns:
the new target_layer or NULL on error
-
void *lv_draw_layer_alloc_buf(lv_layer_t *layer)
Try to allocate a buffer for the layer.
- Parameters:
layer -- pointer to a layer
- Returns:
pointer to the allocated aligned buffer or NULL on failure
-
void *lv_draw_layer_go_to_xy(lv_layer_t *layer, lv_coord_t x, lv_coord_t y)
Got to a pixel at X and Y coordinate on a layer
- Parameters:
layer -- pointer to a layer
x -- the target X coordinate
y -- the target X coordinate
- Returns:
buf
offset to point to the given X and Y coordinate
-
struct _lv_draw_task_t
Public Members
-
struct _lv_draw_task_t *next
-
lv_draw_task_type_t type
-
lv_area_t clip_area
The clip area of the layer is saved here when the draw task is created. As the clip area of the layer can be changed as new draw tasks are added its current value needs to be saved. Therefore during drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks.
-
int state
-
void *draw_dsc
-
uint8_t preferred_draw_unit_id
The ID of the draw_unit which should take this task
-
uint8_t preference_score
Set to which extent
preferred_draw_unit_id
is good at this task. 80: means 20% better (faster) than software rendering 100: the default value 110: means 10% better (faster) than software rendering
-
struct _lv_draw_task_t *next
-
struct _lv_draw_unit_t
Public Members
-
struct _lv_draw_unit_t *next
-
struct _lv_layer_t *target_layer
The target_layer on which drawing should happen
-
int32_t (*dispatch_cb)(struct _lv_draw_unit_t *draw_unit, struct _lv_layer_t *layer)
Called to try to assign a draw task to itself.
lv_draw_get_next_available_task
can be used to get an independent draw task. A draw task should be assign only if the draw unit can draw it too- Param draw_unit:
pointer to the draw unit
- Param layer:
pointer to a layer on which the draw task should be drawn
- Return:
>=0: The number of taken draw task -1: There where no available draw tasks at all. Also means to no call the dispatcher of the other draw units as there is no draw task to take
-
int32_t (*evaluate_cb)(struct _lv_draw_unit_t *draw_unit, lv_draw_task_t *task)
- Param draw_unit:
- Param task:
- Return:
-
struct _lv_draw_unit_t *next
-
struct _lv_layer_t
Public Members
-
void *buf_unaligned
The unaligned buffer where drawing will happen
-
void *buf
The aligned buffer, result of lv_draw_buf_align(layer->buf_unaligned)
-
uint32_t buf_stride
-
lv_color_format_t color_format
-
lv_area_t clip_area
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. Thereforelv_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.
-
lv_draw_task_t *draw_task_head
Linked list of draw tasks
-
struct _lv_layer_t *parent
-
struct _lv_layer_t *next
-
bool all_tasks_added
-
void *user_data
-
void *buf_unaligned
-
struct lv_draw_dsc_base_t
-
struct lv_draw_global_info_t
Public Members
-
lv_draw_unit_t *unit_head
-
uint32_t used_memory_for_layers_kb
-
int dispatch_req
-
lv_mutex_t circle_cache_mutex
-
bool task_running
-
lv_draw_unit_t *unit_head