<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGContext/clip(using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "s:So12CGContextRefa12CoreGraphicsE4clip5usingyAC14CGPathFillRuleO_tF"
  },
  "title" : "clip(using:)"
}
-->

# clip(using:)

Modifies the current clipping path.

```
func clip(using rule: CGPathFillRule = .winding)
```

## Parameters

`rule`

The rule for determining which areas to treat as the interior of the path. See [`CGPathFillRule`](/documentation/CoreGraphics/CGPathFillRule).

    This parameter defaults to the [`CGPathFillRule.winding`](/documentation/CoreGraphics/CGPathFillRule/winding)     rule if unspecified.

## Discussion

A clipping path restricts the paintable area: painting operations take effect only for those areas in the interior of the clipping path. This method uses the specified rule to calculate the intersection of the current path with the current clipping path. The path resulting from the intersection is used as the new current clipping path for subsequent painting operations.

If the current path contains any non-closed subpaths, this method treats each subpath as if it had been closed with the [`closePath()`](/documentation/CoreGraphics/CGContext/closePath()) method, then applies the specified rule to determine which areas to fill.

After determining the new clipping path, this method clears the context’s current path.

Unlike the current path, the current clipping path is part of the graphics state. Therefore, to re-enlarge the paintable area by restoring the clipping path to a prior state, you must save the graphics state before you clip and restore the graphics state after you’ve completed any clipped drawing.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)