From abb60b5ee0885e4e980bef9f4b47ba6addbe26d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20Lehmann?= Date: Tue, 31 Aug 2004 07:10:57 +0000 Subject: [PATCH] convert trafo into a deformer git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@1863 069f4177-920e-0410-937b-c2a4a81bcd90 --- pyx/canvas.py | 5 +---- pyx/trafo.py | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyx/canvas.py b/pyx/canvas.py index 95c0a59f..61975355 100644 --- a/pyx/canvas.py +++ b/pyx/canvas.py @@ -215,14 +215,11 @@ class _canvas(base.canvasitem): """ attrs = attr.mergeattrs(attrs) - attr.checkattrs(attrs, [deco.deco, deformer.deformer, style.fillstyle, style.strokestyle, trafo.trafo_pt]) + attr.checkattrs(attrs, [deco.deco, deformer.deformer, style.fillstyle, style.strokestyle]) for adeformer in attr.getattrs(attrs, [deformer.deformer]): path = adeformer.deform(path) - for t in attr.getattrs(attrs, [trafo.trafo_pt]): - path = path.transformed(t) - styles = attr.getattrs(attrs, [style.fillstyle, style.strokestyle]) dp = deco.decoratedpath(path, styles=styles) diff --git a/pyx/trafo.py b/pyx/trafo.py index fa965fcf..1d13e435 100755 --- a/pyx/trafo.py +++ b/pyx/trafo.py @@ -22,7 +22,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import math -import attr, base, unit +import attr, base, deformer, unit # some helper routines @@ -57,7 +57,7 @@ class UndefinedResultError(ArithmeticError): # trafo: affine transformations -class trafo_pt(base.canvasitem, attr.attr): +class trafo_pt(base.canvasitem, deformer.deformer): """affine transformation (coordinates in constructor in pts) @@ -132,6 +132,9 @@ class trafo_pt(base.canvasitem, attr.attr): tx, ty = self._apply(unit.topt(x), unit.topt(y)) return tx * unit.t_pt, ty * unit.t_pt + def deform(self, path): + return path.transformed(self) + def inverse(self): det = _det(self.matrix) # shouldn't be zero, but try: -- 2.11.4.GIT