diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6cd58791a..658ff571f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,8 @@ repos: exclude: | (?x)^( src/libs/ | - src/lv_conf_internal.h + src/lv_conf_internal.h | + tests/test_images ) types_or: ["c", "header"] - repo: https://github.com/crate-ci/typos diff --git a/demos/render/assets/img_render_lvgl_logo_l8.c b/demos/render/assets/img_render_lvgl_logo_l8.c new file mode 100644 index 000000000..14d090850 --- /dev/null +++ b/demos/render/assets/img_render_lvgl_logo_l8.c @@ -0,0 +1,67 @@ +#ifdef __has_include + #if __has_include("lvgl.h") + #ifndef LV_LVGL_H_INCLUDE_SIMPLE + #define LV_LVGL_H_INCLUDE_SIMPLE + #endif + #endif +#endif + +#if defined(LV_LVGL_H_INCLUDE_SIMPLE) + #include "lvgl.h" +#else + #include "lvgl/lvgl.h" +#endif + + +#ifndef LV_ATTRIBUTE_MEM_ALIGN + #define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_IMG_RENDER_LVGL_LOGO_L8 + #define LV_ATTRIBUTE_IMG_IMG_RENDER_LVGL_LOGO_L8 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMG_RENDER_LVGL_LOGO_L8 uint8_t +img_render_lvgl_logo_l8_map[] = { + /*Pixel format: Grayscale 8 bit*/ + 0xfd,0xfd,0xdf,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xcb,0xed,0xfd,0xfd, + 0xfd,0xa8,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x22,0xcf,0xfd, + 0xdf,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x46,0xfc, + 0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x3f,0xbf,0xb1,0x1d,0x1d,0x1d,0xe7, + 0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xb9,0xfd,0xfd,0x8d,0x1d,0x1d,0xe6, + 0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x97,0xfd,0xfa,0x67,0x1d,0x1d,0xe6, + 0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x72,0x64,0x1d,0x1d,0x1d,0xe6, + 0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xe0,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xfd,0xf1,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xe1,0x7c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xfa,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xdb,0xfd,0xc7,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xed,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd7,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xf2,0xdd,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xfd,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xf1,0xfd,0xfd,0xf0,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xde,0x78,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xfa,0xd5,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xdd,0xfd,0xfa,0xd5,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xdd,0xfd,0xc7,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xee,0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xee,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xe6, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xea, + 0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xd2,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xe9,0xcb,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x64,0xfd, + 0xd7,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xf2,0xd7,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xf2,0xdc,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x56,0xe1,0xfd, + 0xfd,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xee,0xfd,0xfd,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xee,0xfd,0xfd,0xed,0xe6,0xe6,0xe6,0xe6,0xe6,0xfa,0xfd,0xfd, + +}; + +const lv_image_dsc_t img_render_lvgl_logo_l8 = { + .header.cf = LV_COLOR_FORMAT_L8, + .header.w = 30, + .header.h = 30, + .data = img_render_lvgl_logo_l8_map, + .data_size = sizeof(img_render_lvgl_logo_l8_map), +}; + diff --git a/demos/render/assets/img_render_lvgl_logo_l8.png b/demos/render/assets/img_render_lvgl_logo_l8.png new file mode 100644 index 000000000..f5db880fb Binary files /dev/null and b/demos/render/assets/img_render_lvgl_logo_l8.png differ diff --git a/demos/render/lv_demo_render.c b/demos/render/lv_demo_render.c index 033de7a3f..a56e1482f 100644 --- a/demos/render/lv_demo_render.c +++ b/demos/render/lv_demo_render.c @@ -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}, diff --git a/demos/render/lv_demo_render.h b/demos/render/lv_demo_render.h index 9ae1fe415..beab602da 100644 --- a/demos/render/lv_demo_render.h +++ b/demos/render/lv_demo_render.h @@ -1,4 +1,4 @@ -/** +/** * @file lv_demo_render.h * */ @@ -33,8 +33,10 @@ typedef enum { LV_DEMO_RENDER_SCENE_BORDER, LV_DEMO_RENDER_SCENE_BOX_SHADOW, LV_DEMO_RENDER_SCENE_TEXT, - LV_DEMO_RENDER_SCENE_IMAGE_NORMAL, - LV_DEMO_RENDER_SCENE_IMAGE_RECOLOR, + LV_DEMO_RENDER_SCENE_IMAGE_NORMAL_1, + LV_DEMO_RENDER_SCENE_IMAGE_RECOLOR_1, + LV_DEMO_RENDER_SCENE_IMAGE_NORMAL_2, + LV_DEMO_RENDER_SCENE_IMAGE_RECOLOR_2, LV_DEMO_RENDER_SCENE_LINE, LV_DEMO_RENDER_SCENE_ARC_NORMAL, LV_DEMO_RENDER_SCENE_ARC_IMAGE, diff --git a/examples/assets/img_star.c b/examples/assets/img_star.c index c6c79bfc5..0910f7664 100644 --- a/examples/assets/img_star.c +++ b/examples/assets/img_star.c @@ -1,55 +1,63 @@ -#include "../../lvgl.h" +#ifdef __has_include + #if __has_include("lvgl.h") + #ifndef LV_LVGL_H_INCLUDE_SIMPLE + #define LV_LVGL_H_INCLUDE_SIMPLE + #endif + #endif +#endif + +#if defined(LV_LVGL_H_INCLUDE_SIMPLE) + #include "lvgl.h" +#else + #include "lvgl/lvgl.h" +#endif -#if LV_BUILD_EXAMPLES #ifndef LV_ATTRIBUTE_MEM_ALIGN - #define LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN #endif #ifndef LV_ATTRIBUTE_IMAGE_IMG_STAR - #define LV_ATTRIBUTE_IMAGE_IMG_STAR +#define LV_ATTRIBUTE_IMAGE_IMG_STAR #endif const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMAGE_IMG_STAR uint8_t img_star_map[] = { - /*Pixel format: Blue: 8 bit, Green: 8 bit, Red: 8 bit, Alpha: 8 bit*/ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xd2, 0xff, 0x54, 0x43, 0xd9, 0xff, 0x23, 0x00, 0x00, 0x00, 0x00, 0x4d, 0xdb, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xce, 0xff, 0xc7, 0x4c, 0xdb, 0xff, 0xac, 0x31, 0xd6, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0xff, 0x50, 0x08, 0xce, 0xff, 0xec, 0x4f, 0xdc, 0xff, 0xff, 0x50, 0xdb, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x4d, 0xdc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x03, 0x00, 0xcc, 0xff, 0xaf, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x54, 0xdc, 0xff, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x4b, 0x00, 0xcc, 0xff, 0xe8, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x51, 0xdb, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, 0x4e, 0xdc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x08, 0x00, 0xcc, 0xff, 0x9c, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x54, 0xdd, 0xff, 0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x3f, 0x00, 0xcc, 0xff, 0xe8, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xf0, 0x51, 0xdd, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x4f, 0xdc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x0b, 0x00, 0xcc, 0xff, 0x8f, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe6, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0xff, 0x2c, 0x00, 0xcc, 0xff, 0xef, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xe4, 0x51, 0xdd, 0xff, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe6, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe6, 0xff, 0x07, 0x80, 0xe6, 0xff, 0x2f, 0x7b, 0xe5, 0xff, 0x5b, 0x36, 0xd7, 0xff, 0xb0, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x54, 0xdd, 0xff, 0xff, 0x5e, 0xdf, 0xff, 0xc4, 0x87, 0xe8, 0xff, 0x5b, 0x80, 0xe6, 0xff, 0x34, 0x80, 0xe6, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe6, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x33, 0xd7, 0xff, 0x08, 0x6c, 0xe2, 0xff, 0x18, 0x81, 0xe6, 0xff, 0x3f, 0x81, 0xe6, 0xff, 0x68, 0x80, 0xe6, 0xff, 0x93, 0x80, 0xe6, 0xff, 0xbc, 0x80, 0xe6, 0xff, 0xe7, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x71, 0xe3, 0xff, 0xff, 0x1e, 0xd2, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x5b, 0xde, 0xff, 0xff, 0x78, 0xe5, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xeb, 0x80, 0xe6, 0xff, 0xc3, 0x80, 0xe6, 0xff, 0x98, 0x81, 0xe6, 0xff, 0x6f, 0x81, 0xe6, 0xff, 0x44, 0x71, 0xe3, 0xff, 0x1c, 0x35, 0xd7, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x31, 0xd6, 0xff, 0x87, 0x50, 0xdc, 0xff, 0xff, 0x6e, 0xe3, 0xff, 0xff, 0x77, 0xe4, 0xff, 0xff, 0x7e, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x83, 0xe7, 0xff, 0xff, 0x5e, 0xdf, 0xff, 0xff, 0x0a, 0xce, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x57, 0xdd, 0xff, 0xff, 0x6e, 0xe2, 0xff, 0xff, 0x83, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x7f, 0xe6, 0xff, 0xff, 0x78, 0xe4, 0xff, 0xff, 0x6e, 0xe2, 0xff, 0xff, 0x52, 0xdd, 0xff, 0xff, 0x38, 0xd8, 0xff, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0xff, 0x93, 0x01, 0xcc, 0xff, 0xfb, 0x24, 0xd4, 0xff, 0xff, 0x4b, 0xdc, 0xff, 0xff, 0x65, 0xe1, 0xff, 0xff, 0x72, 0xe3, 0xff, 0xff, 0x7f, 0xe6, 0xff, 0xff, 0x83, 0xe7, 0xff, 0xff, 0x82, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x43, 0xda, 0xff, 0xff, 0x01, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x66, 0xe1, 0xff, 0xff, 0x82, 0xe7, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x83, 0xe7, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x74, 0xe4, 0xff, 0xff, 0x67, 0xe1, 0xff, 0xff, 0x4f, 0xdc, 0xff, 0xff, 0x27, 0xd4, 0xff, 0xff, 0x04, 0xcd, 0xff, 0xfb, 0x00, 0xc9, 0xff, 0x8f, 0x00, 0xc1, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x03, 0x00, 0xcc, 0xff, 0x8b, 0x00, 0xcb, 0xff, 0xfb, 0x00, 0xcb, 0xff, 0xff, 0x06, 0xcd, 0xff, 0xff, 0x25, 0xd3, 0xff, 0xff, 0x45, 0xda, 0xff, 0xff, 0x5d, 0xdf, 0xff, 0xff, 0x70, 0xe3, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x87, 0xe7, 0xff, 0xff, 0x7a, 0xe5, 0xff, 0xff, 0x27, 0xd4, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x4f, 0xdc, 0xff, 0xff, 0x5e, 0xdf, 0xff, 0xff, 0x80, 0xe7, 0xff, 0xff, 0x84, 0xe7, 0xff, 0xff, 0x83, 0xe7, 0xff, 0xff, 0x75, 0xe4, 0xff, 0xff, 0x61, 0xe0, 0xff, 0xff, 0x4a, 0xdb, 0xff, 0xff, 0x2a, 0xd5, 0xff, 0xff, 0x09, 0xce, 0xff, 0xff, 0x00, 0xca, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xfc, 0x00, 0xcc, 0xff, 0x8c, 0x02, 0xcd, 0xff, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x08, 0x00, 0xcc, 0xff, 0x87, 0x00, 0xcc, 0xff, 0xf8, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xca, 0xff, 0xff, 0x08, 0xce, 0xff, 0xff, 0x22, 0xd3, 0xff, 0xff, 0x3c, 0xd8, 0xff, 0xff, 0x55, 0xde, 0xff, 0xff, 0x75, 0xe4, 0xff, 0xff, 0x6b, 0xe2, 0xff, 0xff, 0x1c, 0xd2, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x78, 0xe4, 0xff, 0xff, 0x5d, 0xdf, 0xff, 0xff, 0x42, 0xda, 0xff, 0xff, 0x28, 0xd4, 0xff, 0xff, 0x0c, 0xcf, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0x88, 0x00, 0xcc, 0xff, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xcc, 0xff, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x0b, 0x00, 0xcc, 0xff, 0x84, 0x00, 0xcc, 0xff, 0xfb, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x09, 0xce, 0xff, 0xff, 0x1b, 0xd2, 0xff, 0xff, 0x34, 0xd7, 0xff, 0xff, 0x2e, 0xd5, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x37, 0xd7, 0xff, 0xff, 0x1f, 0xd2, 0xff, 0xff, 0x0e, 0xcf, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0x7f, 0x00, 0xcc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x07, 0x00, 0xcc, 0xff, 0x84, 0x00, 0xcc, 0xff, 0xfc, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x02, 0xcd, 0xff, 0xff, 0x0d, 0xcf, 0xff, 0xff, 0x19, 0xd1, 0xff, 0xff, 0x39, 0xd8, 0xff, 0xff, 0x34, 0xd6, 0xff, 0xff, 0x3c, 0xd9, 0xff, 0xff, 0x1d, 0xd2, 0xff, 0xff, 0x07, 0xce, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0x73, 0x00, 0xcc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x03, 0x00, 0xcc, 0xff, 0x83, 0x00, 0xcc, 0xff, 0xff, 0x02, 0xcc, 0xff, 0xff, 0x10, 0xd0, 0xff, 0xff, 0x1d, 0xd2, 0xff, 0xff, 0x26, 0xd3, 0xff, 0xff, 0x26, 0xd3, 0xff, 0xff, 0x38, 0xd6, 0xff, 0xff, 0x4a, 0xdb, 0xff, 0xff, 0x08, 0xcd, 0xff, 0xff, 0x46, 0xda, 0xff, 0xff, 0x52, 0xdc, 0xff, 0xff, 0x4b, 0xdb, 0xff, 0xff, 0x3d, 0xd8, 0xff, 0xff, 0x20, 0xd3, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0x6c, 0x00, 0xcc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xd1, 0xff, 0xb4, 0x28, 0xd4, 0xff, 0xff, 0x29, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x29, 0xd4, 0xff, 0xff, 0x2f, 0xd5, 0xff, 0xff, 0x4c, 0xdb, 0xff, 0xff, 0x4f, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x0c, 0xcf, 0xff, 0xff, 0x54, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x53, 0xdd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x39, 0xd8, 0xff, 0x8b, 0x1c, 0xd2, 0xff, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0xc8, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x42, 0xd9, 0xff, 0xff, 0x57, 0xdd, 0xff, 0xff, 0x4f, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x1e, 0xd2, 0xff, 0xff, 0x59, 0xde, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0x97, 0x55, 0xdd, 0xff, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0xef, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x39, 0xd7, 0xff, 0xff, 0x53, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x4e, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x02, 0xcc, 0xff, 0xff, 0x35, 0xd6, 0xff, 0xff, 0x57, 0xde, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xc0, 0x55, 0xdd, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0x20, 0x2a, 0xd4, 0xff, 0xf4, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x31, 0xd6, 0xff, 0xff, 0x4d, 0xdc, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x4e, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x0a, 0xcf, 0xff, 0xff, 0x46, 0xda, 0xff, 0xff, 0x57, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xe8, 0x55, 0xdd, 0xff, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0x4b, 0x2a, 0xd4, 0xff, 0xf7, 0x2a, 0xd4, 0xff, 0xff, 0x2c, 0xd5, 0xff, 0xff, 0x45, 0xda, 0xff, 0xff, 0x58, 0xde, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x4e, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x19, 0xd1, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x53, 0xdd, 0xff, 0x1f, 0x4a, 0xdc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0x77, 0x2a, 0xd4, 0xff, 0xfb, 0x29, 0xd4, 0xff, 0xff, 0x3d, 0xd8, 0xff, 0xff, 0x57, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xef, 0x05, 0xcd, 0xff, 0xf8, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x01, 0xcc, 0xff, 0xff, 0x2c, 0xd5, 0xff, 0xff, 0x54, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x53, 0xdd, 0xff, 0x47, 0x52, 0xdd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0xa3, 0x29, 0xd4, 0xff, 0xfc, 0x34, 0xd6, 0xff, 0xff, 0x53, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xfc, 0x55, 0xdd, 0xff, 0xb3, 0x53, 0xdd, 0xff, 0x58, 0x04, 0xcd, 0xff, 0x5c, 0x00, 0xcc, 0xff, 0xb0, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x08, 0xce, 0xff, 0xff, 0x3e, 0xd8, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x54, 0xdd, 0xff, 0x74, 0x54, 0xdd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0xcb, 0x2d, 0xd5, 0xff, 0xff, 0x4e, 0xdc, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x53, 0xdc, 0xff, 0xc0, 0x53, 0xdd, 0xff, 0x5b, 0x53, 0xdd, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x1b, 0x00, 0xcc, 0xff, 0x58, 0x00, 0xcc, 0xff, 0xbf, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x12, 0xd0, 0xff, 0xff, 0x4d, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xa4, 0x54, 0xdd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd3, 0xff, 0x0b, 0x27, 0xd4, 0xff, 0xdc, 0x47, 0xda, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x51, 0xdc, 0xff, 0xdb, 0x4e, 0xdc, 0xff, 0x5c, 0x52, 0xdc, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0xd4, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x1b, 0x00, 0xcc, 0xff, 0x5c, 0x00, 0xcc, 0xff, 0xd7, 0x00, 0xcc, 0xff, 0xff, 0x24, 0xd3, 0xff, 0xff, 0x53, 0xdd, 0xff, 0xd3, 0x5d, 0xdf, 0xff, 0x00, 0x39, 0xd7, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xd1, 0xff, 0x30, 0x41, 0xd9, 0xff, 0xef, 0x4f, 0xdc, 0xff, 0xf0, 0x48, 0xdb, 0xff, 0x6b, 0x4a, 0xdb, 0xff, 0x10, 0x3f, 0xda, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0xdc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x03, 0x00, 0xcc, 0xff, 0x14, 0x00, 0xcc, 0xff, 0x6f, 0x00, 0xcc, 0xff, 0xef, 0x37, 0xd7, 0xff, 0xff, 0x49, 0xda, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0xd7, 0xff, 0x4b, 0x40, 0xd9, 0xff, 0x70, 0x3a, 0xd8, 0xff, 0x10, 0x43, 0xda, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xdb, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0xcc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xcc, 0xff, 0x00, 0x00, 0xca, 0xff, 0x10, 0x0c, 0xce, 0xff, 0x90, 0x20, 0xd3, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xd1, 0xff, 0x54, 0x43, 0xda, 0xff, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xce, 0xff, 0xc7, 0x4c, 0xdb, 0xff, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x50, 0x08, 0xce, 0xff, 0xed, 0x4f, 0xdc, 0xff, 0xff, 0x4f, 0xdd, 0xff, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0xcc, 0xff, 0xae, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x54, 0xdc, 0xff, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x4b, 0x00, 0xcc, 0xff, 0xe8, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x52, 0xdd, 0xff, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xff, 0x09, 0x00, 0xcc, 0xff, 0x9c, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x54, 0xde, 0xff, 0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xff, 0x3e, 0x00, 0xcc, 0xff, 0xe9, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xf1, 0x52, 0xde, 0xff, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0x0b, 0x00, 0xcd, 0xff, 0x8e, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xfe, 0x55, 0xdc, 0xff, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0xff, 0x2c, 0x00, 0xcc, 0xff, 0xef, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdc, 0xff, 0xe5, 0x50, 0xdb, 0xff, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0xdb, 0xff, 0x07, 0x82, 0xe4, 0xff, 0x2f, 0x7b, 0xe6, 0xff, 0x5b, 0x35, 0xd7, 0xff, 0xb1, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x54, 0xdd, 0xff, 0xff, 0x5e, 0xde, 0xff, 0xc4, 0x88, 0xe8, 0xff, 0x5a, 0x82, 0xe7, 0xff, 0x35, 0x80, 0xea, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0xdf, 0xff, 0x08, 0x6a, 0xdf, 0xff, 0x18, 0x82, 0xe7, 0xff, 0x3f, 0x81, 0xe7, 0xff, 0x69, 0x80, 0xe7, 0xff, 0x93, 0x80, 0xe7, 0xff, 0xbc, 0x80, 0xe6, 0xff, 0xe6, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x71, 0xe3, 0xff, 0xff, 0x1e, 0xd2, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x5b, 0xde, 0xff, 0xff, 0x78, 0xe5, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xeb, 0x80, 0xe6, 0xff, 0xc2, 0x80, 0xe6, 0xff, 0x98, 0x82, 0xe6, 0xff, 0x6e, 0x80, 0xe5, 0xff, 0x44, 0x72, 0xe5, 0xff, 0x1d, 0x24, 0xdb, 0xff, 0x07, + 0x31, 0xd5, 0xff, 0x87, 0x50, 0xdc, 0xff, 0xff, 0x6e, 0xe3, 0xff, 0xff, 0x77, 0xe4, 0xff, 0xff, 0x7e, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x83, 0xe7, 0xff, 0xff, 0x5e, 0xdf, 0xff, 0xff, 0x0a, 0xce, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x57, 0xdd, 0xff, 0xff, 0x6e, 0xe2, 0xff, 0xff, 0x83, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x7f, 0xe6, 0xff, 0xff, 0x78, 0xe4, 0xff, 0xff, 0x6e, 0xe2, 0xff, 0xff, 0x52, 0xdd, 0xff, 0xff, 0x38, 0xd8, 0xff, 0x83, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc9, 0xff, 0x93, 0x01, 0xcc, 0xff, 0xfb, 0x24, 0xd4, 0xff, 0xff, 0x4b, 0xdc, 0xff, 0xff, 0x65, 0xe1, 0xff, 0xff, 0x72, 0xe3, 0xff, 0xff, 0x7f, 0xe6, 0xff, 0xff, 0x83, 0xe7, 0xff, 0xff, 0x82, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x43, 0xda, 0xff, 0xff, 0x01, 0xcc, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x66, 0xe1, 0xff, 0xff, 0x82, 0xe7, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x83, 0xe7, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x74, 0xe4, 0xff, 0xff, 0x67, 0xe1, 0xff, 0xff, 0x4f, 0xdc, 0xff, 0xff, 0x27, 0xd4, 0xff, 0xff, 0x04, 0xcd, 0xff, 0xfb, 0x00, 0xc9, 0xff, 0x8e, 0x00, 0xbf, 0xff, 0x0c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xff, 0x03, 0x00, 0xcc, 0xff, 0x8b, 0x00, 0xcb, 0xff, 0xfa, 0x00, 0xcb, 0xff, 0xff, 0x06, 0xcd, 0xff, 0xff, 0x25, 0xd3, 0xff, 0xff, 0x45, 0xda, 0xff, 0xff, 0x5d, 0xdf, 0xff, 0xff, 0x70, 0xe3, 0xff, 0xff, 0x81, 0xe6, 0xff, 0xff, 0x87, 0xe7, 0xff, 0xff, 0x7a, 0xe5, 0xff, 0xff, 0x27, 0xd4, 0xff, 0xff, 0x07, 0xcd, 0xff, 0xff, 0x4f, 0xdc, 0xff, 0xff, 0x5e, 0xdf, 0xff, 0xff, 0x80, 0xe7, 0xff, 0xff, 0x84, 0xe7, 0xff, 0xff, 0x83, 0xe7, 0xff, 0xff, 0x75, 0xe4, 0xff, 0xff, 0x61, 0xe0, 0xff, 0xff, 0x4a, 0xdb, 0xff, 0xff, 0x2a, 0xd5, 0xff, 0xff, 0x09, 0xce, 0xff, 0xff, 0x00, 0xca, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xfc, 0x00, 0xcc, 0xff, 0x8d, 0x00, 0xcc, 0xff, 0x0a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xff, 0x08, 0x00, 0xcc, 0xff, 0x87, 0x00, 0xcc, 0xff, 0xf9, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xca, 0xff, 0xff, 0x08, 0xce, 0xff, 0xff, 0x22, 0xd3, 0xff, 0xff, 0x3c, 0xd8, 0xff, 0xff, 0x55, 0xde, 0xff, 0xff, 0x75, 0xe4, 0xff, 0xff, 0x6b, 0xe2, 0xff, 0xff, 0x1c, 0xd2, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x80, 0xe6, 0xff, 0xff, 0x78, 0xe4, 0xff, 0xff, 0x5d, 0xdf, 0xff, 0xff, 0x42, 0xda, 0xff, 0xff, 0x28, 0xd4, 0xff, 0xff, 0x0c, 0xcf, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0x88, 0x00, 0xbf, 0xff, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xff, 0x0a, 0x00, 0xcb, 0xff, 0x85, 0x00, 0xcc, 0xff, 0xfa, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x09, 0xce, 0xff, 0xff, 0x1b, 0xd2, 0xff, 0xff, 0x34, 0xd7, 0xff, 0xff, 0x2e, 0xd5, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x37, 0xd7, 0xff, 0xff, 0x1f, 0xd2, 0xff, 0xff, 0x0e, 0xcf, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcd, 0xff, 0x7f, 0x00, 0xdb, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xff, 0x07, 0x00, 0xcd, 0xff, 0x84, 0x00, 0xcc, 0xff, 0xfd, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x02, 0xcd, 0xff, 0xff, 0x0d, 0xcf, 0xff, 0xff, 0x19, 0xd1, 0xff, 0xff, 0x39, 0xd8, 0xff, 0xff, 0x34, 0xd6, 0xff, 0xff, 0x3c, 0xd9, 0xff, 0xff, 0x1d, 0xd2, 0xff, 0xff, 0x07, 0xce, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcb, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0x73, 0x00, 0xdb, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0xcc, 0xff, 0x82, 0x00, 0xcc, 0xff, 0xfe, 0x02, 0xcc, 0xff, 0xff, 0x10, 0xd0, 0xff, 0xff, 0x1d, 0xd2, 0xff, 0xff, 0x26, 0xd3, 0xff, 0xff, 0x26, 0xd3, 0xff, 0xff, 0x38, 0xd6, 0xff, 0xff, 0x4a, 0xdb, 0xff, 0xff, 0x08, 0xcd, 0xff, 0xff, 0x46, 0xda, 0xff, 0xff, 0x52, 0xdc, 0xff, 0xff, 0x4b, 0xdb, 0xff, 0xff, 0x3d, 0xd8, 0xff, 0xff, 0x20, 0xd3, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcb, 0xff, 0x6c, 0x00, 0xdb, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xd2, 0xff, 0xb4, 0x28, 0xd4, 0xff, 0xff, 0x29, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x29, 0xd4, 0xff, 0xff, 0x2f, 0xd5, 0xff, 0xff, 0x4c, 0xdb, 0xff, 0xff, 0x4f, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x0c, 0xcf, 0xff, 0xff, 0x54, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x53, 0xdd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x39, 0xd8, 0xff, 0x8b, 0x1a, 0xcc, 0xff, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0xc8, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x42, 0xd9, 0xff, 0xff, 0x57, 0xdd, 0xff, 0xff, 0x4f, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x1e, 0xd2, 0xff, 0xff, 0x59, 0xde, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0x96, 0x55, 0xe3, 0xff, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd4, 0xff, 0xef, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x39, 0xd7, 0xff, 0xff, 0x53, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x4e, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x02, 0xcc, 0xff, 0xff, 0x35, 0xd6, 0xff, 0xff, 0x57, 0xde, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdc, 0xff, 0xc0, 0x5b, 0xdb, 0xff, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0xd7, 0xff, 0x20, 0x2a, 0xd4, 0xff, 0xf5, 0x2a, 0xd4, 0xff, 0xff, 0x2a, 0xd4, 0xff, 0xff, 0x31, 0xd6, 0xff, 0xff, 0x4d, 0xdc, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x4e, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x0a, 0xcf, 0xff, 0xff, 0x46, 0xda, 0xff, 0xff, 0x57, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xe9, 0x51, 0xd7, 0xff, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0xd3, 0xff, 0x4b, 0x2a, 0xd4, 0xff, 0xf7, 0x2a, 0xd4, 0xff, 0xff, 0x2c, 0xd5, 0xff, 0xff, 0x45, 0xda, 0xff, 0xff, 0x58, 0xde, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x4e, 0xdc, 0xff, 0xff, 0x05, 0xcd, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x19, 0xd1, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x52, 0xde, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0xd4, 0xff, 0x77, 0x2a, 0xd4, 0xff, 0xfa, 0x29, 0xd4, 0xff, 0xff, 0x3d, 0xd8, 0xff, 0xff, 0x57, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x50, 0xdc, 0xff, 0xee, 0x05, 0xcd, 0xff, 0xf8, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x01, 0xcc, 0xff, 0xff, 0x2c, 0xd5, 0xff, 0xff, 0x54, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x54, 0xde, 0xff, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0xd5, 0xff, 0xa2, 0x29, 0xd4, 0xff, 0xfd, 0x34, 0xd6, 0xff, 0xff, 0x53, 0xdd, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xfd, 0x55, 0xdd, 0xff, 0xb3, 0x54, 0xdc, 0xff, 0x58, 0x03, 0xce, 0xff, 0x5d, 0x00, 0xcc, 0xff, 0xb0, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x08, 0xce, 0xff, 0xff, 0x3e, 0xd8, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x55, 0xdc, 0xff, 0x75, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0xd4, 0xff, 0xcb, 0x2d, 0xd5, 0xff, 0xff, 0x4e, 0xdc, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x55, 0xdd, 0xff, 0xff, 0x53, 0xdd, 0xff, 0xc1, 0x52, 0xdd, 0xff, 0x5a, 0x4e, 0xde, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xff, 0x1a, 0x00, 0xcb, 0xff, 0x58, 0x00, 0xcc, 0xff, 0xbf, 0x00, 0xcc, 0xff, 0xff, 0x00, 0xcc, 0xff, 0xff, 0x12, 0xd0, 0xff, 0xff, 0x4d, 0xdc, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xa4, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0xcc, 0xff, 0x0a, 0x27, 0xd4, 0xff, 0xdd, 0x47, 0xda, 0xff, 0xff, 0x56, 0xdd, 0xff, 0xff, 0x51, 0xdc, 0xff, 0xda, 0x4d, 0xdb, 0xff, 0x5d, 0x4e, 0xde, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xff, 0x1b, 0x00, 0xcb, 0xff, 0x5d, 0x00, 0xcc, 0xff, 0xd7, 0x00, 0xcc, 0xff, 0xff, 0x24, 0xd3, 0xff, 0xff, 0x53, 0xdd, 0xff, 0xd2, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xcf, 0xff, 0x30, 0x41, 0xd9, 0xff, 0xef, 0x4f, 0xdc, 0xff, 0xf0, 0x47, 0xdb, 0xff, 0x6b, 0x4b, 0xe1, 0xff, 0x11, 0x55, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0xce, 0xff, 0x15, 0x00, 0xcc, 0xff, 0x6e, 0x00, 0xcc, 0xff, 0xef, 0x37, 0xd7, 0xff, 0xff, 0x55, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xd6, 0xff, 0x4b, 0x40, 0xd8, 0xff, 0x70, 0x40, 0xdf, 0xff, 0x10, 0x80, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xcf, 0xff, 0x10, 0x0c, 0xce, 0xff, 0x91, 0x21, 0xd6, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const lv_image_dsc_t img_star = { - .header.w = 30, - .header.h = 29, - .header.stride = 120, - .header.cf = LV_COLOR_FORMAT_ARGB8888, - .data = img_star_map, - .data_size = sizeof(img_star_map), + .header.cf = LV_COLOR_FORMAT_ARGB8888, + .header.magic = LV_IMAGE_HEADER_MAGIC, + .header.w = 30, + .header.h = 29, + .data_size = 870 * 4, + .data = img_star_map, }; - -#endif /* LV_BUILD_EXAMPLES */ diff --git a/examples/widgets/canvas/lv_example_canvas_5.c b/examples/widgets/canvas/lv_example_canvas_5.c index a905e4e18..2ebfd1b0d 100644 --- a/examples/widgets/canvas/lv_example_canvas_5.c +++ b/examples/widgets/canvas/lv_example_canvas_5.c @@ -1,4 +1,4 @@ -#include "../../lv_examples.h" +#include "../../lv_examples.h" #if LV_USE_CANVAS && LV_BUILD_EXAMPLES #define CANVAS_WIDTH 50 diff --git a/examples/widgets/canvas/lv_example_canvas_6.c b/examples/widgets/canvas/lv_example_canvas_6.c index fb9db9f67..e4c0dbd82 100644 --- a/examples/widgets/canvas/lv_example_canvas_6.c +++ b/examples/widgets/canvas/lv_example_canvas_6.c @@ -1,4 +1,4 @@ -#include "../../lv_examples.h" +#include "../../lv_examples.h" #if LV_USE_CANVAS && LV_BUILD_EXAMPLES #define CANVAS_WIDTH 50 @@ -29,5 +29,7 @@ void lv_example_canvas_6(void) lv_area_t coords = {10, 10, 10 + img_star.header.w - 1, 10 + img_star.header.h - 1}; lv_draw_image(&layer, &dsc, &coords); + + lv_canvas_finish_layer(canvas, &layer); } #endif diff --git a/scripts/LVGLImage.py b/scripts/LVGLImage.py index b2a8aa5c0..6039e8cbe 100755 --- a/scripts/LVGLImage.py +++ b/scripts/LVGLImage.py @@ -819,6 +819,16 @@ const lv_image_dsc_t {varname} = {{ rawdata += row self.set_data(cf, w, h, rawdata) + + def sRGB_to_linear(self, x): + if x < 0.04045: + return x / 12.92 + return pow((x + 0.055) / 1.055, 2.4) + + 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): reader = png.Reader(str(filename)) @@ -831,8 +841,11 @@ const lv_image_dsc_t {varname} = {{ A = row[3::4] for r, g, b, a in zip(R, G, B, A): r, g, b, a = color_pre_multiply(r, g, b, a, self.background) + r = self.sRGB_to_linear(r / 255.0) + g = self.sRGB_to_linear(g / 255.0) + b = self.sRGB_to_linear(b / 255.0) luma = 0.2126 * r + 0.7152 * g + 0.0722 * b - rawdata += uint8_t(int(luma)) + rawdata += uint8_t(int(self.linear_to_sRGB(luma) * 255)) self.set_data(ColorFormat.L8, w, h, rawdata) diff --git a/src/draw/sw/blend/lv_draw_sw_blend.c b/src/draw/sw/blend/lv_draw_sw_blend.c index 9ceee3b1c..a145efd52 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend.c +++ b/src/draw/sw/blend/lv_draw_sw_blend.c @@ -1,4 +1,4 @@ -/** +/** * @file lv_draw_sw_blend.c * */ @@ -7,6 +7,8 @@ * INCLUDES *********************/ #include "../lv_draw_sw.h" +#include "lv_draw_sw_blend_to_l8.h" +#include "lv_draw_sw_blend_to_al88.h" #include "lv_draw_sw_blend_to_rgb565.h" #include "lv_draw_sw_blend_to_argb8888.h" #include "lv_draw_sw_blend_to_rgb888.h" @@ -83,6 +85,12 @@ void lv_draw_sw_blend(lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t * case LV_COLOR_FORMAT_XRGB8888: lv_draw_sw_blend_color_to_rgb888(&fill_dsc, 4); break; + case LV_COLOR_FORMAT_L8: + lv_draw_sw_blend_color_to_l8(&fill_dsc); + break; + case LV_COLOR_FORMAT_AL88: + lv_draw_sw_blend_color_to_al88(&fill_dsc); + break; default: break; } @@ -142,6 +150,12 @@ void lv_draw_sw_blend(lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t * case LV_COLOR_FORMAT_XRGB8888: lv_draw_sw_blend_image_to_rgb888(&image_dsc, 4); break; + case LV_COLOR_FORMAT_L8: + lv_draw_sw_blend_image_to_l8(&image_dsc); + break; + case LV_COLOR_FORMAT_AL88: + lv_draw_sw_blend_image_to_al88(&image_dsc); + break; default: break; } diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c new file mode 100644 index 000000000..0bdae0ee0 --- /dev/null +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c @@ -0,0 +1,871 @@ +/** + * @file lv_draw_sw_blend_al88.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_draw_sw_blend_to_al88.h" +#if LV_USE_DRAW_SW + +#include "lv_draw_sw_blend.h" +#include "../../../misc/lv_math.h" +#include "../../../display/lv_display.h" +#include "../../../core/lv_refr.h" +#include "../../../misc/lv_color.h" +#include "../../../stdlib/lv_string.h" + +#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON + #include "neon/lv_blend_neon.h" +#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM + #include "helium/lv_blend_helium.h" +#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM + #include LV_DRAW_SW_ASM_CUSTOM_INCLUDE +#endif + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_color16a_t fg_saved; + lv_color16a_t bg_saved; + lv_color16a_t res_saved; + lv_opa_t res_alpha_saved; + lv_opa_t ratio_saved; +} lv_color_mix_alpha_cache_t; + +/********************** + * STATIC PROTOTYPES + **********************/ + +static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, + const uint8_t src_px_size); + +static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static void lv_color_mix_with_alpha_cache_init(lv_color_mix_alpha_cache_t * cache); + +static inline void /* LV_ATTRIBUTE_FAST_MEM */ blend_non_normal_pixel(lv_color16a_t * dest, lv_color16a_t src, + lv_blend_mode_t mode, lv_color_mix_alpha_cache_t * cache); + +static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * buf, uint32_t stride); + +static inline bool lv_color16a_eq(lv_color16a_t c1, lv_color16a_t c2); + +static inline lv_color16a_t LV_ATTRIBUTE_FAST_MEM lv_color_mix16a(lv_color16a_t fg, lv_color16a_t bg); + +static inline void LV_ATTRIBUTE_FAST_MEM lv_color_16a_16a_mix(lv_color16a_t src, lv_color16a_t * dest, + lv_color_mix_alpha_cache_t * cache); + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifndef LV_DRAW_SW_COLOR_BLEND_TO_AL88 + #define LV_DRAW_SW_COLOR_BLEND_TO_AL88(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_COLOR_BLEND_TO_AL88_WITH_OPA + #define LV_DRAW_SW_COLOR_BLEND_TO_AL88_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_COLOR_BLEND_TO_AL88_WITH_MASK + #define LV_DRAW_SW_COLOR_BLEND_TO_AL88_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_COLOR_BLEND_TO_AL88_MIX_MASK_OPA + #define LV_DRAW_SW_COLOR_BLEND_TO_AL88_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88 + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88_WITH_OPA + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88_WITH_MASK + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88 + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88_WITH_OPA + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88_WITH_MASK + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88 + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88_WITH_OPA + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88_WITH_MASK + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88 + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_WITH_OPA + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_WITH_MASK + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_al88(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + const lv_opa_t * mask = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + int32_t dest_stride = dsc->dest_stride; + + lv_color_mix_alpha_cache_t cache; + lv_color_mix_with_alpha_cache_init(&cache); + + int32_t x; + int32_t y; + + LV_UNUSED(w); + LV_UNUSED(h); + LV_UNUSED(x); + LV_UNUSED(y); + LV_UNUSED(opa); + LV_UNUSED(mask); + LV_UNUSED(mask_stride); + LV_UNUSED(dest_stride); + + /*Simple fill*/ + if(mask == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_AL88(dsc)) { + lv_color16a_t color16a; + color16a.lumi = lv_color_luminance(dsc->color); + color16a.alpha = 255; + lv_color16a_t * dest_buf = dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w - 16; x += 16) { + dest_buf[x + 0] = color16a; + dest_buf[x + 1] = color16a; + dest_buf[x + 2] = color16a; + dest_buf[x + 3] = color16a; + + dest_buf[x + 4] = color16a; + dest_buf[x + 5] = color16a; + dest_buf[x + 6] = color16a; + dest_buf[x + 7] = color16a; + + dest_buf[x + 8] = color16a; + dest_buf[x + 9] = color16a; + dest_buf[x + 10] = color16a; + dest_buf[x + 11] = color16a; + + dest_buf[x + 12] = color16a; + dest_buf[x + 13] = color16a; + dest_buf[x + 14] = color16a; + dest_buf[x + 15] = color16a; + } + for(; x < w; x ++) { + dest_buf[x] = color16a; + } + + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + } + } + } + /*Opacity only*/ + else if(mask == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_AL88_WITH_OPA(dsc)) { + lv_color16a_t color16a; + color16a.lumi = lv_color_luminance(dsc->color); + color16a.alpha = opa; + lv_color16a_t * dest_buf = dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color_16a_16a_mix(color16a, &dest_buf[x], &cache); + } + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + } + } + + } + /*Masked with full opacity*/ + else if(mask && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_AL88_WITH_MASK(dsc)) { + lv_color16a_t color16a; + color16a.lumi = lv_color_luminance(dsc->color); + lv_color16a_t * dest_buf = (lv_color16a_t *)dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color16a.alpha = mask[x]; + lv_color_16a_16a_mix(color16a, &dest_buf[x], &cache); + } + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + mask += mask_stride; + } + } + + } + /*Masked with opacity*/ + else { + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_AL88_MIX_MASK_OPA(dsc)) { + lv_color16a_t color16a; + color16a.lumi = lv_color_luminance(dsc->color); + lv_color16a_t * dest_buf = (lv_color16a_t *)dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color16a.alpha = LV_OPA_MIX2(mask[x], opa); + lv_color_16a_16a_mix(color16a, &dest_buf[x], &cache); + } + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + mask += mask_stride; + } + } + } +} + +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_al88(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + switch(dsc->src_color_format) { + case LV_COLOR_FORMAT_RGB565: + rgb565_image_blend(dsc); + break; + case LV_COLOR_FORMAT_RGB888: + rgb888_image_blend(dsc, 3); + break; + case LV_COLOR_FORMAT_XRGB8888: + rgb888_image_blend(dsc, 4); + break; + case LV_COLOR_FORMAT_ARGB8888: + argb8888_image_blend(dsc); + break; + case LV_COLOR_FORMAT_L8: + l8_image_blend(dsc); + break; + case LV_COLOR_FORMAT_AL88: + al88_image_blend(dsc); + break; + default: + LV_LOG_WARN("Not supported source color format"); + break; + } +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + lv_color16a_t * dest_buf_al88 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const uint8_t * src_buf_l8 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + lv_color_mix_alpha_cache_t cache; + lv_color_mix_with_alpha_cache_init(&cache); + + int32_t x, y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + dest_buf_al88[x].lumi = src_buf_l8[x]; + dest_buf_al88[x].alpha = 255; + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = src_buf_l8[x]; + src_color.alpha = opa; + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = src_buf_l8[x]; + src_color.alpha = mask_buf[x]; + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = src_buf_l8[x]; + src_color.alpha = LV_OPA_MIX2(mask_buf[x], opa); + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = src_buf_l8[x]; + if(mask_buf == NULL) src_color.alpha = opa; + else src_color.alpha = LV_OPA_MIX2(mask_buf[x], opa); + blend_non_normal_pixel(&dest_buf_al88[x], src_color, dsc->blend_mode, &cache); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + lv_color16a_t * dest_buf_al88 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const lv_color16a_t * src_buf_al88 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + lv_color_mix_alpha_cache_t cache; + lv_color_mix_with_alpha_cache_init(&cache); + + int32_t x, y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color_16a_16a_mix(src_buf_al88[x], &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color = src_buf_al88[x]; + src_color.alpha = LV_OPA_MIX2(src_color.alpha, opa); + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color = src_buf_al88[x]; + src_color.alpha = LV_OPA_MIX2(src_color.alpha, mask_buf[x]); + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color = src_buf_al88[x]; + src_color.alpha = LV_OPA_MIX3(src_color.alpha, mask_buf[x], opa); + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color = src_buf_al88[x]; + if(mask_buf == NULL) src_color.alpha = LV_OPA_MIX2(src_color.alpha, opa); + else src_color.alpha = LV_OPA_MIX3(src_color.alpha, mask_buf[x], opa); + blend_non_normal_pixel(&dest_buf_al88[x], src_color, dsc->blend_mode, &cache); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + lv_color16a_t * dest_buf_al88 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const lv_color16_t * src_buf_c16 = (const lv_color16_t *)dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + lv_color_mix_alpha_cache_t cache; + lv_color_mix_with_alpha_cache_init(&cache); + + int32_t x, y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + dest_buf_al88[x].lumi = lv_color16_luminance(src_buf_c16[x]); + dest_buf_al88[x].alpha = 255; + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88_WITH_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = lv_color16_luminance(src_buf_c16[x]); + src_color.alpha = opa; + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88_WITH_MASK(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = lv_color16_luminance(src_buf_c16[x]); + src_color.alpha = mask_buf[x]; + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + mask_buf += mask_stride; + } + } + } + else { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = lv_color16_luminance(src_buf_c16[x]); + src_color.alpha = LV_OPA_MIX2(mask_buf[x], opa); + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = lv_color16_luminance(src_buf_c16[x]); + if(mask_buf == NULL) src_color.alpha = opa; + else src_color.alpha = LV_OPA_MIX2(mask_buf[x], opa); + blend_non_normal_pixel(&dest_buf_al88[x], src_color, dsc->blend_mode, &cache); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, + const uint8_t src_px_size) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + lv_color16a_t * dest_buf_al88 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const uint8_t * src_buf_u8 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + lv_color_mix_alpha_cache_t cache; + lv_color_mix_with_alpha_cache_init(&cache); + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + /*Special case*/ + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88(dsc, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + dest_buf_al88[dest_x].lumi = lv_color24_luminance(&src_buf_u8[src_x]); + dest_buf_al88[dest_x].alpha = 255; + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_u8 += src_stride; + } + } + } + if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88_WITH_OPA(dsc, dest_px_size, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + lv_color16a_t src_color; + src_color.lumi = lv_color24_luminance(&src_buf_u8[src_x]); + src_color.alpha = opa; + lv_color_16a_16a_mix(src_color, &dest_buf_al88[dest_x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_u8 += src_stride; + } + } + } + if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88_WITH_MASK(dsc, dest_px_size, src_px_size)) { + uint32_t mask_x; + for(y = 0; y < h; y++) { + for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x++, src_x += src_px_size) { + lv_color16a_t src_color; + src_color.lumi = lv_color24_luminance(&src_buf_u8[src_x]); + src_color.alpha = mask_buf[mask_x]; + lv_color_16a_16a_mix(src_color, &dest_buf_al88[dest_x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_u8 += src_stride; + mask_buf += mask_stride; + } + } + } + if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA(dsc, dest_px_size, src_px_size)) { + uint32_t mask_x; + for(y = 0; y < h; y++) { + for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x++, src_x += src_px_size) { + lv_color16a_t src_color; + src_color.lumi = lv_color24_luminance(&src_buf_u8[src_x]); + src_color.alpha = LV_OPA_MIX2(mask_buf[mask_x], opa); + lv_color_16a_16a_mix(src_color, &dest_buf_al88[dest_x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_u8 += src_stride; + mask_buf += mask_stride; + } + } + } + } + else { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + lv_color16a_t src_color; + src_color.lumi = lv_color24_luminance(&src_buf_u8[src_x]); + if(mask_buf == NULL) src_color.alpha = opa; + else src_color.alpha = LV_OPA_MIX2(mask_buf[dest_x], opa); + + blend_non_normal_pixel(&dest_buf_al88[dest_x], src_color, dsc->blend_mode, &cache); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_u8 += src_stride; + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + lv_color16a_t * dest_buf_al88 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const lv_color32_t * src_buf_c32 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + lv_color_mix_alpha_cache_t cache; + lv_color_mix_with_alpha_cache_init(&cache); + + int32_t x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = lv_color32_luminance(src_buf_c32[x]); + src_color.alpha = src_buf_c32[x].alpha; + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = lv_color32_luminance(src_buf_c32[x]); + src_color.alpha = LV_OPA_MIX2(src_buf_c32[x].alpha, opa); + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = lv_color32_luminance(src_buf_c32[x]); + src_color.alpha = LV_OPA_MIX2(src_buf_c32[x].alpha, mask_buf[x]); + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_AL88_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = lv_color32_luminance(src_buf_c32[x]); + src_color.alpha = LV_OPA_MIX3(src_buf_c32[x].alpha, mask_buf[x], opa); + lv_color_16a_16a_mix(src_color, &dest_buf_al88[x], &cache); + } + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color16a_t src_color; + src_color.lumi = lv_color32_luminance(src_buf_c32[x]); + src_color.alpha = src_buf_c32[x].alpha; + if(mask_buf == NULL) src_color.alpha = LV_OPA_MIX2(src_color.alpha, opa); + else src_color.alpha = LV_OPA_MIX3(src_color.alpha, mask_buf[x], opa); + blend_non_normal_pixel(&dest_buf_al88[x], src_color, dsc->blend_mode, &cache); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_al88 = drawbuf_next_row(dest_buf_al88, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + } + } +} + +/** + * Check if two AL88 colors are equal + * @param c1 the first color + * @param c2 the second color + * @return true: equal + */ +static inline bool lv_color16a_eq(lv_color16a_t c1, lv_color16a_t c2) +{ + return *((uint16_t *)&c1) == *((uint16_t *)&c2); +} + +static inline lv_color16a_t LV_ATTRIBUTE_FAST_MEM lv_color_mix16a(lv_color16a_t fg, lv_color16a_t bg) +{ +#if 0 + if(fg.alpha >= LV_OPA_MAX) { + fg.alpha = bg.alpha; + return fg; + } + if(fg.alpha <= LV_OPA_MIN) { + return bg; + } +#endif + bg.lumi = (uint32_t)((uint32_t)fg.lumi * fg.alpha + (uint32_t)bg.lumi * (255 - fg.alpha)) >> 8; + return bg; +} + +static inline void LV_ATTRIBUTE_FAST_MEM lv_color_16a_16a_mix(lv_color16a_t fg, lv_color16a_t * bg, + lv_color_mix_alpha_cache_t * cache) +{ + /*Pick the foreground if it's fully opaque or the Background is fully transparent*/ + if(fg.alpha >= LV_OPA_MAX || bg->alpha <= LV_OPA_MIN) { + *bg = fg; + } + /*Transparent foreground: use the Background*/ + else if(fg.alpha <= LV_OPA_MIN) { + /* no need to copy */ + } + /*Opaque background: use simple mix*/ + else if(bg->alpha == 255) { + *bg = lv_color_mix16a(fg, *bg); + } + /*Both colors have alpha. Expensive calculation needs to be applied*/ + else { + /*Save the parameters and the result. If they will be asked again don't compute again*/ + + /*Update the ratio and the result alpha value if the input alpha values change*/ + if(bg->alpha != cache->bg_saved.alpha || fg.alpha != cache->fg_saved.alpha) { + /*Info: + * https://en.wikipedia.org/wiki/Alpha_compositing#Analytical_derivation_of_the_over_operator*/ + cache->res_alpha_saved = 255 - LV_OPA_MIX2(255 - fg.alpha, 255 - bg->alpha); + LV_ASSERT(cache->res_alpha_saved != 0); + cache->ratio_saved = (uint32_t)((uint32_t)fg.alpha * 255) / cache->res_alpha_saved; + } + + if(!lv_color16a_eq(*bg, cache->bg_saved) || !lv_color16a_eq(fg, cache->fg_saved)) { + cache->fg_saved = fg; + cache->bg_saved = *bg; + fg.alpha = cache->ratio_saved; + cache->res_saved = lv_color_mix16a(fg, *bg); + cache->res_saved.alpha = cache->res_alpha_saved; + } + + *bg = cache->res_saved; + } +} + +void lv_color_mix_with_alpha_cache_init(lv_color_mix_alpha_cache_t * cache) +{ + lv_memzero(&cache->fg_saved, sizeof(lv_color16a_t)); + lv_memzero(&cache->bg_saved, sizeof(lv_color16a_t)); + lv_memzero(&cache->res_saved, sizeof(lv_color16a_t)); + cache->res_alpha_saved = 255; + cache->ratio_saved = 255; +} + +static inline void LV_ATTRIBUTE_FAST_MEM blend_non_normal_pixel(lv_color16a_t * dest, lv_color16a_t src, + lv_blend_mode_t mode, lv_color_mix_alpha_cache_t * cache) +{ + lv_color16a_t res; + switch(mode) { + case LV_BLEND_MODE_ADDITIVE: + res.lumi = LV_MIN(dest->lumi + src.lumi, 255); + break; + case LV_BLEND_MODE_SUBTRACTIVE: + res.lumi = LV_MAX(dest->lumi - src.lumi, 0); + break; + case LV_BLEND_MODE_MULTIPLY: + res.lumi = (dest->lumi * src.lumi) >> 8; + break; + default: + LV_LOG_WARN("Not supported blend mode: %d", mode); + return; + } + res.alpha = src.alpha; + lv_color_16a_16a_mix(res, dest, cache); +} + +static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, uint32_t stride) +{ + return (void *)((uint8_t *)buf + stride); +} + +#endif diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_al88.h b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.h new file mode 100644 index 000000000..85720ab8b --- /dev/null +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.h @@ -0,0 +1,45 @@ +/** + * @file lv_draw_sw_blend_al88.h + * + */ + +#ifndef LV_DRAW_SW_BLEND_AL88_H +#define LV_DRAW_SW_BLEND_AL88_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_draw_sw.h" +#if LV_USE_DRAW_SW + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_al88(_lv_draw_sw_blend_fill_dsc_t * dsc); + +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_al88(_lv_draw_sw_blend_image_dsc_t * dsc); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_DRAW_SW*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_SW_BLEND_AL88_H*/ diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c index c78c10cfd..6a0306657 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c @@ -1,4 +1,4 @@ -/** +/** * @file lv_draw_sw_blend.c * */ @@ -44,6 +44,10 @@ typedef struct { * STATIC PROTOTYPES **********************/ +static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, @@ -51,6 +55,8 @@ static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_ima static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); +static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_8_32_mix(const uint8_t src, lv_color32_t * dest, uint8_t mix); + static inline lv_color32_t /* LV_ATTRIBUTE_FAST_MEM */ lv_color_32_32_mix(lv_color32_t fg, lv_color32_t bg, lv_color_mix_alpha_cache_t * cache); @@ -84,6 +90,38 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA(...) LV_RESULT_INVALID #endif +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888 + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888_WITH_OPA + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888_WITH_MASK + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888 + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888_WITH_OPA + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888_WITH_MASK + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888(...) LV_RESULT_INVALID #endif @@ -260,6 +298,12 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_argb8888(_lv_draw_sw_blend_ case LV_COLOR_FORMAT_ARGB8888: argb8888_image_blend(dsc); break; + case LV_COLOR_FORMAT_L8: + l8_image_blend(dsc); + break; + case LV_COLOR_FORMAT_AL88: + al88_image_blend(dsc); + break; default: LV_LOG_WARN("Not supported source color format"); break; @@ -270,6 +314,185 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_argb8888(_lv_draw_sw_blend_ * STATIC FUNCTIONS **********************/ +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + lv_color32_t * dest_buf_c32 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const lv_color16a_t * src_buf_al88 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + /* + dest_buf_c32[dest_x].alpha = src_buf_al88[src_x].alpha; + dest_buf_c32[dest_x].red = src_buf_al88[src_x].lumi; + dest_buf_c32[dest_x].green = src_buf_al88[src_x].lumi; + dest_buf_c32[dest_x].blue = src_buf_al88[src_x].lumi; + */ + lv_color_8_32_mix(src_buf_al88[src_x].lumi, &dest_buf_c32[dest_x], src_buf_al88[src_x].alpha); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_32_mix(src_buf_al88[src_x].lumi, &dest_buf_c32[dest_x], LV_OPA_MIX2(src_buf_al88[src_x].alpha, opa)); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_32_mix(src_buf_al88[src_x].lumi, &dest_buf_c32[dest_x], LV_OPA_MIX2(src_buf_al88[src_x].alpha, + mask_buf[src_x])); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_32_mix(src_buf_al88[src_x].lumi, &dest_buf_c32[dest_x], LV_OPA_MIX3(src_buf_al88[src_x].alpha, + mask_buf[src_x], opa)); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + lv_color32_t src_argb; + lv_color_mix_alpha_cache_t cache; + lv_color_mix_with_alpha_cache_init(&cache); + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + src_argb.red = src_buf_al88[src_x].lumi; + src_argb.green = src_buf_al88[src_x].lumi; + src_argb.blue = src_buf_al88[src_x].lumi; + if(mask_buf == NULL) src_argb.alpha = LV_OPA_MIX2(src_buf_al88[src_x].alpha, opa); + else src_argb.alpha = LV_OPA_MIX3(src_buf_al88[src_x].alpha, mask_buf[dest_x], opa); + blend_non_normal_pixel(&dest_buf_c32[dest_x], src_argb, dsc->blend_mode, &cache); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + lv_color32_t * dest_buf_c32 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const uint8_t * src_buf_l8 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + dest_buf_c32[dest_x].alpha = src_buf_l8[src_x]; + dest_buf_c32[dest_x].red = src_buf_l8[src_x]; + dest_buf_c32[dest_x].green = src_buf_l8[src_x]; + dest_buf_c32[dest_x].blue = src_buf_l8[src_x]; + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_32_mix(src_buf_l8[src_x], &dest_buf_c32[dest_x], opa); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_32_mix(src_buf_l8[src_x], &dest_buf_c32[dest_x], mask_buf[src_x]); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_32_mix(src_buf_l8[src_x], &dest_buf_c32[dest_x], LV_OPA_MIX2(mask_buf[src_x], opa)); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + lv_color32_t src_argb; + lv_color_mix_alpha_cache_t cache; + lv_color_mix_with_alpha_cache_init(&cache); + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + src_argb.red = src_buf_l8[src_x]; + src_argb.green = src_buf_l8[src_x]; + src_argb.blue = src_buf_l8[src_x]; + if(mask_buf == NULL) src_argb.alpha = opa; + else src_argb.alpha = LV_OPA_MIX2(mask_buf[dest_x], opa); + blend_non_normal_pixel(&dest_buf_c32[dest_x], src_argb, dsc->blend_mode, &cache); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } +} + static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; @@ -571,6 +794,25 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_d } } +static inline void LV_ATTRIBUTE_FAST_MEM lv_color_8_32_mix(const uint8_t src, lv_color32_t * dest, uint8_t mix) +{ + + if(mix == 0) return; + + dest->alpha = 255; + if(mix >= LV_OPA_MAX) { + dest->red = src; + dest->green = src; + dest->blue = src; + } + else { + lv_opa_t mix_inv = 255 - mix; + dest->red = (uint32_t)((uint32_t)src * mix + dest->red * mix_inv) >> 8; + dest->green = (uint32_t)((uint32_t)src * mix + dest->green * mix_inv) >> 8; + dest->blue = (uint32_t)((uint32_t)src * mix + dest->blue * mix_inv) >> 8; + } +} + static inline lv_color32_t LV_ATTRIBUTE_FAST_MEM lv_color_32_32_mix(lv_color32_t fg, lv_color32_t bg, lv_color_mix_alpha_cache_t * cache) { @@ -595,7 +837,7 @@ static inline lv_color32_t LV_ATTRIBUTE_FAST_MEM lv_color_32_32_mix(lv_color32_t /*Info: * https://en.wikipedia.org/wiki/Alpha_compositing#Analytical_derivation_of_the_over_operator*/ cache->res_alpha_saved = 255 - LV_OPA_MIX2(255 - fg.alpha, 255 - bg.alpha); - LV_ASSERT(cache->ratio_saved != 0); + LV_ASSERT(cache->res_alpha_saved != 0); cache->ratio_saved = (uint32_t)((uint32_t)fg.alpha * 255) / cache->res_alpha_saved; } diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c new file mode 100644 index 000000000..2886fbf54 --- /dev/null +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c @@ -0,0 +1,734 @@ +/** + * @file lv_draw_sw_blend_l8.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_draw_sw_blend_to_l8.h" +#if LV_USE_DRAW_SW + +#include "lv_draw_sw_blend.h" +#include "../../../misc/lv_math.h" +#include "../../../display/lv_display.h" +#include "../../../core/lv_refr.h" +#include "../../../misc/lv_color.h" +#include "../../../stdlib/lv_string.h" + +#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON + #include "neon/lv_blend_neon.h" +#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM + #include "helium/lv_blend_helium.h" +#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM + #include LV_DRAW_SW_ASM_CUSTOM_INCLUDE +#endif + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ + +static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, + const uint8_t src_px_size); + +static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_8_8_mix(const uint8_t src, uint8_t * dest, uint8_t mix); + +static inline void /* LV_ATTRIBUTE_FAST_MEM */ blend_non_normal_pixel(uint8_t * dest, lv_color32_t src, + lv_blend_mode_t mode); + +static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * buf, uint32_t stride); + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifndef LV_DRAW_SW_COLOR_BLEND_TO_L8 + #define LV_DRAW_SW_COLOR_BLEND_TO_L8(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_COLOR_BLEND_TO_L8_WITH_OPA + #define LV_DRAW_SW_COLOR_BLEND_TO_L8_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_COLOR_BLEND_TO_L8_WITH_MASK + #define LV_DRAW_SW_COLOR_BLEND_TO_L8_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_COLOR_BLEND_TO_L8_MIX_MASK_OPA + #define LV_DRAW_SW_COLOR_BLEND_TO_L8_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8 + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_WITH_OPA + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_WITH_MASK + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_MIX_MASK_OPA + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8 + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8_WITH_OPA + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8_WITH_MASK + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8_MIX_MASK_OPA + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8 + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_WITH_OPA + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_WITH_MASK + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_MIX_MASK_OPA + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8 + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8_WITH_OPA + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8_WITH_MASK + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8_MIX_MASK_OPA + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_l8(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + const lv_opa_t * mask = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + int32_t dest_stride = dsc->dest_stride; + + int32_t x; + int32_t y; + + LV_UNUSED(w); + LV_UNUSED(h); + LV_UNUSED(x); + LV_UNUSED(y); + LV_UNUSED(opa); + LV_UNUSED(mask); + LV_UNUSED(mask_stride); + LV_UNUSED(dest_stride); + + /*Simple fill*/ + if(mask == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_L8(dsc)) { + uint8_t color8 = lv_color_luminance(dsc->color); + uint8_t * dest_buf = dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w - 16; x += 16) { + dest_buf[x + 0] = color8; + dest_buf[x + 1] = color8; + dest_buf[x + 2] = color8; + dest_buf[x + 3] = color8; + + dest_buf[x + 4] = color8; + dest_buf[x + 5] = color8; + dest_buf[x + 6] = color8; + dest_buf[x + 7] = color8; + + dest_buf[x + 8] = color8; + dest_buf[x + 9] = color8; + dest_buf[x + 10] = color8; + dest_buf[x + 11] = color8; + + dest_buf[x + 12] = color8; + dest_buf[x + 13] = color8; + dest_buf[x + 14] = color8; + dest_buf[x + 15] = color8; + } + for(; x < w; x ++) { + dest_buf[x] = color8; + } + + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + } + } + } + /*Opacity only*/ + else if(mask == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_L8_WITH_OPA(dsc)) { + uint8_t color8 = lv_color_luminance(dsc->color); + uint8_t * dest_buf = dsc->dest_buf; + + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color_8_8_mix(color8, &dest_buf[x], opa); + } + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + } + } + + } + /*Masked with full opacity*/ + else if(mask && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_L8_WITH_MASK(dsc)) { + uint8_t color8 = lv_color_luminance(dsc->color); + uint8_t * dest_buf = dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color_8_8_mix(color8, &dest_buf[x], mask[x]); + } + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + mask += mask_stride; + } + } + + } + /*Masked with opacity*/ + else { + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_L8_MIX_MASK_OPA(dsc)) { + uint8_t color8 = lv_color_luminance(dsc->color); + uint8_t * dest_buf = dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color_8_8_mix(color8, &dest_buf[x], LV_OPA_MIX2(mask[x], opa)); + } + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + mask += mask_stride; + } + } + } +} + +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_l8(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + switch(dsc->src_color_format) { + case LV_COLOR_FORMAT_RGB565: + rgb565_image_blend(dsc); + break; + case LV_COLOR_FORMAT_RGB888: + rgb888_image_blend(dsc, 3); + break; + case LV_COLOR_FORMAT_XRGB8888: + rgb888_image_blend(dsc, 4); + break; + case LV_COLOR_FORMAT_ARGB8888: + argb8888_image_blend(dsc); + break; + case LV_COLOR_FORMAT_L8: + l8_image_blend(dsc); + break; + case LV_COLOR_FORMAT_AL88: + al88_image_blend(dsc); + break; + default: + LV_LOG_WARN("Not supported source color format"); + break; + } +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + uint8_t * dest_buf_l8 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const uint8_t * src_buf_l8 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8(dsc)) { + for(y = 0; y < h; y++) { + lv_memcpy(dest_buf_l8, src_buf_l8, w); + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(src_buf_l8[src_x], &dest_buf_l8[dest_x], opa); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(src_buf_l8[src_x], &dest_buf_l8[dest_x], mask_buf[src_x]); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(src_buf_l8[src_x], &dest_buf_l8[dest_x], LV_OPA_MIX2(mask_buf[src_x], opa)); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + lv_color32_t src_argb; + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + src_argb.red = src_buf_l8[src_x]; + src_argb.green = src_buf_l8[src_x]; + src_argb.blue = src_buf_l8[src_x]; + if(mask_buf == NULL) src_argb.alpha = opa; + else src_argb.alpha = LV_OPA_MIX2(mask_buf[dest_x], opa); + blend_non_normal_pixel(&dest_buf_l8[dest_x], src_argb, dsc->blend_mode); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + uint8_t * dest_buf_l8 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const lv_color16a_t * src_buf_al88 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(src_buf_al88[src_x].lumi, &dest_buf_l8[dest_x], src_buf_al88[src_x].alpha); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(src_buf_al88[src_x].lumi, &dest_buf_l8[dest_x], LV_OPA_MIX2(src_buf_al88[src_x].alpha, opa)); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(src_buf_al88[src_x].lumi, &dest_buf_l8[dest_x], LV_OPA_MIX2(src_buf_al88[src_x].alpha, + mask_buf[src_x])); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(src_buf_al88[src_x].lumi, &dest_buf_l8[dest_x], LV_OPA_MIX3(src_buf_al88[src_x].alpha, mask_buf[src_x], + opa)); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + lv_color32_t src_argb; + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x++, src_x++) { + src_argb.red = src_buf_al88[src_x].lumi; + src_argb.green = src_buf_al88[src_x].lumi; + src_argb.blue = src_buf_al88[src_x].lumi; + if(mask_buf == NULL) src_argb.alpha = opa; + else src_argb.alpha = LV_OPA_MIX2(mask_buf[dest_x], opa); + blend_non_normal_pixel(&dest_buf_l8[dest_x], src_argb, dsc->blend_mode); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + uint8_t * dest_buf_u8 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const lv_color16_t * src_buf_c16 = (const lv_color16_t *)dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t src_x; + int32_t dest_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8(dsc)) { + for(y = 0; y < h; y++) { + for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) { + dest_buf_u8[dest_x] = lv_color16_luminance(src_buf_c16[src_x]); + } + dest_buf_u8 += dest_stride; + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_WITH_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(lv_color16_luminance(src_buf_c16[src_x]), &dest_buf_u8[dest_x], opa); + } + dest_buf_u8 += dest_stride; + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_WITH_MASK(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(lv_color16_luminance(src_buf_c16[src_x]), &dest_buf_u8[dest_x], mask_buf[src_x]); + } + dest_buf_u8 += dest_stride; + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + mask_buf += mask_stride; + } + } + } + else { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(src_x = 0, dest_x = 0; src_x < w; dest_x++, src_x++) { + lv_color_8_8_mix(lv_color16_luminance(src_buf_c16[src_x]), &dest_buf_u8[dest_x], LV_OPA_MIX2(opa, mask_buf[src_x])); + } + dest_buf_u8 += dest_stride; + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + lv_color32_t src_argb; + for(y = 0; y < h; y++) { + for(src_x = 0, dest_x = 0; src_x < w; src_x++, dest_x++) { + src_argb.red = (src_buf_c16[src_x].red * 2106) >> 8; + src_argb.green = (src_buf_c16[src_x].green * 1037) >> 8; + src_argb.blue = (src_buf_c16[src_x].blue * 2106) >> 8; + if(mask_buf == NULL) src_argb.alpha = opa; + else src_argb.alpha = LV_OPA_MIX2(mask_buf[src_x], opa); + blend_non_normal_pixel(&dest_buf_u8[dest_x], src_argb, dsc->blend_mode); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_u8 += dest_stride; + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, + const uint8_t src_px_size) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + uint8_t * dest_buf_l8 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const uint8_t * src_buf_u8 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + /*Special case*/ + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8(dsc, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + dest_buf_l8[dest_x] = lv_color24_luminance(&src_buf_u8[src_x]); + } + dest_buf_l8 += dest_stride; + src_buf_u8 += src_stride; + } + } + } + if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8_WITH_OPA(dsc, dest_px_size, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + lv_color_8_8_mix(lv_color24_luminance(&src_buf_u8[src_x]), &dest_buf_l8[dest_x], opa); + } + dest_buf_l8 += dest_stride; + src_buf_u8 += src_stride; + } + } + } + if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8_WITH_MASK(dsc, dest_px_size, src_px_size)) { + uint32_t mask_x; + for(y = 0; y < h; y++) { + for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x++, src_x += src_px_size) { + lv_color_8_8_mix(lv_color24_luminance(&src_buf_u8[src_x]), &dest_buf_l8[dest_x], mask_buf[mask_x]); + } + dest_buf_l8 += dest_stride; + src_buf_u8 += src_stride; + mask_buf += mask_stride; + } + } + } + if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(dsc, dest_px_size, src_px_size)) { + uint32_t mask_x; + for(y = 0; y < h; y++) { + for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x++, src_x += src_px_size) { + lv_color_8_8_mix(lv_color24_luminance(&src_buf_u8[src_x]), &dest_buf_l8[dest_x], LV_OPA_MIX2(opa, mask_buf[mask_x])); + } + dest_buf_l8 += dest_stride; + src_buf_u8 += src_stride; + mask_buf += mask_stride; + } + } + } + } + else { + lv_color32_t src_argb; + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + src_argb.red = src_buf_u8[src_x + 2]; + src_argb.green = src_buf_u8[src_x + 1]; + src_argb.blue = src_buf_u8[src_x + 0]; + if(mask_buf == NULL) src_argb.alpha = opa; + else src_argb.alpha = LV_OPA_MIX2(mask_buf[dest_x], opa); + + blend_non_normal_pixel(&dest_buf_l8[dest_x], src_argb, dsc->blend_mode); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_l8 += dest_stride; + src_buf_u8 += src_stride; + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + uint8_t * dest_buf_l8 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const lv_color32_t * src_buf_c32 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color_8_8_mix(lv_color32_luminance(src_buf_c32[x]), &dest_buf_l8[x], src_buf_c32[x].alpha); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color_8_8_mix(lv_color32_luminance(src_buf_c32[x]), &dest_buf_l8[x], LV_OPA_MIX2(src_buf_c32[x].alpha, opa)); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color_8_8_mix(lv_color32_luminance(src_buf_c32[x]), &dest_buf_l8[x], LV_OPA_MIX2(src_buf_c32[x].alpha, mask_buf[x])); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_L8_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color_8_8_mix(lv_color32_luminance(src_buf_c32[x]), &dest_buf_l8[x], LV_OPA_MIX3(src_buf_c32[x].alpha, opa, + mask_buf[x])); + } + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + lv_color32_t color_argb = src_buf_c32[x]; + if(mask_buf == NULL) color_argb.alpha = LV_OPA_MIX2(color_argb.alpha, opa); + else color_argb.alpha = LV_OPA_MIX3(color_argb.alpha, mask_buf[x], opa); + blend_non_normal_pixel(&dest_buf_l8[x], color_argb, dsc->blend_mode); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_l8 = drawbuf_next_row(dest_buf_l8, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + } + } +} + +static inline void LV_ATTRIBUTE_FAST_MEM lv_color_8_8_mix(const uint8_t src, uint8_t * dest, uint8_t mix) +{ + + if(mix == 0) return; + + if(mix >= LV_OPA_MAX) { + *dest = src; + } + else { + lv_opa_t mix_inv = 255 - mix; + *dest = (uint32_t)((uint32_t)src * mix + dest[0] * mix_inv) >> 8; + } +} + +static inline void LV_ATTRIBUTE_FAST_MEM blend_non_normal_pixel(uint8_t * dest, lv_color32_t src, lv_blend_mode_t mode) +{ + uint8_t res; + int32_t src_lumi = lv_color32_luminance(src); + switch(mode) { + case LV_BLEND_MODE_ADDITIVE: + res = LV_MIN(*dest + src_lumi, 255); + break; + case LV_BLEND_MODE_SUBTRACTIVE: + res = LV_MAX(*dest - src_lumi, 0); + break; + case LV_BLEND_MODE_MULTIPLY: + res = (*dest * src_lumi) >> 8; + break; + default: + LV_LOG_WARN("Not supported blend mode: %d", mode); + return; + } + lv_color_8_8_mix(res, dest, src.alpha); +} + +static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, uint32_t stride) +{ + return (void *)((uint8_t *)buf + stride); +} + +#endif diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_l8.h b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.h new file mode 100644 index 000000000..4adab9f16 --- /dev/null +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.h @@ -0,0 +1,45 @@ +/** + * @file lv_draw_sw_blend_l8.h + * + */ + +#ifndef LV_DRAW_SW_BLEND_L8_H +#define LV_DRAW_SW_BLEND_L8_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_draw_sw.h" +#if LV_USE_DRAW_SW + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_l8(_lv_draw_sw_blend_fill_dsc_t * dsc); + +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_l8(_lv_draw_sw_blend_image_dsc_t * dsc); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_DRAW_SW*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_SW_BLEND_L8_H*/ diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c index 84c19398d..a44ba4945 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c @@ -1,4 +1,4 @@ -/** +/** * @file lv_draw_sw_blend_to_rgb565.c * */ @@ -36,6 +36,10 @@ * STATIC PROTOTYPES **********************/ +static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + +static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, @@ -43,6 +47,10 @@ static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_ima static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); +static inline uint16_t /* LV_ATTRIBUTE_FAST_MEM */ l8_to_rgb565(const uint8_t c1); + +static inline uint16_t /* LV_ATTRIBUTE_FAST_MEM */ lv_color_8_16_mix(const uint8_t c1, uint16_t c2, uint8_t mix); + static inline uint16_t /* LV_ATTRIBUTE_FAST_MEM */ lv_color_24_16_mix(const uint8_t * c1, uint16_t c2, uint8_t mix); static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * buf, uint32_t stride); @@ -71,6 +79,38 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(...) LV_RESULT_INVALID #endif +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565 + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565_WITH_OPA + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565_WITH_MASK + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565 + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565_WITH_OPA + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565_WITH_MASK + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA + #define LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(...) LV_RESULT_INVALID #endif @@ -302,6 +342,12 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb565(_lv_draw_sw_blend_im case LV_COLOR_FORMAT_ARGB8888: argb8888_image_blend(dsc); break; + case LV_COLOR_FORMAT_L8: + l8_image_blend(dsc); + break; + case LV_COLOR_FORMAT_AL88: + al88_image_blend(dsc); + break; default: LV_LOG_WARN("Not supported source color format"); break; @@ -312,6 +358,231 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb565(_lv_draw_sw_blend_im * STATIC FUNCTIONS **********************/ +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + uint16_t * dest_buf_u16 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const lv_color16a_t * src_buf_al88 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x++) { + dest_buf_u16[dest_x] = lv_color_8_16_mix(src_buf_al88[src_x].lumi, dest_buf_u16[dest_x], src_buf_al88[src_x].alpha); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x++) { + dest_buf_u16[dest_x] = lv_color_8_16_mix(src_buf_al88[src_x].lumi, dest_buf_u16[dest_x], + LV_OPA_MIX2(src_buf_al88[src_x].alpha, opa)); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x++) { + dest_buf_u16[dest_x] = lv_color_8_16_mix(src_buf_al88[src_x].lumi, dest_buf_u16[dest_x], + LV_OPA_MIX2(src_buf_al88[src_x].alpha, mask_buf[dest_x])); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_AL88_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x++) { + dest_buf_u16[dest_x] = lv_color_8_16_mix(src_buf_al88[src_x].lumi, dest_buf_u16[dest_x], + LV_OPA_MIX3(src_buf_al88[src_x].alpha, mask_buf[dest_x], opa)); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + uint16_t res = 0; + for(y = 0; y < h; y++) { + lv_color16_t * dest_buf_c16 = (lv_color16_t *)dest_buf_u16; + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { + uint8_t rb = src_buf_al88[src_x].lumi >> 3; + uint8_t g = src_buf_al88[src_x].lumi >> 2; + switch(dsc->blend_mode) { + case LV_BLEND_MODE_ADDITIVE: + res = (LV_MIN(dest_buf_c16[dest_x].red + rb, 31)) << 11; + res += (LV_MIN(dest_buf_c16[dest_x].green + g, 63)) << 5; + res += LV_MIN(dest_buf_c16[dest_x].blue + rb, 31); + break; + case LV_BLEND_MODE_SUBTRACTIVE: + res = (LV_MAX(dest_buf_c16[dest_x].red - rb, 0)) << 11; + res += (LV_MAX(dest_buf_c16[dest_x].green - g, 0)) << 5; + res += LV_MAX(dest_buf_c16[dest_x].blue - rb, 0); + break; + case LV_BLEND_MODE_MULTIPLY: + res = ((dest_buf_c16[dest_x].red * rb) >> 5) << 11; + res += ((dest_buf_c16[dest_x].green * g) >> 6) << 5; + res += (dest_buf_c16[dest_x].blue * rb) >> 5; + break; + default: + LV_LOG_WARN("Not supported blend mode: %d", dsc->blend_mode); + return; + } + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + dest_buf_u16[dest_x] = lv_color_16_16_mix(res, dest_buf_u16[dest_x], src_buf_al88[src_x].alpha); + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + dest_buf_u16[dest_x] = lv_color_16_16_mix(res, dest_buf_u16[dest_x], LV_OPA_MIX2(opa, src_buf_al88[src_x].alpha)); + } + else { + if(opa >= LV_OPA_MAX) dest_buf_u16[dest_x] = lv_color_16_16_mix(res, dest_buf_u16[dest_x], mask_buf[dest_x]); + else dest_buf_u16[dest_x] = lv_color_16_16_mix(res, dest_buf_u16[dest_x], LV_OPA_MIX3(mask_buf[dest_x], opa, + src_buf_al88[src_x].alpha)); + } + } + + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + if(mask_buf) mask_buf += mask_stride; + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + uint16_t * dest_buf_u16 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const uint8_t * src_buf_l8 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x++) { + dest_buf_u16[dest_x] = l8_to_rgb565(src_buf_l8[src_x]); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_l8 += src_stride; + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x++) { + dest_buf_u16[dest_x] = lv_color_8_16_mix(src_buf_l8[src_x], dest_buf_u16[dest_x], opa); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_l8 += src_stride; + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x++) { + dest_buf_u16[dest_x] = lv_color_8_16_mix(src_buf_l8[src_x], dest_buf_u16[dest_x], mask_buf[dest_x]); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_l8 += src_stride; + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x++) { + dest_buf_u16[dest_x] = lv_color_8_16_mix(src_buf_l8[src_x], dest_buf_u16[dest_x], LV_OPA_MIX2(mask_buf[dest_x], opa)); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_l8 += src_stride; + mask_buf += mask_stride; + } + } + } + } + else { + uint16_t res = 0; + for(y = 0; y < h; y++) { + lv_color16_t * dest_buf_c16 = (lv_color16_t *)dest_buf_u16; + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { + uint8_t rb = src_buf_l8[src_x] >> 3; + uint8_t g = src_buf_l8[src_x] >> 2; + switch(dsc->blend_mode) { + case LV_BLEND_MODE_ADDITIVE: + res = (LV_MIN(dest_buf_c16[dest_x].red + rb, 31)) << 11; + res += (LV_MIN(dest_buf_c16[dest_x].green + g, 63)) << 5; + res += LV_MIN(dest_buf_c16[dest_x].blue + rb, 31); + break; + case LV_BLEND_MODE_SUBTRACTIVE: + res = (LV_MAX(dest_buf_c16[dest_x].red - rb, 0)) << 11; + res += (LV_MAX(dest_buf_c16[dest_x].green - g, 0)) << 5; + res += LV_MAX(dest_buf_c16[dest_x].blue - rb, 0); + break; + case LV_BLEND_MODE_MULTIPLY: + res = ((dest_buf_c16[dest_x].red * rb) >> 5) << 11; + res += ((dest_buf_c16[dest_x].green * g) >> 6) << 5; + res += (dest_buf_c16[dest_x].blue * rb) >> 5; + break; + default: + LV_LOG_WARN("Not supported blend mode: %d", dsc->blend_mode); + return; + } + + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + dest_buf_u16[dest_x] = res; + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + dest_buf_u16[dest_x] = lv_color_16_16_mix(res, dest_buf_u16[dest_x], opa); + } + else { + if(opa >= LV_OPA_MAX) dest_buf_u16[dest_x] = lv_color_16_16_mix(res, dest_buf_u16[dest_x], mask_buf[dest_x]); + else dest_buf_u16[dest_x] = lv_color_16_16_mix(res, dest_buf_u16[dest_x], LV_OPA_MIX2(mask_buf[dest_x], opa)); + } + } + + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_l8 += src_stride; + if(mask_buf) mask_buf += mask_stride; + } + } +} + static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; @@ -641,6 +912,29 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_d } } +static inline uint16_t LV_ATTRIBUTE_FAST_MEM l8_to_rgb565(const uint8_t c1) +{ + return ((c1 & 0xF8) << 8) + ((c1 & 0xFC) << 3) + ((c1 & 0xF8) >> 3); +} + +static inline uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_8_16_mix(const uint8_t c1, uint16_t c2, uint8_t mix) +{ + + if(mix == 0) { + return c2; + } + else if(mix == 255) { + return ((c1 & 0xF8) << 8) + ((c1 & 0xFC) << 3) + ((c1 & 0xF8) >> 3); + } + else { + lv_opa_t mix_inv = 255 - mix; + + return ((((c1 >> 3) * mix + ((c2 >> 11) & 0x1F) * mix_inv) << 3) & 0xF800) + + ((((c1 >> 2) * mix + ((c2 >> 5) & 0x3F) * mix_inv) >> 3) & 0x07E0) + + (((c1 >> 3) * mix + (c2 & 0x1F) * mix_inv) >> 8); + } +} + static inline uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_24_16_mix(const uint8_t * c1, uint16_t c2, uint8_t mix) { if(mix == 0) { diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c index 84e087f9e..5a832cc0b 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c @@ -1,4 +1,4 @@ -/** +/** * @file lv_draw_sw_blend_to_rgb888.c * */ @@ -36,6 +36,10 @@ * STATIC PROTOTYPES **********************/ +static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); + +static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); + static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, @@ -45,6 +49,8 @@ static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_ima static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); +static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_8_24_mix(const uint8_t src, uint8_t * dest, uint8_t mix); + static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_24_24_mix(const uint8_t * src, uint8_t * dest, uint8_t mix); static inline void /* LV_ATTRIBUTE_FAST_MEM */ blend_non_normal_pixel(uint8_t * dest, lv_color32_t src, @@ -75,6 +81,22 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(...) LV_RESULT_INVALID #endif +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888 + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_WITH_OPA + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_WITH_OPA(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_WITH_MASK + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_WITH_MASK(...) LV_RESULT_INVALID +#endif + +#ifndef LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA + #define LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(...) LV_RESULT_INVALID #endif @@ -270,6 +292,12 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb888(_lv_draw_sw_blend_im case LV_COLOR_FORMAT_ARGB8888: argb8888_image_blend(dsc, dest_px_size); break; + case LV_COLOR_FORMAT_L8: + l8_image_blend(dsc, dest_px_size); + break; + case LV_COLOR_FORMAT_AL88: + al88_image_blend(dsc, dest_px_size); + break; default: LV_LOG_WARN("Not supported source color format"); break; @@ -280,6 +308,172 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb888(_lv_draw_sw_blend_im * STATIC FUNCTIONS **********************/ +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + uint8_t * dest_buf_u8 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const lv_color16a_t * src_buf_al88 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_8_24_mix(src_buf_al88[src_x].lumi, &dest_buf_u8[dest_x], src_buf_al88[src_x].alpha); + } + dest_buf_u8 += dest_stride; + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_8_24_mix(src_buf_al88[src_x].lumi, &dest_buf_u8[dest_x], LV_OPA_MIX2(src_buf_al88[src_x].alpha, opa)); + } + dest_buf_u8 += dest_stride; + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_8_24_mix(src_buf_al88[src_x].lumi, &dest_buf_u8[dest_x], LV_OPA_MIX2(src_buf_al88[src_x].alpha, + mask_buf[src_x])); + } + dest_buf_u8 += dest_stride; + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_8_24_mix(src_buf_al88[src_x].lumi, &dest_buf_u8[dest_x], LV_OPA_MIX3(src_buf_al88[src_x].alpha, + mask_buf[src_x], opa)); + } + dest_buf_u8 += dest_stride; + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color32_t src_argb; + src_argb.red = src_argb.green = src_argb.blue = src_buf_al88[src_x].lumi; + if(mask_buf == NULL) src_argb.alpha = LV_OPA_MIX2(src_buf_al88[src_x].alpha, opa); + else src_argb.alpha = LV_OPA_MIX3(src_buf_al88[src_x].alpha, mask_buf[dest_x], opa); + blend_non_normal_pixel(&dest_buf_u8[dest_x], src_argb, dsc->blend_mode); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_u8 += dest_stride; + src_buf_al88 = drawbuf_next_row(src_buf_al88, src_stride); + } + } +} + +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) +{ + int32_t w = dsc->dest_w; + int32_t h = dsc->dest_h; + lv_opa_t opa = dsc->opa; + uint8_t * dest_buf_u8 = dsc->dest_buf; + int32_t dest_stride = dsc->dest_stride; + const uint8_t * src_buf_l8 = dsc->src_buf; + int32_t src_stride = dsc->src_stride; + const lv_opa_t * mask_buf = dsc->mask_buf; + int32_t mask_stride = dsc->mask_stride; + + int32_t dest_x; + int32_t src_x; + int32_t y; + + if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { + if(mask_buf == NULL && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + dest_buf_u8[dest_x + 2] = src_buf_l8[src_x]; + dest_buf_u8[dest_x + 1] = src_buf_l8[src_x]; + dest_buf_u8[dest_x + 0] = src_buf_l8[src_x]; + } + dest_buf_u8 += dest_stride; + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } + } + else if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_8_24_mix(src_buf_l8[src_x], &dest_buf_u8[dest_x], opa); + } + dest_buf_u8 += dest_stride; + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } + } + else if(mask_buf && opa >= LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_8_24_mix(src_buf_l8[src_x], &dest_buf_u8[dest_x], mask_buf[src_x]); + } + dest_buf_u8 += dest_stride; + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + mask_buf += mask_stride; + } + } + } + else if(mask_buf && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_L8_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_8_24_mix(src_buf_l8[src_x], &dest_buf_u8[dest_x], LV_OPA_MIX2(opa, mask_buf[src_x])); + } + dest_buf_u8 += dest_stride; + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + mask_buf += mask_stride; + } + } + } + } + else { + lv_color32_t src_argb; + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + src_argb.red = src_buf_l8[src_x]; + src_argb.green = src_buf_l8[src_x]; + src_argb.blue = src_buf_l8[src_x]; + if(mask_buf == NULL) src_argb.alpha = opa; + else src_argb.alpha = LV_OPA_MIX2(mask_buf[dest_x], opa); + blend_non_normal_pixel(&dest_buf_u8[dest_x], src_argb, dsc->blend_mode); + } + if(mask_buf) mask_buf += mask_stride; + dest_buf_u8 += dest_stride; + src_buf_l8 = drawbuf_next_row(src_buf_l8, src_stride); + } + } +} + static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) { int32_t w = dsc->dest_w; @@ -583,6 +777,24 @@ static inline void LV_ATTRIBUTE_FAST_MEM blend_non_normal_pixel(uint8_t * dest, lv_color_24_24_mix(res, dest, src.alpha); } +static inline void LV_ATTRIBUTE_FAST_MEM lv_color_8_24_mix(const uint8_t src, uint8_t * dest, uint8_t mix) +{ + + if(mix == 0) return; + + if(mix >= LV_OPA_MAX) { + dest[0] = src; + dest[1] = src; + dest[2] = src; + } + else { + lv_opa_t mix_inv = 255 - mix; + dest[0] = (uint32_t)((uint32_t)src * mix + dest[0] * mix_inv) >> 8; + dest[1] = (uint32_t)((uint32_t)src * mix + dest[1] * mix_inv) >> 8; + dest[2] = (uint32_t)((uint32_t)src * mix + dest[2] * mix_inv) >> 8; + } +} + static inline void LV_ATTRIBUTE_FAST_MEM lv_color_24_24_mix(const uint8_t * src, uint8_t * dest, uint8_t mix) { diff --git a/src/draw/sw/lv_draw_sw_img.c b/src/draw/sw/lv_draw_sw_img.c index b84085979..e13e34321 100644 --- a/src/draw/sw/lv_draw_sw_img.c +++ b/src/draw/sw/lv_draw_sw_img.c @@ -1,4 +1,4 @@ -/** +/** * @file lv_draw_sw_img.c * */ @@ -289,9 +289,13 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t int32_t blend_h = lv_area_get_height(&blend_area); lv_color_format_t cf_final = cf; + if((cf == LV_COLOR_FORMAT_L8) && (draw_dsc->recolor_opa > LV_OPA_MIN)) { + cf_final = LV_COLOR_FORMAT_ARGB8888; + } if(transformed) { - if(cf == LV_COLOR_FORMAT_RGB888 || cf == LV_COLOR_FORMAT_XRGB8888) cf_final = LV_COLOR_FORMAT_ARGB8888; - else if(cf == LV_COLOR_FORMAT_RGB565) cf_final = LV_COLOR_FORMAT_RGB565A8; + if(cf_final == LV_COLOR_FORMAT_RGB888 || cf_final == LV_COLOR_FORMAT_XRGB8888) cf_final = LV_COLOR_FORMAT_ARGB8888; + else if(cf_final == LV_COLOR_FORMAT_RGB565) cf_final = LV_COLOR_FORMAT_RGB565A8; + else if(cf_final == LV_COLOR_FORMAT_L8) cf_final = LV_COLOR_FORMAT_AL88; } uint8_t * tmp_buf; @@ -350,7 +354,23 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t } else if(draw_dsc->recolor_opa >= LV_OPA_MIN) { int32_t h = lv_area_get_height(&relative_area); - if(cf_final == LV_COLOR_FORMAT_RGB565A8) { + if(cf == LV_COLOR_FORMAT_L8) { + /* L8 is recolored, but not transformed: copy L8 image into ARGB8888 temporary buffer */ + const uint8_t * src_buf_tmp = src_buf + img_stride * relative_area.y1 + relative_area.x1 * 1; + lv_color32_t * dest_buf_tmp = (lv_color32_t *)tmp_buf; + int32_t i, x; + for(i = 0; i < h; i++) { + for(x = 0; x < blend_w; x++) { + dest_buf_tmp[x].red = src_buf_tmp[x]; + dest_buf_tmp[x].green = src_buf_tmp[x]; + dest_buf_tmp[x].blue = src_buf_tmp[x]; + dest_buf_tmp[x].alpha = 255; + } + dest_buf_tmp += blend_w; + src_buf_tmp += img_stride; + } + } + else if(cf_final == LV_COLOR_FORMAT_RGB565A8) { uint32_t stride_px = img_stride / 2; const uint8_t * rgb_src_buf = src_buf + stride_px * 2 * relative_area.y1 + relative_area.x1 * 2; const uint8_t * a_src_buf = src_buf + stride_px * 2 * src_h + stride_px * relative_area.y1 + diff --git a/src/draw/sw/lv_draw_sw_transform.c b/src/draw/sw/lv_draw_sw_transform.c index 71fadd7de..c553f20c3 100644 --- a/src/draw/sw/lv_draw_sw_transform.c +++ b/src/draw/sw/lv_draw_sw_transform.c @@ -1,4 +1,4 @@ -/** +/** * @file lv_draw_sw_transform.c * */ @@ -67,6 +67,14 @@ static void transform_a8(const uint8_t * src, int32_t src_w, int32_t src_h, int3 int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, int32_t x_end, uint8_t * abuf, bool aa); +static void transform_l8_to_al88(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, + int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, + int32_t x_end, uint8_t * abuf, bool aa); + +static void transform_l8_to_argb8888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, + int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, + int32_t x_end, uint8_t * abuf, bool aa); + /********************** * STATIC VARIABLES **********************/ @@ -114,10 +122,13 @@ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_are int32_t dest_stride_a8 = dest_w; int32_t dest_stride; - if(src_cf == LV_COLOR_FORMAT_RGB888) { + if(src_cf == LV_COLOR_FORMAT_L8) { + dest_stride = dest_w * ((draw_dsc->recolor_opa >= LV_OPA_MIN) ? 4 : 2); + } + else if(src_cf == LV_COLOR_FORMAT_RGB888) { dest_stride = dest_w * lv_color_format_get_size(LV_COLOR_FORMAT_ARGB8888); } - else if(src_cf == LV_COLOR_FORMAT_RGB565A8) { + else if((src_cf == LV_COLOR_FORMAT_RGB565A8) || (src_cf == LV_COLOR_FORMAT_L8)) { dest_stride = dest_w * 2; } else { @@ -228,6 +239,13 @@ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_are (uint16_t *)dest_buf, alpha_buf, true, aa); break; + case LV_COLOR_FORMAT_L8: + if(draw_dsc->recolor_opa >= LV_OPA_MIN) + transform_l8_to_argb8888(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf, + aa); + else + transform_l8_to_al88(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf, aa); + break; default: break; } @@ -611,6 +629,159 @@ static void transform_a8(const uint8_t * src, int32_t src_w, int32_t src_h, int3 } } +/* L8 will be transformed into an AL88 buffer, because it will not be recolored */ +static void transform_l8_to_al88(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, + int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, + int32_t x_end, uint8_t * dest_buf, bool aa) +{ + int32_t xs_ups_start = xs_ups; + int32_t ys_ups_start = ys_ups; + lv_color16a_t * dest_al88 = (lv_color16a_t *)dest_buf; + + int32_t x; + for(x = 0; x < x_end; x++) { + xs_ups = xs_ups_start + ((xs_step * x) >> 8); + ys_ups = ys_ups_start + ((ys_step * x) >> 8); + + int32_t xs_int = xs_ups >> 8; + int32_t ys_int = ys_ups >> 8; + + /*Fully out of the image*/ + if(xs_int < 0 || xs_int >= src_w || ys_int < 0 || ys_int >= src_h) { + dest_al88[x].lumi = 0x00; + dest_al88[x].alpha = 0x00; + continue; + } + + /*Get the direction the hor and ver neighbor + *`fract` will be in range of 0x00..0xFF and `next` (+/-1) indicates the direction*/ + int32_t xs_fract = xs_ups & 0xFF; + int32_t ys_fract = ys_ups & 0xFF; + + int32_t x_next; + int32_t y_next; + if(xs_fract < 0x80) { + x_next = -1; + xs_fract = (0x7F - xs_fract) * 2; + } + else { + x_next = 1; + xs_fract = (xs_fract - 0x80) * 2; + } + if(ys_fract < 0x80) { + y_next = -1; + ys_fract = (0x7F - ys_fract) * 2; + } + else { + y_next = 1; + ys_fract = (ys_fract - 0x80) * 2; + } + + const uint8_t * src_tmp = src; + src_tmp += ys_int * src_stride + xs_int; + dest_al88[x].lumi = src_tmp[0]; + dest_al88[x].alpha = 255; + if(aa && + xs_int + x_next >= 0 && + xs_int + x_next <= src_w - 1 && + ys_int + y_next >= 0 && + ys_int + y_next <= src_h - 1) { + + lv_opa_t a_ver = src_tmp[x_next]; + lv_opa_t a_hor = src_tmp[y_next * src_stride]; + + if(a_ver != dest_al88[x].lumi) a_ver = ((a_ver * ys_fract) + (dest_al88[x].lumi * (0x100 - ys_fract))) >> 8; + if(a_hor != dest_al88[x].lumi) a_hor = ((a_hor * xs_fract) + (dest_al88[x].lumi * (0x100 - xs_fract))) >> 8; + dest_al88[x].lumi = (a_ver + a_hor) >> 1; + } + else { + /*Partially out of the image*/ + if((xs_int == 0 && x_next < 0) || (xs_int == src_w - 1 && x_next > 0)) { + dest_al88[x].alpha = (src_tmp[0] * (0xFF - xs_fract)) >> 8; + } + else if((ys_int == 0 && y_next < 0) || (ys_int == src_h - 1 && y_next > 0)) { + dest_al88[x].alpha = (src_tmp[0] * (0xFF - ys_fract)) >> 8; + } + } + } +} + +/* L8 has to be transformed into an ARGB8888 buffer, because it will be recolored as well */ +static void transform_l8_to_argb8888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, + int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, + int32_t x_end, uint8_t * dest_buf, bool aa) +{ + int32_t xs_ups_start = xs_ups; + int32_t ys_ups_start = ys_ups; + lv_color32_t * dest_c32 = (lv_color32_t *)dest_buf; + + int32_t x; + for(x = 0; x < x_end; x++) { + xs_ups = xs_ups_start + ((xs_step * x) >> 8); + ys_ups = ys_ups_start + ((ys_step * x) >> 8); + + int32_t xs_int = xs_ups >> 8; + int32_t ys_int = ys_ups >> 8; + + /*Fully out of the image*/ + if(xs_int < 0 || xs_int >= src_w || ys_int < 0 || ys_int >= src_h) { + *((uint32_t *)&dest_c32[x]) = 0L; + continue; + } + + /*Get the direction the hor and ver neighbor + *`fract` will be in range of 0x00..0xFF and `next` (+/-1) indicates the direction*/ + int32_t xs_fract = xs_ups & 0xFF; + int32_t ys_fract = ys_ups & 0xFF; + + int32_t x_next; + int32_t y_next; + if(xs_fract < 0x80) { + x_next = -1; + xs_fract = (0x7F - xs_fract) * 2; + } + else { + x_next = 1; + xs_fract = (xs_fract - 0x80) * 2; + } + if(ys_fract < 0x80) { + y_next = -1; + ys_fract = (0x7F - ys_fract) * 2; + } + else { + y_next = 1; + ys_fract = (ys_fract - 0x80) * 2; + } + + const uint8_t * src_tmp = src; + src_tmp += ys_int * src_stride + xs_int; + dest_c32[x].red = dest_c32[x].green = dest_c32[x].blue = src_tmp[0]; + dest_c32[x].alpha = 255; + if(aa && + xs_int + x_next >= 0 && + xs_int + x_next <= src_w - 1 && + ys_int + y_next >= 0 && + ys_int + y_next <= src_h - 1) { + + lv_opa_t a_ver = src_tmp[x_next]; + lv_opa_t a_hor = src_tmp[y_next * src_stride]; + + if(a_ver != src_tmp[0]) a_ver = ((a_ver * ys_fract) + (src_tmp[0] * (0x100 - ys_fract))) >> 8; + if(a_hor != src_tmp[0]) a_hor = ((a_hor * xs_fract) + (src_tmp[0] * (0x100 - xs_fract))) >> 8; + dest_c32[x].red = dest_c32[x].green = dest_c32[x].blue = (a_ver + a_hor) >> 1; + } + else { + /*Partially out of the image*/ + if((xs_int == 0 && x_next < 0) || (xs_int == src_w - 1 && x_next > 0)) { + dest_c32[x].alpha = (src_tmp[0] * (0xFF - xs_fract)) >> 8; + } + else if((ys_int == 0 && y_next < 0) || (ys_int == src_h - 1 && y_next > 0)) { + dest_c32[x].alpha = (src_tmp[0] * (0xFF - ys_fract)) >> 8; + } + } + } +} + static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int32_t yin, int32_t * xout, int32_t * yout) { diff --git a/src/misc/lv_color.c b/src/misc/lv_color.c index 74b964f30..8e63d3c56 100644 --- a/src/misc/lv_color.c +++ b/src/misc/lv_color.c @@ -1,4 +1,4 @@ -/** +/** * @file lv_color.c * */ @@ -60,6 +60,7 @@ uint8_t lv_color_format_get_bpp(lv_color_format_t cf) case LV_COLOR_FORMAT_RGB565A8: case LV_COLOR_FORMAT_RGB565: + case LV_COLOR_FORMAT_AL88: return 16; case LV_COLOR_FORMAT_ARGB8565: @@ -88,6 +89,7 @@ bool lv_color_format_has_alpha(lv_color_format_t cf) case LV_COLOR_FORMAT_I8: case LV_COLOR_FORMAT_RGB565A8: case LV_COLOR_FORMAT_ARGB8888: + case LV_COLOR_FORMAT_AL88: return true; default: return false; diff --git a/src/misc/lv_color.h b/src/misc/lv_color.h index 8fe2558e3..9f22f3072 100644 --- a/src/misc/lv_color.h +++ b/src/misc/lv_color.h @@ -1,4 +1,4 @@ -/** +/** * @file lv_color.h * */ @@ -72,6 +72,7 @@ typedef uint8_t lv_opa_t; (cf) == LV_COLOR_FORMAT_L8 ? 8 : \ (cf) == LV_COLOR_FORMAT_A8 ? 8 : \ (cf) == LV_COLOR_FORMAT_I8 ? 8 : \ + (cf) == LV_COLOR_FORMAT_AL88 ? 16 : \ (cf) == LV_COLOR_FORMAT_RGB565 ? 16 : \ (cf) == LV_COLOR_FORMAT_RGB565A8 ? 16 : \ (cf) == LV_COLOR_FORMAT_ARGB8565 ? 24 : \ @@ -110,6 +111,11 @@ typedef struct { uint8_t v; } lv_color_hsv_t; +typedef struct { + uint8_t lumi; + uint8_t alpha; +} lv_color16a_t; + enum _lv_color_format_t { LV_COLOR_FORMAT_UNKNOWN = 0, @@ -127,7 +133,8 @@ enum _lv_color_format_t { /*2 byte (+alpha) formats*/ LV_COLOR_FORMAT_RGB565 = 0x12, LV_COLOR_FORMAT_ARGB8565 = 0x13, /**< Not supported by sw renderer yet. */ - LV_COLOR_FORMAT_RGB565A8 = 0x14 /**< Color array followed by Alpha array*/, + LV_COLOR_FORMAT_RGB565A8 = 0x14, /**< Color array followed by Alpha array*/ + LV_COLOR_FORMAT_AL88 = 0x15, /**< L8 with alpha >*/ /*3 byte (+alpha) formats*/ LV_COLOR_FORMAT_RGB888 = 0x0F, @@ -158,6 +165,7 @@ enum _lv_color_format_t { /*Color formats in which LVGL can render*/ #if LV_COLOR_DEPTH == 8 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_L8, + LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_AL88, #elif LV_COLOR_DEPTH == 16 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB565, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_RGB565A8, @@ -439,6 +447,46 @@ static inline void lv_color16_premultiply(lv_color16_t * c, lv_opa_t a) c->blue = LV_OPA_MIX2(c->blue, a); } +/** + * Get the luminance of a color: luminance = 0.3 R + 0.59 G + 0.11 B + * @param color a color + * @return the brightness [0..255] + */ +static inline uint8_t lv_color_luminance(lv_color_t c) +{ + return (uint8_t)((uint16_t)(77u * c.red + 151u * c.green + 28u * c.blue) >> 8); +} + +/** + * Get the luminance of a color16: luminance = 0.3 R + 0.59 G + 0.11 B + * @param color a color + * @return the brightness [0..255] + */ +static inline uint8_t lv_color16_luminance(const lv_color16_t c) +{ + return (uint8_t)((uint16_t)(635u * c.red + 613u * c.green + 231u * c.blue) >> 8); +} + +/** + * Get the luminance of a color24: luminance = 0.3 R + 0.59 G + 0.11 B + * @param color a color + * @return the brightness [0..255] + */ +static inline uint8_t lv_color24_luminance(const uint8_t * c) +{ + return (uint8_t)((uint16_t)(77u * c[2] + 151u * c[1] + 28u * c[0]) >> 8); +} + +/** + * Get the luminance of a color32: luminance = 0.3 R + 0.59 G + 0.11 B + * @param color a color + * @return the brightness [0..255] + */ +static inline uint8_t lv_color32_luminance(lv_color32_t c) +{ + return (uint8_t)((uint16_t)(77u * c.red + 151u * c.green + 28u * c.blue) >> 8); +} + /********************** * MACROS **********************/ diff --git a/src/others/snapshot/lv_snapshot.c b/src/others/snapshot/lv_snapshot.c index 021467bea..e467cf4b5 100644 --- a/src/others/snapshot/lv_snapshot.c +++ b/src/others/snapshot/lv_snapshot.c @@ -80,6 +80,7 @@ lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * obj, lv_color_format_t cf, l case LV_COLOR_FORMAT_RGB888: case LV_COLOR_FORMAT_XRGB8888: case LV_COLOR_FORMAT_ARGB8888: + case LV_COLOR_FORMAT_L8: break; default: LV_LOG_WARN("Not supported color format"); diff --git a/src/widgets/canvas/lv_canvas.c b/src/widgets/canvas/lv_canvas.c index b7094226f..877f6bfa9 100644 --- a/src/widgets/canvas/lv_canvas.c +++ b/src/widgets/canvas/lv_canvas.c @@ -1,4 +1,4 @@ -/** +/** * @file lv_canvas.c * */ @@ -122,6 +122,9 @@ void lv_canvas_set_px(lv_obj_t * obj, int32_t x, int32_t y, lv_color_t color, lv *buf &= ~(1 << bit); *buf |= c_int << bit; } + else if(cf == LV_COLOR_FORMAT_L8) { + *data = lv_color_luminance(color); + } else if(cf == LV_COLOR_FORMAT_A8) { *data = opa; } @@ -149,6 +152,11 @@ void lv_canvas_set_px(lv_obj_t * obj, int32_t x, int32_t y, lv_color_t color, lv buf->blue = color.blue; buf->alpha = opa; } + else if(cf == LV_COLOR_FORMAT_AL88) { + lv_color16a_t * buf = (lv_color16a_t *)data; + buf->lumi = lv_color_luminance(color); + buf->alpha = 255; + } lv_obj_invalidate(obj); } @@ -212,6 +220,13 @@ lv_color32_t lv_canvas_get_px(lv_obj_t * obj, int32_t x, int32_t y) ret.alpha = px[0]; break; } + case LV_COLOR_FORMAT_L8: { + ret.red = *px; + ret.green = *px; + ret.blue = *px; + ret.alpha = 0xFF; + break; + } default: lv_memzero(&ret, sizeof(lv_color32_t)); break; @@ -303,6 +318,27 @@ void lv_canvas_fill_bg(lv_obj_t * obj, lv_color_t color, lv_opa_t opa) } } } + else if(header->cf == LV_COLOR_FORMAT_L8) { + uint8_t c8 = lv_color_luminance(color); + for(y = 0; y < header->h; y++) { + uint8_t * buf = (uint8_t *)(data + y * stride); + for(x = 0; x < header->w; x++) { + buf[x] = c8; + } + } + } + else if(header->cf == LV_COLOR_FORMAT_AL88) { + lv_color16a_t c; + c.lumi = lv_color_luminance(color); + c.alpha = 255; + for(y = 0; y < header->h; y++) { + lv_color16a_t * buf = (lv_color16a_t *)(data + y * stride); + for(x = 0; x < header->w; x++) { + buf[x] = c; + } + } + } + else { for(y = 0; y < header->h; y++) { for(x = 0; x < header->w; x++) { diff --git a/tests/ref_imgs/draw/render/al88/demo_render_arc_image_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_arc_image_opa_128.png new file mode 100644 index 000000000..c8af23f5c Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_arc_image_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_arc_image_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_arc_image_opa_255.png new file mode 100644 index 000000000..f3d09b3ca Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_arc_image_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_arc_normal_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_arc_normal_opa_128.png new file mode 100644 index 000000000..8d11fdd53 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_arc_normal_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_arc_normal_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_arc_normal_opa_255.png new file mode 100644 index 000000000..d589ca5c0 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_arc_normal_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_blend_mode_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_blend_mode_opa_128.png new file mode 100644 index 000000000..e57e11954 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_blend_mode_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_blend_mode_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_blend_mode_opa_255.png new file mode 100644 index 000000000..1f24bcffe Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_blend_mode_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_border_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_border_opa_128.png new file mode 100644 index 000000000..48cf917c3 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_border_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_border_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_border_opa_255.png new file mode 100644 index 000000000..02898f68e Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_border_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_box_shadow_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_box_shadow_opa_128.png new file mode 100644 index 000000000..8803e21c8 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_box_shadow_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_box_shadow_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_box_shadow_opa_255.png new file mode 100644 index 000000000..dc09e6bec Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_box_shadow_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_fill_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_fill_opa_128.png new file mode 100644 index 000000000..3ae976faa Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_fill_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_fill_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_fill_opa_255.png new file mode 100644 index 000000000..011b15bd5 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_fill_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_image_normal_1_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_image_normal_1_opa_128.png new file mode 100644 index 000000000..0ed2d98b1 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_image_normal_1_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_image_normal_1_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_image_normal_1_opa_255.png new file mode 100644 index 000000000..565a6e278 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_image_normal_1_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_image_normal_2_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_image_normal_2_opa_128.png new file mode 100644 index 000000000..db07b87c4 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_image_normal_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_image_normal_2_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_image_normal_2_opa_255.png new file mode 100644 index 000000000..1b6c70471 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_image_normal_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_1_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_1_opa_128.png new file mode 100644 index 000000000..65f35073e Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_1_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_1_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_1_opa_255.png new file mode 100644 index 000000000..18cbb69e9 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_1_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_2_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_2_opa_128.png new file mode 100644 index 000000000..2a88492a4 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_2_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_2_opa_255.png new file mode 100644 index 000000000..36f5edc1f Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_image_recolor_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_layer_normal_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_layer_normal_opa_128.png new file mode 100644 index 000000000..ac4c80294 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_layer_normal_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_layer_normal_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_layer_normal_opa_255.png new file mode 100644 index 000000000..572be2afc Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_layer_normal_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_line_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_line_opa_128.png new file mode 100644 index 000000000..b872fc3aa Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_line_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_line_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_line_opa_255.png new file mode 100644 index 000000000..7cb08274a Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_line_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_text_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_text_opa_128.png new file mode 100644 index 000000000..df8185de9 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_text_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_text_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_text_opa_255.png new file mode 100644 index 000000000..afb77ba1f Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_text_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_triangle_opa_128.png b/tests/ref_imgs/draw/render/al88/demo_render_triangle_opa_128.png new file mode 100644 index 000000000..b96dd042f Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_triangle_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/al88/demo_render_triangle_opa_255.png b/tests/ref_imgs/draw/render/al88/demo_render_triangle_opa_255.png new file mode 100644 index 000000000..48cb93ee7 Binary files /dev/null and b/tests/ref_imgs/draw/render/al88/demo_render_triangle_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_opa_128.png b/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_1_opa_128.png similarity index 100% rename from tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_opa_128.png rename to tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_1_opa_128.png diff --git a/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_opa_255.png b/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_1_opa_255.png similarity index 100% rename from tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_opa_255.png rename to tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_1_opa_255.png diff --git a/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_2_opa_128.png b/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_2_opa_128.png new file mode 100644 index 000000000..d7aa74344 Binary files /dev/null and b/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_2_opa_255.png b/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_2_opa_255.png new file mode 100644 index 000000000..28863049b Binary files /dev/null and b/tests/ref_imgs/draw/render/argb8888/demo_render_image_normal_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_opa_128.png b/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_1_opa_128.png similarity index 100% rename from tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_opa_128.png rename to tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_1_opa_128.png diff --git a/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_opa_255.png b/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_1_opa_255.png similarity index 100% rename from tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_opa_255.png rename to tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_1_opa_255.png diff --git a/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_2_opa_128.png b/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_2_opa_128.png new file mode 100644 index 000000000..c9a8d0832 Binary files /dev/null and b/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_2_opa_255.png b/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_2_opa_255.png new file mode 100644 index 000000000..391d21eea Binary files /dev/null and b/tests/ref_imgs/draw/render/argb8888/demo_render_image_recolor_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_arc_image_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_arc_image_opa_128.png new file mode 100644 index 000000000..71d72f5b1 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_arc_image_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_arc_image_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_arc_image_opa_255.png new file mode 100644 index 000000000..efa96fa9f Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_arc_image_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_arc_normal_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_arc_normal_opa_128.png new file mode 100644 index 000000000..bcb860891 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_arc_normal_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_arc_normal_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_arc_normal_opa_255.png new file mode 100644 index 000000000..77751abf9 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_arc_normal_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_blend_mode_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_blend_mode_opa_128.png new file mode 100644 index 000000000..51cd0fdab Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_blend_mode_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_blend_mode_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_blend_mode_opa_255.png new file mode 100644 index 000000000..873471e5e Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_blend_mode_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_border_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_border_opa_128.png new file mode 100644 index 000000000..48cf917c3 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_border_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_border_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_border_opa_255.png new file mode 100644 index 000000000..02898f68e Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_border_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_box_shadow_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_box_shadow_opa_128.png new file mode 100644 index 000000000..1719edbec Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_box_shadow_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_box_shadow_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_box_shadow_opa_255.png new file mode 100644 index 000000000..f0aa12bd7 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_box_shadow_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_fill_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_fill_opa_128.png new file mode 100644 index 000000000..3ae976faa Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_fill_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_fill_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_fill_opa_255.png new file mode 100644 index 000000000..011b15bd5 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_fill_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_image_normal_1_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_image_normal_1_opa_128.png new file mode 100644 index 000000000..3e24cee20 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_image_normal_1_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_image_normal_1_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_image_normal_1_opa_255.png new file mode 100644 index 000000000..0ab2dbe71 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_image_normal_1_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_image_normal_2_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_image_normal_2_opa_128.png new file mode 100644 index 000000000..0e8f91d9b Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_image_normal_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_image_normal_2_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_image_normal_2_opa_255.png new file mode 100644 index 000000000..427357497 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_image_normal_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_1_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_1_opa_128.png new file mode 100644 index 000000000..80dfb853a Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_1_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_1_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_1_opa_255.png new file mode 100644 index 000000000..aae9cef1f Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_1_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_2_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_2_opa_128.png new file mode 100644 index 000000000..63cd21d55 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_2_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_2_opa_255.png new file mode 100644 index 000000000..e17bd361b Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_image_recolor_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_layer_normal_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_layer_normal_opa_128.png new file mode 100644 index 000000000..c073cd6f9 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_layer_normal_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_layer_normal_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_layer_normal_opa_255.png new file mode 100644 index 000000000..2aefe2719 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_layer_normal_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_line_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_line_opa_128.png new file mode 100644 index 000000000..08128b318 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_line_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_line_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_line_opa_255.png new file mode 100644 index 000000000..608691f15 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_line_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_text_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_text_opa_128.png new file mode 100644 index 000000000..df8185de9 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_text_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_text_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_text_opa_255.png new file mode 100644 index 000000000..afb77ba1f Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_text_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_triangle_opa_128.png b/tests/ref_imgs/draw/render/l8/demo_render_triangle_opa_128.png new file mode 100644 index 000000000..370584f19 Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_triangle_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/l8/demo_render_triangle_opa_255.png b/tests/ref_imgs/draw/render/l8/demo_render_triangle_opa_255.png new file mode 100644 index 000000000..f4fe746af Binary files /dev/null and b/tests/ref_imgs/draw/render/l8/demo_render_triangle_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_opa_128.png b/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_1_opa_128.png similarity index 100% rename from tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_opa_128.png rename to tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_1_opa_128.png diff --git a/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_opa_255.png b/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_1_opa_255.png similarity index 100% rename from tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_opa_255.png rename to tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_1_opa_255.png diff --git a/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_2_opa_128.png b/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_2_opa_128.png new file mode 100644 index 000000000..69389766e Binary files /dev/null and b/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_2_opa_255.png b/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_2_opa_255.png new file mode 100644 index 000000000..72325de45 Binary files /dev/null and b/tests/ref_imgs/draw/render/rgb565/demo_render_image_normal_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_opa_128.png b/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_1_opa_128.png similarity index 100% rename from tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_opa_128.png rename to tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_1_opa_128.png diff --git a/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_opa_255.png b/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_1_opa_255.png similarity index 100% rename from tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_opa_255.png rename to tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_1_opa_255.png diff --git a/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_2_opa_128.png b/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_2_opa_128.png new file mode 100644 index 000000000..bdf4d94af Binary files /dev/null and b/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_2_opa_255.png b/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_2_opa_255.png new file mode 100644 index 000000000..bba0a89f9 Binary files /dev/null and b/tests/ref_imgs/draw/render/rgb565/demo_render_image_recolor_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_opa_128.png b/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_1_opa_128.png similarity index 100% rename from tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_opa_128.png rename to tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_1_opa_128.png diff --git a/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_opa_255.png b/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_1_opa_255.png similarity index 100% rename from tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_opa_255.png rename to tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_1_opa_255.png diff --git a/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_2_opa_128.png b/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_2_opa_128.png new file mode 100644 index 000000000..d7aa74344 Binary files /dev/null and b/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_2_opa_255.png b/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_2_opa_255.png new file mode 100644 index 000000000..28863049b Binary files /dev/null and b/tests/ref_imgs/draw/render/rgb888/demo_render_image_normal_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_opa_128.png b/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_1_opa_128.png similarity index 100% rename from tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_opa_128.png rename to tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_1_opa_128.png diff --git a/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_opa_255.png b/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_1_opa_255.png similarity index 100% rename from tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_opa_255.png rename to tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_1_opa_255.png diff --git a/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_2_opa_128.png b/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_2_opa_128.png new file mode 100644 index 000000000..c9a8d0832 Binary files /dev/null and b/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_2_opa_255.png b/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_2_opa_255.png new file mode 100644 index 000000000..31dddde12 Binary files /dev/null and b/tests/ref_imgs/draw/render/rgb888/demo_render_image_recolor_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_opa_128.png b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_1_opa_128.png similarity index 100% rename from tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_opa_128.png rename to tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_1_opa_128.png diff --git a/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_opa_255.png b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_1_opa_255.png similarity index 100% rename from tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_opa_255.png rename to tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_1_opa_255.png diff --git a/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_2_opa_128.png b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_2_opa_128.png new file mode 100644 index 000000000..d7aa74344 Binary files /dev/null and b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_2_opa_255.png b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_2_opa_255.png new file mode 100644 index 000000000..28863049b Binary files /dev/null and b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_normal_2_opa_255.png differ diff --git a/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_opa_128.png b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_1_opa_128.png similarity index 100% rename from tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_opa_128.png rename to tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_1_opa_128.png diff --git a/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_opa_255.png b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_1_opa_255.png similarity index 100% rename from tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_opa_255.png rename to tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_1_opa_255.png diff --git a/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_2_opa_128.png b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_2_opa_128.png new file mode 100644 index 000000000..c9a8d0832 Binary files /dev/null and b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_2_opa_128.png differ diff --git a/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_2_opa_255.png b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_2_opa_255.png new file mode 100644 index 000000000..31dddde12 Binary files /dev/null and b/tests/ref_imgs/draw/render/xrgb8888/demo_render_image_recolor_2_opa_255.png differ diff --git a/tests/src/test_cases/draw/test_render_to_al88.c b/tests/src/test_cases/draw/test_render_to_al88.c new file mode 100644 index 000000000..24d89e3ff --- /dev/null +++ b/tests/src/test_cases/draw/test_render_to_al88.c @@ -0,0 +1,37 @@ +#if LV_BUILD_TEST +#include "../lvgl.h" +#include "../demos/lv_demos.h" + +#include "unity/unity.h" + +void setUp(void) +{ + /* Function run before every test */ +} + +void tearDown(void) +{ + /* Function run after every test */ + lv_display_set_color_format(NULL, LV_COLOR_FORMAT_XRGB8888); +} + +void test_render_to_al88(void) +{ + lv_display_set_color_format(NULL, LV_COLOR_FORMAT_AL88); + + lv_opa_t opa_values[2] = {0xff, 0x80}; + uint32_t opa; + for(opa = 0; opa < 2; opa++) { + uint32_t i; + for(i = 0; i < _LV_DEMO_RENDER_SCENE_NUM; i++) { + lv_demo_render(i, opa_values[opa]); + + char buf[128]; + lv_snprintf(buf, sizeof(buf), "draw/render/al88/demo_render_%s_opa_%d.png", + lv_demo_render_get_scene_name(i), opa_values[opa]); + TEST_ASSERT_EQUAL_SCREENSHOT(buf); + } + } +} + +#endif diff --git a/tests/src/test_cases/draw/test_render_to_l8.c b/tests/src/test_cases/draw/test_render_to_l8.c new file mode 100644 index 000000000..c5c194b80 --- /dev/null +++ b/tests/src/test_cases/draw/test_render_to_l8.c @@ -0,0 +1,37 @@ +#if LV_BUILD_TEST +#include "../lvgl.h" +#include "../demos/lv_demos.h" + +#include "unity/unity.h" + +void setUp(void) +{ + /* Function run before every test */ +} + +void tearDown(void) +{ + /* Function run after every test */ + lv_display_set_color_format(NULL, LV_COLOR_FORMAT_XRGB8888); +} + +void test_render_to_l8(void) +{ + lv_display_set_color_format(NULL, LV_COLOR_FORMAT_L8); + + lv_opa_t opa_values[2] = {0xff, 0x80}; + uint32_t opa; + for(opa = 0; opa < 2; opa++) { + uint32_t i; + for(i = 0; i < _LV_DEMO_RENDER_SCENE_NUM; i++) { + lv_demo_render(i, opa_values[opa]); + + char buf[128]; + lv_snprintf(buf, sizeof(buf), "draw/render/l8/demo_render_%s_opa_%d.png", + lv_demo_render_get_scene_name(i), opa_values[opa]); + TEST_ASSERT_EQUAL_SCREENSHOT(buf); + } + } +} + +#endif diff --git a/tests/unity/unity_support.c b/tests/unity/unity_support.c index c045d6ddf..a2a563977 100644 --- a/tests/unity/unity_support.c +++ b/tests/unity/unity_support.c @@ -1,4 +1,4 @@ -/** +/** * @file lv_test_assert.c * * Copyright 2002-2010 Guillaume Cottenceau. @@ -419,6 +419,36 @@ static void buf_to_xrgb8888(const uint8_t * buf_in, uint8_t * buf_out, lv_color_ buf_out[x * 4 + 0] = buf_in[x * 3 + 2]; } + buf_in += stride; + buf_out += 800 * 4; + } + } + else if(cf_in == LV_COLOR_FORMAT_L8) { + uint32_t y; + for(y = 0; y < 480; y++) { + uint32_t x; + for(x = 0; x < 800; x++) { + buf_out[x * 4 + 3] = 0xff; + buf_out[x * 4 + 2] = buf_in[x]; + buf_out[x * 4 + 1] = buf_in[x]; + buf_out[x * 4 + 0] = buf_in[x]; + } + + buf_in += stride; + buf_out += 800 * 4; + } + } + else if (cf_in == LV_COLOR_FORMAT_AL88) { + uint32_t y; + for (y = 0; y < 480; y++) { + uint32_t x; + for (x = 0; x < 800; x++) { + buf_out[x * 4 + 3] = buf_in[x * 2 + 1]; + buf_out[x * 4 + 2] = buf_in[x * 2 + 0]; + buf_out[x * 4 + 1] = buf_in[x * 2 + 0]; + buf_out[x * 4 + 0] = buf_in[x * 2 + 0]; + } + buf_in += stride; buf_out += 800 * 4; }