CGContext
A Quartz 2D drawing environment.
Declaration
class CGContextOverview
A CGContext instance represents a Quartz 2D drawing destination. A graphics context contains drawing parameters and all device-specific information needed to render the paint on a page to the destination, whether the destination is a window in an application, a bitmap image, a PDF document, or a printer.
Topics
Creating Bitmap Graphics Contexts
Creating PDF Graphics Contexts
Converting Between Coordinate Spaces
userSpaceToDeviceSpaceTransformconvertToDeviceSpace(_:)convertToUserSpace(_:)convertToDeviceSpace(_:)convertToUserSpace(_:)convertToDeviceSpace(_:)convertToUserSpace(_:)
Constructing a Current Graphics Path
beginPath()move(to:)addLine(to:)addLines(between:)addRect(_:)addRects(_:)addEllipse(in:)addArc(center:radius:startAngle:endAngle:clockwise:)addArc(tangent1End:tangent2End:radius:)addCurve(to:control1:control2:)addQuadCurve(to:control:)addPath(_:)closePath()pathreplacePathWithStrokedPath()
Examining the Current Graphics Path
Drawing the Current Graphics Path
Drawing Shapes
clear(_:)fill(_:)fill(_:)fillEllipse(in:)stroke(_:)stroke(_:width:)strokeEllipse(in:)strokeLineSegments(between:)
Drawing Images and PDF Content
Drawing Gradients and Shadings
drawLinearGradient(_:start:end:options:)drawRadialGradient(_:startCenter:startRadius:endCenter:endRadius:options:)CGGradientDrawingOptionsdrawShading(_:)
Drawing Text
textMatrixtextPositionselectFont(name:size:textEncoding:)setCharacterSpacing(_:)setFont(_:)setFontSize(_:)setTextDrawingMode(_:)setAllowsFontSmoothing(_:)setAllowsFontSubpixelPositioning(_:)setAllowsFontSubpixelQuantization(_:)setShouldSmoothFonts(_:)setShouldSubpixelPositionFonts(_:)setShouldSubpixelQuantizeFonts(_:)showGlyphs(g:count:)showGlyphs(_:at:)showGlyphsAtPoint(x:y:glyphs:count:)showGlyphsWithAdvances(glyphs:advances:count:)showText(string:length:)showTextAtPoint(x:y:string:length:)CGTextDrawingMode
Drawing Core Graphics Layers
Setting Fill, Stroke, and Shadow Colors
setFillColor(_:)setFillColor(_:)setFillColor(cyan:magenta:yellow:black:alpha:)setFillColor(gray:alpha:)setFillColor(red:green:blue:alpha:)setFillColorSpace(_:)setShadow(offset:blur:)setShadow(offset:blur:color:)setStrokeColor(_:)setStrokeColor(_:)setStrokeColor(cyan:magenta:yellow:black:alpha:)setStrokeColor(gray:alpha:)setStrokeColor(red:green:blue:alpha:)setStrokeColorSpace(_:)setStrokePattern(_:colorComponents:)setAlpha(_:)
Working with the Current Clipping Path
Working with Transparency Layers
beginTransparencyLayer(in:auxiliaryInfo:)beginTransparencyLayer(auxiliaryInfo:)endTransparencyLayer()
Working with the Current Transformation Matrix
Setting Path Drawing Options
setAllowsAntialiasing(_:)setFlatness(_:)setLineCap(_:)setLineDash(phase:lengths:)setLineJoin(_:)setLineWidth(_:)setMiterLimit(_:)setPatternPhase(_:)setFillPattern(_:colorComponents:)setShouldAntialias(_:)
Saving and Restoring Graphics State
Managing a Graphics Context
Managing a Bitmap Graphics Context
Managing a PDF Graphics Context
beginPDFPage(_:)endPDFPage()addDestination(_:at:)setDestination(_:for:)setURL(_:for:)addDocumentMetadata(_:)closePDF()
Managing a Page-Based Graphics Context
Working with Core Foundation Types
Constants
Instance Methods
Structures
Initializers
init(data:width:height:bitsPerComponent:bytesPerRow:space:bitmapInfo:)init(data:width:height:bitsPerComponent:bytesPerRow:space:bitmapInfo:)init(data:width:height:bitsPerComponent:bytesPerRow:space:bitmapInfo:releaseCallback:releaseInfo:)init(data:width:height:bitsPerComponent:bytesPerRow:space:bitmapInfo:releaseCallback:releaseInfo:)
Instance Properties
See Also
Related Documentation
- Quartz 2D Programming Guide