path_curve()是專門為路徑引入的函數。 path_curve()在控製點的幫助下從圖像的目標點到特定點(x,y)繪製三次貝塞爾曲線。
用法:
wand.drawing.path_curve(to, controls, smooth, relative)
參數:
參數 | 輸入類型 | 描述 |
---|---|---|
to | 序列或(數字。實數,數字。實數) | 代表要繪製到的坐標的一對。 |
controls | collections.abc.sequence或(numbers.Real,numbers.Real) | 用於影響曲線的坐標 |
smooth | bool | 假設最後定義的控製坐標 |
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()
# Start middle-left
draw.path_move(to =(10, 100))
# Curve accross top-left to center
draw.path_curve(to =(80, 0),
controls =[(20, -80), (60, -80)],
relative = True)
# Continue curve accross bottom-right
draw.path_curve(to =(80, 0),
controls =(60, 80),
smooth = True,
relative = True)
draw.path_finish()
with Image(width = 200, height = 200, background = Color('lightgreen')) as image:
draw(image)
image.save(filename ="pathcurve.png")
輸出:
相關用法
- Python Wand function()用法及代碼示例
- Python Wand gaussian_blur()用法及代碼示例
- Python Wand transform()用法及代碼示例
- Python Wand crop()用法及代碼示例
- Python Wand rotational_blur()用法及代碼示例
- Python Wand Image()用法及代碼示例
- Python Wand shade()用法及代碼示例
- Python Wand sharpen()用法及代碼示例
- Python Wand adaptive_sharpen()用法及代碼示例
- Python Wand noise()用法及代碼示例
- Python Wand blue_shift()用法及代碼示例
- Python Wand color_matrix()用法及代碼示例
- Python Wand unsharp_mask()用法及代碼示例
- Python Wand colorize()用法及代碼示例
- Python Wand fx()用法及代碼示例
注:本文由純淨天空篩選整理自RahulSabharwal大神的英文原創作品 Wand path_curve() function in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。