Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparent screen background #262

Closed
ngsann opened this issue May 24, 2018 · 13 comments
Closed

Transparent screen background #262

ngsann opened this issue May 24, 2018 · 13 comments

Comments

@ngsann
Copy link

ngsann commented May 24, 2018

I am trying to draw a simple object onto the Linux framebuffer. The object does not takes up the whole screen. When the object is drawn to the screen, the background is always white. Is there a way to make the background of the screen transparent? The color space used is argb and the "a" is always the same value (0xff) regardless of the transparency set.

@kisvegabor
Copy link
Member

Hi,

I think I'm not clearly understand.
The screen is the most bottom object and there is not other object behind it. So it's pointless to make it transparent.

What is your goal? What do expect to see with a transparent screen?

@ngsann
Copy link
Author

ngsann commented May 24, 2018

I'm using it to draw a menu over a video image, essentially an OSD. I need the screen background to be transparent to see the video behind the menu.

@kisvegabor
Copy link
Member

kisvegabor commented May 24, 2018

Hm, I never tried to use LittlevGL this way.
But I have an idea how to realize transparency for this purpose. At the end of fbdev_flush do this:

    memset(color_p, 0x00, sizeof(lv_color_t) * LV_VDB_SIZE);

It will always initialize LittlevGL's internal graphics buffer with alpha == 0 so the pixels where LittelvGL doesn't draw will remain transparent.

In your GUI you still have to set you screen's style to transparent (else LittlevGL will draw it)

    lv_obj_set_style(lv_scr_act(), &lv_style_transp);

I never tested it, so I'm also very curious how it will work. :)

But there is an other thing: LittlevGL draws/redraws only if something has changed. So the movie will overwrite the OSD in every frame, right? Or do you have two buffer (one for the movie and one for the OSD) which will be blended together?

@ngsann
Copy link
Author

ngsann commented May 24, 2018

I have 2 buffer, one for the osd. I will try out your suggestion and post back the result. Thanks.

@kisvegabor
Copy link
Member

kisvegabor commented May 24, 2018

Meanwhile I also tested it and found a mistake in my suggestion:
Please replace the memset part with:

    lv_vdb_t * vdb = lv_vdb_get();
    memset(vdb->buf, 0x00, sizeof(lv_color_t) * LV_VDB_SIZE);

This way it worked for me.

@ngsann
Copy link
Author

ngsann commented May 25, 2018

I have tested it your suggestion and it is working well.
Thank you.

@kisvegabor
Copy link
Member

Your welcome!

If it's public can you send some screen shoots about the OSD menu?

@ngsann
Copy link
Author

ngsann commented May 25, 2018

I only have a simple menu now, nothing much, as I still just trying out the library.

menu osd

@kisvegabor
Copy link
Member

kisvegabor commented May 25, 2018

Looks good! Really like an OSD menu!

If you want I happily share a screenshot about this project on the www.littlevgl.com

@ngsann
Copy link
Author

ngsann commented May 25, 2018

I have no issue if you want to share it. Thanks for the great library.

@ngsann ngsann closed this as completed May 25, 2018
@kisvegabor
Copy link
Member

kisvegabor commented May 25, 2018

I also thank you!
Then please post a screenshot if you are in that stage you wanna share.

@OhtokaniPinzon
Copy link

OhtokaniPinzon commented May 16, 2024

Hi @kisvegabor

I am trying to make an LVGL GUI using wayland, that overlays on top of a video stream (which will be playing in a separate wayland window), I need to set transparency to my LVGL GUI in a way such that the video would be visible all the time, and only some buttons of my GUI would be displayed on top of the video and all the GUI background would be transparent.

I tried your suggestion:

lv_vdb_t * vdb = lv_vdb_get();
memset(vdb->buf, 0x00, sizeof(lv_color_t) * LV_VDB_SIZE);

but lv_vdb_t and lv_vdb_get are not defined in my LVGL repo, I am using LVGL V8.3.2
Is there a special branch I have to use to enable this transparency feature?
Is it possible to do this in LVGL v8.3.2?

Best Regards!
Ohtokani

@kisvegabor
Copy link
Member

Hi,

vdb is a very old LVGL concept and it was removed many years ago. Is it an option for you to update to LVGL v9? @daniel-rossier is working on a Wayland driver which will be built in LVGL so it will have better support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants