Next Page > Hide TOC

NSCustomImageRep Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in Mac OS X v10.0 and later.
Companion guide
Declared in
NSCustomImageRep.h

Overview

An NSCustomImageRep object uses a delegate object to render an image. When called upon to produce an image, it sends a message to its delegate to do the actual drawing. You can use this class to support custom image formats without going to the trouble of subclassing NSImageRep directly.

Tasks

Initializing a New NSCustomImageRep

Identifying the Object

Instance Methods

delegate

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

- (id)delegate

Return Value

The delegate object.

Availability
Declared In
NSCustomImageRep.h

drawSelector

Returns the selector for the delegate's drawing method.

- (SEL)drawSelector

Return Value

The selector for the delegate's drawing method.

Availability
Declared In
NSCustomImageRep.h

initWithDrawSelector:delegate:

Returns an NSCustomImageRep object initialized with the specified delegate information.

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

Parameters
aMethod

The selector to call when it is time to draw the image. The method should take a single parameter of type id that represents the NSCustomImageRep object that initiated drawing. The method must draw the image starting at the point (0, 0) in the current coordinate system.

anObject

The delegate object that responds to the selector in aMethod.

Return Value

An initialized NSCustomImageRep object, or nil if the object could not be initialized.

Discussion

When the receiver is asked to draw the image, it sends the specified message to the selector, passing itself as a parameter to the delegate method. The delegate's drawing method should have the following form:

- (void)myCustomDrawMethod:(id)anNSCustomImageRep;
Availability
See Also
Declared In
NSCustomImageRep.h

Next Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-01-19)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.