本文整理匯總了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