projects
/
experiments
/
RadialSymmetry.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cec24af
)
Diagram.py: simplify setting bounding box fill and stroke when drawing text
author
Antonio Ospite <ao2@ao2.it>
Thu, 18 Jun 2015 10:08:53 +0000
(12:08 +0200)
committer
Antonio Ospite <ao2@ao2.it>
Thu, 18 Jun 2015 10:08:53 +0000
(12:08 +0200)
Diagram.py
patch
|
blob
|
history
diff --git
a/Diagram.py
b/Diagram.py
index
b6de388
..
4e14b1c
100755
(executable)
--- a/
Diagram.py
+++ b/
Diagram.py
@@
-202,8
+202,8
@@
class Diagram(object):
def draw_centered_text(self, cx, cy, text, theta=0,
color=[0, 0, 0],
align_baseline=False,
def draw_centered_text(self, cx, cy, text, theta=0,
color=[0, 0, 0],
align_baseline=False,
- bb_fill
=True, bb_fill
_color=[1, 1, 1, 0.8],
- bb_stroke
=False, bb_stroke_color=[0, 0, 0, 0.5]
):
+ bb_fill_color=[1, 1, 1, 0.8],
+ bb_stroke
_color=None
):
cr = self.cr
x_bearing, y_bearing, width, height, x_advance = cr.text_extents(text)[:5]
cr = self.cr
x_bearing, y_bearing, width, height, x_advance = cr.text_extents(text)[:5]
@@
-259,28
+259,28
@@
if __name__ == "__main__":
theta = 0
theta = 0
- advance = diagram.draw_centered_text(x_offset, y, "Ciao", theta, align_baseline=True, bb_stroke
=True
)
+ advance = diagram.draw_centered_text(x_offset, y, "Ciao", theta, align_baseline=True, bb_stroke
_color=[0, 0, 0, 0.5]
)
x_offset += advance
x_offset += advance
- advance = diagram.draw_centered_text(x_offset, y, "____", theta + pi / 4, align_baseline=True, bb_stroke
=True
)
+ advance = diagram.draw_centered_text(x_offset, y, "____", theta + pi / 4, align_baseline=True, bb_stroke
_color=[0, 0, 0, 0.5]
)
x_offset += advance
x_offset += advance
- advance = diagram.draw_centered_text(x_offset, y, "jxpqdlf", theta + pi / 2, align_baseline=True, bb_stroke
=True
)
+ advance = diagram.draw_centered_text(x_offset, y, "jxpqdlf", theta + pi / 2, align_baseline=True, bb_stroke
_color=[0, 0, 0, 0.5]
)
x_offset += advance
x_offset += advance
- advance = diagram.draw_centered_text(x_offset, y, "pppp", theta + 3 * pi / 4, align_baseline=True, bb_stroke
=True
)
+ advance = diagram.draw_centered_text(x_offset, y, "pppp", theta + 3 * pi / 4, align_baseline=True, bb_stroke
_color=[0, 0, 0, 0.5]
)
x_offset += advance
x_offset += advance
- advance = diagram.draw_centered_text(x_offset, y, "dddd", theta + pi, align_baseline=True, bb_stroke
=True
)
+ advance = diagram.draw_centered_text(x_offset, y, "dddd", theta + pi, align_baseline=True, bb_stroke
_color=[0, 0, 0, 0.5]
)
x_offset += advance
x_offset += advance
- advance = diagram.draw_centered_text(x_offset, y, "Jjjj", theta + 5 * pi / 4, align_baseline=True, bb_stroke
=True
)
+ advance = diagram.draw_centered_text(x_offset, y, "Jjjj", theta + 5 * pi / 4, align_baseline=True, bb_stroke
_color=[0, 0, 0, 0.5]
)
x_offset += advance
x_offset += advance
- advance = diagram.draw_centered_text(x_offset, y, "1369", theta + 3 * pi / 2, align_baseline=True, bb_stroke
=True
)
+ advance = diagram.draw_centered_text(x_offset, y, "1369", theta + 3 * pi / 2, align_baseline=True, bb_stroke
_color=[0, 0, 0, 0.5]
)
x_offset += advance
x_offset += advance
- advance = diagram.draw_centered_text(x_offset, y, "qqqq", theta + 7 * pi / 4, align_baseline=True, bb_stroke
=True
)
+ advance = diagram.draw_centered_text(x_offset, y, "qqqq", theta + 7 * pi / 4, align_baseline=True, bb_stroke
_color=[0, 0, 0, 0.5]
)
x_offset += advance
diagram.draw_line(0, y, 400, y, [0, 0, 1, 0.2])
x_offset += advance
diagram.draw_line(0, y, 400, y, [0, 0, 1, 0.2])