cacheImage(in:)
Stores the window’s raster image from a given rectangle expressed in the window’s base coordinate system.
Declaration
func cacheImage(in rect: NSRect)Parameters
- rect:
The rectangle representing the image to cache.
Discussion
This method allows the window to perform temporary drawing, such as a band around the selection as the user drags the mouse, and to quickly restore the previous image by invoking restoreCachedImage() and flushIfNeeded(). The next time the window displays, it discards its cached image rectangles. You can also explicitly use discardCachedImage() to free the memory occupied by cached image rectangles. rect is made integral before caching the image to avoid antialiasing artifacts.
Only the last cached rectangle is remembered and can be restored.