[Bf-committers] paths_svg2obj.py
Mathias Panzenböck
grosser.meister.morti at gmx.net
Mon Dec 24 00:12:15 CET 2007
I imporved the curve_FILL function a bit so it works with my SVGs (produced by inkscape):
# added this function:
def getStyle(proprietes):
style = {}
for item in proprietes['style'].split(';'):
item = item.strip()
if item:
key, value = item.split(':',1)
style[key.rstrip()] = value.lstrip()
return style
def curve_FILL(Courbe,proprietes):
global USE_COLORS
for n in proprietes['n']:
pr = getStyle(proprietes)
fill = pr.get('fill','none')
if n in Courbe and fill != 'none':
Courbe[n].fill=1
if USE_COLORS:
# TODO: handle fill-opacity
if fill.startswith('#'):
r, g, b = fill[1:3], fill[3:5], fill[5:7]
Courbe[n].color=[
int(r,16),int(g,16),int(b,16)]
Courbe[n].mat=1
else:
# TODO: import gradients
color=SVGCOLORNAMELIST.get(fill,None)
if color is not None:
Courbe[n].color=color
Courbe[n].mat=1
More information about the Bf-committers
mailing list