Instance Method

draw

Implemented by subclasses to draw the image in the current coordinate system.

Declaration

- (BOOL)draw;

Return Value

YES if the image was successfully drawn; otherwise, NO if there was a problem. The default version of this method simply returns YES.

Discussion

Subclass override this method to draw the image using the image data. By the time this method is called, the graphics state is already configured for you to draw the image at location (0.0, 0.0) in the current coordinate system.

The standard Application Kit subclasses all draw the image using the NSCompositeCopy composite operation defined in the Constants section of NSImage. Using the copy operator, the image data overwrites the destination without any blending effects. Transparent (alpha) regions in the source image appear black. To use other composite operations, you must place the representation into an NSImage object and use its drawAtPoint:fromRect:operation:fraction: or drawInRect:fromRect:operation:fraction: methods.

See Also

Drawing the Image

- drawAtPoint:

Draws the receiver's image data at the specified point in the current coordinate system.

- drawInRect:

Draws the image, scaling it (as needed) to fit the specified rectangle.

- drawInRect:fromRect:operation:fraction:respectFlipped:hints:

Draws all or part of the image in the specified rectangle in the current coordinate system.

NSImageHintKey

Constants for the keys to include in a hints dictionary when drawing the image.