One Logo Pool Ball
CoreGraphics · IOS API REFERENCE

CGPath

class · SDK 27.1

class CGPath

Members (27)

method · iOS 11.0+

applyWithBlock

TypeScript
applyWithBlock(block: ((arg0: SDKHandle) => void)): void
Swift declaration
func applyWithBlock(_ block: (UnsafePointer<CGPathElement>) -> Void)
method · iOS 2.0+

copy

TypeScript
copy(): (CGPath) | null
Swift declaration
func copy() -> CGPath?
method · iOS 5.0+

copy

TypeScript
copyUsing(transform?: (SDKHandle) | null): (CGPath) | null
Swift declaration
func copy(using transform: UnsafePointer<CGAffineTransform>?) -> CGPath?
method · iOS 2.0+

mutableCopy

TypeScript
mutableCopy(): (CGMutablePath) | null
Swift declaration
func mutableCopy() -> CGMutablePath?
method · iOS 5.0+

mutableCopy

TypeScript
mutableCopyUsing(transform?: (SDKHandle) | null): (CGMutablePath) | null
Swift declaration
func mutableCopy(using transform: UnsafePointer<CGAffineTransform>?) -> CGMutablePath?
init · iOS 5.0+

init

TypeScript
static initEllipseInTransform(rect: { x: number; y: number; width: number; height: number }, transform?: (SDKHandle) | null): CGPath
Swift declaration
init(ellipseIn rect: CGRect, transform: UnsafePointer<CGAffineTransform>?)
init · iOS 4.0+

init

TypeScript
static initRectTransform(rect: { x: number; y: number; width: number; height: number }, transform?: (SDKHandle) | null): CGPath
Swift declaration
init(rect: CGRect, transform: UnsafePointer<CGAffineTransform>?)
init · iOS 7.0+

init

TypeScript
static initRoundedRectCornerWidthCornerHeightTransform(rect: { x: number; y: number; width: number; height: number }, cornerWidth: number, cornerHeight: number, transform?: (SDKHandle) | null): CGPath
Swift declaration
init(roundedRect rect: CGRect, cornerWidth: CGFloat, cornerHeight: CGFloat, transform: UnsafePointer<CGAffineTransform>?)
get · iOS 2.0+

boundingBox

TypeScript
get boundingBox(): { x: number; y: number; width: number; height: number }
Swift declaration
var boundingBox: CGRect { get }
get · iOS 2.0+

currentPoint

TypeScript
get currentPoint(): { x: number; y: number }
Swift declaration
var currentPoint: CGPoint { get }
get · iOS 4.0+

boundingBoxOfPath

TypeScript
get boundingBoxOfPath(): { x: number; y: number; width: number; height: number }
Swift declaration
var boundingBoxOfPath: CGRect { get }
get · iOS 2.0+

typeID

TypeScript
static get typeID(): number
Swift declaration
class var typeID: CFTypeID { get }
get · iOS 2.0+

isEmpty

TypeScript
get isEmpty(): boolean
Swift declaration
var isEmpty: Bool { get }
method · iOS 2.0+

isRect

TypeScript
isRect(rect?: ("animatableData" | SDKHandle) | null): boolean
Swift declaration
func isRect(_ rect: UnsafeMutablePointer<CGRect>?) -> Bool
method · iOS 16.0+

intersects

TypeScript
intersects(other: CGPath, rule?: CGPathFillRule): boolean
Swift declaration
func intersects(_ other: CGPath, using rule: CGPathFillRule = .winding) -> Bool

Returns whether paths overlap. - Parameters: - other: The path to check for intersection. - rule: The rule for determining which areas to treat as the interior of the paths. Defaults to the `CGPathFillRule.winding` rule if not specified. - Returns: `true` if the paths intersect. This is the same as testing if the intersection of two paths is not empty. That is, the filled areas of the paths overlap. Open subpaths are treated as closed subpaths, the same as when filling a path in a `CGContext`.

method · iOS 16.0+

normalized

TypeScript
normalized(rule?: CGPathFillRule): CGPath
Swift declaration
func normalized(using rule: CGPathFillRule = .winding) -> CGPath

Returns a new weakly-simple copy of this path. - Parameter rule: The rule for determining which areas to treat as the interior of the path. Defaults to the `CGPathFillRule.winding` rule if not specified. - Returns: A new path. The returned path is weakly-simple path, has no self-intersections, and has a normalized orientation. The result of filling this path using either even-odd or non-zero fill rules is identical.

method · iOS 16.0+

subtracting

TypeScript
subtracting(other: CGPath, rule?: CGPathFillRule): CGPath
Swift declaration
func subtracting(_ other: CGPath, using rule: CGPathFillRule = .winding) -> CGPath

Returns a new path with filled regions from this path that are not in the given path. - Parameters: - other: The path to subtract. - rule: The rule for determining which areas to treat as the interior of the paths. Defaults to the `CGPathFillRule.winding` rule if not specified. - Returns: A new path. The filled region of the resulting path is the filled region of this path with the filled region `other` removed from it. Any unclosed subpaths in either path are assumed to be closed. The result of filling this path using either even-odd or non-zero fill rules is identical.

method · iOS 16.0+

intersection

TypeScript
intersection(other: CGPath, rule?: CGPathFillRule): CGPath
Swift declaration
func intersection(_ other: CGPath, using rule: CGPathFillRule = .winding) -> CGPath

Returns a new path with filled regions common to both paths. - Parameters: - other: The path to intersect. - rule: The rule for determining which areas to treat as the interior of the paths. Defaults to the `CGPathFillRule.winding` rule if not specified. - Returns: A new path. The filled region of the resulting path is the overlapping area of the filled region of both paths. This can be used to clip the fill of a path to a mask. Any unclosed subpaths in either path are assumed to be closed. The result of filling this path using either even-odd or non-zero fill rules is identical.

method · iOS 16.0+

lineSubtracting

TypeScript
lineSubtracting(other: CGPath, rule?: CGPathFillRule): CGPath
Swift declaration
func lineSubtracting(_ other: CGPath, using rule: CGPathFillRule = .winding) -> CGPath

Returns a new path with a line from this path that does not overlap the filled region of the given path. - Parameters: - other: The path to subtract. - rule: The rule for determining which areas to treat as the interior of `other`. Defaults to the `CGPathFillRule.winding` rule if not specified. - Returns: A new path. The line of the resulting path is the line of this path that does not overlap the filled region of `other`. Intersected subpaths that are clipped create open subpaths. Closed subpaths that do not intersect `other` remain closed.

method · iOS 16.0+

lineIntersection

TypeScript
lineIntersection(other: CGPath, rule?: CGPathFillRule): CGPath
Swift declaration
func lineIntersection(_ other: CGPath, using rule: CGPathFillRule = .winding) -> CGPath

Returns a new path with a line from this path that overlaps the filled regions of the given path. - Parameters: - other: The path to intersect. - rule: The rule for determining which areas to treat as the interior of `other`. Defaults to the `CGPathFillRule.winding` rule if not specified. - Returns: A new path. The line of the resulting path is the line of this path that overlaps the filled region of `other`. Intersected subpaths that are clipped create open subpaths. Closed subpaths that do not intersect `other` remain closed.

method · iOS 16.0+

componentsSeparated

TypeScript
componentsSeparated(rule?: CGPathFillRule): Array<CGPath>
Swift declaration
func componentsSeparated(using rule: CGPathFillRule = .winding) -> [CGPath]

Return an array of the visually separated components of a path. - Parameter rule: The rule for determining which areas to treat as the interior of the path. Defaults to the `CGPathFillRule.winding` rule if not specified. - Returns: The visually separate components. Separating components of a path returns the components from splitting the path into multiple distinct paths. Rendered individually the components look the same as the original path. This can be used to break a single path (eg. a symbol) into its component pieces so that each component can be colored separately.

method · iOS 16.0+

symmetricDifference

TypeScript
symmetricDifference(other: CGPath, rule?: CGPathFillRule): CGPath
Swift declaration
func symmetricDifference(_ other: CGPath, using rule: CGPathFillRule = .winding) -> CGPath

Returns a new path with filled regions either from this path or the given path, but not in both. - Parameters: - other: The path to difference. - rule: The rule for determining which areas to treat as the interior of the paths. Defaults to the `CGPathFillRule.winding` rule if not specified. - Returns: A new path. The filled region of the resulting path is the filled region contained in either this path or `other`, but not both. Any unclosed subpaths in either path are assumed to be closed. The result of filling this path using either even-odd or non-zero fill rules is identical.

method · iOS 7.0+

copy

TypeScript
copyDashingWithPhaseLengthsTransform(phase: number, lengths: Array<number>, transform?: _CoreFoundation_CGAffineTransform): CGPath
Swift declaration
func copy(dashingWithPhase phase: CGFloat, lengths: [CGFloat], transform: CGAffineTransform = .identity) -> CGPath
method · iOS 7.0+

copy

TypeScript
copyStrokingWithWidthLineCapLineJoinMiterLimitTransform(lineWidth: number, lineCap: CGLineCap, lineJoin: CGLineJoin, miterLimit: number, transform?: _CoreFoundation_CGAffineTransform): CGPath
Swift declaration
func copy(strokingWithWidth lineWidth: CGFloat, lineCap: CGLineCap, lineJoin: CGLineJoin, miterLimit: CGFloat, transform: CGAffineTransform = .identity) -> CGPath
method · iOS 16.0+

union

TypeScript
union(other: CGPath, rule?: CGPathFillRule): CGPath
Swift declaration
func union(_ other: CGPath, using rule: CGPathFillRule = .winding) -> CGPath

Returns a new path with filled regions in either this path or the given path. - Parameters: - other: The path to union. - rule: The rule for determining which areas to treat as the interior of the paths. Defaults to the `CGPathFillRule.winding` rule if not specified. - Returns: A new path. The filled region of resulting path is the combination of the filled region of both paths added together. Any unclosed subpaths in either path are assumed to be closed. The result of filling this path using either even-odd or non-zero fill rules is identical.

method · iOS 7.0+

contains

TypeScript
contains(point: { x: number; y: number }, rule?: CGPathFillRule, transform?: _CoreFoundation_CGAffineTransform): boolean
Swift declaration
func contains(_ point: CGPoint, using rule: CGPathFillRule = .winding, transform: CGAffineTransform = .identity) -> Bool
method · iOS 16.0+

flattened

TypeScript
flattened(threshold: number): CGPath
Swift declaration
func flattened(threshold: CGFloat) -> CGPath

Returns a flattened copy of this path. - Parameter threshold: The maximum error tolerance. - Returns: A new path. The granularity of the approximation is controlled by `threshold` the maximum error tolerance (measured in points) for curves.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

CGPath.apply(info:function:)

The iOS SDK compiler rejected this binding: a C function pointer cannot be formed from a closure that captures context

All CoreGraphics types →