Inherits from: NSObject
Package: com.apple.yellow.applicaton
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
- synchronize
public static NSGraphicsContext currentContext()
public static void setCurrentContext(NSGraphicsContext context)
public void flush()
public void flushGraphics()
public boolean isDrawingToScreen()
true
if
the drawing destination is the screen, false
otherwise.The default implementation of this method throws an exception to indicate that the method must be overridden in a concrete subclass.
public 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 throws an exception to indicate that the method must be overridden in a concrete subclass.
public 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 throws an exception to indicate that the method must be overridden in a concrete subclass.
public void synchronize()
The default implementation of this method throws an exception to indicate that the method must be overridden in a concrete subclass.