Struct objc2_app_kit::NSImage
source · #[repr(C)]pub struct NSImage { /* private fields */ }
Available on crate feature
NSImage
only.Implementations§
source§impl NSImage
impl NSImage
pub unsafe fn imageNamed(name: &NSImageName) -> Option<Id<NSImage>>
pub unsafe fn imageWithSystemSymbolName_accessibilityDescription( name: &NSString, description: Option<&NSString> ) -> Option<Id<Self>>
pub unsafe fn imageWithSystemSymbolName_variableValue_accessibilityDescription( name: &NSString, value: c_double, description: Option<&NSString> ) -> Option<Id<Self>>
pub unsafe fn imageWithSymbolName_variableValue( name: &NSString, value: c_double ) -> Option<Id<Self>>
pub unsafe fn imageWithSymbolName_bundle_variableValue( name: &NSString, bundle: Option<&NSBundle>, value: c_double ) -> Option<Id<Self>>
pub unsafe fn initWithSize(this: Allocated<Self>, size: NSSize) -> Id<Self>
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Id<Self>
pub fn initWithData(this: Allocated<Self>, data: &NSData) -> Option<Id<Self>>
pub unsafe fn initWithContentsOfFile( this: Allocated<Self>, file_name: &NSString ) -> Option<Id<Self>>
pub unsafe fn initWithContentsOfURL( this: Allocated<Self>, url: &NSURL ) -> Option<Id<Self>>
pub fn initByReferencingFile( this: Allocated<Self>, file_name: &NSString ) -> Option<Id<Self>>
pub unsafe fn initByReferencingURL( this: Allocated<Self>, url: &NSURL ) -> Id<Self>
pub unsafe fn initWithPasteboard( this: Allocated<Self>, pasteboard: &NSPasteboard ) -> Option<Id<Self>>
Available on crate feature
NSPasteboard
only.pub unsafe fn initWithDataIgnoringOrientation( this: Allocated<Self>, data: &NSData ) -> Option<Id<Self>>
pub unsafe fn imageWithSize_flipped_drawingHandler( size: NSSize, drawing_handler_should_be_called_with_flipped_context: bool, drawing_handler: &Block<dyn Fn(NSRect) -> Bool> ) -> Id<Self>
Available on crate feature
block2
only.pub unsafe fn size(&self) -> NSSize
pub unsafe fn setSize(&self, size: NSSize)
pub unsafe fn setName(&self, string: Option<&NSImageName>) -> bool
pub unsafe fn name(&self) -> Option<Id<NSImageName>>
pub unsafe fn backgroundColor(&self) -> Id<NSColor>
Available on crate feature
NSColor
only.pub unsafe fn setBackgroundColor(&self, background_color: &NSColor)
Available on crate feature
NSColor
only.pub unsafe fn usesEPSOnResolutionMismatch(&self) -> bool
pub unsafe fn setUsesEPSOnResolutionMismatch( &self, uses_eps_on_resolution_mismatch: bool )
pub unsafe fn prefersColorMatch(&self) -> bool
pub unsafe fn setPrefersColorMatch(&self, prefers_color_match: bool)
pub unsafe fn matchesOnMultipleResolution(&self) -> bool
pub unsafe fn setMatchesOnMultipleResolution( &self, matches_on_multiple_resolution: bool )
pub unsafe fn matchesOnlyOnBestFittingAxis(&self) -> bool
pub unsafe fn setMatchesOnlyOnBestFittingAxis( &self, matches_only_on_best_fitting_axis: bool )
pub unsafe fn drawAtPoint_fromRect_operation_fraction( &self, point: NSPoint, from_rect: NSRect, op: NSCompositingOperation, delta: CGFloat )
Available on crate feature
NSGraphics
only.pub unsafe fn drawInRect_fromRect_operation_fraction( &self, rect: NSRect, from_rect: NSRect, op: NSCompositingOperation, delta: CGFloat )
Available on crate feature
NSGraphics
only.pub unsafe fn drawInRect_fromRect_operation_fraction_respectFlipped_hints( &self, dst_space_portion_rect: NSRect, src_space_portion_rect: NSRect, op: NSCompositingOperation, requested_alpha: CGFloat, respect_context_is_flipped: bool, hints: Option<&NSDictionary<NSImageHintKey, AnyObject>> )
Available on crate features
NSGraphics
and NSImageRep
only.pub unsafe fn drawRepresentation_inRect( &self, image_rep: &NSImageRep, rect: NSRect ) -> bool
Available on crate feature
NSImageRep
only.pub unsafe fn drawInRect(&self, rect: NSRect)
pub unsafe fn recache(&self)
pub unsafe fn TIFFRepresentation(&self) -> Option<Id<NSData>>
pub unsafe fn TIFFRepresentationUsingCompression_factor( &self, comp: NSTIFFCompression, factor: c_float ) -> Option<Id<NSData>>
Available on crate feature
NSBitmapImageRep
only.pub unsafe fn representations(&self) -> Id<NSArray<NSImageRep>>
Available on crate feature
NSImageRep
only.pub unsafe fn addRepresentations(&self, image_reps: &NSArray<NSImageRep>)
Available on crate feature
NSImageRep
only.pub unsafe fn addRepresentation(&self, image_rep: &NSImageRep)
Available on crate feature
NSImageRep
only.pub unsafe fn removeRepresentation(&self, image_rep: &NSImageRep)
Available on crate feature
NSImageRep
only.pub unsafe fn isValid(&self) -> bool
pub unsafe fn delegate(&self) -> Option<Id<ProtocolObject<dyn NSImageDelegate>>>
pub unsafe fn setDelegate( &self, delegate: Option<&ProtocolObject<dyn NSImageDelegate>> )
pub unsafe fn imageTypes() -> Id<NSArray<NSString>>
pub unsafe fn imageUnfilteredTypes() -> Id<NSArray<NSString>>
pub unsafe fn canInitWithPasteboard(pasteboard: &NSPasteboard) -> bool
Available on crate feature
NSPasteboard
only.pub unsafe fn cacheMode(&self) -> NSImageCacheMode
pub unsafe fn setCacheMode(&self, cache_mode: NSImageCacheMode)
pub unsafe fn alignmentRect(&self) -> NSRect
pub unsafe fn setAlignmentRect(&self, alignment_rect: NSRect)
pub unsafe fn isTemplate(&self) -> bool
pub unsafe fn setTemplate(&self, template: bool)
pub unsafe fn accessibilityDescription(&self) -> Option<Id<NSString>>
pub unsafe fn setAccessibilityDescription( &self, accessibility_description: Option<&NSString> )
pub unsafe fn bestRepresentationForRect_context_hints( &self, rect: NSRect, reference_context: Option<&NSGraphicsContext>, hints: Option<&NSDictionary<NSImageHintKey, AnyObject>> ) -> Option<Id<NSImageRep>>
Available on crate features
NSGraphicsContext
and NSImageRep
only.pub unsafe fn hitTestRect_withImageDestinationRect_context_hints_flipped( &self, test_rect_dest_space: NSRect, image_rect_dest_space: NSRect, context: Option<&NSGraphicsContext>, hints: Option<&NSDictionary<NSImageHintKey, AnyObject>>, flipped: bool ) -> bool
Available on crate features
NSGraphicsContext
and NSImageRep
only.pub unsafe fn recommendedLayerContentsScale( &self, preferred_contents_scale: CGFloat ) -> CGFloat
pub unsafe fn layerContentsForContentsScale( &self, layer_contents_scale: CGFloat ) -> Id<AnyObject>
pub unsafe fn capInsets(&self) -> NSEdgeInsets
pub unsafe fn setCapInsets(&self, cap_insets: NSEdgeInsets)
pub unsafe fn resizingMode(&self) -> NSImageResizingMode
pub unsafe fn setResizingMode(&self, resizing_mode: NSImageResizingMode)
pub unsafe fn imageWithSymbolConfiguration( &self, configuration: &NSImageSymbolConfiguration ) -> Option<Id<NSImage>>
pub unsafe fn symbolConfiguration(&self) -> Id<NSImageSymbolConfiguration>
pub unsafe fn imageWithLocale(&self, locale: Option<&NSLocale>) -> Id<NSImage>
pub unsafe fn locale(&self) -> Option<Id<NSLocale>>
source§impl NSImage
impl NSImage
Deprecated
pub unsafe fn imageUnfilteredFileTypes() -> Id<NSArray<NSString>>
👎Deprecated: Use +imageUnfilteredTypes instead
pub unsafe fn imageUnfilteredPasteboardTypes() -> Id<NSArray<NSPasteboardType>>
👎Deprecated: Use +imageUnfilteredTypes instead
Available on crate feature
NSPasteboard
only.pub unsafe fn imageFileTypes() -> Id<NSArray<NSString>>
👎Deprecated: Use +imageTypes instead
pub unsafe fn imagePasteboardTypes() -> Id<NSArray<NSPasteboardType>>
👎Deprecated: Use +imageTypes instead
Available on crate feature
NSPasteboard
only.pub unsafe fn bestRepresentationForDevice( &self, device_description: Option<&NSDictionary> ) -> Option<Id<NSImageRep>>
👎Deprecated: Use -[NSImage bestRepresentationForRect:context:hints:] instead. Any deviceDescription dictionary is also a valid hints dictionary.
Available on crate feature
NSImageRep
only.pub unsafe fn lockFocus(&self)
👎Deprecated: This method is incompatible with resolution-independent drawing and should not be used. Instead, use +[NSImage imageWithSize:flipped:drawingHandler:] to create a block-based image describing the desired image drawing, or use +[NSGraphicsContext graphicsContextWithBitmapImageRep:] to manipulate specific bitmap image representations.
pub unsafe fn lockFocusFlipped(&self, flipped: bool)
👎Deprecated: This method is incompatible with resolution-independent drawing and should not be used. Instead, use +[NSImage imageWithSize:flipped:drawingHandler:] to create a block-based image describing the desired image drawing, or use +[NSGraphicsContext graphicsContextWithBitmapImageRep:] to manipulate specific bitmap image representations.
pub unsafe fn unlockFocus(&self)
👎Deprecated: This method is incompatible with resolution-independent drawing and should not be used. Instead, use +[NSImage imageWithSize:flipped:drawingHandler:] to create a block-based image describing the desired image drawing, or use +[NSGraphicsContext graphicsContextWithBitmapImageRep:] to manipulate specific bitmap image representations.
pub unsafe fn setFlipped(&self, flag: bool)
👎Deprecated: The concept of flippedness for NSImage is deprecated. Please see the AppKit 10.6 release notes for a discussion of why and for how to replace existing usage.
pub unsafe fn isFlipped(&self) -> bool
👎Deprecated: The concept of flippedness for NSImage is deprecated. Please see the AppKit 10.6 release notes for a discussion of why and for how to replace existing usage.
pub unsafe fn setScalesWhenResized(&self, flag: bool)
👎Deprecated: You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details.
pub unsafe fn scalesWhenResized(&self) -> bool
👎Deprecated: You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details.
pub unsafe fn setDataRetained(&self, flag: bool)
👎Deprecated: You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details.
pub unsafe fn isDataRetained(&self) -> bool
👎Deprecated: You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details.
pub unsafe fn setCachedSeparately(&self, flag: bool)
👎Deprecated: You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details.
pub unsafe fn isCachedSeparately(&self) -> bool
👎Deprecated: You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details.
pub unsafe fn setCacheDepthMatchesImageDepth(&self, flag: bool)
👎Deprecated: You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details.
pub unsafe fn cacheDepthMatchesImageDepth(&self) -> bool
👎Deprecated: You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details.
pub unsafe fn dissolveToPoint_fraction(&self, point: NSPoint, fraction: CGFloat)
👎Deprecated: Use -drawAtPoint:… or -drawInRect:… methods instead
pub unsafe fn dissolveToPoint_fromRect_fraction( &self, point: NSPoint, rect: NSRect, fraction: CGFloat )
👎Deprecated: Use -drawAtPoint:… or -drawInRect:… methods instead
pub unsafe fn compositeToPoint_operation( &self, point: NSPoint, operation: NSCompositingOperation )
👎Deprecated: Use -drawAtPoint:… or -drawInRect:… methods instead
Available on crate feature
NSGraphics
only.pub unsafe fn compositeToPoint_fromRect_operation( &self, point: NSPoint, rect: NSRect, operation: NSCompositingOperation )
👎Deprecated: Use -drawAtPoint:… or -drawInRect:… methods instead
Available on crate feature
NSGraphics
only.pub unsafe fn compositeToPoint_operation_fraction( &self, point: NSPoint, operation: NSCompositingOperation, fraction: CGFloat )
👎Deprecated: Use -drawAtPoint:… or -drawInRect:… methods instead
Available on crate feature
NSGraphics
only.pub unsafe fn compositeToPoint_fromRect_operation_fraction( &self, point: NSPoint, rect: NSRect, operation: NSCompositingOperation, fraction: CGFloat )
👎Deprecated: Use -drawAtPoint:… or -drawInRect:… methods instead
Available on crate feature
NSGraphics
only.pub unsafe fn lockFocusOnRepresentation( &self, image_representation: Option<&NSImageRep> )
👎Deprecated: Create an image using +[NSImage imageWithSize:flipped:drawingHandler:], and begin your custom drawing with -[NSImageRep drawInRect:] instead.
Available on crate feature
NSImageRep
only.pub unsafe fn cancelIncrementalLoad(&self)
👎Deprecated: This method does not perform any operation on 10.4 or later.
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
Available on crate feature NSAccessibilityConstants
only.
pub fn class(&self) -> &'static AnyClass
NSAccessibilityConstants
only.Dynamically find the class of this object.
§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.Available on crate feature NSAccessibilityConstants
only.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load
instead.NSAccessibilityConstants
only.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 unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load_mut
instead.Available on crate feature NSAccessibilityConstants
only.
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
Ivar::load_mut
instead.NSAccessibilityConstants
only.Use Ivar::load_mut
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.
Trait Implementations§
source§impl BorrowMut<AnyObject> for NSImage
impl BorrowMut<AnyObject> for NSImage
source§fn borrow_mut(&mut self) -> &mut AnyObject
fn borrow_mut(&mut self) -> &mut AnyObject
Mutably borrows from an owned value. Read more
source§impl BorrowMut<NSObject> for NSImage
impl BorrowMut<NSObject> for NSImage
source§fn borrow_mut(&mut self) -> &mut NSObject
fn borrow_mut(&mut self) -> &mut NSObject
Mutably borrows from an owned value. Read more
source§impl ClassType for NSImage
impl ClassType for NSImage
§type Mutability = InteriorMutable
type Mutability = InteriorMutable
Whether the type is mutable or immutable. Read more
source§const NAME: &'static str = "NSImage"
const NAME: &'static str = "NSImage"
The name of the Objective-C class that this type represents. Read more
source§fn class() -> &'static AnyClass
fn class() -> &'static AnyClass
Get a reference to the Objective-C class that this type represents. Read more
source§fn as_super_mut(&mut self) -> &mut Self::Super
fn as_super_mut(&mut self) -> &mut Self::Super
Get a mutable reference to the superclass.
source§impl NSCopying for NSImage
impl NSCopying for NSImage
source§impl NSItemProviderReading for NSImage
impl NSItemProviderReading for NSImage
source§impl NSItemProviderWriting for NSImage
impl NSItemProviderWriting for NSImage
source§unsafe fn writableTypeIdentifiersForItemProvider_class(
) -> Id<NSArray<NSString>>
unsafe fn writableTypeIdentifiersForItemProvider_class( ) -> Id<NSArray<NSString>>
Available on crate features
NSArray
and NSString
only.source§unsafe fn writableTypeIdentifiersForItemProvider(&self) -> Id<NSArray<NSString>>
unsafe fn writableTypeIdentifiersForItemProvider(&self) -> Id<NSArray<NSString>>
Available on crate features
NSArray
and NSString
only.source§unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier_class(
type_identifier: &NSString
) -> NSItemProviderRepresentationVisibility
unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier_class( type_identifier: &NSString ) -> NSItemProviderRepresentationVisibility
Available on crate feature
NSString
only.source§unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier(
&self,
type_identifier: &NSString
) -> NSItemProviderRepresentationVisibility
unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier( &self, type_identifier: &NSString ) -> NSItemProviderRepresentationVisibility
Available on crate feature
NSString
only.source§impl NSObjectProtocol for NSImage
impl NSObjectProtocol for NSImage
source§fn isEqual(&self, other: &AnyObject) -> bool
fn isEqual(&self, other: &AnyObject) -> bool
Check whether the object is equal to an arbitrary other object. Read more
source§fn hash(&self) -> usize
fn hash(&self) -> usize
An integer that can be used as a table address in a hash table
structure. Read more
source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Check if the object is an instance of the class, or one of its
subclasses. Read more
source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
Check if the object is an instance of the class type, or one of its
subclasses. Read more
source§fn isMemberOfClass(&self, cls: &AnyClass) -> bool
fn isMemberOfClass(&self, cls: &AnyClass) -> bool
Check if the object is an instance of a specific class, without
checking subclasses. Read more
source§fn respondsToSelector(&self, aSelector: Sel) -> bool
fn respondsToSelector(&self, aSelector: Sel) -> bool
Check whether the object implements or inherits a method with the
given selector. Read more
source§fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
Check whether the object conforms to a given protocol. Read more
source§fn debugDescription(&self) -> Id<NSObject>
fn debugDescription(&self) -> Id<NSObject>
A textual representation of the object to use when debugging. Read more
source§impl NSPasteboardReading for NSImage
Available on crate feature NSPasteboard
only.
impl NSPasteboardReading for NSImage
Available on crate feature
NSPasteboard
only.unsafe fn readableTypesForPasteboard( pasteboard: &NSPasteboard ) -> Id<NSArray<NSPasteboardType>>
unsafe fn readingOptionsForType_pasteboard( type: &NSPasteboardType, pasteboard: &NSPasteboard ) -> NSPasteboardReadingOptions
unsafe fn initWithPasteboardPropertyList_ofType( this: Allocated<Self>, property_list: &AnyObject, type: &NSPasteboardType ) -> Option<Id<Self>>
source§impl NSPasteboardWriting for NSImage
Available on crate feature NSPasteboard
only.
impl NSPasteboardWriting for NSImage
Available on crate feature
NSPasteboard
only.unsafe fn writableTypesForPasteboard( &self, pasteboard: &NSPasteboard ) -> Id<NSArray<NSPasteboardType>>
unsafe fn writingOptionsForType_pasteboard( &self, type: &NSPasteboardType, pasteboard: &NSPasteboard ) -> NSPasteboardWritingOptions
unsafe fn pasteboardPropertyListForType( &self, type: &NSPasteboardType ) -> Option<Id<AnyObject>>
source§impl NSSecureCoding for NSImage
impl NSSecureCoding for NSImage
source§impl PartialEq for NSImage
impl PartialEq for NSImage
source§impl RefEncode for NSImage
impl RefEncode for NSImage
source§const ENCODING_REF: Encoding = <NSObject as ::objc2::RefEncode>::ENCODING_REF
const ENCODING_REF: Encoding = <NSObject as ::objc2::RefEncode>::ENCODING_REF
The Objective-C type-encoding for a reference of this type. Read more
impl Eq for NSImage
impl Message for NSImage
impl StructuralPartialEq for NSImage
Auto Trait Implementations§
impl !Freeze for NSImage
impl !RefUnwindSafe for NSImage
impl !Send for NSImage
impl !Sync for NSImage
impl !Unpin for NSImage
impl !UnwindSafe for NSImage
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CounterpartOrSelf for T
impl<T> CounterpartOrSelf for T
§type Immutable = <<T as ClassType>::Mutability as MutabilityCounterpartOrSelf<T>>::Immutable
type Immutable = <<T as ClassType>::Mutability as MutabilityCounterpartOrSelf<T>>::Immutable
The immutable counterpart of the type, or
Self
if the type has no
immutable counterpart. Read more§type Mutable = <<T as ClassType>::Mutability as MutabilityCounterpartOrSelf<T>>::Mutable
type Mutable = <<T as ClassType>::Mutability as MutabilityCounterpartOrSelf<T>>::Mutable
The mutable counterpart of the type, or
Self
if the type has no
mutable counterpart. Read more