<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGraphicsRendererContext",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIGraphicsRendererContext"
  },
  "title" : "UIGraphicsRendererContext"
}
-->

# UIGraphicsRendererContext

The base class for the drawing environments for graphics renderers.

```
class UIGraphicsRendererContext
```

## Overview

You don’t create instances of [`UIGraphicsRendererContext`](/documentation/UIKit/UIGraphicsRendererContext) yourself. Instead, when you use a concrete subclass of [`UIGraphicsRenderer`](/documentation/UIKit/UIGraphicsRenderer), you are provided an instance of the appropriate [`UIGraphicsRendererContext`](/documentation/UIKit/UIGraphicsRendererContext) subclass—either [`UIGraphicsImageRendererContext`](/documentation/UIKit/UIGraphicsImageRendererContext) or [`UIGraphicsPDFRendererContext`](/documentation/UIKit/UIGraphicsPDFRendererContext)—as an argument to a [`UIGraphicsDrawingActions`](/documentation/UIKit/UIGraphicsDrawingActions) drawing actions block.

[`UIGraphicsRendererContext`](/documentation/UIKit/UIGraphicsRendererContext) objects provide high-level drawing methods in addition to access to the underlying Core Graphics context.

## Topics

### Getting the drawing context

[`CGContext`](/documentation/UIKit/UIGraphicsRendererContext/cgContext)

The underlying Core Graphics context.

[`format`](/documentation/UIKit/UIGraphicsRendererContext/format)

The format used to create the associated graphics renderer.

### Drawing content

[`-  strokeRect:`](/documentation/UIKit/UIGraphicsRendererContext/stroke(_:))

Paints a rectangular path using the currently selected stroke color.

[`-  strokeRect:blendMode:`](/documentation/UIKit/UIGraphicsRendererContext/stroke(_:blendMode:))

Paints a rectangular path using the currently selected stroke color and specified blend mode.

[`-  fillRect:blendMode:`](/documentation/UIKit/UIGraphicsRendererContext/fill(_:blendMode:))

Paints a rectangular area with the currently selected fill color using the supplied blend mode.

[`-  fillRect:`](/documentation/UIKit/UIGraphicsRendererContext/fill(_:))

Paints a rectangular area with the currently selected fill color.

### Applying a clipping rectangle

[`-  clipToRect:`](/documentation/UIKit/UIGraphicsRendererContext/clip(to:))

Sets the clipping mask for the drawing context to the specified rectangle.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

### Inherited By

[`UIGraphicsImageRendererContext`](/documentation/UIKit/UIGraphicsImageRendererContext)

[`UIGraphicsPDFRendererContext`](/documentation/UIKit/UIGraphicsPDFRendererContext)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)