feat(draw/sw): added support for LV_COLOR_FORMAT_L8 (#5800)

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Signed-off-by: qinshijing <qinshijing@xiaomi.com>
Co-authored-by: Zoltan Janosy <zjanosy@fishman.com>
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
Co-authored-by: VIFEX <vifextech@foxmail.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: Niklas Fiekas <niklas.fiekas@sartorius.com>
Co-authored-by: qinshijing <51692568+qinshijing@users.noreply.github.com>
Co-authored-by: qinshijing <qinshijing@xiaomi.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
Zoltan Janosy
2024-04-20 13:14:25 +02:00
committed by GitHub
parent be4a9d1e73
commit abc8a7292a
114 changed files with 3033 additions and 83 deletions

View File

@@ -1,4 +1,4 @@
/**
/**
* @file lv_demo_render.c
*
*/
@@ -329,17 +329,20 @@ static lv_obj_t * image_obj_create(lv_obj_t * parent, int32_t col, int32_t row,
}
static void image_core_cb(lv_obj_t * parent, bool recolor)
static void image_core_cb(lv_obj_t * parent, bool recolor, uint32_t startAt)
{
LV_IMAGE_DECLARE(img_render_lvgl_logo_xrgb8888);
LV_IMAGE_DECLARE(img_render_lvgl_logo_rgb888);
LV_IMAGE_DECLARE(img_render_lvgl_logo_rgb565);
LV_IMAGE_DECLARE(img_render_lvgl_logo_argb8888);
LV_IMAGE_DECLARE(img_render_lvgl_logo_l8);
const void * srcs[] = {
&img_render_lvgl_logo_argb8888,
&img_render_lvgl_logo_xrgb8888,
&img_render_lvgl_logo_rgb888,
&img_render_lvgl_logo_rgb565,
&img_render_lvgl_logo_l8,
};
const void * names[] = {
@@ -347,46 +350,49 @@ static void image_core_cb(lv_obj_t * parent, bool recolor)
"XRGB\n8888",
"RGB\n888",
"RGB\n565",
"L8",
};
uint32_t stopAt = startAt + LV_MIN(sizeof(srcs) / sizeof(void *) - startAt, 4);
uint32_t i;
for(i = 0; i < 4; i++) {
for(i = startAt; i < stopAt; i++) {
lv_obj_t * obj;
uint32_t row = i - startAt;
obj = lv_label_create(parent);
lv_label_set_text(obj, names[i]);
add_to_cell(obj, 0, i * 2);
add_to_cell(obj, 0, row * 2);
obj = image_obj_create(parent, 1, i * 2, recolor);
obj = image_obj_create(parent, 1, row * 2, recolor);
lv_image_set_src(obj, srcs[i]);
obj = image_obj_create(parent, 2, i * 2, recolor);
obj = image_obj_create(parent, 2, row * 2, recolor);
lv_image_set_src(obj, srcs[i]);
lv_image_set_rotation(obj, 300);
lv_image_set_pivot(obj, 0, 0);
obj = image_obj_create(parent, 3, i * 2, recolor);
obj = image_obj_create(parent, 3, row * 2, recolor);
lv_image_set_src(obj, srcs[i]);
lv_image_set_scale(obj, 400);
lv_image_set_pivot(obj, 0, 0);
obj = image_obj_create(parent, 4, i * 2, recolor);
obj = image_obj_create(parent, 4, row * 2, recolor);
lv_image_set_src(obj, srcs[i]);
lv_image_set_scale_x(obj, 400);
lv_image_set_pivot(obj, 0, 0);
obj = image_obj_create(parent, 5, i * 2, recolor);
obj = image_obj_create(parent, 5, row * 2, recolor);
lv_image_set_src(obj, srcs[i]);
lv_image_set_scale_y(obj, 400);
lv_image_set_pivot(obj, 0, 0);
obj = image_obj_create(parent, 6, i * 2, recolor);
obj = image_obj_create(parent, 6, row * 2, recolor);
lv_image_set_src(obj, srcs[i]);
lv_image_set_rotation(obj, 300);
lv_image_set_scale(obj, 400);
lv_image_set_pivot(obj, 0, 0);
obj = image_obj_create(parent, 7, i * 2, recolor);
obj = image_obj_create(parent, 7, row * 2, recolor);
lv_image_set_src(obj, srcs[i]);
lv_image_set_scale_y(obj, 400);
lv_image_set_rotation(obj, 300);
@@ -394,14 +400,24 @@ static void image_core_cb(lv_obj_t * parent, bool recolor)
}
}
static void image_normal_cb(lv_obj_t * parent)
static void image_normal_1_cb(lv_obj_t * parent)
{
image_core_cb(parent, false);
image_core_cb(parent, false, 0);
}
static void image_recolored_cb(lv_obj_t * parent)
static void image_recolored_1_cb(lv_obj_t * parent)
{
image_core_cb(parent, true);
image_core_cb(parent, true, 0);
}
static void image_normal_2_cb(lv_obj_t * parent)
{
image_core_cb(parent, false, 4);
}
static void image_recolored_2_cb(lv_obj_t * parent)
{
image_core_cb(parent, true, 4);
}
static lv_obj_t * line_obj_create(lv_obj_t * parent, int32_t col, int32_t row, lv_point_precise_t p[])
@@ -827,8 +843,10 @@ static scene_dsc_t scenes[] = {
{.name = "border", .create_cb = border_cb},
{.name = "box_shadow", .create_cb = box_shadow_cb},
{.name = "text", .create_cb = text_cb},
{.name = "image_normal", .create_cb = image_normal_cb},
{.name = "image_recolor", .create_cb = image_recolored_cb},
{.name = "image_normal_1", .create_cb = image_normal_1_cb},
{.name = "image_recolor_1", .create_cb = image_recolored_1_cb},
{.name = "image_normal_2", .create_cb = image_normal_2_cb},
{.name = "image_recolor_2", .create_cb = image_recolored_2_cb},
{.name = "line", .create_cb = line_cb},
{.name = "arc_normal", .create_cb = arc_normal_cb},
{.name = "arc_image", .create_cb = arc_image_cb},