- Inherits from:
- NSObject
- Package:
- com.apple.yellow.application
The NSGraphicsContext class is the 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 superclass for destination-specific graphics contexts.
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.
- Constructors
- NSGraphicsContext
- Creating a graphics context
- graphicsContextWithAttributes
- graphicsContextWithWindow
- Testing the drawing destination
- currentContextDrawingToScreen
- isDrawingToScreen
- Setting and identifying the current context
- currentContext
- restoreGraphicsContext
- setCurrentContext
- saveGraphicsContext
- Getting information about a context
- attributes
- Controlling the context -flush
- flush
- flushGraphics
- restoreGraphicsState
- saveGraphicsState
- setGraphicsState
- synchronize
public NSGraphicsContext()
public static NSGraphicsContext currentContext()
public static boolean currentContextDrawingToScreen()
public static NSGraphicsContext graphicsContextWithAttributes(NSDictionary attributes)
public static NSGraphicsContext graphicsContextWithWindow(NSWindow aWindow)
public static void restoreGraphicsContext()
public static void saveGraphicsContext()
public static void setCurrentContext(NSGraphicsContext context)
public static void setGraphicsState(int graphicsState)
public NSDictionary attributes()
public void flush()
public void flushGraphics()
public boolean isDrawingToScreen()
true
if
the drawing destination is the screen, false
otherwise.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.
public void saveGraphicsState()
Saving the graphics state saves such attributes as the current drawing style, transformation matrix, color, and font. To set drawing style attributes, use the methods of NSBezierPath. Other attributes are accessed through appropriate objects such as NSAffineTransform, NSColor, and NSFont.
public void synchronize()