<!--
{
  "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/CGContextFillRects",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGContextFillRects"
  },
  "title" : "CGContextFillRects"
}
-->

# CGContextFillRects

Paints the areas contained within the provided rectangles, using the fill color in the current graphics state.

```
extern void CGContextFillRects(CGContextRef c, const CGRect *rects, size_t count);
```

## Parameters

`c`

A graphics context .

`rects`

An array of rectangles, in user space coordinates.

`count`

The number rectangles in the  `rects` array.

## Discussion

The current path is cleared as a side effect of calling this function.

---

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)