Mercurial > MadButterfly
comparison tools/svg2code.py @ 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 |
---|---|
145 node_id, paint_id) | 145 node_id, paint_id) |
146 else: | 146 else: |
147 raise ValueError, '\'%s\' is an invalid value for stroke.' \ | 147 raise ValueError, '\'%s\' is an invalid value for stroke.' \ |
148 % (stroke) | 148 % (stroke) |
149 pass | 149 pass |
150 | |
151 if prop_map.has_key('stroke-width'): | |
152 stroke_width = float(prop_map['stroke-width']) | |
153 print >> codefo, 'STROKE_WIDTH([%s], %f)dnl' % ( | |
154 node_id, stroke_width) | |
155 pass | |
150 pass | 156 pass |
151 | 157 |
152 def translate_path(path, coord_id, codefo, doc): | 158 def translate_path(path, coord_id, codefo, doc): |
153 path_id = path.getAttribute('id') | 159 path_id = path.getAttribute('id') |
154 d = path.getAttribute('d') | 160 d = path.getAttribute('d') |
159 | 165 |
160 def translate_rect(rect, coord_id, codefo, doc): | 166 def translate_rect(rect, coord_id, codefo, doc): |
161 rect_id = rect.getAttribute('id') | 167 rect_id = rect.getAttribute('id') |
162 x = float(rect.getAttribute('x')) | 168 x = float(rect.getAttribute('x')) |
163 y = float(rect.getAttribute('y')) | 169 y = float(rect.getAttribute('y')) |
170 rx = 0.0 | |
171 if rect.hasAttribute('rx'): | |
172 rx = float(rect.getAttribute('rx')) | |
173 pass | |
174 ry = 0.0 | |
175 if rect.hasAttribute('ry'): | |
176 ry = float(rect.getAttribute('ry')) | |
177 pass | |
164 width = float(rect.getAttribute('width')) | 178 width = float(rect.getAttribute('width')) |
165 height = float(rect.getAttribute('height')) | 179 height = float(rect.getAttribute('height')) |
166 print >> codefo, 'dnl' | 180 print >> codefo, 'dnl' |
167 print >> codefo, 'ADD_RECT([%s], %f, %f, %f, %f, [%s])dnl' % ( | 181 print >> codefo, 'ADD_RECT([%s], %f, %f, %f, %f, %f, %f, [%s])dnl' % ( |
168 rect_id, x, y, width, height, coord_id) | 182 rect_id, x, y, width, height, rx, ry, coord_id) |
169 translate_style(rect, coord_id, codefo, doc) | 183 translate_style(rect, coord_id, codefo, doc) |
170 pass | 184 pass |
171 | 185 |
172 def translate_group(group, parent_id, codefo, doc): | 186 def translate_group(group, parent_id, codefo, doc): |
173 group_id = group.getAttribute('id') | 187 group_id = group.getAttribute('id') |