changeset 313:5737548e922f

Fix bug that svg2code.py handle fill & stroke opacity in a wrong way.
author Thinker K.F. Li <thinker@branda.to>
date Thu, 05 Mar 2009 00:54:42 +0800
parents e4abe8e149de
children 6c350fc92ae3
files tools/svg2code.py
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tools/svg2code.py	Sun Feb 22 14:22:56 2009 +0800
+++ b/tools/svg2code.py	Thu Mar 05 00:54:42 2009 +0800
@@ -130,11 +130,14 @@
     except:
         style_str = node.getAttribute('style')
         prop_map = get_style_map(style_str)
-
-    try:
+        pass
+    
+    if node.hasAttribute('fill-opacity'):
+        opacity = float(node.getAttribute('fill-opacity'))
+    elif node.hasAttribute('opacity'):
         opacity = float(node.getAttribute('opacity'))
-    except:
-        opacity = 1.0
+    else:
+        opacity = 1
         pass
 
     try:
@@ -160,9 +163,11 @@
             raise ValueError, '\'%s\' is an invalid value for fill.' % (fill)
         pass
 
-    try:
+    if node.hasAttribute('stroke-opacity'):
         stroke_opacity = float(node.getAttribute('stroke-opacity'))
-    except:
+    elif node.hasAttribute('opacity'):
+        stroke_opacity = float(node.getAttribute('opacity'))
+    else:
         stroke_opacity = 1.0
         pass