path_curve_to_quadratic_bezier()绘制从当前点到给定坐标的二次Bezier曲线。如果smooth为True,则假定控制点是上一个命令的控制点的反射,否则必须给出一对控制坐标。
用法: wand.drawing.path_curve_to_quadratic_bezier(to, controls, smooth, relative)
参数 | 输入类型 | 描述 |
---|---|---|
to | 序列或(数字。实数,数字。实数) | 代表要绘制到的坐标的一对。 |
control | 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()
# points list to determine curve
points = [(40, 10), # Start point
(20, 50), # First control
(90, 10), # Second control
(70, 40)] # End point
# Start middle-left
draw.path_move(to =(10, 100))
# Curve accross top-left to center
draw.path_curve_to_quadratic_bezier(to =(100, 0),
control = points,
smooth = True,
relative = True)
draw.path_finish()
with Image(width = 200,
height = 200,
background = Color('lightgreen')) as image:
draw(image)
image.save(filename ="pathbcurve.png")
输出:
范例2:
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=(100, 100))
# Curve accross top-left to center
draw.path_curve_to_quadratic_bezier(to=(100, 0),
control=[(20,50),(90,10)],
smooth=True,relative=True)
draw.path_finish()
with Image(width=200, height=200, background=Color('lightgreen')) as image:
draw(image)
image.save(filename="pathbcurve.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()用法及代码示例
- Python Wand implode()用法及代码示例
- Python Wand polaroid()用法及代码示例
- Python Wand sepia_tone()用法及代码示例
注:本文由纯净天空筛选整理自RahulSabharwal大神的英文原创作品 Python – path_curve_to_quadratic_bezier() function in Wand。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。