Instance Method


Draws the image using the specified image representation object.


- (BOOL)drawRepresentation:(NSImageRep *)imageRep inRect:(NSRect)rect;



The image representation object to be drawn.


The rectangle in which to draw the image representation, specified in the current coordinate system.

Return Value

YES if the image was successfully drawn; otherwise, returns NO.


This method fills the specified rectangle with the image's current background color and then sends a message to the specified image representation asking if to draw itself. If the image supports the ability to scale itself when it is resized, this method sends a drawInRect: message; otherwise, it sends a drawAtPoint: message.

You should not call this method directly; an NSImage object uses it to cache and print its image representations. You can override this method to change the way images are rendered into their caches and onto the printed page. For example, you could scale or rotate the coordinate system before sending this message to super to continue rendering the image representation.

If the background color is fully transparent and the image data is not being cached, the specified rectangle is not to be filled before the representation draws.

See Also

Drawing the Image

- drawInRect:

Draws the image in the specified rectangle.

- drawAtPoint:fromRect:operation:fraction:

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

- drawInRect:fromRect:operation:fraction:

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

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

Draws all or part of the image in the specified rectangle respecting the hints and the orientation of the current coordinate system.


Compositing operators, described in terms of having source and destination images, each having an opaque and transparent region.