pub struct CIImage { /* private fields */ }CIImage only.Expand description
Implementations§
Source§impl CIImage
impl CIImage
pub unsafe fn imageWithCGImage(image: &CGImage) -> Retained<CIImage>
objc2-core-graphics only.Sourcepub unsafe fn imageWithCGImage_options(
image: &CGImage,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<CIImage>
Available on crate feature objc2-core-graphics only.
pub unsafe fn imageWithCGImage_options( image: &CGImage, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-core-graphics only.§Safety
options generic should be of the correct type.
Sourcepub unsafe fn imageWithCGImageSource_index_options(
source: &CGImageSource,
index: usize,
dict: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<CIImage>
Available on crate feature objc2-image-io only.
pub unsafe fn imageWithCGImageSource_index_options( source: &CGImageSource, index: usize, dict: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-image-io only.§Safety
dict generic should be of the correct type.
pub unsafe fn imageWithCGLayer(layer: &CGLayer) -> Retained<CIImage>
objc2-core-graphics only.Sourcepub unsafe fn imageWithCGLayer_options(
layer: &CGLayer,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<CIImage>
👎DeprecatedAvailable on crate feature objc2-core-graphics only.
pub unsafe fn imageWithCGLayer_options( layer: &CGLayer, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-core-graphics only.§Safety
options generic should be of the correct type.
pub unsafe fn imageWithBitmapData_bytesPerRow_size_format_colorSpace( data: &NSData, bytes_per_row: usize, size: CGSize, format: CIFormat, color_space: Option<&CGColorSpace>, ) -> Retained<CIImage>
objc2-core-foundation and objc2-core-graphics only.pub unsafe fn imageWithTexture_size_flipped_colorSpace( name: c_uint, size: CGSize, flipped: bool, color_space: Option<&CGColorSpace>, ) -> Retained<CIImage>
objc2-core-foundation and objc2-core-graphics only.Sourcepub unsafe fn imageWithTexture_size_flipped_options(
name: c_uint,
size: CGSize,
flipped: bool,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<CIImage>
👎Deprecated: Core Image OpenGL API deprecated. (Define CI_SILENCE_GL_DEPRECATION to silence these warnings)Available on crate feature objc2-core-foundation only.
pub unsafe fn imageWithTexture_size_flipped_options( name: c_uint, size: CGSize, flipped: bool, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-core-foundation only.§Safety
options generic should be of the correct type.
Sourcepub unsafe fn imageWithMTLTexture_options(
texture: &ProtocolObject<dyn MTLTexture>,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Option<Retained<CIImage>>
Available on crate feature objc2-metal only.
pub unsafe fn imageWithMTLTexture_options( texture: &ProtocolObject<dyn MTLTexture>, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<CIImage>>
objc2-metal only.§Safety
texturemay need to be synchronized.texturemay be unretained, you must ensure it is kept alive while in use.optionsgeneric should be of the correct type.
pub unsafe fn imageWithContentsOfURL(url: &NSURL) -> Option<Retained<CIImage>>
Sourcepub unsafe fn imageWithContentsOfURL_options(
url: &NSURL,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Option<Retained<CIImage>>
pub unsafe fn imageWithContentsOfURL_options( url: &NSURL, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<CIImage>>
§Safety
options generic should be of the correct type.
pub unsafe fn imageWithData(data: &NSData) -> Option<Retained<CIImage>>
Sourcepub unsafe fn imageWithData_options(
data: &NSData,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Option<Retained<CIImage>>
pub unsafe fn imageWithData_options( data: &NSData, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<CIImage>>
§Safety
options generic should be of the correct type.
pub unsafe fn imageWithCVImageBuffer( image_buffer: &CVImageBuffer, ) -> Retained<CIImage>
objc2-core-video only.Sourcepub unsafe fn imageWithCVImageBuffer_options(
image_buffer: &CVImageBuffer,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<CIImage>
Available on crate feature objc2-core-video only.
pub unsafe fn imageWithCVImageBuffer_options( image_buffer: &CVImageBuffer, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-core-video only.§Safety
options generic should be of the correct type.
pub unsafe fn imageWithCVPixelBuffer( pixel_buffer: &CVPixelBuffer, ) -> Retained<CIImage>
objc2-core-video only.Sourcepub unsafe fn imageWithCVPixelBuffer_options(
pixel_buffer: &CVPixelBuffer,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<CIImage>
Available on crate feature objc2-core-video only.
pub unsafe fn imageWithCVPixelBuffer_options( pixel_buffer: &CVPixelBuffer, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-core-video only.§Safety
options generic should be of the correct type.
pub unsafe fn imageWithIOSurface(surface: &IOSurfaceRef) -> Retained<CIImage>
objc2-io-surface only.Sourcepub unsafe fn imageWithIOSurface_options(
surface: &IOSurfaceRef,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<CIImage>
Available on crate feature objc2-io-surface only.
pub unsafe fn imageWithIOSurface_options( surface: &IOSurfaceRef, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-io-surface only.§Safety
options generic should be of the correct type.
pub unsafe fn imageWithColor(color: &CIColor) -> Retained<CIImage>
CIColor only.pub unsafe fn emptyImage() -> Retained<CIImage>
pub unsafe fn blackImage() -> Retained<CIImage>
pub unsafe fn whiteImage() -> Retained<CIImage>
pub unsafe fn grayImage() -> Retained<CIImage>
pub unsafe fn redImage() -> Retained<CIImage>
pub unsafe fn greenImage() -> Retained<CIImage>
pub unsafe fn blueImage() -> Retained<CIImage>
pub unsafe fn cyanImage() -> Retained<CIImage>
pub unsafe fn magentaImage() -> Retained<CIImage>
pub unsafe fn yellowImage() -> Retained<CIImage>
pub unsafe fn clearImage() -> Retained<CIImage>
pub unsafe fn initWithCGImage( this: Allocated<Self>, image: &CGImage, ) -> Retained<Self>
objc2-core-graphics only.Sourcepub unsafe fn initWithCGImage_options(
this: Allocated<Self>,
image: &CGImage,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<Self>
Available on crate feature objc2-core-graphics only.
pub unsafe fn initWithCGImage_options( this: Allocated<Self>, image: &CGImage, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
objc2-core-graphics only.§Safety
options generic should be of the correct type.
Sourcepub unsafe fn initWithCGImageSource_index_options(
this: Allocated<Self>,
source: &CGImageSource,
index: usize,
dict: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<Self>
Available on crate feature objc2-image-io only.
pub unsafe fn initWithCGImageSource_index_options( this: Allocated<Self>, source: &CGImageSource, index: usize, dict: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
objc2-image-io only.§Safety
dict generic should be of the correct type.
pub unsafe fn initWithCGLayer( this: Allocated<Self>, layer: &CGLayer, ) -> Retained<Self>
objc2-core-graphics only.Sourcepub unsafe fn initWithCGLayer_options(
this: Allocated<Self>,
layer: &CGLayer,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<Self>
👎Deprecated: Use initWithCGImage:options instead.Available on crate feature objc2-core-graphics only.
pub unsafe fn initWithCGLayer_options( this: Allocated<Self>, layer: &CGLayer, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
objc2-core-graphics only.§Safety
options generic should be of the correct type.
pub unsafe fn initWithData( this: Allocated<Self>, data: &NSData, ) -> Option<Retained<Self>>
Sourcepub unsafe fn initWithData_options(
this: Allocated<Self>,
data: &NSData,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Option<Retained<Self>>
pub unsafe fn initWithData_options( this: Allocated<Self>, data: &NSData, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<Self>>
§Safety
options generic should be of the correct type.
pub unsafe fn initWithBitmapData_bytesPerRow_size_format_colorSpace( this: Allocated<Self>, data: &NSData, bytes_per_row: usize, size: CGSize, format: CIFormat, color_space: Option<&CGColorSpace>, ) -> Retained<Self>
objc2-core-foundation and objc2-core-graphics only.pub unsafe fn initWithTexture_size_flipped_colorSpace( this: Allocated<Self>, name: c_uint, size: CGSize, flipped: bool, color_space: Option<&CGColorSpace>, ) -> Retained<Self>
objc2-core-foundation and objc2-core-graphics only.Sourcepub unsafe fn initWithTexture_size_flipped_options(
this: Allocated<Self>,
name: c_uint,
size: CGSize,
flipped: bool,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<Self>
👎Deprecated: Core Image OpenGL API deprecated. (Define CI_SILENCE_GL_DEPRECATION to silence these warnings)Available on crate feature objc2-core-foundation only.
pub unsafe fn initWithTexture_size_flipped_options( this: Allocated<Self>, name: c_uint, size: CGSize, flipped: bool, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
objc2-core-foundation only.§Safety
options generic should be of the correct type.
Sourcepub unsafe fn initWithMTLTexture_options(
this: Allocated<Self>,
texture: &ProtocolObject<dyn MTLTexture>,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Option<Retained<Self>>
Available on crate feature objc2-metal only.
pub unsafe fn initWithMTLTexture_options( this: Allocated<Self>, texture: &ProtocolObject<dyn MTLTexture>, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<Self>>
objc2-metal only.§Safety
texturemay need to be synchronized.texturemay be unretained, you must ensure it is kept alive while in use.optionsgeneric should be of the correct type.
pub unsafe fn initWithContentsOfURL( this: Allocated<Self>, url: &NSURL, ) -> Option<Retained<Self>>
Sourcepub unsafe fn initWithContentsOfURL_options(
this: Allocated<Self>,
url: &NSURL,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Option<Retained<Self>>
pub unsafe fn initWithContentsOfURL_options( this: Allocated<Self>, url: &NSURL, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<Self>>
§Safety
options generic should be of the correct type.
pub unsafe fn initWithIOSurface( this: Allocated<Self>, surface: &IOSurfaceRef, ) -> Retained<Self>
objc2-io-surface only.Sourcepub unsafe fn initWithIOSurface_options(
this: Allocated<Self>,
surface: &IOSurfaceRef,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<Self>
Available on crate feature objc2-io-surface only.
pub unsafe fn initWithIOSurface_options( this: Allocated<Self>, surface: &IOSurfaceRef, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
objc2-io-surface only.§Safety
options generic should be of the correct type.
Sourcepub unsafe fn initWithIOSurface_plane_format_options(
this: Allocated<Self>,
surface: &IOSurfaceRef,
plane: usize,
format: CIFormat,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<Self>
👎DeprecatedAvailable on crate feature objc2-io-surface only.
pub unsafe fn initWithIOSurface_plane_format_options( this: Allocated<Self>, surface: &IOSurfaceRef, plane: usize, format: CIFormat, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
objc2-io-surface only.§Safety
options generic should be of the correct type.
pub unsafe fn initWithCVImageBuffer( this: Allocated<Self>, image_buffer: &CVImageBuffer, ) -> Retained<Self>
objc2-core-video only.Sourcepub unsafe fn initWithCVImageBuffer_options(
this: Allocated<Self>,
image_buffer: &CVImageBuffer,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<Self>
Available on crate feature objc2-core-video only.
pub unsafe fn initWithCVImageBuffer_options( this: Allocated<Self>, image_buffer: &CVImageBuffer, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
objc2-core-video only.§Safety
options generic should be of the correct type.
pub unsafe fn initWithCVPixelBuffer( this: Allocated<Self>, pixel_buffer: &CVPixelBuffer, ) -> Retained<Self>
objc2-core-video only.Sourcepub unsafe fn initWithCVPixelBuffer_options(
this: Allocated<Self>,
pixel_buffer: &CVPixelBuffer,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<Self>
Available on crate feature objc2-core-video only.
pub unsafe fn initWithCVPixelBuffer_options( this: Allocated<Self>, pixel_buffer: &CVPixelBuffer, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
objc2-core-video only.§Safety
options generic should be of the correct type.
pub unsafe fn initWithColor( this: Allocated<Self>, color: &CIColor, ) -> Retained<Self>
CIColor only.pub unsafe fn imageByApplyingTransform( &self, matrix: CGAffineTransform, ) -> Retained<CIImage>
objc2-core-foundation only.pub unsafe fn imageByApplyingTransform_highQualityDownsample( &self, matrix: CGAffineTransform, high_quality_downsample: bool, ) -> Retained<CIImage>
objc2-core-foundation only.pub unsafe fn imageByApplyingOrientation( &self, orientation: c_int, ) -> Retained<CIImage>
pub unsafe fn imageTransformForOrientation( &self, orientation: c_int, ) -> CGAffineTransform
objc2-core-foundation only.pub unsafe fn imageByApplyingCGOrientation( &self, orientation: CGImagePropertyOrientation, ) -> Retained<CIImage>
objc2-image-io only.pub unsafe fn imageTransformForCGOrientation( &self, orientation: CGImagePropertyOrientation, ) -> CGAffineTransform
objc2-core-foundation and objc2-image-io only.pub unsafe fn imageByCompositingOverImage( &self, dest: &CIImage, ) -> Retained<CIImage>
pub unsafe fn imageByCroppingToRect(&self, rect: CGRect) -> Retained<CIImage>
objc2-core-foundation only.pub unsafe fn imageByClampingToExtent(&self) -> Retained<CIImage>
pub unsafe fn imageByClampingToRect(&self, rect: CGRect) -> Retained<CIImage>
objc2-core-foundation only.Sourcepub unsafe fn imageByApplyingFilter_withInputParameters(
&self,
filter_name: &NSString,
params: &NSDictionary<NSString, AnyObject>,
) -> Retained<CIImage>
pub unsafe fn imageByApplyingFilter_withInputParameters( &self, filter_name: &NSString, params: &NSDictionary<NSString, AnyObject>, ) -> Retained<CIImage>
§Safety
params generic should be of the correct type.
pub unsafe fn imageByApplyingFilter( &self, filter_name: &NSString, ) -> Retained<CIImage>
pub unsafe fn imageByColorMatchingColorSpaceToWorkingSpace( &self, color_space: &CGColorSpace, ) -> Option<Retained<CIImage>>
objc2-core-graphics only.pub unsafe fn imageByColorMatchingWorkingSpaceToColorSpace( &self, color_space: &CGColorSpace, ) -> Option<Retained<CIImage>>
objc2-core-graphics only.pub unsafe fn imageByPremultiplyingAlpha(&self) -> Retained<CIImage>
pub unsafe fn imageByUnpremultiplyingAlpha(&self) -> Retained<CIImage>
pub unsafe fn imageBySettingAlphaOneInExtent( &self, extent: CGRect, ) -> Retained<CIImage>
objc2-core-foundation only.Sourcepub unsafe fn imageByApplyingGaussianBlurWithSigma(
&self,
sigma: c_double,
) -> Retained<CIImage>
pub unsafe fn imageByApplyingGaussianBlurWithSigma( &self, sigma: c_double, ) -> Retained<CIImage>
Create an image by applying a gaussian blur to the receiver.
- Parameters:
- sigma: The sigma of the gaussian blur to apply to the receiver.
If the sigma is very small (less than
0.16) then the receiver is returned. - Returns:
An autoreleased
CIImageinstance or the received image.
Sourcepub unsafe fn imageBySettingProperties(
&self,
properties: &NSDictionary,
) -> Retained<CIImage>
pub unsafe fn imageBySettingProperties( &self, properties: &NSDictionary, ) -> Retained<CIImage>
Return a new image by changing the receiver’s metadata properties.
When you create an image, Core Image sets an image’s properties to a metadata
dictionary as described here: properties.
Use this method to override an image’s metadata properties with new values.
- Parameters:
- properties: A dictionary of metadata properties akin to the
CGImageSourceCopyPropertiesAtIndex()function. - Returns:
An autoreleased
CIImageinstance with a copy of the new properties.
§Safety
properties generic should be of the correct type.
Sourcepub unsafe fn imageBySamplingLinear(&self) -> Retained<CIImage>
pub unsafe fn imageBySamplingLinear(&self) -> Retained<CIImage>
Create an image by changing the receiver’s sample mode to bilinear interpolation.
- Returns:
An autoreleased
CIImageinstance with a bilinear sampling.
Sourcepub unsafe fn imageBySamplingNearest(&self) -> Retained<CIImage>
pub unsafe fn imageBySamplingNearest(&self) -> Retained<CIImage>
Create an image by changing the receiver’s sample mode to nearest neighbor.
- Returns:
An autoreleased
CIImageinstance with a nearest sampling.
Sourcepub unsafe fn imageByInsertingIntermediate(&self) -> Retained<CIImage>
pub unsafe fn imageByInsertingIntermediate(&self) -> Retained<CIImage>
Create an image that inserts a intermediate that is cacheable
This intermediate will be not be cached if kCIContextCacheIntermediates is false.
- Returns:
An autoreleased
CIImage.
Sourcepub unsafe fn imageByInsertingIntermediate_(
&self,
cache: bool,
) -> Retained<CIImage>
pub unsafe fn imageByInsertingIntermediate_( &self, cache: bool, ) -> Retained<CIImage>
Create an image that inserts a intermediate that is cacheable.
- Parameters:
- cache: Controls if Core Image caches the returned image.
YES: This intermediate will be cacheable even ifkCIContextCacheIntermediatesis false.NO: the intermediate will be not be cached ifkCIContextCacheIntermediatesis false.
- Returns:
An autoreleased
CIImage.
Sourcepub unsafe fn imageByInsertingTiledIntermediate(&self) -> Retained<CIImage>
pub unsafe fn imageByInsertingTiledIntermediate(&self) -> Retained<CIImage>
Create an image that inserts a intermediate that is cached in tiles
This intermediate will be cacheable even if kCIContextCacheIntermediates is false.
- Returns:
An autoreleased
CIImage.
Sourcepub unsafe fn imageByApplyingGainMap(
&self,
gainmap: &CIImage,
) -> Retained<CIImage>
pub unsafe fn imageByApplyingGainMap( &self, gainmap: &CIImage, ) -> Retained<CIImage>
Create an image that applies a gain map Core Image image to the received Core Image image.
The gain map image can be obtained by creating a CIImage instance from NSURL/NSData
and setting the kCIImageAuxiliaryHDRGainMap option set to true``.
If the gain map CIImage instance doesn’t have the needed properties metadata,
the received image will be returned as-is.
- Returns:
An autoreleased
CIImageinstance or the received image.
Sourcepub unsafe fn imageByApplyingGainMap_headroom(
&self,
gainmap: &CIImage,
headroom: c_float,
) -> Retained<CIImage>
pub unsafe fn imageByApplyingGainMap_headroom( &self, gainmap: &CIImage, headroom: c_float, ) -> Retained<CIImage>
Create an image that applies a gain map Core Image image with a specified headroom to the received Core Image image.
- Parameters:
- gainmap: The gain map
CIImageinstance to apply to the receiver. - headroom: a float value that specify how much headroom the resulting image should have. The headroom value will be limited to between 1.0 (i.e. SDR) and the full headroom allowed by the gain map.
- Returns:
An autoreleased
CIImageinstance or the received image.
Sourcepub unsafe fn imageBySettingContentHeadroom(
&self,
headroom: c_float,
) -> Retained<CIImage>
pub unsafe fn imageBySettingContentHeadroom( &self, headroom: c_float, ) -> Retained<CIImage>
Create an image by changing the receiver’s contentHeadroom property.
Changing this value will alter the behavior of the CIToneMapHeadroom and CISystemToneMap filters.
- If the value is set to 0.0 then the returned image’s headroom is unknown.
- If the value is set to 1.0 then the returned image is SDR.
- If the value is set to greater 1.0 then the returned image is HDR.
- Otherwise the returned image’s headroom is unknown.
- Returns:
An autoreleased
CIImage.
Sourcepub unsafe fn imageBySettingContentAverageLightLevel(
&self,
average: c_float,
) -> Retained<CIImage>
pub unsafe fn imageBySettingContentAverageLightLevel( &self, average: c_float, ) -> Retained<CIImage>
Create an image by changing the receiver’s contentAverageLightLevel property.
Changing this value will alter the behavior of the CIToneMapHeadroom and CISystemToneMap filters.
- If the value is set to 0.0 or less then the returned image’s
contentAverageLightLevelis unknown.
- Returns:
An autoreleased
CIImage.
Sourcepub unsafe fn extent(&self) -> CGRect
Available on crate feature objc2-core-foundation only.
pub unsafe fn extent(&self) -> CGRect
objc2-core-foundation only.Returns a rectangle the defines the bounds of non-(0,0,0,0) pixels in the image.
Note: the
extentof `CIImage`` may be infinite or have a non-zero origin.
Sourcepub unsafe fn isOpaque(&self) -> bool
pub unsafe fn isOpaque(&self) -> bool
Returns YES if the image is known to have and alpha value of 1.0 over the entire image extent.
This property is not atomic.
§Safety
This might not be thread-safe.
Sourcepub unsafe fn properties(&self) -> Retained<NSDictionary<NSString, AnyObject>>
pub unsafe fn properties(&self) -> Retained<NSDictionary<NSString, AnyObject>>
Returns the metadata properties dictionary of the image.
If the CIImage was created from NSURL or NSData then this dictionary is determined by calling CGImageSourceCopyPropertiesAtIndex().
If the CIImage was created with the kCIImageProperties option, then that dictionary is returned.
If the CIImage was created by applying CIFilter-class or CIKernel then the
properties of the root inputImage will be returned.
pub unsafe fn definition(&self) -> Retained<CIFilterShape>
CIFilterShape only.pub unsafe fn url(&self) -> Option<Retained<NSURL>>
pub unsafe fn colorSpace(&self) -> Option<Retained<CGColorSpace>>
objc2-core-graphics only.Sourcepub unsafe fn contentHeadroom(&self) -> c_float
pub unsafe fn contentHeadroom(&self) -> c_float
Returns the content headroom of the image.
If the image headroom is unknown, then the value 0.0 will be returned.
If the image headroom is known, then a value greater than or equal to 1.0 will be returned. A value of 1.0 will be returned if the image is SDR. A value greater than 1.0 will be returned if the image is HDR.
The image headroom may known when a CIImage is first initialized. If the a CIImage is initialized using:
NSURLorNSData: the headroom may be determined by associated metadata or deduced from pixel format or colorSpace information.CGImage: headroom may be determined byCGImageGetHeadroomInfo()or deduced from pixel format or colorSpace information.IOSurface: then the headroom will be determined bykIOSurfaceContentHeadroom. or deduced from pixel format or colorSpace information.CVPixelBuffer: then the headroom will be determined bykCVImageBufferContentLightLevelInfoKey. or deduced from pixel format or colorSpace information.BitmapData: headroom may be deduced from pixel format or colorSpace information.
If the image is the result of applying a CIFilter-class or CIKernel, this method will return 0.0.
There are exceptions to this. Applying a CIWarpKernel`` or certain ``CIFilter-class`` (e.g. CIGaussianBlur, CILanczosScaleTransform, CIAreaAverageand some others) to an image will result in a ``CIImage`` instance with the samecontentHeadroom` property value.
This property is not atomic.
§Safety
This might not be thread-safe.
Sourcepub unsafe fn contentAverageLightLevel(&self) -> c_float
pub unsafe fn contentAverageLightLevel(&self) -> c_float
Returns the content average light level of the image.
If the image average light level is unknown, then the value 0.0 will be returned.
If the image headroom is known, then a value greater than or equal to 0.0 will be returned.
The image average light level may known when a CIImage is first initialized. If the a CIImage is initialized with a:
CGImage: then the headroom will be determined byCGImageGetContentAverageLightLevel().CVPixelBuffer: then the headroom will be determined bykCVImageBufferContentLightLevelInfoKey.
If the image is the result of applying a CIFilter-class or CIKernel, this property will return 0.0.
There are exceptions to this. Applying a CIWarpKernel or certain CIFilter-class
(e.g. CIGaussianBlur, CILanczosScaleTransform, CIAreaAverage and some others)
to an image will result in a CIImage instance with the same contentAverageLightLevel property value.
This property is not atomic.
§Safety
This might not be thread-safe.
Sourcepub unsafe fn pixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>
Available on crate feature objc2-core-video only.
pub unsafe fn pixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>
objc2-core-video only.Sourcepub unsafe fn CGImage(&self) -> Option<Retained<CGImage>>
Available on crate feature objc2-core-graphics only.
pub unsafe fn CGImage(&self) -> Option<Retained<CGImage>>
objc2-core-graphics only.Sourcepub unsafe fn metalTexture(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>
Available on crate feature objc2-metal only.
pub unsafe fn metalTexture( &self, ) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>
objc2-metal only.Returns a Metal Texture if the Core Image image was created with a texture.
This will return non-nil if the image was created with /CIImage/imageWithMTLTexture:options: and no options.
Otherwise this property will be nil you should instead call
/CIContext/render:toMTLTexture:commandBuffer:bounds:colorSpace:.
Warning: Modifying the contents of this texture will cause the
CIImageinstance to render with incorrect results.
This property is not atomic.
§Safety
This might not be thread-safe.
pub unsafe fn regionOfInterestForImage_inRect( &self, image: &CIImage, rect: CGRect, ) -> CGRect
objc2-core-foundation only.Source§impl CIImage
AutoAdjustment.
impl CIImage
AutoAdjustment.
pub unsafe fn autoAdjustmentFilters(&self) -> Retained<NSArray<CIFilter>>
CIFilter only.Sourcepub unsafe fn autoAdjustmentFiltersWithOptions(
&self,
options: Option<&NSDictionary<CIImageAutoAdjustmentOption, AnyObject>>,
) -> Retained<NSArray<CIFilter>>
Available on crate feature CIFilter only.
pub unsafe fn autoAdjustmentFiltersWithOptions( &self, options: Option<&NSDictionary<CIImageAutoAdjustmentOption, AnyObject>>, ) -> Retained<NSArray<CIFilter>>
CIFilter only.§Safety
options generic should be of the correct type.
Source§impl CIImage
LabConversion.
impl CIImage
LabConversion.
pub unsafe fn imageByConvertingWorkingSpaceToLab(&self) -> Retained<CIImage>
pub unsafe fn imageByConvertingLabToWorkingSpace(&self) -> Retained<CIImage>
Source§impl CIImage
CIImageProvider.
impl CIImage
CIImageProvider.
Sourcepub unsafe fn imageWithImageProvider_size__format_colorSpace_options(
provider: &AnyObject,
width: usize,
height: usize,
format: CIFormat,
color_space: Option<&CGColorSpace>,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<CIImage>
Available on crate features CIImageProvider and objc2-core-graphics only.
pub unsafe fn imageWithImageProvider_size__format_colorSpace_options( provider: &AnyObject, width: usize, height: usize, format: CIFormat, color_space: Option<&CGColorSpace>, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
CIImageProvider and objc2-core-graphics only.Create an image object based on pixels from an image provider object.
Core Image retains the provider object until the image is deallocated. The image provider object will not be called until the image is rendered.
- Parameters:
- provider: An object that implements the
CIImageProviderprotocol. - width: The width of the image.
- height: The height of the image.
- format: The
CIFormatof the provided pixels. - colorSpace: The color space that the image is defined in.
If
nil, then the pixels will not be is not color matched to the Core Image working color space. - options: A dictionary that contains various
CIImageOptionkeys that affect the resultingCIImage. The optionkCIImageProviderTileSizecontrols if and how the provider object is called in tiles. The optionkCIImageProviderUserInfoallows additional state to be passed to the provider object. - Returns:
An autoreleased
CIImageobject based on the data provider.
§Safety
providershould be of the correct type.optionsgeneric should be of the correct type.
Sourcepub unsafe fn initWithImageProvider_size__format_colorSpace_options(
this: Allocated<Self>,
provider: &AnyObject,
width: usize,
height: usize,
format: CIFormat,
color_space: Option<&CGColorSpace>,
options: Option<&NSDictionary<CIImageOption, AnyObject>>,
) -> Retained<Self>
Available on crate features CIImageProvider and objc2-core-graphics only.
pub unsafe fn initWithImageProvider_size__format_colorSpace_options( this: Allocated<Self>, provider: &AnyObject, width: usize, height: usize, format: CIFormat, color_space: Option<&CGColorSpace>, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
CIImageProvider and objc2-core-graphics only.Initializes an image object based on pixels from an image provider object.
Core Image retains the provider object until the image is deallocated. The image provider object will not be called until the image is rendered.
- Parameters:
- provider: An object that implements the
CIImageProviderprotocol. - width: The width of the image.
- height: The height of the image.
- format: The
CIFormatof the provided pixels. - colorSpace: The color space that the image is defined in.
If
nil, then the pixels will not be is not color matched to the Core Image working color space. - options: A dictionary that contains various
CIImageOptionkeys that affect the resultingCIImage. The optionkCIImageProviderTileSizecontrols if and how the provider object is called in tiles. The optionkCIImageProviderUserInfoallows additional state to be passed to the provider object. - Returns:
An initialized
CIImageobject based on the data provider.
§Safety
providershould be of the correct type.optionsgeneric should be of the correct type.
Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init/new methods).
§Example
Check that an instance of NSObject has the precise class NSObject.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load instead.Use Ivar::load instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T.
See Ivar::load_ptr for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Attempt to downcast the object to a class of type T.
This is the reference-variant. Use Retained::downcast if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString to a NSMutableString,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass: for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject.
§Panics
This works internally by calling isKindOfClass:. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject and
NSProxy implement this method.
§Examples
Cast an NSString back and forth from NSObject.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();Try (and fail) to cast an NSObject to an NSString.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}Trait Implementations§
Source§impl ClassType for CIImage
impl ClassType for CIImage
Source§const NAME: &'static str = "CIImage"
const NAME: &'static str = "CIImage"
Source§type ThreadKind = <<CIImage as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<CIImage as ClassType>::Super as ClassType>::ThreadKind
Source§impl CopyingHelper for CIImage
impl CopyingHelper for CIImage
Source§impl NSCopying for CIImage
impl NSCopying for CIImage
Source§impl NSObjectProtocol for CIImage
impl NSObjectProtocol for CIImage
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass directly, or cast your objects with AnyObject::downcast_ref