changeset 86:7d0580f89468

Fix bug of dealing matrix().
author Thinker K.F. Li <thinker@branda.to>
date Fri, 22 Aug 2008 16:14:53 +0800
parents 9b4a02bcaeb1
children 8dfebf76cb59
files src/shape_path.c tools/svg2code.py
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/shape_path.c	Fri Aug 22 15:47:03 2008 +0800
+++ b/src/shape_path.c	Fri Aug 22 16:14:53 2008 +0800
@@ -46,6 +46,10 @@
     free(path);
 }
 
+/*! \brief Count number of arguments.
+ *
+ * \todo Notify programmers that syntax or value error of path data.
+ */
 static int sh_path_cmd_arg_cnt(char *data, int *cmd_cntp, int *arg_cntp) {
     char *p, *old;
     int cmd_cnt, arg_cnt;
--- a/tools/svg2code.py	Fri Aug 22 15:47:03 2008 +0800
+++ b/tools/svg2code.py	Fri Aug 22 16:14:53 2008 +0800
@@ -24,6 +24,10 @@
                 r = float(int(color[1:3], 16)) / 255.0
                 g = float(int(color[3:5], 16)) / 255.0
                 b = float(int(color[5:7], 16)) / 255.0
+            elif color.lower() == 'white':
+                r, g, b = 1, 1, 1
+            elif color.lower() == 'black':
+                r, g, b = 0, 0, 0
             else:
                 mo = re_rgb.match(color)
                 if mo:
@@ -34,7 +38,11 @@
                     raise ValueError, '\'%s\' is invalid color value.' % (color)
                 pass
 
-            opacity = style_map['stop-opacity']
+            try:
+                opacity = style_map['stop-opacity']
+            except:
+                opacity = 1
+                pass
             offset = node.getAttribute('offset')
             stops.append('[COLOR_STOP([%s], %f, %f, %f, %f, %f)]' % (
                 parent_id, r, g, b, float(opacity), float(offset)))
@@ -136,6 +144,8 @@
             paint_id = fill[5:-1]
             print >> codefo, 'FILL_SHAPE_WITH_PAINT([%s], [%s])dnl' % (
                 node_id, paint_id)
+        elif fill.lower() == 'none':
+            pass
         else:
             raise ValueError, '\'%s\' is an invalid value for fill.' % (fill)
         pass
@@ -286,7 +296,6 @@
     if not mo:
         return
     name = mo.group(1)
-    print name
     if name == 'translate':
         mo = reo_translate.match(transform)
         if mo: