<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIImageProcessorKernel/roi(forInput:arguments:outputRect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIImageProcessorKernel(cm)roiForInput:arguments:outputRect:"
  },
  "title" : "roi(forInput:arguments:outputRect:)"
}
-->

# roi(forInput:arguments:outputRect:)

Override this class method to implement your processor’s ROI callback.

```
class func roi(forInput inputIndex: Int32, arguments: [String : Any]?, outputRect: CGRect) -> CGRect
```

## Parameters

`inputIndex`

the index that tells you which processor input for which to return the ROI rectangle.

`arguments`

the arguments dictionary that was passed to [`apply(withExtent:inputs:arguments:)`](/documentation/CoreImage/CIImageProcessorKernel/apply(withExtent:inputs:arguments:)).

`outputRect`

the output `CGRect` that processor will be asked to output.

## Return Value


The `CGRect` of the `inputIndex`th input that is required for the above `outputRect`

## Discussion

This will be called one or more times per render to determine what portion
of the input images are needed to render a given ‘outputRect’ of the output.
This will not be called if processor has no input images.

The default implementation would return outputRect.

> Important: this is a class method so that you cannot use or capture any state by accident.
> All the parameters that affect the output results must be passed to
> ``doc://com.apple.coreimage/documentation/CoreImage/CIImageProcessorKernel/apply(withExtent:inputs:arguments:)``.

---

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)