comparison tools/svg2code.py @ 300:1b69da2494e9

Use the opacity of the style to overwrite the default opacity property of the node itself.
author wycc
date Sun, 15 Feb 2009 08:21:37 +0800
parents 2e97e8082d83
children c981e561ac37
comparison
equal deleted inserted replaced
299:5bf503270419 300:1b69da2494e9
132 prop_map = get_style_map(style_str) 132 prop_map = get_style_map(style_str)
133 133
134 try: 134 try:
135 opacity = float(node.getAttribute('opacity')) 135 opacity = float(node.getAttribute('opacity'))
136 except: 136 except:
137 opacity = 0.5 137 opacity = 1.0
138 pass 138 pass
139
140 try:
141 opacity = float(prop_map['opacity'])
142 except:
143 pass
144
145 print "# opacity of %s is %g" % (node_id, opacity)
139 146
140 if prop_map.has_key('fill'): 147 if prop_map.has_key('fill'):
141 fill = prop_map['fill'].strip() 148 fill = prop_map['fill'].strip()
142 if fill.startswith('#') and len(fill) == 7: 149 if fill.startswith('#') and len(fill) == 7:
143 r, g, b = trans_color(fill) 150 r, g, b = trans_color(fill)