Framework

Core Graphics

Harness the power of Quartz technology to perform lightweight 2D rendering with high-fidelity output. Handle path-based drawing, anti-aliased rendering, gradients, images, color management, PDF documents, and more.

Overview

The Core Graphics framework is based on the Quartz advanced drawing engine. It provides low-level, lightweight 2D rendering with unmatched output fidelity. You use this framework to handle path-based drawing, transformations, color management, offscreen rendering, patterns, gradients and shadings, image data management, image creation, and image masking, as well as PDF document creation, display, and parsing.

In macOS, Core Graphics also includes services for working with display hardware, low-level user input events, and the windowing system.

Symbols

Geometric Data Types

CGFloat

The basic type for floating-point scalar values in Core Graphics and related frameworks.

CGPoint

A structure that contains a point in a two-dimensional coordinate system.

CGSize

A structure that contains width and height values.

CGRect

A structure that contains the location and dimensions of a rectangle.

CGVector

A structure that contains a two-dimensional vector.

CGAffineTransform

An affine transformation matrix for use in drawing 2D graphics.

2D Drawing

CGContext

A Quartz 2D drawing environment.

CGImage

A bitmap image or image mask.

CGPath

An immutable graphics path: a mathematical description of shapes or lines to be drawn in a graphics context.

CGMutablePath

A mutable graphics path: a mathematical description of shapes or lines to be drawn in a graphics context.

CGLayer

An offscreen context for reusing content drawn with Core Graphics.

Colors and Fonts

CGColor

A set of components that define a color, with a color space specifying how to interpret them.

CGColorConversionInfo

An object that describes how to convert between color spaces for use by other system services.

CGColorSpace

A profile that specifies how to interpret a color value for display.

CGFont

A set of character glyphs and layout information for drawing text.

Working with PDF Documents

CGPDFDocument

A document that contains PDF (Portable Document Format) drawing information.

Utility and Support Classes

CGDataConsumer

An abstraction for data-writing tasks that eliminates the need to manage a raw memory buffer.

CGDataProvider

An abstraction for data-reading tasks that eliminates the need to manage a raw memory buffer.

CGShading

A definition for a smooth transition between colors, controlled by a custom function you provide, for drawing radial and axial gradient fills.

CGGradient

A definition for a smooth transition between colors for drawing radial and axial gradient fills.

CGFunction

A general facility for defining and using callback functions.

CGPattern

A 2D pattern to be used for drawing graphics paths.

Services

Quartz Display Services

Provides direct access to features in the macOS window server for configuring and controlling display hardware.

Quartz Event Services

Provides features for managing event taps—filters for observing and altering the stream of low-level user input events in macOS.

Quartz Window Services

Provides information about the windows managed by the macOS window server.

Extended Types

Double

A double-precision, floating-point value type.

Float

A single-precision, floating-point value type.

Int

A signed integer value type.

Int16

A 16-bit signed integer value type.

Int32

A 32-bit signed integer value type.

Int64

A 64-bit signed integer value type.

Int8

An 8-bit signed integer value type.

UInt

An unsigned integer value type.

UInt16

A 16-bit unsigned integer value type.

UInt32

A 32-bit unsigned integer value type.

UInt64

A 64-bit unsigned integer value type.

UInt8

An 8-bit unsigned integer value type.

Enumerations

CGPathFillRule

Rules for determining which regions are interior to a path, used by the fillPath(using:) and clip(using:) methods.

See Also

Related Documentation