From: acspike Date: Wed, 10 May 2006 22:00:58 +0000 (+0000) Subject: whitespace X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=41bb1b5239778726ba20b392a70149d07790b41f;p=inkscape.git whitespace --- diff --git a/share/extensions/bezmisc.py b/share/extensions/bezmisc.py index e8cc8c2e9..f52fb6728 100755 --- a/share/extensions/bezmisc.py +++ b/share/extensions/bezmisc.py @@ -69,14 +69,14 @@ def linebezierintersect(((lx1,ly1),(lx2,ly2)),((bx0,by0),(bx1,by1),(bx2,by2),(bx c=coef1*cy-coef2*cx d=coef1*(y0-bb)-coef2*(x0-dd) - roots = rootWrapper(a,b,c,d) - retval = [] - for i in roots: - if type(i) is complex and i.imag==0: - i = i.real - if type(i) is not complex and 0<=i<=1: - retval.append(i) - return retval + roots = rootWrapper(a,b,c,d) + retval = [] + for i in roots: + if type(i) is complex and i.imag==0: + i = i.real + if type(i) is not complex and 0<=i<=1: + retval.append(i) + return retval def bezierpointatt(((bx0,by0),(bx1,by1),(bx2,by2),(bx3,by3)),t): ax,ay,bx,by,cx,cy,x0,y0=bezierparameterize(((bx0,by0),(bx1,by1),(bx2,by2),(bx3,by3))) diff --git a/share/extensions/summersnight.py b/share/extensions/summersnight.py index 6f39170eb..b94d2b9b7 100755 --- a/share/extensions/summersnight.py +++ b/share/extensions/summersnight.py @@ -39,49 +39,49 @@ def unittouu(string): return retval class Project(inkex.Effect): - def __init__(self): - inkex.Effect.__init__(self) - def effect(self): - if len(self.options.ids) < 2: - inkex.debug("Requires two selected paths. The second must be exctly four nodes long.") - exit() + def __init__(self): + inkex.Effect.__init__(self) + def effect(self): + if len(self.options.ids) < 2: + inkex.debug("Requires two selected paths. The second must be exctly four nodes long.") + exit() - #obj is selected second - obj = self.selected[self.options.ids[0]] - trafo = self.selected[self.options.ids[1]] - if obj.tagName == 'path' and trafo.tagName == 'path': - #distil trafo into four node points - trafo = cubicsuperpath.parsePath(trafo.attributes.getNamedItem('d').value) - trafo = [[Point(csp[1][0],csp[1][1]) for csp in subs] for subs in trafo][0][:4] + #obj is selected second + obj = self.selected[self.options.ids[0]] + trafo = self.selected[self.options.ids[1]] + if obj.tagName == 'path' and trafo.tagName == 'path': + #distil trafo into four node points + trafo = cubicsuperpath.parsePath(trafo.attributes.getNamedItem('d').value) + trafo = [[Point(csp[1][0],csp[1][1]) for csp in subs] for subs in trafo][0][:4] - #vectors pointing away from the trafo origin - self.t1 = Segment(trafo[0],trafo[1]) - self.t2 = Segment(trafo[1],trafo[2]) - self.t3 = Segment(trafo[3],trafo[2]) - self.t4 = Segment(trafo[0],trafo[3]) + #vectors pointing away from the trafo origin + self.t1 = Segment(trafo[0],trafo[1]) + self.t2 = Segment(trafo[1],trafo[2]) + self.t3 = Segment(trafo[3],trafo[2]) + self.t4 = Segment(trafo[0],trafo[3]) - #query inkscape about the bounding box of obj - self.q = {'x':0,'y':0,'width':0,'height':0} - file = self.args[-1] - id = self.options.ids[0] - for query in self.q.keys(): - f = os.popen("inkscape --query-%s --query-id=%s %s" % (query,id,file)) - self.q[query] = float(f.read()) - f.close() - #glean document height from the SVG - docheight = unittouu(inkex.xml.xpath.Evaluate('/svg/@height',self.document)[0].value) - #Flip inkscapes transposed renderer coords - self.q['y'] = docheight - self.q['y'] - self.q['height'] + #query inkscape about the bounding box of obj + self.q = {'x':0,'y':0,'width':0,'height':0} + file = self.args[-1] + id = self.options.ids[0] + for query in self.q.keys(): + f = os.popen("inkscape --query-%s --query-id=%s %s" % (query,id,file)) + self.q[query] = float(f.read()) + f.close() + #glean document height from the SVG + docheight = unittouu(inkex.xml.xpath.Evaluate('/svg/@height',self.document)[0].value) + #Flip inkscapes transposed renderer coords + self.q['y'] = docheight - self.q['y'] - self.q['height'] - #process path - d = obj.attributes.getNamedItem('d') - p = cubicsuperpath.parsePath(d.value) - for subs in p: - for csp in subs: - csp[0] = self.trafopoint(csp[0]) - csp[1] = self.trafopoint(csp[1]) - csp[2] = self.trafopoint(csp[2]) - d.value = cubicsuperpath.formatPath(p) + #process path + d = obj.attributes.getNamedItem('d') + p = cubicsuperpath.parsePath(d.value) + for subs in p: + for csp in subs: + csp[0] = self.trafopoint(csp[0]) + csp[1] = self.trafopoint(csp[1]) + csp[2] = self.trafopoint(csp[2]) + d.value = cubicsuperpath.formatPath(p) def trafopoint(self,(x,y)): #Transform algorithm thanks to Jose Hevia (freon) @@ -96,4 +96,4 @@ class Project(inkex.Effect): return [p['x'],p['y']] e = Project() -e.affect() +e.affect() \ No newline at end of file