Draws the specified area of the view, and its descendants, into a provided bitmap-representation object.
SDK
- macOS 10.4+
Framework
- App
Kit
Declaration
func cacheDisplay(in rect: NSRect, to bitmapImageRep: NSBitmap Image Rep)
Parameters
rect
A rectangle defining the region to be drawn into
bitmap
.Image Rep bitmapImageRep
An
NSBitmap
object. For pixel-format compatibility,Image Rep bitmap
should have been obtained fromImage Rep bitmap
.Image Rep For Caching Display(in:)
Discussion
You are responsible for initializing the bitmap to the desired configuration before calling this method. However, once initialized, you can reuse the same bitmap multiple times to refresh the cached copy of your view’s contents.
The bitmap produced by this method is transparent (that is, has an alpha value of 0) wherever the view and its descendants do not draw any content.