Class

UIGraphicsRendererContext

The base class for the drawing environments associated with graphics renderers.

Declaration

class UIGraphicsRendererContext : NSObject

Overview

You don't create instances of UIGraphicsRendererContext yourself. Instead, when you use a concrete subclass of UIGraphicsRenderer, you are provided an instance of the appropriate UIGraphicsRendererContext subclass—either UIGraphicsImageRendererContext or UIGraphicsPDFRendererContext—as an argument to a UIGraphicsDrawingActions drawing actions block.

UIGraphicsRendererContext objects provide high-level drawing methods in addition to access to the underlying Core Graphics context.

Topics

Getting the Drawing Context

var cgContext: CGContext

The underlying Core Graphics context.

var format: UIGraphicsRendererFormat

The format used to create the associated graphics renderer.

Drawing Content

func stroke(CGRect)

Paints a rectangular path using the currently selected stroke color.

func stroke(CGRect, blendMode: CGBlendMode)

Paints a rectangular path using the currently selected stroke color and specified blend mode.

func fill(CGRect, blendMode: CGBlendMode)

Paints a rectangular area with the currently selected fill color using the supplied blend mode.

func fill(CGRect)

Paints a rectangular area with the currently selected fill color.

Applying a Clipping Rectangle

func clip(to: CGRect)

Sets the clipping mask for the drawing context to the specified rectangle.

Relationships

Inherits From

Conforms To

See Also

Drawing Contexts

class UIGraphicsRenderer

An abstract base class for creating graphics renderers.

class UIGraphicsRendererFormat

A set of drawing attributes that represent the configuration of a graphics renderer context.

class UIGraphicsImageRenderer

A graphics renderer for creating Core Graphics-backed images.

class UIGraphicsImageRendererContext

The drawing environment associated with an image renderer.

class UIGraphicsImageRendererFormat

A set of drawing attributes that represent the configuration of an image renderer context.

class UIGraphicsPDFRenderer

A graphics renderer for creating PDFs.

typealias UIGraphicsPDFRenderer.DrawingActions

A handler block that you use to draw PDF content.

class UIGraphicsPDFRendererContext

A drawing environment associated with a PDF renderer.

class UIGraphicsPDFRendererFormat

A set of drawing attributes that represents the configuration of a PDF renderer context.