<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGRectDivide",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGRectDivide"
  },
  "title" : "CGRectDivide"
}
-->

# CGRectDivide

Divides a source rectangle into two component rectangles.

```
extern void CGRectDivide(CGRect rect, CGRect *slice, CGRect *remainder, CGFloat amount, CGRectEdge edge);
```

## Parameters

`rect`

The source rectangle.

`slice`

On input, a pointer to an uninitialized rectangle. On return, the rectangle is filled in with the specified edge and values that extends the distance beyond the edge specified by the `amount` parameter. Must not be `NULL`.

`remainder`

On input, a pointer to an uninitialized rectangle. On return, the rectangle contains the portion of the source rectangle that remains after <doc://com.apple.documentation/documentation/CoreFoundation/CGRectEdge> produces the “slice” rectangle. Must not be `NULL`.

`amount`

A distance from the rectangle side that is specified in the `edge` parameter. This distance defines the line, parallel to the specified side, that Core Graphics uses to divide the source rectangle.

`edge`

An edge value that specifies the side of the rectangle from which the distance passed in the `amount` parameter is measured. [`CGRectDivide`](/documentation/CoreGraphics/CGRectDivide) produces a “slice” rectangle that contains the specified edge and extends `amount` distance beyond it.

## Discussion

If `rect` is a null rectangle, this function outputs [`CGRectNull`](/documentation/CoreGraphics/CGRectNull) for both the `slice` and `remainder` rectangles.

---

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)