pub unsafe trait CIImageProcessorOutput {
// Provided methods
unsafe fn region(&self) -> CGRect
where Self: Sized + Message { ... }
unsafe fn bytesPerRow(&self) -> usize
where Self: Sized + Message { ... }
unsafe fn format(&self) -> CIFormat
where Self: Sized + Message { ... }
unsafe fn baseAddress(&self) -> NonNull<c_void>
where Self: Sized + Message { ... }
unsafe fn surface(&self) -> Retained<IOSurfaceRef>
where Self: Sized + Message { ... }
unsafe fn pixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>
where Self: Sized + Message { ... }
unsafe fn metalTexture(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>
where Self: Sized + Message { ... }
unsafe fn metalCommandBuffer(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>
where Self: Sized + Message { ... }
unsafe fn digest(&self) -> u64
where Self: Sized + Message { ... }
}CIImageProcessor only.Expand description
Your app does not define classes that adopt this protocol; Core Image provides an object of this type
when rendering a custom image processor you create with a CIImageProcessorKernel subclass.
When a CIImage containing your CIImageProcessorKernel class is rendered, your
CIImageProcessorKernel/processWithInputs:arguments:output:error: class method will be called as
needed for that render. The method may be called more than once if Core Image needs to tile to
limit memory usage.
When your image processor class method is called, use the provided CIImageProcessorOutput object to return
processed pixel data to Core Image. For example, if you process the image using a Metal shader, bind the metalTexture
property as an attachment in a render pass or as an output texture in a compute pass. Or, if you process the image
using a CPU-based routine, write processed pixel data to memory using the baseAddress pointer.
You should use the output’s region property to determine which portion of the output image needs to be processed.
Your code should fill the entirety of the region. This includes setting to zero any pixels in the region that
are outside the extent passed extent applyWithExtent:inputs:arguments:error:.
Important: You must provide rendered output using only one of the following properties of the output:
baseAddress,surface,pixelBuffer,metalTexture.
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn region(&self) -> CGRect
Available on crate feature objc2-core-foundation only.
unsafe fn region(&self) -> CGRect
objc2-core-foundation only.The rectangular region of the output image that your Core Image Processor Kernel must provide.
Note: This may be different (larger or smaller) than the
extentthat was passed to/CIImageProcessorKernel/applyWithExtent:inputs:arguments:error:.
Sourceunsafe fn bytesPerRow(&self) -> usize
unsafe fn bytesPerRow(&self) -> usize
The bytes per row of the CPU memory that your Core Image Processor Kernel can write pixels to.
Sourceunsafe fn format(&self) -> CIFormat
Available on crate feature CIImage only.
unsafe fn format(&self) -> CIFormat
CIImage only.The pixel format of the CPU memory that your Core Image Processor Kernel can write pixels to.
Sourceunsafe fn baseAddress(&self) -> NonNull<c_void>
unsafe fn baseAddress(&self) -> NonNull<c_void>
The base address of CPU memory that your Core Image Processor Kernel can write pixels to.
Sourceunsafe fn surface(&self) -> Retained<IOSurfaceRef>
Available on crate feature objc2-io-surface only.
unsafe fn surface(&self) -> Retained<IOSurfaceRef>
objc2-io-surface only.An output surface object that your Core Image Processor Kernel can write to.
Sourceunsafe fn pixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>
Available on crate feature objc2-core-video only.
unsafe fn pixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>
objc2-core-video only.An output pixelBuffer object that your Core Image Processor Kernel can write to.
Sourceunsafe fn metalTexture(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>
Available on crate feature objc2-metal only.
unsafe fn metalTexture( &self, ) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>
objc2-metal only.A Metal texture object that can be bound for output using Metal.
Sourceunsafe fn metalCommandBuffer(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>
Available on crate feature objc2-metal only.
unsafe fn metalCommandBuffer( &self, ) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>
objc2-metal only.Returns a Metal command buffer object that can be used for encoding commands.