Caching Window Images

To support transitory drawing by views, the NSWindow class defines methods that temporarily cache a portion of its raster image so that it can be restored later. This feature is useful for situations where highly dynamic drawing must be done over the otherwise static image of the window. For example, in a drawing program where the user drags lines and other shapes directly onto a canvas, it’s more efficient to restore the window’s cached image and draw anew over that than to have all the views send display instructions to the window server. For more information, see the method descriptions for cacheImageInRect:, restoreCachedImage, and discardCachedImage.