annotate src/graph_engine_cairo.c @ 935:960e2395973d

Fix the bug of crash by abort() when running testsvg.js. The cached coords their pcache areas should be recomputed are also add ro zeroing list. They have no dirty areas. But, their pcache area must be added to parent cached coord.
author Thinker K.F. Li <thinker@codemud.net>
date Fri, 12 Nov 2010 16:03:19 +0800
parents 74e3ba4d3fa1
children 7b4e80ab671a
rev   line source
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*-
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
2 // vim: sw=4:ts=8:sts=4
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 #include <fontconfig/fontconfig.h>
480
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
4 #include <cairo-ft.h>
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 #include "mb_graph_engine_cairo.h"
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 #include "mb_shapes.h"
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 #ifndef ASSERT
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 #define ASSERT(x)
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 #endif
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 /*! \brief Find out a font pattern.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 *
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 * This function use fontconfig to decide a font file in pattern. It can
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 * replaced by other mechanism if you think it is not what you want.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 *
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 * \param slant make font prune if it it non-zero.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 * \param weight make font normal if it is 100.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 */
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 static
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 FcPattern *query_font_pattern(const char *family, int slant, int weight) {
901
74e3ba4d3fa1 Fix issue of unworking text style.
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
22 FcPattern *ptn, *fn_ptn;
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 FcValue val;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 FcConfig *cfg;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 FcBool r;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 FcResult result;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 static int slant_map[] = { /* from MB_FONT_SLANT_* to FC_SLANT_* */
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 FC_SLANT_ROMAN,
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 FC_SLANT_ROMAN,
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 FC_SLANT_ITALIC,
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 FC_SLANT_OBLIQUE};
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 cfg = FcConfigGetCurrent();
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 ptn = FcPatternCreate();
901
74e3ba4d3fa1 Fix issue of unworking text style.
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
35 if(ptn == NULL)
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 goto err;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38 val.type = FcTypeString;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 val.u.s = family;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 FcPatternAdd(ptn, "family", val, FcTrue);
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
41
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42 val.type = FcTypeInteger;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43 val.u.i = slant_map[slant];
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 FcPatternAdd(ptn, "slant", val, FcTrue);
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
45
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46 val.type = FcTypeInteger;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47 val.u.i = weight;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48 FcPatternAdd(ptn, "weight", val, FcTrue);
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49
901
74e3ba4d3fa1 Fix issue of unworking text style.
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
50 FcDefaultSubstitute(ptn);
74e3ba4d3fa1 Fix issue of unworking text style.
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
51
74e3ba4d3fa1 Fix issue of unworking text style.
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
52 r = FcConfigSubstituteWithPat(cfg, ptn, ptn, FcMatchPattern);
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
53 if(!r)
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
54 goto err;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
55
901
74e3ba4d3fa1 Fix issue of unworking text style.
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
56 r = FcConfigSubstituteWithPat(cfg, ptn, ptn, FcMatchFont);
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
57 if(!r)
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
58 goto err;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
59
901
74e3ba4d3fa1 Fix issue of unworking text style.
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
60 fn_ptn = FcFontMatch(cfg, ptn, &result);
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
61
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
62 /* It is supposed to return FcResultMatch. But, it is no, now.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
63 * I don't know why. Someone should figure out the issue.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
64 */
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
65 #if 0
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
66 if(result != FcResultMatch) {
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
67 printf("%d %d\n", result, FcResultMatch);
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
68 goto err;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
69 }
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
70 #endif
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
71 if(fn_ptn == NULL)
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
72 goto err;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
73
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
74 FcPatternDestroy(ptn);
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
75
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
76 return fn_ptn;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
77
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
78 err:
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
79 if(ptn)
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
80 FcPatternDestroy(ptn);
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
81 return NULL;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
82
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
83 }
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
84
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
85 /*! \brief Find out a font face for a pattern specified.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
86 *
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
87 * The pattern, here, is a vector of family, slant, and weight.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
88 * This function base on fontconfig and cairo FreeType font supporting.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
89 * You can replace this function with other font mechanisms.
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
90 */
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
91 mbe_font_face_t *
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
92 mbe_query_font_face(const char *family, int slant, int weight) {
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
93 mbe_font_face_t *cface;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
94 FcPattern *ptn;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
95
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
96 ptn = query_font_pattern(family, slant, weight);
469
4dc0be6c044a Add copy and clear graphic engine functions.
Thinker K.F. Li <thinker@branda.to>
parents: 465
diff changeset
97 cface = cairo_ft_font_face_create_for_pattern(ptn);
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
98 FcPatternDestroy(ptn);
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
99
465
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
100 return cface;
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
101 }
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
102
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
103 void
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
104 mbe_free_font_face(mbe_font_face_t *face) {
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
105 ASSERT(face == NULL);
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
106
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
107 mbe_font_face_destroy(face);
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
108 }
d8181696b689 Move functions into graphic engine layers.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
109
480
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
110 mbe_pattern_t *
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
111 mbe_pattern_create_radial(co_aix cx0, co_aix cy0, co_aix radius0,
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
112 co_aix cx1, co_aix cy1, co_aix radius1,
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
113 grad_stop_t *stops, int stop_cnt) {
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
114 cairo_pattern_t *ptn;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
115 grad_stop_t *stop;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
116 int i;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
117
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
118 ptn = cairo_pattern_create_radial(cx0, cy0, radius0,
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
119 cx1, cy1, radius1);
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
120 if(ptn == NULL)
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
121 return NULL;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 480
diff changeset
122
480
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
123 stop = stops;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
124 for(i = 0; i < stop_cnt; i++) {
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
125 cairo_pattern_add_color_stop_rgba(ptn, stop->offset,
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
126 stop->r, stop->g, stop->b, stop->a);
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
127 stop++;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
128 }
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
129
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
130 return ptn;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
131 }
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
132
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
133 mbe_pattern_t *
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
134 mbe_pattern_create_linear(co_aix x0, co_aix y0, co_aix x1, co_aix y1,
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
135 grad_stop_t *stops, int stop_cnt) {
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
136 cairo_pattern_t *ptn;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
137 grad_stop_t *stop;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
138 int i;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
139
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
140 ptn = cairo_pattern_create_linear(x0, y0, x1, y1);
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
141 if(ptn == NULL)
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
142 return NULL;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
143
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
144 stop = stops;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
145 for(i = 0; i < stop_cnt; i++) {
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
146 cairo_pattern_add_color_stop_rgba(ptn, stop->offset,
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
147 stop->r, stop->g, stop->b, stop->a);
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
148 stop++;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
149 }
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
150
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
151 return ptn;
e813ac222f48 Merge add colors into constructor of gradient pattern.
Thinker K.F. Li <thinker@branda.to>
parents: 469
diff changeset
152 }