-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat(draw/sw): added support for LV_COLOR_FORMAT_L8 #5800
Conversation
…into RGB565, RGB888 and ARGB8888 canvas.
All changes make sense to me at first glance. L8 cogwheel image looks okay on It's a large space of possibilities to test. The eventual test cases will reveal any non-obvious problems. |
Hi, //example |
You made a valid point not to round. If you don't see a huge difference, it may be better to be faster. |
Hey, Thank you or the PR! It was already requested by a lot of people! 🙂 I've tested it like this: lv_demo_widgets();
lv_draw_buf_t * draw_buf = lv_snapshot_create_draw_buf(lv_screen_active(), LV_COLOR_FORMAT_L8);
lv_snapshot_take_to_draw_buf(lv_screen_active(), LV_COLOR_FORMAT_L8, draw_buf);
lv_obj_clean(lv_screen_active());
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
lv_canvas_set_draw_buf(canvas, draw_buf);
lv_demo_render(LV_DEMO_RENDER_SCENE_FILL, LV_OPA_50); I've updated the tests to support rendering to L8 and added the reference images as well for this test case. It seems there are a few places where the rendering is not correct. Could you take a look at these? |
The CI passing for me locally, but here is an off by one error here. Do you have any idea why the rendering can be platform dependent? |
And it's passing now. We will see if the passing or the failure have happened by "accident". I've discussed it with @zjanosy that he will update |
…amma correction before luminance calculation. This method results in more details in the dark areas of the picture.
# Conflicts: # demos/render/lv_demo_render.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just fixed the code formatting issue.
#if defined(LV_LVGL_H_INCLUDE_SIMPLE) | ||
#include "lvgl.h" | ||
#elif defined(LV_BUILD_TEST) | ||
#include "../lvgl.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use an include similar to the other images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
…vgl#5979) Signed-off-by: qinshijing <qinshijing@xiaomi.com> Co-authored-by: qinshijing <qinshijing@xiaomi.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the accidentally changed test files.
The rest is looking good!
src/core/lv_obj_scroll.c
Outdated
@@ -309,7 +309,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t a | |||
lv_anim_t a; | |||
lv_anim_init(&a); | |||
lv_anim_set_var(&a, obj); | |||
lv_anim_set_completed_cb(&a, scroll_completed_completed_cb); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was it modified? it comes from this fix: #5979
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted it.
typedef struct { | ||
uint8_t lumi; | ||
uint8_t alpha; | ||
} lv_color16a_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be lv_color8a_t
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lv_color16a_t
is really misleading as lv_color16_t
is RGB565. lv_color_al88_t
would be cleanest, but it's different style. lv_color8a_t
can be a good trade off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I agree that lv_color16a_t
is not the best name, the naming scheme was that the number in the color format name indicates the number of bits of the value. Therefore I think color8a is a bit misleading, too, because it suggest that it is a 8 bit value, which it is not. Maybe lv_color8a8_t
would be better (although ARGB8888
is called lv_color32_t
, and not something like lv_color24a
or lv_color24a8
).
Certainly, the cleanest solution would be to call them as the corresponding color format is called, i.e.:
lv_color32_t
-> lv_argb8888_t
lv_color16_t
-> lv_rgb565_t
lv_color16a_t
-> lv_al88_t
But this would likely break too much code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we can rename these by adding typedef lv_color_argb8888_t lv_color32_t
in lv_api_map_v9.h
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lv_color32_t -> lv_argb8888_t
lv_color16_t -> lv_rgb565_t
lv_color16a_t -> lv_al88_t
I agree with it. But it should be lv_color16_t --> lv_al88_t
where 16 means it takes 16bits. There will be lv_color[32|24|16|8]_t.
Actually we can rename these by adding typedef lv_color_argb8888_t lv_color32_t in lv_api_map_v9.h.
Let's go for it. It can be a separate PR. We can merge this massive achievement firstly.
def linear_to_sRGB(self, y): | ||
if y <= 0.0031308: | ||
return 12.92 * y | ||
return 1.055 * pow(y, 1/2.4) - 0.055 | ||
|
||
def _png_to_luma_only(self, cf: ColorFormat, filename: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the luma here should be called lumi(nance) instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, luma and luminance are different terms:
https://www.geeksforgeeks.org/difference-between-luma-and-luminance/
But honestly I don't know which is the correct name in our case.
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
Merged, thank you! |
I plan to add the Arm-2D (Helium) support for L8. In fact, in arm-2d, we call L8 the GRAY8. |
Amazing, thank you in advance! |
Description of the feature or fix
Implemented rendering L8, RGB565, RGB888 and ARGB8888 into L8 canvas.
Implemented rendering L8 format image into L8, RGB565, RGB888 and ARGB8888 canvas.
Notes
Documentation, examples and tests are WIP.