Sets the selector Core Image uses to query the region of interest for image processing with the kernel.
- iOS 9.0+
- macOS 10.4+
- Mac Catalyst 13.0+
- tvOS 9.0+
- Core Image
A selector name.
When applying a filter kernel, the region of interest (ROI) is the area of source image pixels that must be processed to produce a given area of destination image pixels. For a more detailed definition, see The Region of Interest.
a argument must use the signature that is defined for the
region method, which is as follows:
- (CGRect) region
samplerdefines the sampler to query
destis the extent of the region, in working space coordinates, to render.
useris the object associated with the
koption when the kernel is applied to its arguments (with the
CIApply Option User Info
apply(_:method of a
CIFilterobject using the kernel). The
useris important because instance variables can’t be used by the defining class. Instance variables must be passed through the
region method of the CIFilter object is called by the framework. This method returns the rectangle that contains the region of the sampler that the kernel needs to render the specified destination rectangle.
region method might look as follows:
If your kernel does not need the image at
index to produce output in the rectangle
rect, your method should return
In the filter code, you set the selector using the following:
Alternatively, use the
apply(extent: method to directly apply a kernel to create an output image, specifying the ROI callback as a block or closure.