本文整理汇总了Python中pgmagick.api.Draw.rectangle方法的典型用法代码示例。如果您正苦于以下问题:Python Draw.rectangle方法的具体用法?Python Draw.rectangle怎么用?Python Draw.rectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pgmagick.api.Draw
的用法示例。
在下文中一共展示了Draw.rectangle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_rectangle
# 需要导入模块: from pgmagick.api import Draw [as 别名]
# 或者: from pgmagick.api.Draw import rectangle [as 别名]
def draw_rectangle(self, x, y, width, height):
draw = Draw()
draw.fill_opacity(0.0)
draw.stroke_color('white')
draw.stroke_width(1)
draw.rectangle(x, y, x + width, y + height)
self.image.draw(draw.drawer)
示例2: DrawTestCase
# 需要导入模块: from pgmagick.api import Draw [as 别名]
# 或者: from pgmagick.api.Draw import rectangle [as 别名]
#.........这里部分代码省略.........
self.im.write('t.png')
def test_point(self):
for i in range(50):
self.d.point(i, i + 10)
for i in range(50, 200, 2):
self.d.point(i, i + 10)
self.im.draw(self.d.drawer)
self.im.write('t.png')
def test_pointsize(self):
self.d.pointsize(10)
self.d.pointsize(30.)
self.d.circle(150, 150, 50, 180)
self.im.draw(self.d.drawer)
self.im.write('t.png')
def test_polygon(self):
coordinate = ((10, 10), (20, 30), (40, 50))
self.d.polygon(coordinate)
coordinate = [(100, 100), (150, 100), [150, 150], (100, 150)]
self.d.polygon(coordinate)
self.im.draw(self.d)
self.im.write('t.png')
def test_polyline(self):
coordinate = ((10, 10), (20, 30), (40, 50))
self.d.polyline(coordinate)
coordinate = [(100, 100), (150, 100), [150, 150], (100, 150)]
self.d.polyline(coordinate)
self.im.draw(self.d)
self.im.write('t.png')
def test_rectangle(self):
self.d.rectangle(50, 50, 100, 100)
self.im.draw(self.d)
self.im.write('t.png')
def test_rotation(self):
self.d.rectangle(150, 150, 200, 200)
self.d.rotation(40)
self.im.draw(self.d)
self.d = Draw()
self.d.fill_opacity(0.8)
self.d.rectangle(150, 150, 200, 200)
self.d.rotation(20)
self.im.draw(self.d)
self.d = Draw()
self.d.fill_opacity(0.6)
self.d.rectangle(150, 150, 200, 200)
self.im.draw(self.d)
self.im.write('t.png')
def test_round_rectangle(self):
self.d.round_rectangle(200, 200, 30, 30, 15, 15)
self.im.draw(self.d)
self.im.write('t.png')
def test_scaling(self):
self.d.scaling(0.4, 0.4)
self.d.circle(150, 150, 150, 200)
self.im.draw(self.d)
self.d = Draw()
self.d.fill_opacity(0.6)
self.d.circle(150, 150, 150, 200)
self.im.draw(self.d)