From 60bc46d07e8149b82248cef5a85569f213ebdd37 Mon Sep 17 00:00:00 2001 From: Adam Mayer Date: Fri, 22 Dec 2017 11:48:24 -0500 Subject: [PATCH] clipping implemented --- apple410/plot_to_cairo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apple410/plot_to_cairo.py b/apple410/plot_to_cairo.py index 3d50723..149ff0d 100755 --- a/apple410/plot_to_cairo.py +++ b/apple410/plot_to_cairo.py @@ -32,8 +32,6 @@ class CairoPlotter: self.window = (0, 0, W, H) self.text_theta = 0 self.text_size = 1 - #self.clip = None - #self.clipno = 0 self.update_ctm() # A quick review of coordinate systems: @@ -49,9 +47,11 @@ class CairoPlotter: y0 = v[1] - w[1]*ys window_m = cairo.Matrix(xx=xs, yy=ys, x0=x0, y0=y0) pn_to_cn = cairo.Matrix(yy=-1.0, y0=H) - #self.context.set_matrix(pn_to_cn.multiply(window_m)) self.context.set_matrix(window_m.multiply(pn_to_cn)) self.context.set_line_width(LW) + self.context.reset_clip() + self.context.rectangle(w[0],w[1],w[2]-w[0],w[3]-w[1]) + self.context.clip() def update_font(self): m = cairo.Matrix(xx=self.text_size, yy=-self.text_size)