Code

Fix function plotter for the most common case where there are no transforms applied...
[inkscape.git] / share / extensions / cubicsuperpath.py
index a151084eb39b41bcf4bb7a60aff430c8bd5072c9..cc59905abc03fd7a9e74db0b4a629474dc182c75 100755 (executable)
@@ -22,13 +22,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 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:]:
@@ -111,8 +104,10 @@ def CubicSuperPath(simplepath):
     for s in simplepath:
         cmd, params = s        
         if cmd == 'M':
+            if last:
+                csp[subpath].append([lastctrl[:],last[:],last[:]])
             subpath += 1
-            csp.append(SuperSubpath())
+            csp.append([])
             subpathstart =  params[:]
             last = params[:]
             lastctrl = params[:]
@@ -146,9 +141,11 @@ def CubicSuperPath(simplepath):
             lastctrl = arcp[-1][0]
             csp[subpath]+=arcp[:-1]
         elif cmd == 'Z':
-            csp[subpath].close()
+            csp[subpath].append([lastctrl[:],last[:],last[:]])
             last = subpathstart[:]
             lastctrl = subpathstart[:]
+    #append final superpoint
+    csp[subpath].append([lastctrl[:],last[:],last[:]])
     return csp    
 
 def unCubicSuperPath(csp):
@@ -158,11 +155,6 @@ 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):