[TOC] [Prev] [Next] [Bottom]

NSCustomImageRep

Inherits From:
NSImageRep : NSObject

Conforms To:
NSCoding (from NSImageRep)
NSCopying (from NSImageRep)
NSObject (from NSObject)

Declared In:
AppKit/NSCustomImageRep.h

Class Description

An NSCustomImageRep is an object that uses a delegated method to render an image. When called upon to produce the image, it sends a message to its delegate to have the method performed.

Like most other kinds of NSImageReps, an NSCustomImageRep is generally used indirectly, through an NSImage object. An NSImage must be able to choose between various representations of a given image. It also needs to provide an off-screen cache of the appropriate depth for any image it uses. It determines this information by querying its NSImageReps.

Thus to work with an NSImage, an NSCustomImageRep must be able to provide some information about its image. Use the following methods, inherited from the NSImageRep class, to set attributes of the NSCustomImageRep:

setSize:

setColorSpaceName:

setAlpha:

setPixelsHigh:

setPixelsWide:

setBitsPerSample:

Note that if these attributes aren't set, and an NSCustomImageRep is used in an NSImage with other representations, NSImage won't be able to select between them. In actual practice, this usually isn't a problem.


Method Types

Initializing a new NSCustomImageRep
- initWithDrawSelector:delegate:
Identifying the object
- delegate
- drawSelector

Instance Methods

delegate

- (id)delegate

Returns the delegate object that renders the image for the NSCustomImageRep.


drawSelector

- (SEL)drawSelector

Returns the associated draw method selector.


initWithDrawSelector:delegate:

- (id)initWithDrawSelector:(SEL)aMethod delegate:(id)anObject

Initializes the receiver, a newly allocated NSCustomImageRep instance, so that it delegates responsibility for rendering the image to anObject. When the NSCustomImageRep receives a draw message, it will in turn send a message to anObject to perform the aMethod method. The aMethod method should take only one argument, the id of the NSCustomImageRep. It should draw the image at location (0.0, 0.0) in the current coordinate system.

Returns self.

See also: - draw (NSImageRep)



[TOC] [Prev] [Next] [Bottom]

Copyright © 1997, Apple Computer, Inc. All rights reserved.