本文整理匯總了Python中pgmagick.api.Draw.line方法的典型用法代碼示例。如果您正苦於以下問題:Python Draw.line方法的具體用法?Python Draw.line怎麽用?Python Draw.line使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pgmagick.api.Draw
的用法示例。
在下文中一共展示了Draw.line方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __create_arrow_border
# 需要導入模塊: from pgmagick.api import Draw [as 別名]
# 或者: from pgmagick.api.Draw import line [as 別名]
def __create_arrow_border( self, start_x, end_x , y, arrow_height, color ):
"""
Create a draw of arrow border.
"""
center_x = ( start_x + end_x ) /2
center_y = arrow_height + y
arrow_border_draw = Draw()
arrow_border_draw.stroke_color( color )
arrow_border_draw.stroke_antialias( False )
arrow_border_draw.line( start_x, y, center_x, center_y )
arrow_border_draw.line( center_x, center_y, end_x, y )
arrow_border_draw.stroke_width( 2 )
return arrow_border_draw
示例2: DrawTestCase
# 需要導入模塊: from pgmagick.api import Draw [as 別名]
# 或者: from pgmagick.api.Draw import line [as 別名]
#.........這裏部分代碼省略.........
self.im.draw(self.d)
self.im.write('t.png')
def test_font_stretch_ultracondensed(self):
self.d.font('vera.ttf', 'oblique', stretch='ultracondensed')
self.d.text(30, 30, "hello pgmagick")
self.im.draw(self.d)
self.im.write('t.png')
def test_font_stretch_extraexpanded(self):
self.d.font('vera.ttf', 'oblique', stretch='extraexpanded')
self.d.text(30, 30, "hello pgmagick")
self.im.draw(self.d)
self.im.write('t.png')
def test_font_weight100(self):
self.d.font('vera.ttf', weight=100)
self.d.text(30, 30, "hello pgmagick")
self.im.draw(self.d)
self.im.write('t.png')
def test_font_bold(self):
self.d.font('vera.ttf', weight='bold')
self.d.text(30, 30, "hello pgmagick")
self.im.draw(self.d)
self.im.write('t.png')
def test_gravity(self):
self.d.gravity('center')
self.d.text(0, 0, "hello pgmagick")
self.im.draw(self.d)
self.im.write('t.png')
def test_line(self):
self.d.line(10, 10, 40, 200)
self.im.draw(self.d)
self.im.write('t.png')
def test_matte(self):
self.d.matte(30, 30, 'filltoborder')
self.im.draw(self.d)
self.im.write('t.png')
def test_miterlimit(self):
self.d.miterlimit(0)
self.d.stroke_color('black')
self.d.stroke_width(3)
self.d.line(10, 200, 100, 10)
self.d.line(100, 10, 210, 200)
self.im.draw(self.d)
self.d = Draw()
self.d.miterlimit(18)
self.d.stroke_color('black')
self.d.stroke_width(3)
self.d.stroke_opacity(0.5)
self.d.fill_opacity(0.5)
self.d.line(210, 200, 300, 10)
self.d.line(300, 10, 410, 200)
self.im.draw(self.d)
self.im.write('t.png')
def test_path(self):
paths = ((40, 30),)
self.d.path(paths)
self.im.draw(self.d.drawer)
self.im.write('t.png')