CIImageProcessorInput

Trait CIImageProcessorInput 

Source
pub unsafe trait CIImageProcessorInput {
    // 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 digest(&self) -> u64
       where Self: Sized + Message { ... }
    unsafe fn roiTileIndex(&self) -> NSUInteger
       where Self: Sized + Message { ... }
    unsafe fn roiTileCount(&self) -> NSUInteger
       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 CIImageProcessorInput object to access the image data and supporting information to perform your custom image processing routine. For example, if you process the image using a Metal shader, use the metalTexture property to bind the image as an input texture. Or, if you process the image using a CPU-based routine, use the baseAddress property to access pixel data in memory.

You should use the input’s region property to determine which portion of the input image is available to be processed.

To finish setting up or performing your image processing routine, use the provided CIImageProcessorOutput object to return processed pixel data to Core Image.

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 input image that your Core Image Processor Kernel can use to provide the output.

Note: This will contain but may be larger than the rect returned by ‘roiCallback’.

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 read pixelsfrom.

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 read pixels from.

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 read pixels from.

Warning: This memory must not be modified by the CIImageProcessorKernel.

Source

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

Available on crate feature objc2-io-surface only.

An input surface object that your Core Image Processor Kernel can read from.

Warning: This surface must not be modified by the CIImageProcessorKernel.

Source

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

Available on crate feature objc2-core-video only.

An input pixel buffer object that your Core Image Processor Kernel can read from.

Warning: This buffer must not be modified by the CIImageProcessorKernel.

Source

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

Available on crate feature objc2-metal only.

A MTLTexture object that can be bound for input using Metal.

Warning: This texture must not be modified by the CIImageProcessorKernel.

Source

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

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

This digest will change if the graph of the input changes in any way.

Source

unsafe fn roiTileIndex(&self) -> NSUInteger
where Self: Sized + Message,

This property tells a tiled-input processor which input tile index is being processed.

This property is only relevant if your processor implements /CIImageProcessorKernel/roiTileArrayForInput:arguments:outputRect:

This can be useful if the processor needs to clear the CIImageProcessorOutput before the first tile is processed.

Source

unsafe fn roiTileCount(&self) -> NSUInteger
where Self: Sized + Message,

This property tells a tiled-input processor how many input tiles will be processed.

This property is only relevant if your processor implements /CIImageProcessorKernel/roiTileArrayForInput:arguments:outputRect:

This can be useful if the processor needs to do work CIImageProcessorOutput after the last tile is processed.

Trait Implementations§

Source§

impl ProtocolType for dyn CIImageProcessorInput

Source§

const NAME: &'static str = "CIImageProcessorInput"

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 CIImageProcessorInput

Implementations on Foreign Types§

Source§

impl<T> CIImageProcessorInput for ProtocolObject<T>

Implementors§