class Diagram(object):
- def __init__(self, width, height, background=[1, 1, 1]):
+ def __init__(self, width, height, background=[1, 1, 1], font_size=20):
self.width = width
self.height = height
self.background = background
cr.select_font_face("Georgia", cairo.FONT_SLANT_NORMAL,
cairo.FONT_WEIGHT_NORMAL)
- cr.set_font_size(20)
+ cr.set_font_size(font_size)
# Adjust the font matrix to left-bottom origin
M = cr.get_font_matrix()
diagram.draw_line(0, y, 400, y, [0, 0, 1, 0.2])
+ diagram.draw_rect(40, 40, 300, 100, stroke=True)
+ diagram.draw_rect(40, 40, 300, 100, pi / 30, stroke=True)
+
+ diagram.draw_rect(40, 250, 300, 100, stroke=True)
+ diagram.draw_rect_from_center(40 + 150, 250 + 50, 300, 100, theta=pi / 40, stroke=True, stroke_color=[1, 0, 0], fill=False)
+
diagram.show()