Instance Method

copy(strokingWithWidth:lineCap:lineJoin:miterLimit:transform:)

Returns a new path equivalent to the results of drawing the path with a solid stroke.

Declaration

func copy(strokingWithWidth lineWidth: CGFloat, lineCap: CGLineCap, lineJoin: CGLineJoin, miterLimit: CGFloat, transform: CGAffineTransform = .identity) -> CGPath

Parameters

lineWidth

The line width to use, in user space units. The value must be greater than 0.

lineCap

The line cap style to render. (For equivalent CGContext drawing methods, the default style is CGLineCap.butt.)

lineJoin

The line join style to render. (For equivalent CGContext drawing methods, the default style is CGLineJoin.miter.)

miterLimit

A value that limits how sharp individual corners in the path can be when using the CGLineJoin.miter line join style. When the ratio of a the length required for a mitered corner to the line width exceeds this value, that corner uses the CGLineJoin.bevel style instead.

transform

An affine transform to apply to the path before dashing. Defaults to the identity transform if not specified.

Return Value

A new path.

Discussion

The new path is created so that filling the new path draws the same pixels as stroking the original path with the specified line style.

See Also

Copying a Graphics Path

func copy() -> CGPath?

Creates an immutable copy of a graphics path.

func copy(using: UnsafePointer<CGAffineTransform>?) -> CGPath?

Creates an immutable copy of a graphics path transformed by a transformation matrix.

func copy(dashingWithPhase: CGFloat, lengths: [CGFloat], transform: CGAffineTransform) -> CGPath

Returns a new path equivalent to the results of drawing the path with a dashed stroke.

func mutableCopy() -> CGMutablePath?

Creates a mutable copy of an existing graphics path.

func mutableCopy(using: UnsafePointer<CGAffineTransform>?) -> CGMutablePath?

Creates a mutable copy of a graphics path transformed by a transformation matrix.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software