Instance Method


Stores the window’s raster image from a given rectangle expressed in the window’s base coordinate system.


- (void)cacheImageInRect:(NSRect)rect;



The rectangle representing the image to cache.


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 flushWindowIfNeeded. 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.

See Also

Bracketing Drawing Operations

- restoreCachedImage

Splices the window’s cached image rectangles, if any, back into its raster image (and buffer if it has one), undoing the effect of any drawing performed within those areas since they were established using cacheImageInRect:.

- discardCachedImage

Discards all of the window’s cached image rectangles.