Initializer

init(cgImage:)

Returns an NSBitmapImageRep object created from a Core Graphics image object.

Declaration

init(cgImage: CGImage)

Parameters

cgImage

A Core Graphics image object (an opaque type) from which to create the receiver. This opaque type is retained.

Return Value

An NSBitmapImageRep object initialized from the contents of the Core Graphics image.

Discussion

If you use this method, you should treat the resulting bitmap NSBitmapImageRep object as read only. Because it only retains the value in the cgImage parameter, rather than unpacking the data, accessing the pixel data requires the creation of a copy of that data in memory. Changes to that data are not saved back to the Core Graphics image.

See Also

Creating an NSBitmapImageRep Object

class func imageReps(with: Data) -> [NSImageRep]

Creates and returns an array of initialized NSBitmapImageRep objects corresponding to the images in the supplied data.

init(ciImage: CIImage)

Returns an NSBitmapImageRep object created from a Core Image object.

init?(data: Data)

Initializes a newly allocated NSBitmapImageRep from the provided data.

init?(focusedViewRect: NSRect)

Initializes the receiver, a newly allocated NSBitmapImageRep object, with bitmap data read from a rendered image.

Deprecated
init(forIncrementalLoad: ())

Initializes and returns the receiver, a newly allocated NSBitmapImageRep object, for incremental loading.