<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Cinematic",
  "identifier" : "/documentation/Cinematic/CNImageRenderingSession",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Cinematic"
    ],
    "preciseIdentifier" : "c:objc(cs)CNImageRenderingSession"
  },
  "title" : "CNImageRenderingSession"
}
-->

# CNImageRenderingSession

A session for rendering a shallow depth-of-field (SDoF) effect onto still images using Metal.

```
class CNImageRenderingSession
```

## Overview

Use CNImageRenderingSession to apply a cinematic, lens-simulated bokeh effect to an image given
a disparity map. For large images, prefer the tiled API to avoid excessive GPU memory usage.

A single session may be reused across multiple render calls. It is not thread-safe.

## Topics

### Initializers

[`init(configuration: CNImageRenderingSessionConfiguration)`](/documentation/Cinematic/CNImageRenderingSession/init(configuration:))

### Instance Properties

[`var configuration: CNImageRenderingSessionConfiguration`](/documentation/Cinematic/CNImageRenderingSession/configuration)

### Instance Methods

[`func encodeRender(to: any MTLCommandBuffer, sourceRGBA: any MTLTexture, sourceDisparity: any MTLTexture, destinationRGBA: any MTLTexture, fNumber: Float, focusDisparity: Float) -> Bool`](/documentation/Cinematic/CNImageRenderingSession/encodeRender(to:sourceRGBA:sourceDisparity:destinationRGBA:fNumber:focusDisparity:))

Encode a command to render a shallow depth of field (SDoF) image to a metal texture

[`func encodeTileRender(to: any MTLCommandBuffer, sourceTileRGBA: any MTLTexture, sourceDisparity: any MTLTexture, destinationTileRGBA: any MTLTexture, fNumber: Float, focusDisparity: Float, sourceRGBASize: CGSize, tileOffset: CGPoint, tileExtendOffset: CGPoint) -> Bool`](/documentation/Cinematic/CNImageRenderingSession/encodeTileRender(to:sourceTileRGBA:sourceDisparity:destinationTileRGBA:fNumber:focusDisparity:sourceRGBASize:tileOffset:tileExtendOffset:))

Encode a command to render a shallow depth of field (SDoF) image to a metal texture

### Type Methods

[`class func minimumTileExtendRect(forTileRect: CGRect, sourceRGBASize: CGSize) -> CGRect`](/documentation/Cinematic/CNImageRenderingSession/minimumTileExtendRect(forTileRect:sourceRGBASize:))

Returns the minimum source rect that must be sampled to render tileRect without edge artifacts.

## Relationships

### Conforms To

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

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

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

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

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

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

### 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)