NSImage — Mac OS X 10.0


This class is the general interface to images in the AppKit. Instances of NSImage usually have one or more image representations (instances of the class NSImageRep or one of its subclasses) associated with them. The purpose of keeping multiple image representations is so the image data can be rendered on a variety of devices, with each image representation providing rendering functionality for a specific device.

image with no caption

@interface NSImage : NSObject <NSCoding, NSCopying>
                                  // Convenience Constructors
   + (NSArray *)imageFileTypes;
   + (id)imageNamed:(NSString *)name;
   + (NSArray *)imagePasteboardTypes;
   + (NSArray *)imageUnfilteredFileTypes;
   + (NSArray *)imageUnfilteredPasteboardTypes;
                                  // Initializers
   - (id)initByReferencingFile:(NSString *)fileName;
   - (id)initByReferencingURL:(NSURL *)url;
   - (id)initWithContentsOfFile:(NSString *)fileName;
   - (id)initWithContentsOfURL:(NSURL *)url;
   - (id)initWithData:(NSData *)data;
   - (id)initWithPasteboard:(NSPasteboard *)pasteboard;
   - (id)initWithSize:(NSSize)aSize;
                                  // Accessor Methods
   - (void)setSize:(NSSize)aSize;
   - (NSSize)size;
   - (void)setPrefersColorMatch:(BOOL)flag;
   - (BOOL)prefersColorMatch;
   - (void)setCacheMode:(NSImageCacheMode)mode;
   - (NSImageCacheMode)cacheMode;
   - (void)setUsesEPSOnResolutionMismatch:(BOOL)flag;
   - (BOOL)usesEPSOnResolutionMismatch;
   - (void)setFlipped ...

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.