diff --git a/src/draw/lv_draw_buf.c b/src/draw/lv_draw_buf.c index 13cf59b66c..9a69e3c725 100644 --- a/src/draw/lv_draw_buf.c +++ b/src/draw/lv_draw_buf.c @@ -362,6 +362,21 @@ lv_result_t lv_draw_buf_premultiply(lv_draw_buf_t * draw_buf) alpha += alpha_stride; } } + else if(cf == LV_COLOR_FORMAT_ARGB8565) { + uint32_t h = draw_buf->header.h; + uint32_t w = draw_buf->header.w; + uint32_t stride = draw_buf->header.stride; + uint8_t * line = (uint8_t *)draw_buf->data; + for(uint32_t y = 0; y < h; y++) { + uint8_t * pixel = line; + for(uint32_t x = 0; x < w; x++) { + uint8_t alpha = pixel[2]; + lv_color16_premultiply((lv_color16_t *)pixel, alpha); + pixel += 3; + } + line += stride; + } + } else if(LV_COLOR_FORMAT_IS_ALPHA_ONLY(cf)) { /*Pass*/ } diff --git a/src/libs/bin_decoder/lv_bin_decoder.c b/src/libs/bin_decoder/lv_bin_decoder.c index 954f206833..15c9dd754a 100644 --- a/src/libs/bin_decoder/lv_bin_decoder.c +++ b/src/libs/bin_decoder/lv_bin_decoder.c @@ -230,7 +230,8 @@ lv_result_t lv_bin_decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d || cf == LV_COLOR_FORMAT_XRGB8888 \ || cf == LV_COLOR_FORMAT_RGB888 \ || cf == LV_COLOR_FORMAT_RGB565 \ - || cf == LV_COLOR_FORMAT_RGB565A8) { + || cf == LV_COLOR_FORMAT_RGB565A8 \ + || cf == LV_COLOR_FORMAT_ARGB8565) { res = decode_rgb(decoder, dsc); } #else @@ -381,6 +382,7 @@ lv_result_t lv_bin_decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod || cf == LV_COLOR_FORMAT_XRGB8888 \ || cf == LV_COLOR_FORMAT_RGB888 \ || cf == LV_COLOR_FORMAT_RGB565 \ + || cf == LV_COLOR_FORMAT_ARGB8565 \ || cf == LV_COLOR_FORMAT_RGB565A8; if(!supported) { LV_LOG_WARN("CF: %d is not supported", cf); @@ -469,7 +471,7 @@ lv_result_t lv_bin_decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod } if(cf == LV_COLOR_FORMAT_ARGB8888 || cf == LV_COLOR_FORMAT_XRGB8888 || cf == LV_COLOR_FORMAT_RGB888 - || cf == LV_COLOR_FORMAT_RGB565) { + || cf == LV_COLOR_FORMAT_RGB565 || cf == LV_COLOR_FORMAT_ARGB8565) { uint32_t len = (w_px * bpp) / 8; offset += decoded_area->y1 * dsc->header.stride; offset += decoded_area->x1 * bpp / 8; /*Move to x1*/ diff --git a/src/misc/lv_color.c b/src/misc/lv_color.c index efe6bd660d..74b964f30f 100644 --- a/src/misc/lv_color.c +++ b/src/misc/lv_color.c @@ -62,6 +62,7 @@ uint8_t lv_color_format_get_bpp(lv_color_format_t cf) case LV_COLOR_FORMAT_RGB565: return 16; + case LV_COLOR_FORMAT_ARGB8565: case LV_COLOR_FORMAT_RGB888: return 24; case LV_COLOR_FORMAT_ARGB8888: diff --git a/src/misc/lv_color.h b/src/misc/lv_color.h index e1eca1b767..943234490f 100644 --- a/src/misc/lv_color.h +++ b/src/misc/lv_color.h @@ -76,6 +76,7 @@ typedef uint8_t lv_opa_t; (cf) == LV_COLOR_FORMAT_I8 ? 8 : \ (cf) == LV_COLOR_FORMAT_RGB565 ? 16 : \ (cf) == LV_COLOR_FORMAT_RGB565A8 ? 16 : \ + (cf) == LV_COLOR_FORMAT_ARGB8565 ? 24 : \ (cf) == LV_COLOR_FORMAT_RGB888 ? 24 : \ (cf) == LV_COLOR_FORMAT_ARGB8888 ? 32 : \ (cf) == LV_COLOR_FORMAT_XRGB8888 ? 32 : \ @@ -127,6 +128,7 @@ 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*/, /*3 byte (+alpha) formats*/