当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python Wand path_move()用法及代码示例


path_move()是用于路径的wand中引入的另一个函数。 path_move()函数的主要目的是为新的sub_path设置新的起点。通过设置相对标志,可以给参数以相对或绝对值。

用法:
wand.drawing.path_move(to, relative)

参数:

参数 输入类型 描述
to 序列或(数字。实数,数字。实数) 代表要绘制到的坐标的一对。
relative bool 将给定的坐标视为相对于当前点。

范例1:

from wand.image import Image 
from wand.drawing import Drawing 
from wand.color import Color 
  
with Drawing() as draw:
    draw.stroke_width = 2
    draw.stroke_color = Color('black') 
    draw.fill_color = Color('white') 
    draw.path_start() 
    # set starting point for first sub-path 
    draw.path_move(to =(10, 10)) 
    # Drawing vertical line from start 
    draw.path_vertical_line(100, 
                            relative = True) 
    # set starting point for second sub-path 
    draw.path_move(to =(190, 10)) 
    # Drawing vertical line from start 
    draw.path_vertical_line(100, 
                            relative = True) 
    draw.path_finish() 
    with Image(width = 200, height = 200, background = Color('lightgreen')) as image:
        draw(image) 
        image.save(filename ="pathmove.png")

输出:

相关用法


注:本文由纯净天空筛选整理自RahulSabharwal大神的英文原创作品 Wand path_move() function in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。