From a6d9e9435d6fc121b19f01123cddab8dcb7193c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Fri, 26 Oct 2012 09:02:28 +0000 Subject: [PATCH] further fixes to the drawing and clipping of the gradient style git-svn-id: http://svn.code.sf.net/p/pyx/code/trunk/pyx@3335 a4f5e268-e194-4f32-bce1-d30804cbbcc5 --- CHANGES | 2 +- pyx/graph/style.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 9662dc5c..e8c3cf57 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,6 @@ 0.12.1 (2012/??/??): - graph styles: - - fix clipping of gradient style + - fix drawing and clipping of gradient style 0.12 (2012/10/17): - canvas module: diff --git a/pyx/graph/style.py b/pyx/graph/style.py index 13c794d7..6b8d23a7 100644 --- a/pyx/graph/style.py +++ b/pyx/graph/style.py @@ -2133,9 +2133,7 @@ class gradient(_style): llx_pt -= 0.5*graph.width_pt urx_pt += 0.5*graph.width_pt - c = canvas.canvas([canvas.clip(path.rect_pt(llx_pt, lly_pt, urx_pt, ury_pt))]) - - graph.layer("filldata").stroke(path.rect_pt(llx_pt, lly_pt, urx_pt, ury_pt), [color.rgb.red]) + c = canvas.canvas([canvas.clip(path.rect_pt(llx_pt, lly_pt, urx_pt-llx_pt, ury_pt-lly_pt))]) if graph.direction == "horizontal": add_pt = (urx_pt-llx_pt)*0.5/(self.resolution-1) @@ -2146,7 +2144,10 @@ class gradient(_style): lly_pt -= add_pt ury_pt += add_pt - t = trafo.trafo_pt(((0, urx_pt-llx_pt), (ury_pt-lly_pt, 0)), (llx_pt, lly_pt)) + if graph.direction == "horizontal": + t = trafo.trafo_pt(((urx_pt-llx_pt,0 ), (0, ury_pt-lly_pt)), (llx_pt, lly_pt)) + else: + t = trafo.trafo_pt(((0, urx_pt-llx_pt), (ury_pt-lly_pt, 0)), (llx_pt, lly_pt)) b = bitmap.bitmap_trafo(t, i) c.insert(b) -- 2.11.4.GIT