Mercurial > MadButterfly
annotate tools/mb_c_source.m4 @ 1170:e64b02951627
Fix the issue in the normal tween. We duplicate the object only when the object is not in the duplicated node yet.
author | wycc |
---|---|
date | Thu, 30 Dec 2010 11:30:16 +0800 |
parents | 8679b03f72e8 |
children |
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 |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
13 define([DECLARE_EMPTIES], [ |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
14 define([ADD_LINEAR_PAINT]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
15 define([ADD_RADIAL_PAINT]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
16 define([COLOR_STOP]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
17 define([REF_STOPS_RADIAL]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
18 define([REF_STOPS_LINEAR]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
19 define([ADD_PATH]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
20 define([ADD_RECT]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
21 define([ADD_COORD]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
22 define([ADD_TEXT],) |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
23 define([ADD_STEXT]) |
257
50d253d0fcba
Simple image loader and image shape.
Thinker K.F. Li <thinker@branda.to>
parents:
244
diff
changeset
|
24 define([ADD_IMAGE],) |
278
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
25 define([PANGO_BEGIN_TEXT],) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
26 define([PANGO_END_TEXT],) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
27 define([PANGO_SIZE],) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
28 define([PANGO_STYLE],) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
29 define([PANGO_WEIGHT],) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
30 define([PANGO_FAMILY],) |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
31 define([FILL_SHAPE]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
32 define([STROKE_SHAPE]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
33 define([FILL_SHAPE_WITH_PAINT]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
34 define([STROKE_SHAPE_WITH_PAINT]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
35 define([STROKE_WIDTH]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
36 define([GROUP_HIDE],) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
37 define([RECT_HIDE],) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
38 define([PATH_HIDE],) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
39 define([COORD_TRANSLATE],) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
40 define([COORD_MATRIX],) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
41 define([SHAPE_TRANSLATE],) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
42 define([SHAPE_MATRIX],) |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
43 define([STYLE_BLOCK]) |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
44 define([ADD_SYMBOL],) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
45 define([SCENE]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
46 ]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
47 |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
48 define([C_NL],[ |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
49 ]) |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
50 define([RM_C_NL], |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
51 [ifelse(index([$1],C_NL), -1, |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
52 [$1], |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
53 [substr([$1], 0, index([$1],C_NL))[\n]RM_C_NL(substr([$1], |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
54 eval(index([$1],C_NL) + 1)))])]) |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
55 define([TO_CSTR], ["[]RM_C_NL(patsubst(patsubst(patsubst([$1], |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
56 [\\], [[\\\\]]), |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
57 [ ],[[\\t]]), |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
58 ["], [[\\"]]))[]"]) |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
59 |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
60 dnl -------------------- Declare Local Variables -------------------- |
64 | 61 define([D_COLOR_STOP],[ |
62 {$6,$2,$3,$4,$5}]) | |
63 | 63 |
64 define([D_ADD_LINEAR_PAINT],[dnl | |
64 | 65 ifelse(COUNT($6),0,,[dnl |
66 static const int n_$1_stops = COUNT($6); | |
67 static const grad_stop_t $1_stops[[]] = {UNQUOTE($6)}; | |
63 | 68 ])dnl |
69 ]) | |
70 | |
71 define([D_ADD_RADIAL_PAINT],[dnl | |
64 | 72 ifelse(COUNT($5),0,,[dnl |
73 static const int n_$1_stops = COUNT($5); | |
74 static const grad_stop_t $1_stops[[]] = {UNQUOTE($5)}; | |
63 | 75 ])dnl |
76 ]) | |
77 | |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
78 define([D_ADD_STEXT],[dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
79 define([$1_CNT], 0)dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
80 [ mb_style_blk_t *$1_blk; |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
81 ]]) |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
82 |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
83 define([D_STYLE_BLOCK],[dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
84 define([$1_CNT], eval($1_CNT + 1))dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
85 ]) |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
86 |
63 | 87 define([DECLARE_VARS], [divert([-1]) |
64 | 88 define([DIMPORT],[IMPORT(]QUOTE($[]1)[,[D_])]) |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
89 DECLARE_EMPTIES |
64 | 90 DIMPORT([ADD_LINEAR_PAINT]) |
91 DIMPORT([ADD_RADIAL_PAINT]) | |
92 DIMPORT([COLOR_STOP]) | |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
93 DIMPORT([ADD_STEXT]) |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
94 DIMPORT([STYLE_BLOCK]) |
63 | 95 divert[]]) |
96 | |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
97 dnl -------------------- Setup Value for Member Variables -------------------- |
63 | 98 define([S_ADD_LINEAR_PAINT],[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
99 obj->$1 = rdman_paint_linear_new(rdman, $2, $3, $4, $5); |
64 | 100 ifelse(COUNT($6),0,,[dnl |
101 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops); | |
102 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops); | |
103 paint_linear_stops(obj->$1, n_$1_stops, stops); | |
104 ])dnl | |
63 | 105 ]) |
64 | 106 |
63 | 107 define([S_ADD_RADIAL_PAINT],[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
108 obj->$1 = rdman_paint_radial_new(rdman, $2, $3, $4); |
64 | 109 ifelse(COUNT($5),0,,[ |
110 stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$1_stops); | |
111 memcpy(stops, $1_stops, sizeof(grad_stop_t) * n_$1_stops); | |
112 paint_radial_stops(obj->$1, n_$1_stops, stops); | |
113 ])dnl | |
63 | 114 ]) |
115 | |
64 | 116 define([S_COLOR_STOP],[]) |
78 | 117 |
118 define([S_REF_STOPS_RADIAL],[dnl | |
64 | 119 [ stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$2_stops); |
120 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops); | |
121 paint_radial_stops(obj->$1, n_$2_stops, stops); | |
122 ]]) | |
123 | |
78 | 124 define([S_REF_STOPS_LINEAR],[dnl |
125 [ stops = (grad_stop_t *)malloc(sizeof(grad_stop_t) * n_$2_stops); | |
126 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops); | |
127 paint_linear_stops(obj->$1, n_$2_stops, stops); | |
128 ]]) | |
129 | |
64 | 130 define([S_ADD_RECT],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
131 obj->$1 = rdman_shape_rect_new(rdman, $2, $3, $4, $5, $6, $7); |
197
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
132 |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
133 rdman_add_shape(rdman, obj->$1, obj->$8); |
64 | 134 ]]) |
135 | |
136 define([S_ADD_PATH],[[ | |
197
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
137 { |
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
138 char _cmds[] = "$3"; |
458
bb4f651090bf
Use cairo to transform and draw arc.
Thinker K.F. Li <thinker@branda.to>
parents:
431
diff
changeset
|
139 float _pnts[] = {$4}; |
bb4f651090bf
Use cairo to transform and draw arc.
Thinker K.F. Li <thinker@branda.to>
parents:
431
diff
changeset
|
140 float _float_args[] = {$6}; |
bb4f651090bf
Use cairo to transform and draw arc.
Thinker K.F. Li <thinker@branda.to>
parents:
431
diff
changeset
|
141 obj->$1 = rdman_shape_path_new_from_binary(rdman, _cmds, |
bb4f651090bf
Use cairo to transform and draw arc.
Thinker K.F. Li <thinker@branda.to>
parents:
431
diff
changeset
|
142 _pnts, $5, _float_args, $7); |
197
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
143 rdman_add_shape(rdman, obj->$1, obj->$2); |
bcad1ccdf45c
Translate the path string into binary array to save the parsing in the runtime. It can reduce the size as well.
wycc@wycc-desktop
parents:
186
diff
changeset
|
144 } |
64 | 145 ]]) |
146 | |
147 define([S_ADD_COORD],[[ | |
66
309f1eefbec0
create new coords from redraw_man
Thinker K.F. Li <thinker@branda.to>
parents:
64
diff
changeset
|
148 obj->$1 = rdman_coord_new(rdman, obj->$2); |
64 | 149 ]]) |
150 | |
83 | 151 define([S_ADD_TEXT],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
152 obj->$1 = rdman_shape_text_new(rdman, "$2", $3, $4, $5, |
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
153 cairo_get_font_face(rdman->cr)); |
83 | 154 rdman_add_shape(rdman, obj->$1, obj->$6); |
155 ]]) | |
156 | |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
157 define([S_ADD_IMAGE],[[ |
356
3e84458968ec
Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents:
349
diff
changeset
|
158 obj->$1_paint_img = rdman_img_ldr_load_paint(rdman, "$2"); |
3e84458968ec
Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents:
349
diff
changeset
|
159 obj->$1 = rdman_shape_image_new(rdman, |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
160 $3, $4, $5, $6); |
356
3e84458968ec
Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents:
349
diff
changeset
|
161 rdman_paint_fill(rdman, obj->$1_paint_img, obj->$1); |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
162 rdman_add_shape(rdman, obj->$1, obj->$7); |
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
163 ]]) |
278
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
164 define([S_PANGO_BEGIN_TEXT],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
165 { |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
166 PangoAttribute *attr; |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
167 PangoAttrList *attrs = pango_attr_list_new(); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
168 |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
169 ]]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
170 define([S_PANGO_END_TEXT],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
171 obj->$1 = rdman_shape_text_new(rdman, "$2", $3, $4, $5, |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
172 cairo_get_font_face(rdman->cr),attrs); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
173 rdman_add_shape(rdman, obj->$1, obj->$6); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
174 } |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
175 ]]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
176 define([S_PANGO_SIZE],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
177 attr = pango_attr_size_new($1); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
178 attr->start_index = $2; |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
179 attr->end_index = $3; |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
180 pango_attr_list_insert(attrs,attr); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
181 ]]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
182 define([S_PANGO_WEIGHT],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
183 attr = pango_attr_weight_new($1); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
184 attr->start_index = $2; |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
185 attr->end_index = $3; |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
186 pango_attr_list_insert(attrs,attr); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
187 ]]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
188 define([S_PANGO_FAMILY],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
189 attr = pango_attr_family_new("$1"); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
190 attr->start_index = $2; |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
191 attr->end_index = $3; |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
192 pango_attr_list_insert(attrs,attr); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
193 ]]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
194 define([S_PANGO_STYLE],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
195 attr = pango_attr_style_new($1); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
196 attr->start_index = $2; |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
197 attr->end_index = $3; |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
198 pango_attr_list_insert(attrs,attr); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
199 ]]) |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
200 |
64 | 201 define([S_FILL_SHAPE_WITH_PAINT],[dnl |
202 [ rdman_paint_fill(rdman, obj->$2, obj->$1); | |
203 ]]) | |
204 | |
205 define([S_STROKE_SHAPE_WITH_PAINT],[dnl | |
206 [ rdman_paint_stroke(rdman, obj->$2, obj->$1); | |
207 ]]) | |
208 | |
209 define([S_FILL_SHAPE],[dnl | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
210 [ obj->$1_fill = rdman_paint_color_new(rdman, $2, $3, $4, $5); |
64 | 211 rdman_paint_fill(rdman, obj->$1_fill, obj->$1); |
212 ]]) | |
213 | |
214 define([S_STROKE_SHAPE],[dnl | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
215 [ obj->$1_stroke = rdman_paint_color_new(rdman, $2, $3, $4, $5); |
64 | 216 rdman_paint_stroke(rdman, obj->$1_stroke, obj->$1); |
217 ]]) | |
218 | |
80
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
219 define([S_STROKE_WIDTH],[dnl |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
220 [ obj->$1->stroke_width = $2; |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
221 ]]) |
e548221c04eb
svg2code.py support stroke
Thinker K.F. Li <thinker@branda.to>
parents:
78
diff
changeset
|
222 |
81 | 223 define([S_GROUP_HIDE],[dnl |
224 [ coord_hide(obj->$1); | |
225 ]]) | |
226 | |
227 define([S_RECT_HIDE],[dnl | |
228 [ sh_hide(obj->$1); | |
229 ]]) | |
230 | |
231 define([S_PATH_HIDE],[dnl | |
232 [ sh_hide(obj->$1); | |
233 ]]) | |
234 | |
84
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
235 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
|
236 [ 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
|
237 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
|
238 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
|
239 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
|
240 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
|
241 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
|
242 ]]) |
42698de1f653
Support translate() function for transform attribute of 'g' tag.
Thinker K.F. Li <thinker@branda.to>
parents:
83
diff
changeset
|
243 |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
244 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
|
245 [ 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 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
|
252 ]]) |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
253 |
100
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
254 define([S_SHAPE_TRANSLATE],[dnl |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
255 [ memset(obj->$1->matrix, 0, sizeof(obj->$1->matrix)); |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
256 obj->$1->matrix[0] = 1; |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
257 obj->$1->matrix[2] = $2; |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
258 obj->$1->matrix[4] = 1; |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
259 obj->$1->matrix[5] = $3; |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
260 rdman_coord_changed(rdman, obj->$1); |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
261 ]]) |
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
262 |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
263 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
|
264 [ 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
|
265 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
|
266 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
|
267 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
|
268 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
|
269 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
|
270 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
|
271 ]]) |
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
272 |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
273 define([S_ADD_STEXT],[dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
274 [ obj->$1 = rdman_shape_stext_new(rdman, ]TO_CSTR([$2])[, $3, $4); |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
275 rdman_add_shape(rdman, obj->$1, obj->$5); |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
276 obj->$1_style_blks_num = ]$1_CNT[; |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
277 obj->$1_style_blks = $1_blk = |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
278 (mb_style_blk_t *)malloc(sizeof(mb_style_blk_t) * ]$1_CNT[); |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
279 ]dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
280 define($1_IDX,0)dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
281 ]) |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
282 |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
283 define([S_STYLE_BLOCK],[dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
284 [ $1_blk->n_chars = $2; |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
285 $1_blk->font_sz = $4; |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
286 $1_blk->face = mb_font_face_query(rdman, ]TO_CSTR([$3])[, $5, $6); |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
287 $1_blk++; |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
288 ]dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
289 define([$1_IDX], eval($1_IDX + 1))dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
290 ifelse($1_IDX, $1_CNT, |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
291 [ sh_stext_set_style(obj->$1, obj->$1_style_blks, ]$1_CNT[); |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
292 ])dnl |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
293 ]) |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
294 |
63 | 295 define([SETUP_VARS],[divert([-1]) |
64 | 296 define([SIMPORT],[IMPORT(]QUOTE($[]1)[,[S_])]) |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
297 DECLARE_EMPTIES |
64 | 298 SIMPORT([ADD_LINEAR_PAINT]) |
299 SIMPORT([ADD_RADIAL_PAINT]) | |
300 SIMPORT([COLOR_STOP]) | |
78 | 301 SIMPORT([REF_STOPS_RADIAL]) |
302 SIMPORT([REF_STOPS_LINEAR]) | |
64 | 303 SIMPORT([ADD_PATH],) |
304 SIMPORT([ADD_RECT]) | |
305 SIMPORT([ADD_COORD]) | |
83 | 306 SIMPORT([ADD_TEXT]) |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
307 SIMPORT([ADD_STEXT]) |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
308 SIMPORT([ADD_IMAGE]) |
278
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
309 SIMPORT([PANGO_BEGIN_TEXT]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
310 SIMPORT([PANGO_END_TEXT]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
311 SIMPORT([PANGO_SIZE]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
312 SIMPORT([PANGO_WEIGHT]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
313 SIMPORT([PANGO_FAMILY]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
314 SIMPORT([PANGO_STYLE]) |
64 | 315 SIMPORT([FILL_SHAPE]) |
316 SIMPORT([STROKE_SHAPE]) | |
317 SIMPORT([FILL_SHAPE_WITH_PAINT]) | |
318 SIMPORT([STROKE_SHAPE_WITH_PAINT]) | |
81 | 319 SIMPORT([STROKE_WIDTH]) |
320 SIMPORT([GROUP_HIDE]) | |
321 SIMPORT([RECT_HIDE]) | |
322 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
|
323 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
|
324 SIMPORT([COORD_MATRIX]) |
100
1a1dda98730c
Fix the bug of order of cross & inner product of vectors
Thinker K.F. Li <thinker@branda.to>
parents:
85
diff
changeset
|
325 SIMPORT([SHAPE_TRANSLATE]) |
85
9b4a02bcaeb1
matrix() function in transform attribute of group and shapes
Thinker K.F. Li <thinker@branda.to>
parents:
84
diff
changeset
|
326 SIMPORT([SHAPE_MATRIX]) |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
327 SIMPORT([STYLE_BLOCK]) |
63 | 328 divert[]]) |
329 | |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
330 dnl -------------------- Clear Member Variables -------------------- |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
331 define([F_ADD_LINEAR_PAINT],[[ |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
332 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
|
333 free(stops); |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
334 rdman_paint_free(rdman, obj->$1); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
335 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
336 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
337 define([F_ADD_RADIAL_PAINT],[[ |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
338 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
|
339 free(stops); |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
340 rdman_paint_free(rdman, obj->$1); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
341 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
342 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
343 define([F_ADD_PATH],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
344 rdman_shape_free(rdman, obj->$1); |
83 | 345 ]]) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
346 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
347 define([F_ADD_RECT],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
348 rdman_shape_free(rdman, obj->$1); |
83 | 349 ]]) |
350 | |
351 define([F_ADD_TEXT],[[ | |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
352 rdman_shape_free(rdman, obj->$1); |
83 | 353 ]]) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
354 |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
355 define([F_ADD_IMAGE],[[ |
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
356 rdman_shape_free(rdman, obj->$1); |
356
3e84458968ec
Move mb_img_data_t out from argument list of rdman_shape_image_new().
Thinker K.F. Li <thinker@branda.to>
parents:
349
diff
changeset
|
357 rdman_paint_free(rdman, obj->$1_paint_img); |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
358 ]]) |
278
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
359 define([F_PANGO_BEGIN_TEXT],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
360 rdman_shape_free(rdman, obj->$1); |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
361 ]]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
362 define([F_PANGO_SIZE],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
363 ]]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
364 define([F_PANGO_STYLE],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
365 ]]) |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
366 define([F_PANGO_WEIGHT],[[ |
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
367 ]]) |
260
29acbd8a0dd0
Integrate sh_image with svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
257
diff
changeset
|
368 |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
369 define([F_FILL_SHAPE],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
370 rdman_paint_free(rdman, obj->$1_fill); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
371 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
372 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
373 define([F_STROKE_SHAPE],[[ |
159
b90abd31a281
Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents:
154
diff
changeset
|
374 rdman_paint_free(rdman, obj->$1_stroke); |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
375 ]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
376 |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
377 define([F_ADD_STEXT],[[ |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
378 rdman_shape_free(rdman, obj->$1); |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
379 ]]) |
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
380 |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
381 define([CLEAR_VARS],[divert([-1]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
382 define([FIMPORT],[IMPORT(]QUOTE($[]1)[,[F_])]) |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
383 DECLARE_EMPTIES |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
384 FIMPORT([ADD_LINEAR_PAINT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
385 FIMPORT([ADD_RADIAL_PAINT]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
386 FIMPORT([ADD_PATH],) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
387 FIMPORT([ADD_RECT]) |
83 | 388 FIMPORT([ADD_TEXT]) |
349
700954870cee
Free sh_image_t & mb_img_data_t objects when free a sprite.
Thinker K.F. Li <thinker@branda.to>
parents:
333
diff
changeset
|
389 FIMPORT([ADD_IMAGE]) |
278
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
390 FIMPORT([PANGO_BEGIN_TEXT]) |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
391 FIMPORT([FILL_SHAPE]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
392 FIMPORT([STROKE_SHAPE]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
393 divert[]]) |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
394 |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
395 dnl -------------------- Macro to Reverse Calling -------------------- |
154 | 396 define([REVERSE_VARS],[divert([-1]) |
397 define([__REV_VAR],[]) | |
398 define([PUSH_REV], [ | |
399 pushdef([__REV_VAR]) | |
400 define([__REV_VAR], ]QUOTE(QUOTE($[]1))[)]) | |
401 define([POP_ALL_REV], [dnl | |
402 ifelse(__REV_VAR, [], ,[UNQUOTE(__REV_VAR)[]dnl | |
403 popdef([__REV_VAR])[]POP_ALL_REV[]])]) | |
404 define([RIMPORT], [ | |
405 define(]QUOTE($[]1)[, | |
406 [PUSH_REV(]]QUOTE(QUOTE($[]1))[[(]QUOTE($[]@)[))]) | |
407 ]) | |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
408 DECLARE_EMPTIES |
154 | 409 RIMPORT([ADD_LINEAR_PAINT]) |
410 RIMPORT([ADD_RADIAL_PAINT]) | |
411 RIMPORT([COLOR_STOP]) | |
412 RIMPORT([REF_STOPS_RADIAL]) | |
413 RIMPORT([REF_STOPS_LINEAR]) | |
414 RIMPORT([ADD_PATH]) | |
415 RIMPORT([ADD_RECT]) | |
416 RIMPORT([ADD_COORD]) | |
417 RIMPORT([ADD_TEXT]) | |
349
700954870cee
Free sh_image_t & mb_img_data_t objects when free a sprite.
Thinker K.F. Li <thinker@branda.to>
parents:
333
diff
changeset
|
418 RIMPORT([ADD_IMAGE]) |
278
a90fd749af82
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents:
244
diff
changeset
|
419 RIMPORT([PANGO_BEGIN_TEXT]) |
154 | 420 RIMPORT([FILL_SHAPE]) |
421 RIMPORT([STROKE_SHAPE]) | |
422 RIMPORT([FILL_SHAPE_WITH_PAINT]) | |
423 RIMPORT([STROKE_SHAPE_WITH_PAINT]) | |
424 RIMPORT([STROKE_WIDTH]) | |
425 RIMPORT([GROUP_HIDE]) | |
426 RIMPORT([RECT_HIDE]) | |
427 RIMPORT([PATH_HIDE]) | |
428 RIMPORT([COORD_TRANSLATE]) | |
429 RIMPORT([COORD_MATRIX]) | |
430 RIMPORT([SHAPE_TRANSLATE]) | |
431 RIMPORT([SHAPE_MATRIX]) | |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
432 divert[]dnl |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
433 ]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
434 |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
435 dnl -------------------- Define Symbol Table -------------------- |
296
2e97e8082d83
* Fix the symbol definition code which does not assume the id is the same as the mbname.
wycc
parents:
280
diff
changeset
|
436 define([Y_ADD_SYMBOL],[[{"$2", MB_SPRITE_OFFSET($1)},]]) |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
437 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
438 define([DECLARE_SYMS], [divert([-1]) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
439 define([YIMPORT],[IMPORT(]QUOTE($[]1)[,[Y_])]) |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
440 DECLARE_EMPTIES |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
441 YIMPORT([ADD_SYMBOL]) |
154 | 442 divert[]dnl |
443 ]) | |
444 | |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
445 define([SC_SCENE], [[static const int scene_$1[] = {] |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
446 foreach([GROUP_NAME], ($2), [[ MB_SPRITE_OFFSET(]GROUP_NAME[), |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
447 ]])dnl |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
448 [ 0 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
449 }; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
450 ]]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
451 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
452 define([DEFINE_SCENES], [divert([-1]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
453 define([SCIMPORT],[IMPORT(]QUOTE($[]1)[,[SC_])]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
454 DECLARE_EMPTIES |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
455 SCIMPORT([SCENE]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
456 divert[]dnl |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
457 ]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
458 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
459 define([SCA_SCENE], [[ scene_$1, |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
460 ]]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
461 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
462 define([DEFINE_SCENES_ARRAY], [divert([-1]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
463 define([SCAIMPORT],[IMPORT(]QUOTE($[]1)[,[SCA_])]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
464 DECLARE_EMPTIES |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
465 SCAIMPORT([SCENE]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
466 divert[]dnl |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
467 ]) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
468 |
431
bf1addb037b7
Add -s option to svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
356
diff
changeset
|
469 dnl -------------------- C Template -------------------- |
63 | 470 define([MADBUTTERFLY],[dnl |
471 [#include <stdio.h> | |
69
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
472 #include <stdlib.h> |
a6150b4e0667
Fix bug of newing linear & radial paints
Thinker K.F. Li <thinker@branda.to>
parents:
68
diff
changeset
|
473 #include <string.h> |
186
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
159
diff
changeset
|
474 #include <mb_types.h> |
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
159
diff
changeset
|
475 #include <mb_redraw_man.h> |
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
159
diff
changeset
|
476 #include <mb_shapes.h> |
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
159
diff
changeset
|
477 #include <mb_paint.h> |
1051
8679b03f72e8
Move declaration about sprite to a separated header file.
Thinker K.F. Li <thinker@codemud.net>
parents:
458
diff
changeset
|
478 #include <mb_sprite.h> |
63 | 479 #include "$1.h" |
480 | |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
481 #ifdef MB_SPRITE_OFFSET |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
482 #undef MB_SPRITE_OFFSET |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
483 #endif |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
484 #define MB_SPRITE_OFFSET(x) ((int)&((($1_t *)0)->x)) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
485 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
486 #ifndef MB_LSYM_GET_OBJ_WITH_NAME |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
487 #define MB_LSYM_GET_OBJ_WITH_NAME |
213
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
488 |
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
489 #define MB_SPRITE_OFF_2_PTR(x, off) (((void *)(x)) + (off)) |
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
490 |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
491 static |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
492 mb_obj_t *mb_lsym_get_obj_with_name(mb_sprite_lsym_t *lsym, const char *sym) { |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
493 int i; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
494 |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
495 for(i = 0; i < lsym->num_entries; i++) { |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
496 if(strcmp(lsym->entries[i].sym, sym) != 0) |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
497 continue; |
213
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
498 return *(mb_obj_t **)MB_SPRITE_OFF_2_PTR(lsym, |
a0a3196b1a05
Refactory pointer computation into a macro.
Thinker K.F. Li <thinker@branda.to>
parents:
212
diff
changeset
|
499 lsym->entries[i].offset); |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
500 } |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
501 return NULL; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
502 } |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
503 #endif /* MB_LSYM_GET_OBJ_WITH_NAME */ |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
504 |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
505 static |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
506 mb_sprite_lsym_entry_t $1_symbols[] = {]DECLARE_SYMS |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
507 $2[ |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
508 }; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
509 |
333
bdf36a26e420
Make generated code clean.
Thinker K.F. Li <thinker@branda.to>
parents:
311
diff
changeset
|
510 ]DEFINE_SCENES[]dnl |
bdf36a26e420
Make generated code clean.
Thinker K.F. Li <thinker@branda.to>
parents:
311
diff
changeset
|
511 $2[]dnl |
bdf36a26e420
Make generated code clean.
Thinker K.F. Li <thinker@branda.to>
parents:
311
diff
changeset
|
512 DEFINE_SCENES_ARRAY[]dnl |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
513 static const int *$1_scenes[[]] = { |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
514 $2[]dnl |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
515 NULL |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
516 };[ |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
517 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
518 #define SCENES_NUM ((sizeof($1_scenes) / sizeof(const int *)) - 1) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
519 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
520 static |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
521 int $1_goto_scene($1_t *sprite, int scene_no) { |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
522 coord_t *coord; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
523 const int *p; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
524 const int *scene; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
525 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
526 if(scene_no >= SCENES_NUM || scene_no < -1) |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
527 return 1; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
528 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
529 if(sprite->last_scene) { |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
530 p = sprite->last_scene; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
531 while(*p != 0) { |
244
d36abace2ce4
Fix bug in *_goto_scene()
Thinker K.F. Li <thinker@branda.to>
parents:
241
diff
changeset
|
532 coord = *(coord_t **)MB_SPRITE_OFF_2_PTR(sprite, *p); |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
533 coord_hide(coord); |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
534 rdman_coord_changed(sprite->rdman, coord); |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
535 p++; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
536 } |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
537 } |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
538 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
539 if(scene_no == -1) { |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
540 sprite->last_scene = NULL; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
541 return 0; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
542 } |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
543 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
544 scene = $1_scenes[scene_no]; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
545 p = scene; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
546 while(*p != 0) { |
244
d36abace2ce4
Fix bug in *_goto_scene()
Thinker K.F. Li <thinker@branda.to>
parents:
241
diff
changeset
|
547 coord = *(coord_t **)MB_SPRITE_OFF_2_PTR(sprite, *p); |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
548 coord_show(coord); |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
549 rdman_coord_changed(sprite->rdman, coord); |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
550 p++; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
551 } |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
552 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
553 sprite->last_scene = scene; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
554 |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
555 return 0; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
556 } |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
557 |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
558 void $1_free($1_t *); |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
559 |
130
3a4d6179e6a9
change mb_c_source.m4 and mb_c_header.m4 to specify parent for SVG object
Thinker K.F. Li <thinker@branda.to>
parents:
113
diff
changeset
|
560 $1_t *$1_new(redraw_man_t *rdman, coord_t *parent_coord) { |
64 | 561 $1_t *obj; |
311 | 562 mb_img_ldr_t *img_ldr = NULL; |
64 | 563 grad_stop_t *stops = NULL;]DECLARE_VARS |
63 | 564 $2[]dnl |
565 [ | |
311 | 566 img_ldr = rdman_img_ldr(rdman); |
63 | 567 obj = ($1_t *)malloc(sizeof($1_t)); |
568 if(obj == NULL) return NULL; | |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
569 |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
570 obj->lsym.sprite.free = (void (*)(mb_sprite_t *))$1_free; |
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
571 obj->lsym.sprite.goto_scene = (int (*)(mb_sprite_t *, int))$1_goto_scene; |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
572 obj->lsym.sprite.get_obj_with_name = |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
573 (mb_obj_t *(*)(mb_sprite_t *, const char *))mb_lsym_get_obj_with_name; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
574 obj->lsym.num_entries = |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
575 sizeof($1_symbols) / sizeof(mb_sprite_lsym_entry_t); |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
576 obj->lsym.entries = $1_symbols; |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
577 |
154 | 578 obj->rdman = rdman; |
241
104d83378582
Add scene support in svg2code.py.
Thinker K.F. Li <thinker@branda.to>
parents:
213
diff
changeset
|
579 obj->last_scene = NULL; |
210
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
580 ]SETUP_VARS[ |
3fadd2f2742e
M4 macros to generate code for dynamic loading.
Thinker K.F. Li <thinker@branda.to>
parents:
197
diff
changeset
|
581 obj->root_coord = rdman_coord_new(rdman, parent_coord);] |
63 | 582 $2 |
583 [ return obj; | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
584 } |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
585 |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
586 void $1_free($1_t *obj) { |
68 | 587 grad_stop_t *stops = NULL; |
154 | 588 redraw_man_t *rdman; |
589 | |
590 rdman = obj->rdman; | |
591 ]REVERSE_VARS[]dnl | |
592 divert([-1])dnl | |
593 $2[]dnl | |
594 divert[]dnl | |
595 CLEAR_VARS[]dnl | |
596 POP_ALL_REV[ | |
597 rdman_coord_subtree_free(rdman, obj->root_coord); | |
67
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
598 free(obj); |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
599 } |
3f2872a1a2fe
clear objects in *_free() for generated code
Thinker K.F. Li <thinker@branda.to>
parents:
66
diff
changeset
|
600 ]dnl |
63 | 601 ]) |
602 divert[]dnl |