From: Antonio Ospite Date: Fri, 12 Jun 2015 20:14:06 +0000 (+0200) Subject: Diagram.py: support drawing a rectangle rotated on its bottom-left corner X-Git-Url: https://git.ao2.it/experiments/RadialSymmetry.git/commitdiff_plain/d61a76f33cbf0f18f63e0b365e9d7f0ba6732323?ds=inline;hp=16dd2ae0d430a47d3fef03b2b2d5401487385f4e Diagram.py: support drawing a rectangle rotated on its bottom-left corner --- diff --git a/Diagram.py b/Diagram.py index 8d958f9..ff5a500 100755 --- a/Diagram.py +++ b/Diagram.py @@ -186,12 +186,13 @@ class Diagram(object): cr.restore() - def draw_rect(self, x, y, width, height, fill=True, fill_color=[1, 1, 1, 0.8], + def draw_rect(self, x, y, width, height, theta=0, fill=True, fill_color=[1, 1, 1, 0.8], stroke=False, stroke_color=[0, 0, 0, 0.5]): cr = self.cr cr.save() cr.translate(x, y) + cr.rotate(theta) if fill: cr.rectangle(0, 0, width, height) @@ -244,7 +245,7 @@ class Diagram(object): cr.rotate(theta) if bb_fill or bb_stroke: - self.draw_rect(bb[0], bb[1], bb[2], bb[3], bb_fill, bb_fill_color, bb_stroke, bb_stroke_color) + self.draw_rect(bb[0], bb[1], bb[2], bb[3], 0, bb_fill, bb_fill_color, bb_stroke, bb_stroke_color) r, g, b, a = self.color_to_rgba(color) cr.set_source_rgba(r, g, b, a)