Mercurial > hg > dmlib
comparison svg2qd.py @ 254:9c33e11c3d39
C nodes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 09 Oct 2012 21:49:47 +0300 |
parents | 98483680ea0f |
children | cac0b6cfebb4 |
comparison
equal
deleted
inserted
replaced
253:61eb5fb4a5e6 | 254:9c33e11c3d39 |
---|---|
11 def printVertex(v) : | 11 def printVertex(v) : |
12 if type(v) is list : | 12 if type(v) is list : |
13 return "{:.2f},{:.2f},{:.2f}".format(v[0], v[1], v[2]) | 13 return "{:.2f},{:.2f},{:.2f}".format(v[0], v[1], v[2]) |
14 else : | 14 else : |
15 return v | 15 return v |
16 | |
16 | 17 |
17 def getTransform(elem) : | 18 def getTransform(elem) : |
18 if "transform" in elem.attrib : | 19 if "transform" in elem.attrib : |
19 ntrans = elem.attrib["transform"] | 20 ntrans = elem.attrib["transform"] |
20 tmatch = re.compile(r"translate\((.*?)\)", re.IGNORECASE) | 21 tmatch = re.compile(r"translate\((.*?)\)", re.IGNORECASE) |
56 | 57 |
57 out = "" | 58 out = "" |
58 vertices = [] | 59 vertices = [] |
59 type = "" | 60 type = "" |
60 for elem in path.attrib["d"].split(" ") : | 61 for elem in path.attrib["d"].split(" ") : |
61 if elem == "m" or elem == "M": | 62 if elem == "m" or elem == "M" or elem == "c": |
62 out += printVertices(type, vertices, width) | 63 out += printVertices(type, vertices, width) |
63 type = elem | 64 type = elem |
64 elif elem == "z" : | 65 elif elem == "z" : |
65 vertices.append("Z") | 66 vertices.append("Z") |
66 else : | 67 else : |