lv_port_linux icon indicating copy to clipboard operation
lv_port_linux copied to clipboard

Alpha Blending in Wayland

Open symfund opened this issue 2 years ago • 2 comments

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

}

symfund avatar Sep 16 '22 05:09 symfund

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 avatar Sep 19 '22 09:09 kisvegabor

@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 avatar Sep 22 '22 13:09 symfund

I fixed the problem!

wayland-screenshot-2022-12-24_21-39-49

symfund avatar Dec 25 '22 07:12 symfund

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

...

}

symfund avatar Dec 25 '22 07:12 symfund