comparison tools/mb_c_source.m4 @ 260:29acbd8a0dd0

Integrate sh_image with svg2code.py. diff -r e8a784a306d0 examples/svg2code_ex/dsc_3241.png Binary file examples/svg2code_ex/dsc_3241.png has changed diff -r e8a784a306d0 examples/svg2code_ex/dsc_3241.png Binary file examples/svg2code_ex/dsc_3241.png has changed
author Thinker K.F. Li <thinker@branda.to>
date Fri, 23 Jan 2009 23:00:23 +0800
parents 50d253d0fcba
children c8b6ca46950b
comparison
equal deleted inserted replaced
259:e8a784a306d0 260:29acbd8a0dd0
118 obj->$1 = rdman_shape_text_new(rdman, "$2", $3, $4, $5, 118 obj->$1 = rdman_shape_text_new(rdman, "$2", $3, $4, $5,
119 cairo_get_font_face(rdman->cr)); 119 cairo_get_font_face(rdman->cr));
120 rdman_add_shape(rdman, obj->$1, obj->$6); 120 rdman_add_shape(rdman, obj->$1, obj->$6);
121 ]]) 121 ]])
122 122
123 define([S_ADD_IMAGE],[[
124 obj->$1_img_data = MB_IMG_LDR_LOAD(img_ldr, "$2");
125 obj->$1 = rdman_shape_image_new(rdman, obj->$1_img_data,
126 $3, $4, $5, $6);
127 rdman_add_shape(rdman, obj->$1, obj->$7);
128 ]])
129
123 define([S_FILL_SHAPE_WITH_PAINT],[dnl 130 define([S_FILL_SHAPE_WITH_PAINT],[dnl
124 [ rdman_paint_fill(rdman, obj->$2, obj->$1); 131 [ rdman_paint_fill(rdman, obj->$2, obj->$1);
125 ]]) 132 ]])
126 133
127 define([S_STROKE_SHAPE_WITH_PAINT],[dnl 134 define([S_STROKE_SHAPE_WITH_PAINT],[dnl
202 SIMPORT([REF_STOPS_LINEAR]) 209 SIMPORT([REF_STOPS_LINEAR])
203 SIMPORT([ADD_PATH],) 210 SIMPORT([ADD_PATH],)
204 SIMPORT([ADD_RECT]) 211 SIMPORT([ADD_RECT])
205 SIMPORT([ADD_COORD]) 212 SIMPORT([ADD_COORD])
206 SIMPORT([ADD_TEXT]) 213 SIMPORT([ADD_TEXT])
214 SIMPORT([ADD_IMAGE])
207 SIMPORT([FILL_SHAPE]) 215 SIMPORT([FILL_SHAPE])
208 SIMPORT([STROKE_SHAPE]) 216 SIMPORT([STROKE_SHAPE])
209 SIMPORT([FILL_SHAPE_WITH_PAINT]) 217 SIMPORT([FILL_SHAPE_WITH_PAINT])
210 SIMPORT([STROKE_SHAPE_WITH_PAINT]) 218 SIMPORT([STROKE_SHAPE_WITH_PAINT])
211 SIMPORT([STROKE_WIDTH]) 219 SIMPORT([STROKE_WIDTH])
238 rdman_shape_free(rdman, obj->$1); 246 rdman_shape_free(rdman, obj->$1);
239 ]]) 247 ]])
240 248
241 define([F_ADD_TEXT],[[ 249 define([F_ADD_TEXT],[[
242 rdman_shape_free(rdman, obj->$1); 250 rdman_shape_free(rdman, obj->$1);
251 ]])
252
253 define([F_ADD_IMAGE],[[
254 rdman_shape_free(rdman, obj->$1);
255 MB_IMAGE_DATA_FREE(obj->$1_img_data);
243 ]]) 256 ]])
244 257
245 define([F_FILL_SHAPE],[[ 258 define([F_FILL_SHAPE],[[
246 rdman_paint_free(rdman, obj->$1_fill); 259 rdman_paint_free(rdman, obj->$1_fill);
247 ]]) 260 ]])
421 434
422 void $1_free($1_t *); 435 void $1_free($1_t *);
423 436
424 $1_t *$1_new(redraw_man_t *rdman, coord_t *parent_coord) { 437 $1_t *$1_new(redraw_man_t *rdman, coord_t *parent_coord) {
425 $1_t *obj; 438 $1_t *obj;
426 grad_stop_t *stops = NULL;]DECLARE_VARS 439 grad_stop_t *stops = NULL;
440 mb_img_ldr_t *img_ldr = NULL;]DECLARE_VARS
427 $2[]dnl 441 $2[]dnl
428 [ 442 [
443 img_ldr = rdman_img_ldr(rdman);
444
429 obj = ($1_t *)malloc(sizeof($1_t)); 445 obj = ($1_t *)malloc(sizeof($1_t));
430 if(obj == NULL) return NULL; 446 if(obj == NULL) return NULL;
431 447
432 obj->lsym.sprite.free = (void (*)(mb_sprite_t *))$1_free; 448 obj->lsym.sprite.free = (void (*)(mb_sprite_t *))$1_free;
433 obj->lsym.sprite.goto_scene = (int (*)(mb_sprite_t *, int))$1_goto_scene; 449 obj->lsym.sprite.goto_scene = (int (*)(mb_sprite_t *, int))$1_goto_scene;