#[repr(C)]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.pub unsafe fn imageWithCGImage_options( image: &CGImage, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-core-graphics
only.pub unsafe fn imageWithCGLayer(layer: &CGLayer) -> Retained<CIImage>
objc2-core-graphics
only.pub unsafe fn imageWithCGLayer_options( layer: &CGLayer, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-core-graphics
only.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.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.pub unsafe fn imageWithMTLTexture_options( texture: &ProtocolObject<dyn MTLTexture>, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<CIImage>>
objc2-metal
only.pub unsafe fn imageWithContentsOfURL(url: &NSURL) -> Option<Retained<CIImage>>
pub unsafe fn imageWithContentsOfURL_options( url: &NSURL, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<CIImage>>
pub unsafe fn imageWithData(data: &NSData) -> Option<Retained<CIImage>>
pub unsafe fn imageWithData_options( data: &NSData, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<CIImage>>
pub unsafe fn imageWithCVImageBuffer( image_buffer: &CVImageBuffer, ) -> Retained<CIImage>
objc2-core-video
only.pub unsafe fn imageWithCVImageBuffer_options( image_buffer: &CVImageBuffer, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-core-video
only.pub unsafe fn imageWithCVPixelBuffer( pixel_buffer: &CVPixelBuffer, ) -> Retained<CIImage>
objc2-core-video
only.pub unsafe fn imageWithCVPixelBuffer_options( pixel_buffer: &CVPixelBuffer, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-core-video
only.pub unsafe fn imageWithIOSurface(surface: &IOSurfaceRef) -> Retained<CIImage>
objc2-io-surface
only.pub unsafe fn imageWithIOSurface_options( surface: &IOSurfaceRef, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
objc2-io-surface
only.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.pub unsafe fn initWithCGImage_options( this: Allocated<Self>, image: &CGImage, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
objc2-core-graphics
only.pub unsafe fn initWithCGLayer( this: Allocated<Self>, layer: &CGLayer, ) -> Retained<Self>
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.pub unsafe fn initWithData( this: Allocated<Self>, data: &NSData, ) -> Option<Retained<Self>>
pub unsafe fn initWithData_options( this: Allocated<Self>, data: &NSData, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<Self>>
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.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.pub unsafe fn initWithMTLTexture_options( this: Allocated<Self>, texture: &ProtocolObject<dyn MTLTexture>, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<Self>>
objc2-metal
only.pub unsafe fn initWithContentsOfURL( this: Allocated<Self>, url: &NSURL, ) -> Option<Retained<Self>>
pub unsafe fn initWithContentsOfURL_options( this: Allocated<Self>, url: &NSURL, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Option<Retained<Self>>
pub unsafe fn initWithIOSurface( this: Allocated<Self>, surface: &IOSurfaceRef, ) -> Retained<Self>
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.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.pub unsafe fn initWithCVImageBuffer( this: Allocated<Self>, image_buffer: &CVImageBuffer, ) -> Retained<Self>
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.pub unsafe fn initWithCVPixelBuffer( this: Allocated<Self>, pixel_buffer: &CVPixelBuffer, ) -> Retained<Self>
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.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 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.pub unsafe fn imageByApplyingFilter_withInputParameters( &self, filter_name: &NSString, params: &NSDictionary<NSString, AnyObject>, ) -> Retained<CIImage>
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.pub unsafe fn imageByApplyingGaussianBlurWithSigma( &self, sigma: c_double, ) -> Retained<CIImage>
pub unsafe fn imageBySettingProperties( &self, properties: &NSDictionary, ) -> Retained<CIImage>
pub unsafe fn imageBySamplingLinear(&self) -> Retained<CIImage>
pub unsafe fn imageBySamplingNearest(&self) -> Retained<CIImage>
pub unsafe fn imageByInsertingIntermediate(&self) -> Retained<CIImage>
pub unsafe fn imageByInsertingIntermediate_( &self, cache: bool, ) -> Retained<CIImage>
pub unsafe fn imageByApplyingGainMap( &self, gainmap: &CIImage, ) -> Retained<CIImage>
pub unsafe fn imageByApplyingGainMap_headroom( &self, gainmap: &CIImage, headroom: c_float, ) -> Retained<CIImage>
pub unsafe fn extent(&self) -> CGRect
objc2-core-foundation
only.pub unsafe fn isOpaque(&self) -> bool
pub unsafe fn properties(&self) -> Retained<NSDictionary<NSString, AnyObject>>
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.pub unsafe fn contentHeadroom(&self) -> c_float
pub unsafe fn pixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>
objc2-core-video
only.pub unsafe fn CGImage(&self) -> Option<Retained<CGImage>>
objc2-core-graphics
only.pub unsafe fn metalTexture( &self, ) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>
objc2-metal
only.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.pub unsafe fn autoAdjustmentFiltersWithOptions( &self, options: Option<&NSDictionary<CIImageAutoAdjustmentOption, AnyObject>>, ) -> Retained<NSArray<CIFilter>>
CIFilter
only.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.
pub unsafe fn imageWithImageProvider_size__format_colorSpace_options( p: &AnyObject, width: usize, height: usize, f: CIFormat, cs: Option<&CGColorSpace>, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<CIImage>
CIImageProvider
and objc2-core-graphics
only.pub unsafe fn initWithImageProvider_size__format_colorSpace_options( this: Allocated<Self>, p: &AnyObject, width: usize, height: usize, f: CIFormat, cs: Option<&CGColorSpace>, options: Option<&NSDictionary<CIImageOption, AnyObject>>, ) -> Retained<Self>
CIImageProvider
and objc2-core-graphics
only.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