lv_obj_draw.h

API reference for lv_obj_draw.h

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

Functions

lv_obj_init_draw_rect_dsc

Initialize a rectangle draw descriptor from an object's styles in its current state

 
void lv_obj_init_draw_rect_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_rect_dsc_t *draw_dsc)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an object
partlv_part_tpart of the object, e.g. LV_PART_MAIN, LV_PART_SCROLLBAR, LV_PART_KNOB, etc
draw_dsclv_draw_rect_dsc_t *the descriptor to initialize. If an ..._opa field is set to LV_OPA_TRANSP the related properties won't be initialized. Should be initialized with lv_draw_rect_dsc_init(draw_dsc).

Only the relevant fields will be set. E.g. if border width == 0 the other border properties won't be evaluated.

lv_obj_init_draw_label_dsc

Initialize a label draw descriptor from an object's styles in its current state

 
void lv_obj_init_draw_label_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_label_dsc_t *draw_dsc)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an object
partlv_part_tpart of the object, e.g. LV_PART_MAIN, LV_PART_SCROLLBAR, LV_PART_KNOB, etc
draw_dsclv_draw_label_dsc_t *the descriptor to initialize. If the opa field is set to or the property is equal to LV_OPA_TRANSP the rest won't be initialized. Should be initialized with lv_draw_label_dsc_init(draw_dsc).

lv_obj_init_draw_image_dsc

Initialize an image draw descriptor from an object's styles in its current state

 
void lv_obj_init_draw_image_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_image_dsc_t *draw_dsc)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an object
partlv_part_tpart of the object, e.g. LV_PART_MAIN, LV_PART_SCROLLBAR, LV_PART_KNOB, etc
draw_dsclv_draw_image_dsc_t *the descriptor to initialize. Should be initialized with lv_draw_image_dsc_init(draw_dsc).

lv_obj_init_draw_line_dsc

Initialize a line draw descriptor from an object's styles in its current state

 
void lv_obj_init_draw_line_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_line_dsc_t *draw_dsc)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an object
partlv_part_tpart of the object, e.g. LV_PART_MAIN, LV_PART_SCROLLBAR, LV_PART_KNOB, etc
draw_dsclv_draw_line_dsc_t *the descriptor to initialize. Should be initialized with lv_draw_line_dsc_init(draw_dsc).

lv_obj_init_draw_arc_dsc

Initialize an arc draw descriptor from an object's styles in its current state

 
void lv_obj_init_draw_arc_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_arc_dsc_t *draw_dsc)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an object
partlv_part_tpart of the object, e.g. LV_PART_MAIN, LV_PART_SCROLLBAR, LV_PART_KNOB, etc
draw_dsclv_draw_arc_dsc_t *the descriptor to initialize. Should be initialized with lv_draw_arc_dsc_init(draw_dsc).

lv_obj_init_draw_blur_dsc

Initialize a blur draw descriptor from an object's styles in its current state. draw_dsc->radius will only be calculated if it's 0 initially. Radius can be set before calling this function to avoid getting it twice.

 
void lv_obj_init_draw_blur_dsc(lv_obj_t *obj, lv_part_t part, lv_draw_blur_dsc_t *draw_dsc)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an object
partlv_part_tpart of the object, e.g. LV_PART_MAIN, LV_PART_SCROLLBAR, LV_PART_KNOB, etc
draw_dsclv_draw_blur_dsc_t *the descriptor to initialize. Should be initialized with lv_draw_blur_dsc_init(draw_dsc).

lv_obj_calculate_ext_draw_size

Get the required extra size (around the object's part) to draw shadow, outline, value etc.

 
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t *obj, lv_part_t part)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an object
partlv_part_tpart of the object

Returns: int32_t — the extra size required around the object

lv_obj_refresh_ext_draw_size

Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size. The result will be saved in obj.

 
void lv_obj_refresh_ext_draw_size(lv_obj_t *obj)
Parameters
NameTypeDescription
objlv_obj_t *pointer to an object

Enums

lv_layer_type_t

Store the type of layer required to render a widget.

NameDescription
LV_LAYER_TYPE_NONENo layer is needed.
LV_LAYER_TYPE_SIMPLESimple layer means that the layer can be rendered in chunks. For example with opa_layered = 140 it's possible to render only 10 lines from the layer. When it's ready go to the next 10 lines. It avoids large memory allocations for the layer buffer. The buffer size for a chunk can be set by LV_DRAW_LAYER_SIMPLE_BUF_SIZE in lv_conf.h.
LV_LAYER_TYPE_TRANSFORMThe widget is transformed and cannot be rendered in chunks. It's because - due to the transformations - pixel outside of a given area will also contribute to the final image. In this case there is no limitation on the buffer size. LVGL will allocate as large buffer as needed to render the transformed area.

Dependencies

How is this guide?

Last updated on

On this page