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


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

path_elliptic_arc()是专门为路径引入的函数。 path_elliptic_arc()将从当前点绘制一个椭圆弧到要绘制弧的特定点。
让我们看看此函数所需的参数。

用法:
wand.drawing.path_elliptic_arc(to, radius, rotation, large_arc, clockwise, relative)

参数:

参数 输入类型 描述
to 序列或(数字。实数,数字。实数) 对,代表要绘制的坐标。
radius collections.abc.sequence或(numbers.Real,numbers.Real) 代表绘制半径的椭圆对。
rotate bool 度以在x轴上旋转椭圆。
large_arc bool 绘制最大可用弧。
clockwise bool 从起点到目标顺时针绘制弧线路径。
relative bool 将给定的坐标视为相对于当前点。

例:画一条椭圆曲线。

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() 
    # Start middle-left 
    draw.path_move(to =(10, 100)) 
    # draw elliptical curve 
    draw.path_elliptic_arc(to =(10, 180), 
                           radius = (20, 40), 
                           rotation = 270, 
                           large_arc = True, 
                           clockwise = True, 
                           relative = True ) 
    with Image(width = 200, height = 200, background = Color('lightgreen')) as image:
        draw(image) 
        image.save(filename ="pathecurve.png")

输出:




相关用法


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