Mercurial > MadButterfly
comparison 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 |
comparison
equal
deleted
inserted
replaced
597:3300992b29ff | 598:aba62eb9362d |
---|---|
4 mbe_t *_ge_openvg_current_canvas = NULL; | 4 mbe_t *_ge_openvg_current_canvas = NULL; |
5 | 5 |
6 #ifndef ASSERT | 6 #ifndef ASSERT |
7 #define ASSERT(x) | 7 #define ASSERT(x) |
8 #endif | 8 #endif |
9 | |
10 #define MB_2_VG_COLOR(r, g, b, a) ((((int)(0xf * r) & 0xf) << 24) | \ | |
11 (((int)(0xf * g) & 0xf) << 16) | \ | |
12 (((int)(0xf * b) & 0xf) << 16) | \ | |
13 ((int)(0xf * a) & 0xf)) | |
14 | |
15 void mbe_set_source_rgba(mbe_t *canvas, co_comp_t r, co_comp_t g, | |
16 co_comp_t b, co_comp_t a) { | |
17 VGPaint paint; | |
18 VGuint color; | |
19 | |
20 if(paint != VG_INVALID_HANDLE && canvas->src == NULL) | |
21 paint = canvas->paint; /* previous one is also a color paint */ | |
22 else { | |
23 paint = vgCreatePaint(); | |
24 ASSERT(paint != VG_INVALID_HANDLE); | |
25 canvas->paint = paint; | |
26 canvas->src = NULL; | |
27 } | |
28 | |
29 color = MB_2_VG_COLOR(r, g, b, a); | |
30 vgSetColor(paint, color); | |
31 canvas->paint_installed = 0; | |
32 } | |
9 | 33 |
10 void | 34 void |
11 mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) { | 35 mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) { |
12 static VGint *scissors = NULL; | 36 static VGint *scissors = NULL; |
13 static int n_scissors = 0; | 37 static int n_scissors = 0; |