Mercurial > MadButterfly
annotate tools/mb_c_source.m4 @ 94:57f8fecca8f3
-
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 24 Aug 2008 08:11:16 +0800 |
parents | 9b4a02bcaeb1 |
children | 1a1dda98730c |
rev | line source |
---|---|
63 | 1 changequote(`[', `]')dnl |
2 include([foreach.m4])dnl | |
3 divert([-1]) | |
4 | |
64 | 5 define([UNQUOTE], [$*]) |
6 | |
7 define([QUOTE], [[[$*]]]) | |
63 | 8 |
64 | 9 define([COUNT],[ifelse([$*],[],0,[$#])]) |
63 | 10 |
64 | 11 define([IMPORT],[define([$1],[$2$1(]$[]@[)])]) |
63 | 12 |
64 | 13 define([D_COLOR_STOP],[ |
14 {$6,$2,$3,$4,$5}]) | |
63 | 15 |
16 define([D_ADD_LINEAR_PAINT],[dnl | |
64 | 17 ifelse(COUNT($6),0,,[dnl |
18 static const int n_$1_stops = COUNT($6); | |
19 static const grad_stop_t $1_stops[[]] = {UNQUOTE($6)}; | |
63 | 20 ])dnl |
21 ]) | |
22 | |
23 define([D_ADD_RADIAL_PAINT],[dnl | |
64 | 24 ifelse(COUNT($5),0,,[dnl |
25 static const int n_$1_stops = COUNT($5); | |
26 static const grad_stop_t $1_stops[[]] = {UNQUOTE($5)}; | |
63 | 27 ])dnl |
28 ]) | |
29 | |
30 define([DECLARE_VARS], [divert([-1]) | |
64 | 31 define([DIMPORT],[IMPORT(]QUOTE($[]1)[,[D_])]) |
32 DIMPORT([ADD_LINEAR_PAINT]) | |
33 DIMPORT([ADD_RADIAL_PAINT]) | |
34 DIMPORT([COLOR_STOP]) | |
78 | 35 define([REF_STOPS_RADIAL]) |
36 define([REF_STOPS_LINEAR]) | |
73
9ab15ebc9061
Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents:
69
diff
changeset
|
37 define([ADD_PATH]) |
64 | 38 define([ADD_RECT]) |
39 define([ADD_COORD]) | |
83 | 40 define([ADD_TEXT],) |
64 | 41 define([FILL_SHAPE]) |
42 define([STROKE_SHAPE]) | |
43 define([FILL_SHAPE_WITH_PAINT]) | |
44 define([STROKE_SHAPE_WITH_PAINT]) | |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
45 define([STROKE_WIDTH]) |
81 | 46 define([GROUP_HIDE],) |
47 define([RECT_HIDE],) | |
48 define([PATH_HIDE],) | |
84
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
49 define([COORD_TRANSLATE],) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
50 define([COORD_MATRIX],) |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
51 define([SHAPE_MATRIX],) |
63 | 52 divert[]]) |
53 | |
54 define([S_ADD_LINEAR_PAINT],[ | |
69
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
55 obj->$1 = paint_linear_new(rdman, $2, $3, $4, $5); |
64 | 56 ifelse(COUNT($6),0,,[dnl |
57 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops); | |
58 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops); | |
59 paint_linear_stops(obj->$1, n_$1_stops, stops); | |
60 ])dnl | |
63 | 61 ]) |
64 | 62 |
63 | 63 define([S_ADD_RADIAL_PAINT],[ |
69
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
64 obj->$1 = paint_radial_new(rdman, $2, $3, $4); |
64 | 65 ifelse(COUNT($5),0,,[ |
66 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops); | |
67 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops); | |
68 paint_radial_stops(obj->$1, n_$1_stops, stops); | |
69 ])dnl | |
63 | 70 ]) |
71 | |
64 | 72 define([S_COLOR_STOP],[]) |
78 | 73 |
74 define([S_REF_STOPS_RADIAL],[dnl | |
64 | 75 [ stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$2_stops); |
76 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops); | |
77 paint_radial_stops(obj->$1, n_$2_stops, stops); | |
78 ]]) | |
79 | |
78 | 80 define([S_REF_STOPS_LINEAR],[dnl |
81 [ stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$2_stops); | |
82 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops); | |
83 paint_linear_stops(obj->$1, n_$2_stops, stops); | |
84 ]]) | |
85 | |
64 | 86 define([S_ADD_RECT],[[ |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
87 obj->$1 = sh_rect_new($2, $3, $4, $5, $6, $7); |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
88 rdman_add_shape(rdman, obj->$1, obj->$8); |
64 | 89 ]]) |
90 | |
91 define([S_ADD_PATH],[[ | |
92 obj->$1 = sh_path_new("$2"); | |
93 rdman_add_shape(rdman, obj->$1, obj->$3); | |
94 ]]) | |
95 | |
96 define([S_ADD_COORD],[[ | |
66
309f1eefbec0
create new coords from redraw_man
Thinker K.F. Li <thinker@branda.to>
parents:
64
diff
changeset
|
97 obj->$1 = rdman_coord_new(rdman, obj->$2); |
64 | 98 ]]) |
99 | |
83 | 100 define([S_ADD_TEXT],[[ |
101 obj->$1 = sh_text_new("$2", $3, $4, $5, cairo_get_font_face(rdman->cr)); | |
102 rdman_add_shape(rdman, obj->$1, obj->$6); | |
103 ]]) | |
104 | |
64 | 105 define([S_FILL_SHAPE_WITH_PAINT],[dnl |
106 [ rdman_paint_fill(rdman, obj->$2, obj->$1); | |
107 ]]) | |
108 | |
109 define([S_STROKE_SHAPE_WITH_PAINT],[dnl | |
110 [ rdman_paint_stroke(rdman, obj->$2, obj->$1); | |
111 ]]) | |
112 | |
113 define([S_FILL_SHAPE],[dnl | |
114 [ obj->$1_fill = paint_color_new(rdman, $2, $3, $4, $5); | |
115 rdman_paint_fill(rdman, obj->$1_fill, obj->$1); | |
116 ]]) | |
117 | |
118 define([S_STROKE_SHAPE],[dnl | |
119 [ obj->$1_stroke = paint_color_new(rdman, $2, $3, $4, $5); | |
120 rdman_paint_stroke(rdman, obj->$1_stroke, obj->$1); | |
121 ]]) | |
122 | |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
123 define([S_STROKE_WIDTH],[dnl |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
124 [ obj->$1->stroke_width = $2; |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
125 ]]) |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
126 |
81 | 127 define([S_GROUP_HIDE],[dnl |
128 [ coord_hide(obj->$1); | |
129 ]]) | |
130 | |
131 define([S_RECT_HIDE],[dnl | |
132 [ sh_hide(obj->$1); | |
133 ]]) | |
134 | |
135 define([S_PATH_HIDE],[dnl | |
136 [ sh_hide(obj->$1); | |
137 ]]) | |
138 | |
84
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
139 define([S_COORD_TRANSLATE],[dnl |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
140 [ memset(obj->$1->matrix, 0, sizeof(obj->$1->matrix)); |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
141 obj->$1->matrix[0] = 1; |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
142 obj->$1->matrix[2] = $2; |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
143 obj->$1->matrix[4] = 1; |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
144 obj->$1->matrix[5] = $3; |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
145 rdman_coord_changed(rdman, obj->$1); |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
146 ]]) |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
147 |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
148 define([S_COORD_MATRIX],[dnl |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
149 [ obj->$1->matrix[0] = $2; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
150 obj->$1->matrix[3] = $3; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
151 obj->$1->matrix[1] = $4; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
152 obj->$1->matrix[4] = $5; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
153 obj->$1->matrix[2] = $6; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
154 obj->$1->matrix[5] = $7; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
155 rdman_coord_changed(rdman, obj->$1); |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
156 ]]) |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
157 |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
158 define([S_SHAPE_MATRIX],[dnl |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
159 [ obj->$1->matrix[0] = $2; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
160 obj->$1->matrix[3] = $3; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
161 obj->$1->matrix[1] = $4; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
162 obj->$1->matrix[4] = $5; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
163 obj->$1->matrix[2] = $6; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
164 obj->$1->matrix[5] = $7; |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
165 rdman_coord_changed(rdman, obj->$1); |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
166 ]]) |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
167 |
63 | 168 define([SETUP_VARS],[divert([-1]) |
64 | 169 define([SIMPORT],[IMPORT(]QUOTE($[]1)[,[S_])]) |
170 SIMPORT([ADD_LINEAR_PAINT]) | |
171 SIMPORT([ADD_RADIAL_PAINT]) | |
172 SIMPORT([COLOR_STOP]) | |
78 | 173 SIMPORT([REF_STOPS_RADIAL]) |
174 SIMPORT([REF_STOPS_LINEAR]) | |
64 | 175 SIMPORT([ADD_PATH],) |
176 SIMPORT([ADD_RECT]) | |
177 SIMPORT([ADD_COORD]) | |
83 | 178 SIMPORT([ADD_TEXT]) |
64 | 179 SIMPORT([FILL_SHAPE]) |
180 SIMPORT([STROKE_SHAPE]) | |
181 SIMPORT([FILL_SHAPE_WITH_PAINT]) | |
182 SIMPORT([STROKE_SHAPE_WITH_PAINT]) | |
81 | 183 SIMPORT([STROKE_WIDTH]) |
184 SIMPORT([GROUP_HIDE]) | |
185 SIMPORT([RECT_HIDE]) | |
186 SIMPORT([PATH_HIDE]) | |
84
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
187 SIMPORT([COORD_TRANSLATE]) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
188 SIMPORT([COORD_MATRIX]) |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
189 SIMPORT([SHAPE_MATRIX]) |
63 | 190 divert[]]) |
191 | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
192 define([F_ADD_LINEAR_PAINT],[[ |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
193 stops = paint_linear_stops(obj->$1, 0, NULL); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
194 free(stops); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
195 obj->$1->free(obj->$1); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
196 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
197 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
198 define([F_ADD_RADIAL_PAINT],[[ |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
199 stops = paint_radial_stops(obj->$1, 0, NULL); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
200 free(stops); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
201 obj->$1->free(obj->$1); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
202 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
203 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
204 define([F_ADD_PATH],[[ |
73
9ab15ebc9061
Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents:
69
diff
changeset
|
205 obj->$1->free(obj->$1); |
83 | 206 ]]) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
207 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
208 define([F_ADD_RECT],[[ |
73
9ab15ebc9061
Observer for mouse events
Thinker K.F. Li <thinker@branda.to>
parents:
69
diff
changeset
|
209 obj->$1->free(obj->$1); |
83 | 210 ]]) |
211 | |
212 define([F_ADD_TEXT],[[ | |
213 obj->$1->free(obj->$1); | |
214 ]]) | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
215 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
216 define([F_FILL_SHAPE],[[ |
69
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
217 obj->$1_fill->free(obj->$1_fill); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
218 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
219 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
220 define([F_STROKE_SHAPE],[[ |
69
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
221 obj->$1_stroke->free(obj->$1_stroke); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
222 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
223 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
224 define([CLEAR_VARS],[divert([-1]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
225 define([FIMPORT],[IMPORT(]QUOTE($[]1)[,[F_])]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
226 FIMPORT([ADD_LINEAR_PAINT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
227 FIMPORT([ADD_RADIAL_PAINT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
228 define([COLOR_STOP]) |
78 | 229 define([REF_STOPS_RADIAL]) |
230 define([REF_STOPS_LINEAR]) | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
231 FIMPORT([ADD_PATH],) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
232 FIMPORT([ADD_RECT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
233 define([ADD_COORD]) |
83 | 234 FIMPORT([ADD_TEXT]) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
235 FIMPORT([FILL_SHAPE]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
236 FIMPORT([STROKE_SHAPE]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
237 define([FILL_SHAPE_WITH_PAINT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
238 define([STROKE_SHAPE_WITH_PAINT]) |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
239 define([STROKE_WIDTH]) |
81 | 240 define([GROUP_HIDE],) |
241 define([RECT_HIDE],) | |
242 define([PATH_HIDE],) | |
84
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
243 define([COORD_TRANSLATE],) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
244 define([COORD_MATRIX],) |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
245 define([SHAPE_MATRIX],) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
246 divert[]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
247 |
63 | 248 define([MADBUTTERFLY],[dnl |
249 [#include <stdio.h> | |
69
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
250 #include <stdlib.h> |
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
251 #include <string.h> |
63 | 252 #include "mb_types.h" |
253 #include "redraw_man.h" | |
254 #include "shapes.h" | |
255 #include "paint.h" | |
256 #include "$1.h" | |
257 | |
69
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
258 $1_t *$1_new(redraw_man_t *rdman) { |
64 | 259 $1_t *obj; |
260 grad_stop_t *stops = NULL;]DECLARE_VARS | |
63 | 261 $2[]dnl |
262 [ | |
263 obj = ($1_t *)malloc(sizeof($1_t)); | |
264 if(obj == NULL) return NULL; | |
265 ]SETUP_VARS | |
64 | 266 obj->root_coord = rdman->root_coord; |
63 | 267 $2 |
268 [ return obj; | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
269 } |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
270 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
271 void $1_free($1_t *obj) { |
68 | 272 grad_stop_t *stops = NULL; |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
273 ]CLEAR_VARS[]$2[ |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
274 free(obj); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
275 } |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
276 ]dnl |
63 | 277 ]) |
278 divert[]dnl |