Python中的魔杖点()函数
point()是另一个绘图函数,也是最简单的。 point()函数基本上在图像上的特定点上绘制一个点。它只需要两个 x, y 参数作为点坐标。
Syntax :
Parameters:
Parameter Input Type Description x numbers.Real x coordinate of point y numbers.Real y coordinate of point
示例 #1:
Python3
wand.drawing.point(x, y)
Python3
# Import different modules of wand
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
# object for Drawing
with Drawing() as draw:
x = 100
y = 100
# draw point at (100, 100) using point() function
draw.point(x, y)
with Image(width = 200, height = 200,
background = Color('lightgreen')) as image:
draw(image)
image.save(filename ="point.png")
输出:
示例 #2:
Python3
# Import different modules of wand
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
import math
with Drawing() as draw:
for x in xrange(0, 200):
y = math.tan(x) * 4
# draw points at different locations using point() function
draw.point(x, y + 50)
with Image(width = 200, height = 200, background = Color('lightgreen')) as image:
draw(image)
image.save(filename = "points.png")
输出: