def _load_image_data(self, file_, source):
"""Read image settings from SVG tags"""
tree = etree.parse(source, self.parser)
root = tree.getroot()
xhtml = "{%s}" % root.nsmap[None]
imagedata = ImageData(file_, tree)
transform_tag = root.find(".//%s*[@id='transform']" % xhtml)
imagedata.set_transform(transform_tag)
background_tag = root.find(".//%s*[@id='background']" % xhtml)
imagedata.set_background(background_tag)
counter = count(1)
while True:
index = next(counter)
id_ = "color" + str(index)
tag = root.find(".//%s*[@id='%s']" % (xhtml, id_))
if tag is None:
break
imagedata.set_color(tag, id_)
return imagedata
评论列表
文章目录