feat(color): add color format ARGB8565

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Xu Xingliang
2024-02-04 14:49:27 +08:00
committed by Neo Xu
parent 52426ec191
commit 86016a819a
4 changed files with 22 additions and 2 deletions
+15
View File
@@ -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*/
}
+4 -2
View File
@@ -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*/
+1
View File
@@ -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:
+2
View File
@@ -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*/