Mercurial > MadButterfly
comparison src/graph_engine_openvg.c @ 610:e78bff7d23d3 openvg
create pattern from surface for OpenVG
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 05 Jul 2010 14:29:26 +0800 |
parents | 6c74bc371e37 |
children | b1d1b6c5af90 |
comparison
equal
deleted
inserted
replaced
609:287db640078d | 610:e78bff7d23d3 |
---|---|
10 | 10 |
11 #define MB_2_VG_COLOR(r, g, b, a) ((((int)(0xf * r) & 0xf) << 24) | \ | 11 #define MB_2_VG_COLOR(r, g, b, a) ((((int)(0xf * r) & 0xf) << 24) | \ |
12 (((int)(0xf * g) & 0xf) << 16) | \ | 12 (((int)(0xf * g) & 0xf) << 16) | \ |
13 (((int)(0xf * b) & 0xf) << 16) | \ | 13 (((int)(0xf * b) & 0xf) << 16) | \ |
14 ((int)(0xf * a) & 0xf)) | 14 ((int)(0xf * a) & 0xf)) |
15 | |
16 /* | |
17 * This implementation supports only from image surface. | |
18 */ | |
19 mbe_pattern_t * | |
20 mbe_pattern_create_for_surface(mbe_surface_t *surface) { | |
21 mbe_pattern_t *pattern; | |
22 _ge_openvg_img_t *ge_img; | |
23 VGPaint paint; | |
24 | |
25 /* Support only from image surface */ | |
26 if(surface->asso_img == NULL) | |
27 return NULL; | |
28 | |
29 paint = vgCreatePaint(); | |
30 if(paint == VG_INVALID_HANDLE) | |
31 return NULL; | |
32 | |
33 ge_img = surface->asso_img; | |
34 pattern = O_ALLOC(mbe_pattern_t); | |
35 pattern->asso_img = ge_img; | |
36 pattern->paint = paint; | |
37 | |
38 return pattern; | |
39 } | |
15 | 40 |
16 static mbe_pattern_t * | 41 static mbe_pattern_t * |
17 _mbe_pattern_create_gradient(VGfloat *gradient, int grad_len, | 42 _mbe_pattern_create_gradient(VGfloat *gradient, int grad_len, |
18 int grad_type, | 43 int grad_type, |
19 grad_stop_t *stops, int stop_cnt) { | 44 grad_stop_t *stops, int stop_cnt) { |