lockFocus()
Prepares the image to receive drawing commands.
Declaration
func lockFocus()Discussion
This method sets the current drawing context to the area of the offscreen window used to cache the receiver’s contents. Subsequent drawing commands are composited to this offscreen window. If the offscreen drawing area already has some content, any new drawing commands are composited with that content. This method does not modify the original image data directly.
When locking focus, this method chooses the best image representation object available and locks focus on that object. If the receiver has no image representations, this method creates one with the default depth and locks focus on it.
A successful lockFocus() message must be balanced with a matching unlockFocus() message to the same NSImage object. These messages bracket the code that draws the image.
If lockFocus() is unable to focus on the image, it raises an NSImageCacheException.