Label text gradient on latest release

Description

I would like to create a text gradient for a label widget. There is an example here: Label (lv_label) — LVGL documentation which is exactly what I want, but it does not appear to be correct. See the “What have you tried so far?” section below for details about what is incorrect.

What MCU/Processor/Board and compiler are you using?

I have an STM32U5G9J-DK2 development board with the latest LVGL release (9.1) installed and running. I am able to display graphics properly on the screen.

What LVGL version are you using?

9.1

What do you want to achieve?

I would like to get a functional version of the text gradient working on LVGL 9.1

What have you tried so far?

In the provided code: Label (lv_label) — LVGL documentation, the lv_draw_mask_map_param_t does not seem to exist anymore, despite still being listed in the docs. The closest that I could find is lv_draw_sw_mask_map_param_t. However, I do not know what the “sw” means…

I tried replacing all of the functions that reffered to lv_draw_mask_map_param_t with the equivalent sw ones, however, I discovered that lv_draw_mask_add and lv_draw_mask_remove_id do not have equivalent function in the sw collection (found at lvgl/src/draw/sw).

Additionally, lv_canvas_draw_text appears to be missing from the latest LVGL version and I cannot find an equivalent for drawing text to a canvas object.

How can I rework this example to get a function text gradient in 9.1? Why were these functions removed? And what is the sw mask?

1 Like

Something reallt strange is going on, in the label example that uses masks, the whole code is disabled with a 0 at the end of the #if

#if LV_USE_LABEL && LV_USE_CANVAS && LV_BUILD_EXAMPLES && LV_DRAW_SW_COMPLEX && 0

Has this feature been dropped, or is just unsuable now?

It looks like it really has been dropped:

Thank you for pointing it out. It’s temporarily disabled because the masking works differently in v9 and some features are not implemented yet. I’ll update it when feat(draw/sw): added support for LV_COLOR_FORMAT_L8 by zjanosy · Pull Request #5800 · lvgl/lvgl · GitHub is mereged.