From d61a76f33cbf0f18f63e0b365e9d7f0ba6732323 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Fri, 12 Jun 2015 22:14:06 +0200 Subject: [PATCH 1/1] Diagram.py: support drawing a rectangle rotated on its bottom-left corner --- Diagram.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) -- 2.1.4