Understanding CanvasRenderingContext2D and UIBezierPath

Issue #180

CanvasRenderingContext2D

https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/bezierCurveTo

The CanvasRenderingContext2D.bezierCurveTo() method of the Canvas 2D API adds a cubic Bézier curve to the current sub-path. It requires three points: the first two are control points and the third one is the end point. The starting point is the latest point in the current path, which can be changed using moveTo() before creating the Bézier curve.

1
void ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);

Where order is control point 1, control point 2 and end point

UIBezierPath

https://developer.apple.com/documentation/uikit/uibezierpath/1624357-addcurve

Appends a cubic Bézier curve to the receiver’s path.

1
addCurve(to:controlPoint1:controlPoint2:)

The same for void ctx.quadraticCurveTo(cpx, cpy, x, y); and addQuadCurve(to:controlPoint:)

Comments