From: Antonio Ospite Date: Thu, 18 Jun 2015 10:03:12 +0000 (+0200) Subject: Diagram.py: allow drawing fill and stroke for circles X-Git-Url: https://git.ao2.it/experiments/RadialSymmetry.git/commitdiff_plain/d97421ff1619c12aeb2516ed21959352d5c7515d?ds=sidebyside;hp=7b312ebf7585412a6f3e0a999adf6972b0e239e8 Diagram.py: allow drawing fill and stroke for circles --- 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):