Mercurial > MadButterfly
diff src/graph_engine_openvg.c @ 598:aba62eb9362d openvg
define color source for VG
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Thu, 01 Jul 2010 16:16:46 +0800 |
parents | 3300992b29ff |
children | 20b396c09c23 |
line wrap: on
line diff
--- a/src/graph_engine_openvg.c Thu Jul 01 15:52:29 2010 +0800 +++ b/src/graph_engine_openvg.c Thu Jul 01 16:16:46 2010 +0800 @@ -7,6 +7,30 @@ #define ASSERT(x) #endif +#define MB_2_VG_COLOR(r, g, b, a) ((((int)(0xf * r) & 0xf) << 24) | \ + (((int)(0xf * g) & 0xf) << 16) | \ + (((int)(0xf * b) & 0xf) << 16) | \ + ((int)(0xf * a) & 0xf)) + +void mbe_set_source_rgba(mbe_t *canvas, co_comp_t r, co_comp_t g, + co_comp_t b, co_comp_t a) { + VGPaint paint; + VGuint color; + + if(paint != VG_INVALID_HANDLE && canvas->src == NULL) + paint = canvas->paint; /* previous one is also a color paint */ + else { + paint = vgCreatePaint(); + ASSERT(paint != VG_INVALID_HANDLE); + canvas->paint = paint; + canvas->src = NULL; + } + + color = MB_2_VG_COLOR(r, g, b, a); + vgSetColor(paint, color); + canvas->paint_installed = 0; +} + void mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) { static VGint *scissors = NULL;