diff tools/svg2code.py @ 64:c668c5c3ceae

M4 macro for C binding.
author Thinker K.F. Li <thinker@branda.to>
date Wed, 13 Aug 2008 02:07:40 +0800
parents f4b792afa74e
children 35c2b7ba140b
line wrap: on
line diff
--- a/tools/svg2code.py	Tue Aug 12 14:21:09 2008 +0800
+++ b/tools/svg2code.py	Wed Aug 13 02:07:40 2008 +0800
@@ -6,6 +6,7 @@
 xlinkns='http://www.w3.org/1999/xlink'
 
 def translate_stops(parent, codefo, parent_id):
+    stops = []
     for node in parent.childNodes:
         if node.localName == 'stop' and node.namespaceURI == svgns:
             style = node.getAttribute('style')
@@ -26,10 +27,11 @@
 
             opacity = style_map['stop-opacity']
             offset = node.getAttribute('offset')
-            print >> codefo, '[COLOR_STOP([%s], %f, %f, %f, %f, %f)],' % (
-                parent_id, r, g, b, float(opacity), float(offset))
+            stops.append('[COLOR_STOP([%s], %f, %f, %f, %f, %f)]' % (
+                parent_id, r, g, b, float(opacity), float(offset)))
             pass
         pass
+    print >> codefo, '%sdnl' % (', '.join(stops))
     pass
 
 def translate_linearGradient(linear, codefo, doc):