path_horizontal_line()是路径的另一个函数。 path_horizontal_line()函数生成从目标点到特定x点的水平线。它仅将参数中的x作为绘制点的起点。
用法: wand.drawing.path_horizontal_line(to, relative)
参数:
参数 | 输入类型 | 描述 |
---|---|---|
x | Real | 要绘制的x轴点。 |
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, 50))
# horizontal line to x=100
draw.path_horizontal_line(100)
draw.path_finish()
with Image(width=200,
height=200,
background=Color('lightgreen')) as image:
draw(image)
image.save(filename="pathhline.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, 50))
# horizontal line to x=50
draw.path_horizontal_line(50)
draw.path_finish()
with Image(width=200,
height=200,
background=Color('lightgreen')) as image:
draw(image)
image.save(filename="pathhline.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_horizontal_line() function in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。