samplify.py revision caaab6103a6a927a301e2fb28c45021f44587e6e
# This script produces a sample SVG demonstrating all filters in a filters file.
#
# It takes two inputs: the sample file with the object that will be cloned and filtered, and
# the file with filters (such as Inkscape's share/filters/filters.svg).
#
# Run it thus:
#
# python samplify.py sample.svg filters.svg > out.svg
#
# It requires 'inkscape' in executable path for dimension queries.
# namespaces we need to be aware of
NSS = {
u'sodipodi' :u'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd',
u'cc' :u'http://web.resource.org/cc/',
u'svg' :u'http://www.w3.org/2000/svg',
u'dc' :u'http://purl.org/dc/elements/1.1/',
u'rdf' :u'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
u'inkscape' :u'http://www.inkscape.org/namespaces/inkscape',
u'xlink' :u'http://www.w3.org/1999/xlink',
u'xml' :u'http://www.w3.org/XML/1998/namespace'
}
# helper function to add namespace URI to a name
return val
# attributes and elements we will use, prepared with their namespace
menus = []
menu_shifts = {}
for m in menus:
menu_shifts[m] = 0
#print menus
def copy_element (a):
for i in a.items():
return b
#query inkscape about the bounding box of obj
q = {'x':0,'y':0,'width':0,'height':0}
f.close()
# add some margins
q['width'] = q['width'] * 1.3
q['height'] = q['height'] * 1.3
#print q
continue
clone.attrib["transform"] = 'translate('+str( q['width'] * menu_shifts[menu] )+', '+str( q['height'] * (menus.index(menu) + 1) )+')'
break