comparison tools/mb_c_source.m4 @ 80:e548221c04eb

svg2code.py support stroke
author Thinker K.F. Li <thinker@branda.to>
date Thu, 21 Aug 2008 00:27:36 +0800
parents 3645e29e4986
children 13fdf205047b
comparison
equal deleted inserted replaced
79:5bcb329a5157 80:e548221c04eb
39 define([ADD_COORD]) 39 define([ADD_COORD])
40 define([FILL_SHAPE]) 40 define([FILL_SHAPE])
41 define([STROKE_SHAPE]) 41 define([STROKE_SHAPE])
42 define([FILL_SHAPE_WITH_PAINT]) 42 define([FILL_SHAPE_WITH_PAINT])
43 define([STROKE_SHAPE_WITH_PAINT]) 43 define([STROKE_SHAPE_WITH_PAINT])
44 define([STROKE_WIDTH])
44 divert[]]) 45 divert[]])
45 46
46 define([S_ADD_LINEAR_PAINT],[ 47 define([S_ADD_LINEAR_PAINT],[
47 obj->$1 = paint_linear_new(rdman, $2, $3, $4, $5); 48 obj->$1 = paint_linear_new(rdman, $2, $3, $4, $5);
48 ifelse(COUNT($6),0,,[dnl 49 ifelse(COUNT($6),0,,[dnl
74 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops); 75 memcpy(stops, $2_stops, sizeof(grad_stop_t) * n_$2_stops);
75 paint_linear_stops(obj->$1, n_$2_stops, stops); 76 paint_linear_stops(obj->$1, n_$2_stops, stops);
76 ]]) 77 ]])
77 78
78 define([S_ADD_RECT],[[ 79 define([S_ADD_RECT],[[
79 obj->$1 = sh_rect_new($2, $3, $4, $5, 0, 0); 80 obj->$1 = sh_rect_new($2, $3, $4, $5, $6, $7);
80 rdman_add_shape(rdman, obj->$1, obj->$6); 81 rdman_add_shape(rdman, obj->$1, obj->$8);
81 ]]) 82 ]])
82 83
83 define([S_ADD_PATH],[[ 84 define([S_ADD_PATH],[[
84 obj->$1 = sh_path_new("$2"); 85 obj->$1 = sh_path_new("$2");
85 rdman_add_shape(rdman, obj->$1, obj->$3); 86 rdman_add_shape(rdman, obj->$1, obj->$3);
103 ]]) 104 ]])
104 105
105 define([S_STROKE_SHAPE],[dnl 106 define([S_STROKE_SHAPE],[dnl
106 [ obj->$1_stroke = paint_color_new(rdman, $2, $3, $4, $5); 107 [ obj->$1_stroke = paint_color_new(rdman, $2, $3, $4, $5);
107 rdman_paint_stroke(rdman, obj->$1_stroke, obj->$1); 108 rdman_paint_stroke(rdman, obj->$1_stroke, obj->$1);
109 ]])
110
111 define([S_STROKE_WIDTH],[dnl
112 [ obj->$1->stroke_width = $2;
108 ]]) 113 ]])
109 114
110 define([SETUP_VARS],[divert([-1]) 115 define([SETUP_VARS],[divert([-1])
111 define([SIMPORT],[IMPORT(]QUOTE($[]1)[,[S_])]) 116 define([SIMPORT],[IMPORT(]QUOTE($[]1)[,[S_])])
112 SIMPORT([ADD_LINEAR_PAINT]) 117 SIMPORT([ADD_LINEAR_PAINT])
119 SIMPORT([ADD_COORD]) 124 SIMPORT([ADD_COORD])
120 SIMPORT([FILL_SHAPE]) 125 SIMPORT([FILL_SHAPE])
121 SIMPORT([STROKE_SHAPE]) 126 SIMPORT([STROKE_SHAPE])
122 SIMPORT([FILL_SHAPE_WITH_PAINT]) 127 SIMPORT([FILL_SHAPE_WITH_PAINT])
123 SIMPORT([STROKE_SHAPE_WITH_PAINT]) 128 SIMPORT([STROKE_SHAPE_WITH_PAINT])
129 SIMPORT([STROKE_WIDTH],)
124 divert[]]) 130 divert[]])
125 131
126 define([F_ADD_LINEAR_PAINT],[[ 132 define([F_ADD_LINEAR_PAINT],[[
127 stops = paint_linear_stops(obj->$1, 0, NULL); 133 stops = paint_linear_stops(obj->$1, 0, NULL);
128 free(stops); 134 free(stops);
163 define([ADD_COORD]) 169 define([ADD_COORD])
164 FIMPORT([FILL_SHAPE]) 170 FIMPORT([FILL_SHAPE])
165 FIMPORT([STROKE_SHAPE]) 171 FIMPORT([STROKE_SHAPE])
166 define([FILL_SHAPE_WITH_PAINT]) 172 define([FILL_SHAPE_WITH_PAINT])
167 define([STROKE_SHAPE_WITH_PAINT]) 173 define([STROKE_SHAPE_WITH_PAINT])
174 define([STROKE_WIDTH])
168 divert[]]) 175 divert[]])
169 176
170 define([MADBUTTERFLY],[dnl 177 define([MADBUTTERFLY],[dnl
171 [#include <stdio.h> 178 [#include <stdio.h>
172 #include <stdlib.h> 179 #include <stdlib.h>