In some case true color format image source is too large but it can zoom.
When reduce to index color16bit format for tiny size.
It seems can’t zoom.
Wish image widget support for index color 16 bit format too.
Thank you very much.
In some case true color format image source is too large but it can zoom.
When reduce to index color16bit format for tiny size.
It seems can’t zoom.
Wish image widget support for index color 16 bit format too.
Thank you very much.
The problem with indexed colors, in this regard, that the colors can’t be interpolated. For example if you zoom and RGB image to x1.5 size, 2 adjacent pixel should behave like this:
RED, WHITE
-> RED, ROSE, WHITE
You can’t do the same with indexed colors:
0, 10
-> 0, 5, 10
doesn’t make sens.
However an non-antialiased zoom still would be possible:
0, 10
-> 0, 0, 10
If you were willing to take a hit in performance, and you had a palette with a reasonable number of shades of the same color, perhaps one could scan the palette and choose the closest color to the interpolated value. It definitely wouldn’t be perfect, but the quality might be reasonable enough.
The disadvantage is that scanning through the whole 256-color palette to find the closest color is very slow, even on an STM32F7 (a previous GUI library I worked with used this technique for other reasons).
Interesting idea, but find it a little bit over kill. I think one can accept this limitation with indexed colors.
May I ask what was the library?
It was Nano-X.
In some cases, enabling zoom function for LV_COLOR_FORMAT_I8 is still useful. For example, the data produced by the thermal image camera is a matrix where each pixel is a temperature value. If we use LV_COLOR_FORMAT_I8, we can convert the temperature value (after scaling to 0 to 255) to a color to create a heat map which is what people usually see from the thermal image camera.
In this case, zooming function makes sense since linearly interpolation between adjacent temperature values is meaningful.
I tried to add zooming support for LV_COLOR_FORMAT_I8 but it did not work. Are you able to point where I get it wrong? I changed the following file lvgl\src\draw\sw\lv_draw_sw_transform.c because I thought LV_COLOR_FORMAT_I8 should be similar to LV_COLOR_FORMAT_A8 in term of transform.
From:
#if LV_DRAW_SW_SUPPORT_A8
case LV_COLOR_FORMAT_A8:
transform_a8(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf, aa);
break;
#endif
To:
#if LV_DRAW_SW_SUPPORT_A8
case LV_COLOR_FORMAT_A8:
case LV_COLOR_FORMAT_I8:
transform_a8(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf, aa);
break;
#endif