lv_port_linux
lv_port_linux copied to clipboard
Alpha Blending in Wayland
Below is the original background of Sticky Notes
The shadow of border is wrong using the latest source repository.
void lv_example_sticky_notes(void) { LV_IMG_DECLARE(img_sticky_notes_png);
lv_obj_t *central = lv_scr_act();
lv_obj_set_style_bg_opa(central, LV_OPA_TRANSP, 0);
lv_obj_t *img = lv_img_create(central);
lv_img_set_src(img, &img_sticky_notes_png);
lv_img_set_antialias(img, true);
lv_obj_center(img);
lv_obj_t *label1 = lv_label_create(img);
lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP); /*Break the long lines*/
lv_label_set_recolor(label1, true); /*Enable re-coloring by commands in the text*/
lv_label_set_text(label1, "#ff0000 Sticky Notes# is a borderless Wayland client developed by LVGL with Wayland backend. "
"\n\n #0000ff Wayland# on embedded SBC board, brought to you by LVGL.");
lv_obj_set_width(label1, 200); /*Set smaller width to make the lines wrap*/
lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);
}
If you are using LVGL v8.3 you should enable disp_drv->screen_transp
and LV_COLOR_SCREEN_TRANSP
.
In LVGL master
only disp_drv->screen_transp
needs to be enabled.
@kisvegabor In my fork v8.2, displ_drv->screen_transp and LV_COLOR_SCREEN_TRANSP already are enabled, I will try on v8.3.
I fixed the problem!

In void lv_disp_drv_init(),
void lv_disp_drv_init(lv_disp_drv_t * driver) { ...
#if LV_COLOR_SCREEN_TRANSP driver->screen_transp = 1; #else driver->screen_transp = 0; #endif
...
}