Contents

init(bezierPath:creationDate:pointProvider:)

Creates a stroke path recreating the specified Bézier path as a cubic uniform B-Spline.

Declaration

convenience init(bezierPath: CGPath, creationDate: Date, pointProvider: (PKConvertedBezierPointReference) -> PKStrokePoint)

Parameters

  • bezierPath:

    The Bézier path to convert to a cubic uniform B-Spline.

  • creationDate:

    The start time of this path.

  • pointProvider:

    Block to initialize the PKStrokePoints of the path. A single PKConvertedBezierPoint instance is shared across all converted points.

Discussion

The count of control points of the generated spline is not guaranteed to be a specific value except when the provided path is the output of bezierRepresentation->CGPathRef, where it will match the original curve.

The output B-Spline will have continuous curvature and 0 curvature at the endpoints. In cases where the B-Spline cannot fully recreate the Bézier path, it will be an approximation. For example, if the given Bézier path includes line to elements, these will produce straight line segments in the resulting B-Spline, but if a line to element is adjacent to a curve to element, the resulting curve may not match the original.