CIImageProcessorOutput

Trait CIImageProcessorOutput 

Source
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 { ... }
}
Available on crate feature 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§

Source

unsafe fn region(&self) -> CGRect
where Self: Sized + Message,

Available on crate feature 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 extent that was passed to /CIImageProcessorKernel/applyWithExtent:inputs:arguments:error:.

Source

unsafe fn bytesPerRow(&self) -> usize
where Self: Sized + Message,

The bytes per row of the CPU memory that your Core Image Processor Kernel can write pixels to.

Source

unsafe fn format(&self) -> CIFormat
where Self: Sized + Message,

Available on crate feature CIImage only.

The pixel format of the CPU memory that your Core Image Processor Kernel can write pixels to.

Source

unsafe fn baseAddress(&self) -> NonNull<c_void>
where Self: Sized + Message,

The base address of CPU memory that your Core Image Processor Kernel can write pixels to.

Source

unsafe fn surface(&self) -> Retained<IOSurfaceRef>
where Self: Sized + Message,

Available on crate feature objc2-io-surface only.

An output surface object that your Core Image Processor Kernel can write to.

Source

unsafe fn pixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>
where Self: Sized + Message,

Available on crate feature objc2-core-video only.

An output pixelBuffer object that your Core Image Processor Kernel can write to.

Source

unsafe fn metalTexture( &self, ) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>
where Self: Sized + Message,

Available on crate feature objc2-metal only.

A Metal texture object that can be bound for output using Metal.

Source

unsafe fn metalCommandBuffer( &self, ) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>
where Self: Sized + Message,

Available on crate feature objc2-metal only.

Returns a Metal command buffer object that can be used for encoding commands.

Source

unsafe fn digest(&self) -> u64
where Self: Sized + Message,

A 64-bit digest that uniquely describes the contents of the output of a processor.

This digest will change if the graph up to and including the output of the processor changes in any way.

Trait Implementations§

Source§

impl ProtocolType for dyn CIImageProcessorOutput

Source§

const NAME: &'static str = "CIImageProcessorOutput"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn CIImageProcessorOutput

Implementations on Foreign Types§

Source§

impl<T> CIImageProcessorOutput for ProtocolObject<T>

Implementors§