(Preliminary Documentation) Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSImage 

Inherits From:	NSObject 

Declared In:	appkit/NSImage.h 

Initializing a New NSImage Instance 

- (id)init	Initializes the new NSImage without setting its size.
- (id)initByReferencingFile:(NSString *)filename	Initializes the new NSImage from the data in filename.  The file is assumed to persist and may be reread later if the NSImage is resized or otherwise modified.
- (id)initWithContentsOfFile:(NSString *)filename
	Initializes the new NSImage from the data in filename. 
- (id)initWithPasteboard:(NSPasteboard *)pasteboard
	Initializes the new NSImage with the data in pasteboard.
- (id)initWithData:(NSData *)data	Initializes the new NSImage from data.
- (id)initWithSize:(NSSize)aSize	Initializes the new NSImage to the specified size.

Setting the Size of the Image 

- (void)setSize:(NSSize)aSize	Sets the size of the image to aSize in base coordinates.
- (NSSize)size	Returns the size of the image.

Referring to Images by Name 

- (BOOL)setName:(NSString *)name	Assigns name to be the receiver's name.  Returns NO if name is already in use; otherwise, returns YES.
- (NSString *)name	Returns the receiver's name.
+ (id)imageNamed:(NSString *)name	Returns the NSImage object having name.  Searches the main bundle for the image if necessary.

Specifying the Image 

- (void)addRepresentation:(NSImageRep *)imageRep
	Adds imageRep to the receiver's list of representations.
- (void)addRepresentations:(NSArray *)imageRepArray
	Adds the imageReps from imageRepArray to the receiver's list of representations.
- (void)lockFocus	Prepares for drawing in the best representation.
- (void)lockFocusOnRepresentation:(NSImageRep *)imageRep
	Prepares for drawing in imageRep.
- (void)unlockFocus	Balances a previous lockFocus or lockFocusOn:.

Using the Image 

- (void)compositeToPoint:(NSPoint)aPoint	Composites the image to aPoint using the operation op.
operation:(NSCompositingOperation)op
- (void)compositeToPoint:(NSPoint)aPoint	Composites the aRect portion of the image to aPoint using
fromRect:(NSRect)aRect		the operation op.
operation:(NSCompositingOperation)op
- (void)dissolveToPoint:(NSPoint)aPoint	Composites the image to aPoint using the dissolve
fraction:(float)aFloat		operator.   aFloat is a value from 0.0 to 1.0 that determines how much of the resulting composite comes from the receiver.
- (void)dissolveToPoint:(NSPoint)aPoint	Composites the aRect portion of the image to aPoint using
fromRect:(NSRect)aRect		the dissolve operator.     aFloat is a value from 0.0 to 1.0
fraction:(float)aFloat		that determines how much of the resulting composite comes from the receiver.

Choosing Which Image Representation to Use 

- (void)setPrefersColorMatch:(BOOL)flag	Determines whether color matches are preferred.
- (BOOL)prefersColorMatch	Returns whether color matches are preferred.
- (void)setUsesEPSOnResolutionMismatch:(BOOL)flag
	Sets whether to use EPS representations on mismatch.
- (BOOL)usesEPSOnResolutionMismatch	Returns whether to use EPS representations on mismatch.
- (void)setMatchesOnMultipleResolution:(BOOL)flag
	Sets whether resolution multiples match.
- (BOOL)matchesOnMultipleResolution	Returns whether resolution multiples match.

Getting the Representations 

- (NSImageRep *)bestRepresentationForDevice:(NSDictionary *)deviceDescription
	Returns the best representation for the device described by deviceDescription.  If deviceDescription is nil, the current device is assumed.  See NSGraphics.h for appropriate dictionary keys and values.
- (NSArray *)representations	Returns an array of all the representations.
- (void)removeRepresentation:(NSImageRep *)imageRep
	Removes imageRep from the receiver's list of representations.

Determining How the Image is Stored 

- (void)setCachedSeparately:(BOOL)flag	Sets whether representations are cached separately.
- (BOOL)isCachedSeparately	Returns whether representations are cached separately.
- (void)setDataRetained:(BOOL)flag	Sets whether image data is retained by the object after the image is cached.
- (BOOL)isDataRetained	Returns whether image data is retained.
- (void)setCacheDepthMatchesImageDepth:(BOOL)flag
	Sets whether the default depth limit applies to caches.
- (BOOL)cacheDepthMatchesImageDepth	Returns whether the default depth limit applies to caches.

Determining How the Image is Drawn 

- (BOOL)isValid	Returns YES to indicate that the receiver's image is valid.
- (void)setScalesWhenResized:(BOOL)flag	If flag is YES, representations are scaled to fit. 
- (BOOL)scalesWhenResized	Returns whether representations are scaled to fit.
- (void)setBackgroundColor:(NSColor *)aColor	Sets the background color of the image to aColor.
- (NSColor *)backgroundColor	Returns the background color of the image.
- (BOOL)drawRepresentation:(NSImageRep *)imageRep 
inRect:(NSRect)aRect	Overridden to have imageRep draw the representation in aRect.
- (void)recache	Invalidates caches of all representations, so they will be redrawn.

Assigning a Delegate 

- (void)setDelegate:(id)anObject	Makes anObject the delegate of the NSImage.
- (id)delegate	Returns the delegate of the NSImage.

Producing TIFF Data for the Image 

- (NSData *)TIFFRepresentation	Returns a data object containing TIFF for all representations, using their default compressions.
- (NSData *)TIFFRepresentationUsingCompression:(NSTIFFCompression)comp
factor:(float)aFloat	Returns a data object containing TIFF for all the representations.

Managing NSImageRep subclasses 

+ (NSArray *)imageUnfilteredFileTypes 	Returns an array of file types recognized by the NSImage
		without filtering.  This list comes from all registered NSImageReps.
+ (NSArray *)imageUnfilteredPasteboardTypes
	Returns an array of pasteboard types recognized by the NSImage.

Testing Image Data Sources 

+ (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard
	Returns YES if the receiver can create a representation from pasteboard; otherwise, returns NO.
+ (NSArray *)imageFileTypes	Returns an array of supported image data file types.
+ (NSArray *)imagePasteboardTypes	Returns an array of supported pasteboard types.

Methods Implemented by the Delegate 

- (NSImage *)imageDidNotDraw:(id)sender	Responds to message that image couldn't be composited
inRect:(NSRect)aRect		into aRect.