summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c9c47dc)
raw | patch | inline | side by side (parent: c9c47dc)
author | acspike <acspike@users.sourceforge.net> | |
Mon, 30 Apr 2007 19:16:11 +0000 (19:16 +0000) | ||
committer | acspike <acspike@users.sourceforge.net> | |
Mon, 30 Apr 2007 19:16:11 +0000 (19:16 +0000) |
this is generally a good thing but might cause some differences in visual result, especially in any effect that used the implicit curveto conversion of the closing Z segments as a feature.
share/extensions/cubicsuperpath.py | patch | blob | history |
index cc59905abc03fd7a9e74db0b4a629474dc182c75..a151084eb39b41bcf4bb7a60aff430c8bd5072c9 100755 (executable)
import simplepath
from math import *
+class SuperSubpath(list):
+ def __init__(self, items=[]):
+ self.closed = False
+ list.__init__(self, items)
+ def close(self, state=True):
+ self.closed = state
+
def matprod(mlist):
prod=mlist[0]
for m in mlist[1:]:
for s in simplepath:
cmd, params = s
if cmd == 'M':
- if last:
- csp[subpath].append([lastctrl[:],last[:],last[:]])
subpath += 1
- csp.append([])
+ csp.append(SuperSubpath())
subpathstart = params[:]
last = params[:]
lastctrl = params[:]
lastctrl = arcp[-1][0]
csp[subpath]+=arcp[:-1]
elif cmd == 'Z':
- csp[subpath].append([lastctrl[:],last[:],last[:]])
+ csp[subpath].close()
last = subpathstart[:]
lastctrl = subpathstart[:]
- #append final superpoint
- csp[subpath].append([lastctrl[:],last[:],last[:]])
return csp
def unCubicSuperPath(csp):
a.append(['M',subpath[0][1][:]])
for i in range(1,len(subpath)):
a.append(['C',subpath[i-1][2][:] + subpath[i][0][:] + subpath[i][1][:]])
+ try:
+ if subpath.closed:
+ a.append(['Z',[]])
+ except:
+ pass
return a
def parsePath(d):