lvgl / lv_port_linux

LVGL configured to work with a standard Linux framebuffer
MIT License
235 stars 148 forks source link

Alpha Blending in Wayland #27

Closed symfund closed 1 year ago

symfund commented 2 years ago
Capture

Below is the original background of Sticky Notes Yellow-Sticky-Note-PNG-HD-Image

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);

}

kisvegabor commented 2 years ago

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.

symfund commented 2 years ago

@kisvegabor In my fork v8.2, displ_drv->screen_transp and LV_COLOR_SCREEN_TRANSP already are enabled, I will try on v8.3.

symfund commented 1 year ago

I fixed the problem!

wayland-screenshot-2022-12-24_21-39-49
symfund commented 1 year ago

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

...

}