Initializer

init(attributes:)

Instantiates and returns an instance of NSGraphicsContext using the specified attributes.

Declaration

init?(attributes: [NSGraphicsContext.AttributeKey : Any] = [:])

Parameters

attributes

A dictionary of values associated with the keys described in Attribute dictionary keys. The attributes specify such things as representation format and destination.

Return Value

A new NSGraphicsContext object or nil if the object could not be created.

Discussion

Use this method to create a graphics context for a window or bitmap destination. If you want to create a graphics context for a PDF or PostScript destination, do not use this method; instead, use the NSPrintOperation class to set up the printing environment needed to generate that type of information.

See Also

Creating a Graphics Context

init?(bitmapImageRep: NSBitmapImageRep)

Instantiates and returns a new graphics context using the supplied NSBitmapImageRep object as the context destination.

init(cgContext: CGContext, flipped: Bool)

Creates a new graphics context from the specified Core Graphics context and the initial flipped state.

init(graphicsPort: UnsafeMutableRawPointer, flipped: Bool)

Instantiates and returns a new graphics context from the given graphics port.

Deprecated
init(window: NSWindow)

Creates and returns a new graphics context for drawing into a window.