當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。