本文整理汇总了Python中reportlab.graphics.shapes.Line.curveTo方法的典型用法代码示例。如果您正苦于以下问题:Python Line.curveTo方法的具体用法?Python Line.curveTo怎么用?Python Line.curveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.graphics.shapes.Line
的用法示例。
在下文中一共展示了Line.curveTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from reportlab.graphics.shapes import Line [as 别名]
# 或者: from reportlab.graphics.shapes.Line import curveTo [as 别名]
#.........这里部分代码省略.........
shape.lineTo(x, y)
currentX, currentY = x, y
elif op == 'V':
# vertical line absolute
for y in args:
shape.lineTo(currentX, y)
currentY = y
elif op == 'v':
# vertical line relative
for ry in args:
y = currentY + ry
shape.lineTo(currentX, y)
currentY = y
elif op == 'H':
# horisontal line absolute
for x in args:
shape.lineTo(x, currentY)
currentX = x
elif op == 'h':
# horisontal line relative
for rx in args:
x = currentX + rx
shape.lineTo(x, currentY)
currentX = x
elif op == 'C':
# cubic bezier absolute
for p1, p2, p3 in zip(*([iter(args)] * 3)):
shape.curveTo(*(p1 + p2 + p3))
currentX, currentY = p3
elif op == 'c':
# cubic bezier relative
for pnts in zip(*([iter(args)] * 3)):
(x1, y1), (x2, y2), (x3, y3) = pnts
pnts = tuple((p[0] + currentX, p[1] + currentY) for p in pnts)
shape.curveTo(*(pnts[0] + pnts[1] + pnts[2]))
currentX, currentY = pnts[2]
lastOp = op
lastArgs = pnts
continue
elif op == 'S':
# shorthand cubic bezier absolute
for p2, p3 in zip(*([iter(args)] * 2)):
x1, y1 = prevCtrl(lastOp, lastArgs, currentX, currentY)
x2, y2 = p2
x3, y3 = p3
shape.curveTo(x1, y1, x2, y2, x3, y3)
lastOp = op
lastArgs = (x2, y2), (x3, y3)
currentX, currentY = x3, y3
continue
elif op == 's':
# shorthand cubic bezier relative
for p2, p3 in zip(*([iter(args)] * 2)):
x1, y1 = prevCtrl(lastOp, lastArgs, currentX, currentY)
x2, y2 = p2
x2, y2 = x2 + currentX, y2 + currentY
x3, y3 = p3