NSGraphicsContext
An object that represents a graphics context.
Declaration
class NSGraphicsContextOverview
You can think of a graphics context as a destination to which drawing and graphics state operations are sent for execution. Each graphics context contains its own graphics environment and state.
The NSGraphicsContext class is an abstract superclass for destination-specific graphics contexts. You obtain instances of concrete subclasses with the class methods current, init(attributes:), init(bitmapImageRep:), init(cgContext:flipped:), and init(window:).
At any time there is the notion of the current context. The current context for the current thread may be set using current.
Graphics contexts are maintained on a stack. You push a graphics context onto the stack by sending it a saveGraphicsState() message, and pop it off the stack by sending it a restoreGraphicsState() message. By sending restoreGraphicsState() to a graphics context object you remove it from the stack, and the next graphics context on the stack becomes the current graphics context.
Topics
Creating a Graphics Context
init(attributes:)init(bitmapImageRep:)init(cgContext:flipped:)init(window:)init(graphicsPort:flipped:)
Managing the Current Context
Managing the Graphics State
restoreGraphicsState()restoreGraphicsState()saveGraphicsState()saveGraphicsState()setGraphicsState(_:)
Testing the Drawing Destination
Getting Information About the Context
Flushing Graphics to the Context
Configuring Rendering Options
compositingOperationNSCompositingOperationimageInterpolationNSImageInterpolationshouldAntialiaspatternPhase