Instance Method

addRepresentation(_:)

Adds the specified image representation object to the image.

Declaration

func addRepresentation(_ imageRep: NSImageRep)

Parameters

imageRep

The image representation to add.

Discussion

After invoking this method, you may need to explicitly set features of the new image representation, such as the size, number of colors, and so on. This is true particularly when the NSImage object has multiple image representations to choose from. See NSImageRep and its subclasses for the methods you use to complete initialization.

Any representation added by this method is retained by the receiver. Image representations cannot be shared among multiple NSImage objects.

See Also

Working with Image Representations

func addRepresentations([NSImageRep])

Adds an array of image representation objects to the receiver.

var representations: [NSImageRep]

An array containing all of the receiver's image representations.

func removeRepresentation(NSImageRep)

Removes and releases the specified image representation.

func bestRepresentation(for: NSRect, context: NSGraphicsContext?, hints: [NSImageRep.HintKey : Any]?) -> NSImageRep?

Returns the best representation of the image for the specified rectangle using the provided hints.

struct NSImageRep.HintKey

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

enum NSImage.LayoutDirection

The layout direction for the image.