Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: AppKit/NSGraphicsContext.h
The NSGraphicsContext class is the abstract programmatic interface to objects that represent graphics contexts. A context can be thought of as a destination to which drawing and graphics state operations are sent for execution. Each graphics context contains its own graphics environment and state.
At any time there is the notion of the current context. The current context for the current thread may be set using setCurrentContext:.
The NSGraphicsContext class is an abstract superclass for platform-specific graphics contexts. The most familiar subclass of the NSGraphicsContext for OPENSTEP programmers is the NSDPSContext class. The NSApplication object creates an NSDPSContext by default.
Graphics contexts are maintained on a stack. You push a graphics context onto the stack by sending it a saveGraphicsState message, and push it off the stack by sending it a restoreGraphicsState message. By sending restoreGraphicsState to an NSGraphicsContext object you remove it from the stack and the next graphics context on stack becomes the current graphics context.
- Testing the drawing destination
- - isDrawingToScreen
- Setting and identifying the current context
- + currentContext
- + setCurrentContext:
- Controlling the context - flush
- - isDrawingToScreen
- - restoreGraphicsState
- - saveGraphicsState
- - wait
+ (NSGraphicsContext *)currentContext
+ (void)setCurrentContext:(NSGraphicsContext
*)context
- (void)flush
- (void)flushGraphics
- (BOOL)isDrawingToScreen
YES
if
the drawing destination is the screen, NO
otherwise.The default implementation of this method raises NSInvalidArgumentException to indicate that the method must be overridden in a concrete subclass.
- (void)restoreGraphicsState
Restoring the graphics state restores such attributes as the current drawing style, transformation matrix, color, and font of the original graphics state.
The default implementation of this method raises NSInvalidArgumentException to indicate that the method must be overridden in a concrete subclass.
- (void)saveGraphicsState
Saving the graphics state saves such attributes as the current drawing style, transformation matrix, color, and font. To set drawing style attrbutes, use the methods of NSBezierPath. Other attributes are accessed through appropriate objects such as NSAffineTransform, NSColor, and NSFont.
The default implementation of this method raises NSInvalidArgumentException to indicate that the method must be overridden in a concrete subclass.
- (void)wait
The default implementation of this method raises NSInvalidArgumentException to indicate that the method must be overridden in a concrete subclass.