PATH  Documentation > Mac OS X > Application Kit Reference: Objective-C

Table of Contents

NSCustomImageRep


Inherits from:
NSImageRep : NSObject
Conforms to:
NSCoding
(NSImageRep)
NSCopying (NSImageRep)
NSObject (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:

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 among them. In 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 aMethod . aMethod 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)




Table of Contents