From d97421ff1619c12aeb2516ed21959352d5c7515d Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Thu, 18 Jun 2015 12:03:12 +0200 Subject: [PATCH] Diagram.py: allow drawing fill and stroke for circles --- Diagram.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Diagram.py b/Diagram.py index 1e9b172..ee7dd36 100755 --- a/Diagram.py +++ b/Diagram.py @@ -132,14 +132,23 @@ class Diagram(object): cr.set_source_rgba(r, g, b, a) cr.stroke() - def draw_dot(self, cx, cy, size=10.0, fill_color=[0, 0, 0, 0.5]): + def draw_circle(self, cx, cy, size=10.0, fill_color=[0, 0, 0, 0.5], + stroke_color=None): cr = self.cr cr.save() - r, g, b, a = self.color_to_rgba(fill_color) - cr.set_source_rgba(r, g, b, a) cr.arc(cx, cy, size, 0, 2 * pi) - cr.fill() + + if fill_color: + r, g, b, a = self.color_to_rgba(fill_color) + cr.set_source_rgba(r, g, b, a) + cr.fill() + + if stroke_color: + r, g, b, a = self.color_to_rgba(stroke_color) + cr.set_source_rgba(r, g, b, a) + cr.stroke() + cr.restore() def normalized_angle_01(self, theta): -- 2.1.4