lv_draw_label.h
API reference for lv_draw_label.h
Functions
lv_draw_task_get_label_dsc
Try to get a label draw descriptor from a draw task.
lv_draw_label_dsc_t * lv_draw_task_get_label_dsc(lv_draw_task_t *task)| Name | Type | Description |
|---|---|---|
task | lv_draw_task_t * | draw task |
Returns: lv_draw_label_dsc_t * — the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_LABEL
lv_draw_letter_dsc_init
void lv_draw_letter_dsc_init(lv_draw_letter_dsc_t *dsc)| Name | Type |
|---|---|
dsc | lv_draw_letter_dsc_t * |
lv_draw_label_dsc_init
Initialize a label draw descriptor
void lv_draw_label_dsc_init(lv_draw_label_dsc_t *dsc)| Name | Type | Description |
|---|---|---|
dsc | lv_draw_label_dsc_t * | pointer to a draw descriptor |
lv_draw_glyph_dsc_init
Initialize a glyph draw descriptor. Used internally.
void lv_draw_glyph_dsc_init(lv_draw_glyph_dsc_t *dsc)| Name | Type | Description |
|---|---|---|
dsc | lv_draw_glyph_dsc_t * | pointer to a draw descriptor |
lv_draw_label
Create a draw task to render a text
void lv_draw_label(lv_layer_t *layer, const lv_draw_label_dsc_t *dsc, const lv_area_t *coords)| Name | Type | Description |
|---|---|---|
layer | lv_layer_t * | pointer to a layer |
dsc | const lv_draw_label_dsc_t * | pointer to draw descriptor |
coords | const lv_area_t * | coordinates of the character |
lv_draw_character
Create a draw task to render a single character
void lv_draw_character(lv_layer_t *layer, lv_draw_label_dsc_t *dsc, const lv_point_t *point, uint32_t unicode_letter)| Name | Type | Description |
|---|---|---|
layer | lv_layer_t * | pointer to a layer |
dsc | lv_draw_label_dsc_t * | pointer to draw descriptor |
point | const lv_point_t * | position of the label |
unicode_letter | uint32_t | the letter to draw |
lv_draw_letter
Draw a single letter
void lv_draw_letter(lv_layer_t *layer, lv_draw_letter_dsc_t *dsc, const lv_point_t *point)| Name | Type | Description |
|---|---|---|
layer | lv_layer_t * | pointer to a layer |
dsc | lv_draw_letter_dsc_t * | pointer to draw descriptor |
point | const lv_point_t * | position of the label |
lv_draw_label_iterate_characters
Should be used during rendering the characters to get the position and other parameters of the characters
void lv_draw_label_iterate_characters(lv_draw_task_t *t, const lv_draw_label_dsc_t *dsc, const lv_area_t *coords, lv_draw_glyph_cb_t cb)| Name | Type | Description |
|---|---|---|
t | lv_draw_task_t * | pointer to a draw task |
dsc | const lv_draw_label_dsc_t * | pointer to draw descriptor |
coords | const lv_area_t * | coordinates of the label |
cb | lv_draw_glyph_cb_t | a callback to call to draw each glyphs one by one |
lv_draw_unit_draw_letter
Draw a single letter using the provided draw unit, glyph descriptor, position, font, and callback.
This function is responsible for rendering a single character from a text string, applying the necessary styling described by the glyph descriptor (dsc). It handles the retrieval of the glyph's description, checks its visibility within the clipping area, and invokes the callback (cb) to render the glyph at the specified position (pos) using the given font (font).
void lv_draw_unit_draw_letter(lv_draw_task_t *t, lv_draw_glyph_dsc_t *dsc, const lv_point_t *pos, const lv_font_t *font, uint32_t letter, lv_draw_glyph_cb_t cb)| Name | Type | Description |
|---|---|---|
t | lv_draw_task_t * | Pointer to the drawing task. |
dsc | lv_draw_glyph_dsc_t * | Pointer to the descriptor containing styling for the glyph to be drawn. |
pos | const lv_point_t * | Pointer to the point coordinates where the letter should be drawn. |
font | const lv_font_t * | Pointer to the font containing the glyph. |
letter | uint32_t | The Unicode code point of the letter to be drawn. |
cb | lv_draw_glyph_cb_t | Callback function to execute the actual rendering of the glyph. |
Structs
lv_draw_label_dsc_t
| Member | Type | Description |
|---|---|---|
base | lv_draw_dsc_base_t | |
text | const char * | The text to draw |
text_size | lv_point_t | The size of the text |
font | const lv_font_t * | The font to use. Fallback fonts are also handled. |
color | lv_color_t | Color of the text |
line_space | int32_t | Extra space between the lines |
letter_space | int32_t | Extra space between the characters |
ofs_x | int32_t | Offset the text with this value horizontally |
ofs_y | int32_t | Offset the text with this value vertically |
rotation | int32_t | Rotation of the letters in 0.1 degree unit |
sel_start | uint32_t | The first characters index for selection (not byte index). LV_DRAW_LABEL_NO_TXT_SEL for no selection |
sel_end | uint32_t | The last characters's index for selection (not byte index). LV_DRAW_LABEL_NO_TXT_SEL for no selection |
sel_color | lv_color_t | Color of the selected characters |
sel_bg_color | lv_color_t | Background color of the selected characters |
text_length | uint32_t | The number of characters to render. 0: means render until reaching the \0 termination. |
align | lv_text_align_t | The alignment of the text LV_TEXT_ALIGN_LEFT/RIGHT/CENTER |
bidi_dir | lv_base_dir_t | The base direction. Used when type setting Right-to-left (e.g. Arabic) texts |
opa | lv_opa_t | Opacity of the text in 0...255 range. LV_OPA_TRANSP, LV_OPA_10, LV_OPA_20, .. LV_OPA_COVER can be used as well |
outline_stroke_opa | lv_opa_t | Letter outline stroke opacity |
decor | lv_text_decor_t | Text decoration, e.g. underline |
flag | lv_text_flag_t | Some flags to control type setting |
text_local | uint8_t | 1: malloc a buffer and copy text there. 0: text will be valid during rendering. |
text_static | uint8_t | Indicate that the text is constant and its pointer can be safely saved e.g. in a cache. |
has_bided | uint8_t | 1: already executed lv_bidi_process_paragraph. 0: has not been executed lv_bidi_process_paragraph. |
hint | lv_draw_label_hint_t * | Pointer to an externally stored struct where some data can be cached to speed up rendering |
outline_stroke_color | lv_color_t | |
outline_stroke_width | int32_t |
Used by 12 functions
lv_obj_init_draw_label_dsc— paramdraw_dsclv_draw_label_dsc_init— paramdsclv_draw_label— paramdsclv_draw_character— paramdsclv_draw_label_iterate_characters— paramdsclv_draw_eve_label— paramdsclv_draw_nanovg_label— paramdsclv_draw_nema_gfx_label— paramdsclv_draw_dave2d_label— paramdsclv_draw_sdl_label— paramdsclv_draw_sw_label— paramdsclv_draw_vg_lite_label— paramdsc
lv_draw_letter_dsc_t
| Member | Type | Description |
|---|---|---|
base | lv_draw_dsc_base_t | |
unicode | uint32_t | |
font | const lv_font_t * | |
color | lv_color_t | |
rotation | int32_t | |
scale_x | int32_t | |
scale_y | int32_t | |
skew_x | int32_t | |
skew_y | int32_t | |
pivot | lv_point_t | |
opa | lv_opa_t | |
decor | lv_text_decor_t | |
blend_mode | lv_blend_mode_t | |
outline_stroke_opa | lv_opa_t | |
outline_stroke_width | int32_t | |
outline_stroke_color | lv_color_t |
Used by 5 functions
lv_draw_letter_dsc_init— paramdsclv_draw_letter— paramdsclv_draw_nanovg_letter— paramdsclv_draw_sw_letter— paramdsclv_draw_vg_lite_letter— paramdsc
Typedefs
lv_draw_glyph_cb_t
typedef void(* lv_draw_glyph_cb_t) (lv_draw_task_t *t, lv_draw_glyph_dsc_t *dsc, lv_draw_fill_dsc_t *fill_dsc, const lv_area_t *fill_area)Passed as a parameter to lv_draw_label_iterate_characters to draw the characters one by one
Used by 3 functions
lv_draw_label_iterate_characters— paramcblv_draw_unit_draw_letter— paramcblv_draw_unit_draw_letter_internal— paramcb
Macros
LV_DRAW_LABEL_NO_TXT_SEL
#define LV_DRAW_LABEL_NO_TXT_SEL (0xFFFF)Dependencies
Indirect dependencies
lv_anim.hlv_area.hlv_assert.hlv_color_op.hlv_conf_internal.hlv_draw_buf.hlv_event.hlv_ext_data.hlv_flex.hlv_font.hlv_grad.hlv_grid.hlv_image_dsc.hlv_layout.hlv_log.hlv_math.hlv_matrix.hlv_mem.hlv_palette.hlv_profiler.hlv_profiler_builtin.hlv_sprintf.hlv_string.hlv_style_gen.hlv_symbol_def.hlv_types.h
Last updated on