-
Notifications
You must be signed in to change notification settings - Fork 27
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
image with alpha channel is broken #25
Comments
If you use lvgl v8 can you try lvgl master? The PNG lib was merged there: |
I use lvgl v7.6.1 and code from lv_png v7 branch |
One more moment. For example, I use png from this issue. I use lvgl-settings given in this discussion. Could the LV_COLOR_DEPTH=16 have any effect on this? |
I suggest taking a look at this function: https://github.com/lvgl/lv_lib_png/blob/master/lv_png.c#L214 |
I see following images on the screen Img_data variable data-dump before call and after It seems like colors converted correctly. But drawed image contains stripes. So it seems lvgl-image-draw worked incorrectly with img_data received from decoder -> lvgl itself issue. |
Hmm, I'd be very surprised if LVGL had a bug in simply displaying and image. Can you reproduce in a simulator? If so please send me the commit hash of LVGL your are using and a short codsnippet to be sure we are doing the very same thing. |
I tried to debug how img_draw worked with my image.
which resets first line of mask buffer to 0/255 (as if this line should be completely transparent for the top half of the image where alpha channel < 128, or opaque for bottom half where alpha > 128). So after blending (in my case with map_normal() ) I see first line transparent/opaque (background/map color - clearly visible on a red background), next 10 lines normal (as it should be in image). So in case of big picture (like in this post) image will be blended line by line and alpha channel values will be LV_OPA_COVER or LV_OPA_TRANSP. |
Wow, it's really a bug if But not that with antialiasing enabled you can't draw ARGB images because the alpha channel will be rounded to 0 or 255. |
Now, in latest commit, if antialiazing is disabled alpha channel will be rounded for full blended area, and as a result for whole drawn image. And if png-image have alpha-channel those values will be ignored. Am I understand correctly ? |
Not ignored but there won't be semi-transparent pixels. Only 0% or 100% alpha. Note that even with antialising=0 ARGB images could be drawn correctly as they have nothing to do with antialiasing. But antialiasing is handled here because all drawing ends up in the to Just out of curiosity, why do you need antialaising=0? |
This option disabled by default in zephyr-config. But I didn't think it could be such important. I thought that anti-aliasing should help remove the distortion artifacts on the edges, but I ran into the PNG image losing its alpha channel on output, or drawed as broken. |
By the way, in my example, the PNG image is presented in ARGB (after lodepng_decode32() decoding, a 32-bit array was obtained), but since the LV_COLOR_DEPTH is set to 16 decoder_open() converted it to 3-byte (16bit color + aplha) array, and after that image blended. |
I used such image - 4 rectangles filled with almost the same color but different alpha value
After it drawed on the screen it looks strange - with lines, although rectangles at the source image has solid filled alpha-channel
The text was updated successfully, but these errors were encountered: