improve agge

This commit is contained in:
lixianjing 2023-08-10 09:44:49 +08:00
parent 2562ee94fc
commit 4fb34be082
4 changed files with 36 additions and 1 deletions

View File

@ -336,6 +336,20 @@ void renderPaint(AGGENVGcontext* agge, NVGpaint* paint) {
ren(surface, 0, ras, color, agge::winding<>());
break;
}
case NVG_TEXTURE_ARGB: {
typedef agge::bitmap<agge::pixel32_argb, agge::raw_bitmap> argb_bitmap_t;
argb_bitmap_t src(tex->width, tex->height, tex->stride, tex->flags, tex->orientation, (uint8_t*)(tex->data));
agge::nanovg_image_blender<PixelT, argb_bitmap_t> color(&src, (float*)invxform, paint->innerColor.a);
ren(surface, 0, ras, color, agge::winding<>());
break;
}
case NVG_TEXTURE_ABGR: {
typedef agge::bitmap<agge::pixel32_abgr, agge::raw_bitmap> abgr_bitmap_t;
abgr_bitmap_t src(tex->width, tex->height, tex->stride, tex->flags, tex->orientation, (uint8_t*)(tex->data));
agge::nanovg_image_blender<PixelT, abgr_bitmap_t> color(&src, (float*)invxform, paint->innerColor.a);
ren(surface, 0, ras, color, agge::winding<>());
break;
}
case NVG_TEXTURE_BGR565: {
typedef agge::bitmap<agge::pixel16_bgr565, agge::raw_bitmap> bgr565_bitmap_t;
bgr565_bitmap_t src(tex->width, tex->height, tex->stride, tex->flags, tex->orientation, (uint8_t*)(tex->data));
@ -487,6 +501,16 @@ static void nvgInitAGGE(AGGENVGcontext* agge, NVGparams* params, uint32_t w, uin
params->renderFill = renderFill<agge::pixel32_bgra>;
break;
}
case NVG_TEXTURE_ARGB: {
params->renderStroke = renderStroke<agge::pixel32_argb>;
params->renderFill = renderFill<agge::pixel32_argb>;
break;
}
case NVG_TEXTURE_ABGR: {
params->renderStroke = renderStroke<agge::pixel32_abgr>;
params->renderFill = renderFill<agge::pixel32_abgr>;
break;
}
case NVG_TEXTURE_RGB: {
params->renderStroke = renderStroke<agge::pixel24_rgb>;
params->renderFill = renderFill<agge::pixel24_rgb>;

View File

@ -688,7 +688,9 @@ enum NVGtexture {
NVG_TEXTURE_RGB = 8,
NVG_TEXTURE_BGR = 16,
NVG_TEXTURE_RGB565 = 32,
NVG_TEXTURE_BGR565 = 64
NVG_TEXTURE_BGR565 = 64,
NVG_TEXTURE_ARGB = 128,
NVG_TEXTURE_ABGR = 256,
};
struct NVGscissor {

View File

@ -3,6 +3,7 @@
2023/08/10
* 完善progress bar的脏矩形(感谢智明提供补丁)
* 完善demoui text selector资源(感谢智明提供补丁)
* agge 模式增加 argb 和 abgr 的颜色支持(感谢智明提供补丁)
2023/08/09
* 增加函数bits\_stream\_set/bits\_stream\_get

View File

@ -24,6 +24,14 @@ static enum NVGtexture bitmap_format_to_nanovg(bitmap_format_t format) {
f = NVG_TEXTURE_BGRA;
break;
}
case BITMAP_FMT_ARGB8888: {
f = NVG_TEXTURE_ARGB;
break;
}
case BITMAP_FMT_ABGR8888: {
f = NVG_TEXTURE_ABGR;
break;
}
case BITMAP_FMT_BGR888: {
f = NVG_TEXTURE_BGR;
break;