Contents

drawRepresentation(_:in:)

Draws the image using the specified image representation object.

Declaration

func drawRepresentation(_ imageRep: NSImageRep, in rect: NSRect) -> Bool

Parameters

  • imageRep:

    The image representation object to be drawn.

  • rect:

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

Return Value

true if the image was successfully drawn; otherwise, returns false.

Discussion

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 draw(in:) message; otherwise, it sends a draw(at:) 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

Related Documentation

Drawing Images