NSObjectCIImageProvider

Trait NSObjectCIImageProvider 

Source
pub unsafe trait NSObjectCIImageProvider:
    ClassType
    + Sized
    + Sealed {
    // Provided methods
    unsafe fn provideImageData_bytesPerRow_origin__size__userInfo(
        &self,
        data: NonNull<c_void>,
        rowbytes: usize,
        originx: usize,
        originy: usize,
        width: usize,
        height: usize,
        info: Option<&AnyObject>,
    ) { ... }
    unsafe fn provideImageToMTLTexture_commandBuffer_originx_originy_width_height_userInfo(
        &self,
        texture: &ProtocolObject<dyn MTLTexture>,
        command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
        originx: usize,
        originy: usize,
        width: usize,
        height: usize,
        info: Option<&AnyObject>,
    ) { ... }
}
Available on crate feature CIImageProvider only.
Expand description

Category “CIImageProvider” on NSObject.

Protocol used to lazily supply image data.

Provided Methods§

Source

unsafe fn provideImageData_bytesPerRow_origin__size__userInfo( &self, data: NonNull<c_void>, rowbytes: usize, originx: usize, originy: usize, width: usize, height: usize, info: Option<&AnyObject>, )

The method that an image provider object must implement. This method provides pixel data when the image object is rendered.

The implementation should provide pixels for the requested sub-rect x,y,width,height of the image. The sub-rect is in defined in the image’s local coordinate space, where the origin is relative to the top left corner of the image.

By default, this method will be called to request the full image regardless of what sub-rect is needed for the current render. In this case the requested x,y,width,height will be 0,0,imageWidth,imageHeight

If the kCIImageProviderTileSize option is specified when the CIImage was created, then this method may be called once for each tile that is needed for the current render.

  • Parameters:
  • data: A pointer into which the provider should copy the pixels for the requested sub-rect.
  • rowbytes: The number of bytes per row for the requested pixels.
  • originx: The x origin of the requested sub-rect relative to the upper left corner of the image.
  • originy: The y origin of the requested sub-rect relative to the upper left corner of the image.
  • width: The width of the requested sub-rect.
  • height: The height of the requested sub-rect.
  • info: The value of the `kCIImageProviderTileSize`` option specified when calling:
  • /CIImage/imageWithImageProvider:size::format:colorSpace:options:
  • /CIImage/initWithImageProvider:size::format:colorSpace:options:
§Safety
  • data must be a valid pointer.
  • info should be of the correct type.
Source

unsafe fn provideImageToMTLTexture_commandBuffer_originx_originy_width_height_userInfo( &self, texture: &ProtocolObject<dyn MTLTexture>, command_buffer: &ProtocolObject<dyn MTLCommandBuffer>, originx: usize, originy: usize, width: usize, height: usize, info: Option<&AnyObject>, )

Available on crate feature objc2-metal only.

An optional method that an image provider object way implement. With this method, the provider object can use the Metal API to provide pixel data into a MTLTexture when the image object is rendered.

The implementation should provide pixels for the requested sub-rect x,y,width,height of the image. The sub-rect is in defined in the image’s local coordinate space, where the origin is relative to the top left corner of the image.

The work to fill the MTLTexture should be encoded on the specified commandBuffer. If the implementation uses its own commandBuffer, then it should call waitUntilCompleted before returning. If the texture is surface-backed then you only need to call waitUntilScheduled before returning.

By default, this method will be called to request the full image regardless of what sub-rect is needed for the current render. In this case the requested x,y,width,height will be 0,0,imageWidth,imageHeight

If the kCIImageProviderTileSize option is specified when the CIImage was created, then this method may be called once for each tile that is needed for the current render.

  • Parameters:
  • texture: The ` <id

MTLTexture` into which the provider should copy the pixels for the requested sub-rect.

  • commandBuffer: The ` <id

MTLCommandBuffer` that the provider should use encoded the copy.

  • originx: The x origin of the requested sub-rect relative to the upper left corner of the image.
  • originy: The y origin of the requested sub-rect relative to the upper left corner of the image.
  • width: The width of the requested sub-rect.
  • height: The height of the requested sub-rect.
  • info: The value of the `kCIImageProviderTileSize`` option specified when calling:
  • /CIImage/imageWithImageProvider:size::format:colorSpace:options:
  • /CIImage/initWithImageProvider:size::format:colorSpace:options:
§Safety
  • texture may need to be synchronized.
  • texture may be unretained, you must ensure it is kept alive while in use.
  • info should be of the correct type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl NSObjectCIImageProvider for NSObject

Implementors§