init(cgImage:)
Returns a bitmap image representation 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
Related Documentation
Creating Bitmap Representations of Images
imageReps(with:)colorize(byMappingGray:to:blackMapping:whiteMapping:)init(bitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:)init(bitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:)init(ciImage:)init(data:)init(forIncrementalLoad:)init(focusedViewRect:)