TechnologiesGraphics, Imaging & Compositing

CoreGraphics

iOSmacOStvOSwatchOSvisionOS

CoreGraphics is the Quartz 2D drawing engine for rendering paths, colors, images, fonts, gradients, and PDF content across iOS, macOS, tvOS, watchOS, and visionOS. You issue drawing commands into a CGContext, controlling appearance with types such as CGBlendMode, CGPathDrawingMode, CGTextDrawingMode, and CGInterpolationQuality, and you manage color with CGColor, CGColorSpace, and CGColorRenderingIntent. Pixel data flows through CGDataProvider and CGDataConsumer, while types like CGDisplayMode, CGDisplayStream, and CGEvent give access to display configuration, screen capture, and input events. CGError reports the outcome of these operations.

Drawing Contexts 3

The destinations and offscreen surfaces that receive Quartz 2D drawing commands.

  • Cl
    CGContext
    A Quartz 2D drawing destination that receives path, image, text, and shading commands.
  • Cl
    CGLayer
    An offscreen drawing surface optimized for repeated reuse within a context.
  • St
    __CGBitmapParameters
    A structure that holds the low-level parameters describing a bitmap context's layout.

Paths and Geometry 8

Types for building, stroking, and filling vector paths.

  • Cl
    CGPath
    An immutable graphics path describing a set of lines, curves, and shapes.
  • Cl
    CGMutablePath
    A mutable graphics path that you build by adding lines, curves, and subpaths.
  • St
    CGPathElement
    A structure that describes a single segment of a graphics path and its points.
  • En
    CGPathElementType
    Constants that identify the kind of segment described by a path element.
  • En
    CGPathDrawingMode
    Constants that specify whether a path is filled, stroked, or both.
  • En
    CGPathFillRuleiOS 7.0+
    Constants that specify the rule used to determine the interior of a path.
  • En
    CGLineJoin
    Constants that specify how connected line segments are joined when stroked.
  • En
    CGLineCap
    Constants that specify how the endpoints of an open path are drawn when stroked.

Colors and Color Spaces 12

Types that define colors, color spaces, and color management for accurate rendering.

  • Cl
    CGColor
    An object that represents a color in a specific color space, including its components and alpha value.
  • Cl
    CGColorSpace
    An object that defines how the numeric color values of an image or context are interpreted.
  • En
    CGColorSpaceModel
    Constants that identify the color model of a color space.
  • Cl
    CGColorConversionInfo
    An object that describes how to convert color values from one color space to another.
  • En
    CGColorConversionInfoTransformType
    Constants that specify the direction of a color-space transform.
  • En
    CGColorRenderingIntent
    Constants that specify how out-of-gamut colors are mapped during rendering.
  • Cl
    ColorSyncProfile
    An object that represents an ICC color profile used for color management.
  • St
    CGColorModel
    A type that identifies the basic color model used by a color space.
  • St
    CGDeviceColor
    A structure that represents a color expressed in device-specific components.
  • St
    CGColorBufferFormat
    A structure that describes the memory layout of a buffer of color values.
  • St
    CGColorDataFormat
    A structure that describes the format of color data exchanged with a color space.
  • En
    CGComponent
    A type that identifies an individual color component within a color value.

Images and Bitmaps 11

Types for creating, inspecting, and configuring bitmap images and their pixel layout.

  • Cl
    CGImage
    An object that represents a bitmap image and its pixel data, color space, and alpha information.
  • St
    CGBitmapInfomacOS 10.0+
    A structure of flags that describe the alpha and pixel-component layout of a bitmap.
  • En
    CGBitmapLayout
    Constants that describe the in-memory layout of a bitmap's pixel components.
  • En
    CGImageAlphaInfo
    Constants that specify how a bitmap stores and interprets its alpha component.
  • En
    CGImageByteOrderInfomacOS 10.0+
    Constants that specify the byte order of an image's pixel data.
  • En
    CGImagePixelFormatInfomacOS 10.14+
    Constants that identify the pixel format used to store an image's data.
  • En
    CGImageComponentInfomacOS 10.0+
    Constants that describe the role of a component within an image's pixels.
  • En
    CGInterpolationQuality
    Constants that specify the quality level used when interpolating image pixels.
  • St
    CGContentInfo
    A structure that describes characteristics of image content, such as its dynamic range.
  • Cl
    IOSurfaceRef
    A reference to a shareable hardware-accelerated image buffer that can back Core Graphics images and surfaces.
  • Cl
    CGRenderingBufferProvider
    An object that supplies a buffer of memory used to back rendering operations.

Gradients, Patterns, and Shadings 9

Types that fill regions with smooth color transitions, repeating tiles, and shading functions.

  • Cl
    CGGradient
    An object that defines a smooth transition between colors for filling regions.
  • St
    CGGradientDrawingOptions
    A structure of options that control how a gradient extends beyond its endpoints.
  • Cl
    CGShading
    An object that paints a smooth color gradient defined by a function across a region.
  • Cl
    CGPattern
    An object that defines a repeating image or drawing used to fill or stroke shapes.
  • En
    CGPatternTiling
    Constants that specify how a pattern is tiled across a fill area.
  • St
    CGPatternCallbacks
    A structure of callbacks that draw and release a repeating pattern's content.
  • Cl
    CGFunction
    An object that wraps a callback evaluating a function used by shadings and patterns.
  • St
    CGFunctionCallbacks
    A structure of callbacks that evaluate and release a Core Graphics function.
  • En
    CGBlendMode
    Constants that specify how source and destination colors combine during compositing.

Fonts and Text 4

Types for loading glyph data and controlling how text is rendered.

  • Cl
    CGFont
    An object that represents a font and its glyph data for rendering text in a context.
  • En
    CGFontPostScriptFormat
    Constants that identify the PostScript format of an embedded font.
  • En
    CGTextDrawingMode
    Constants that specify how glyphs are filled, stroked, or used for clipping.
  • En
    CGGlyphDeprecatedEnum
    A deprecated enumeration formerly used to represent glyph values.

Data Providers and Consumers 5

Types that supply raw bytes to and read rendered bytes from Quartz.

  • Cl
    CGDataProvider
    An object that supplies raw bytes of data, such as image or font content, to Core Graphics.
  • St
    CGDataProviderSequentialCallbacks
    A structure of callbacks that a data provider uses to supply bytes sequentially.
  • St
    CGDataProviderDirectCallbacks
    A structure of callbacks that a data provider uses to supply bytes by direct access.
  • Cl
    CGDataConsumer
    An object that receives the bytes of data written during a Core Graphics operation.
  • St
    CGDataConsumerCallbacks
    A structure of callbacks that a data consumer uses to write and release bytes.

PDF Documents 15

Types for reading, parsing, and rendering PDF content and its object structure.

  • Cl
    CGPDFDocument
    An object that represents a PDF document and provides access to its pages and metadata.
  • Cl
    CGPDFPage
    An object that represents a single page of a PDF document for drawing or inspection.
  • En
    CGPDFBox
    Constants that identify a page boundary box within a PDF page.
  • St
    CGPDFObjectRef
    A reference to a generic object within a PDF document.
  • En
    CGPDFObjectType
    Constants that identify the type of an object stored in a PDF document.
  • St
    CGPDFArrayRef
    A reference to an array object within a PDF document's content structure.
  • St
    CGPDFDictionaryRef
    A reference to a dictionary object within a PDF document's content structure.
  • St
    CGPDFStreamRef
    A reference to a stream object within a PDF document.
  • St
    CGPDFStringRef
    A reference to a string object within a PDF document.
  • En
    CGPDFDataFormat
    Constants that identify the encoding format of a PDF data stream.
  • St
    CGPDFAccessPermissions
    A structure of flags that describe the permitted operations on a PDF document.
  • En
    CGPDFTagTypemacOS 10.15+
    Constants that identify the structural tag type of a tagged PDF element.
  • St
    CGPDFTagProperty
    A structure that identifies a property associated with a tagged PDF element.
  • Cl
    CGPSConverter
    An object that converts PostScript data into PDF content.
  • St
    CGPSConverterCallbacks
    A structure of callbacks that report progress during PostScript-to-PDF conversion.

Display Configuration and Capture 13

Types for querying display modes, reconfiguring displays, and streaming captured screen frames.

  • Cl
    CGDisplayMode
    An object that describes a display's resolution, pixel depth, and refresh rate.
  • St
    CGConfigureOption
    A structure of options that control how a display reconfiguration is applied.
  • St
    CGDisplayChangeSummaryFlags
    A structure of flags that summarize the changes from a display reconfiguration.
  • St
    CGCaptureOptions
    A structure of options that control how a display is captured.
  • Cl
    CGDisplayStream
    @typedef CGDisplayStreamRef
  • Cl
    CGDisplayStreamUpdate
    @typedef CGDisplayStreamUpdateRef
  • En
    CGDisplayStreamUpdateRectType
    @enum CGDisplayStreamUpdateRectType
  • En
    CGDisplayStreamFrameStatus
    @enum CGDisplayStreamFrameStatus
  • St
    CGScreenUpdateOperation
    A structure of flags that describe the kind of update applied to a screen region.
  • St
    CGScreenUpdateMoveDelta
    A structure that describes the offset by which a screen region moved.
  • St
    __CGContentToneMappingInfomacOS 26.0+
    A structure that holds parameters describing how content is tone-mapped.
  • En
    CGContentToneMappingInfoiOS 26.0+
    An enumeration that describes the tone-mapping information applied to displayed content.
  • En
    CGToneMapping
    Constants that specify the tone-mapping method applied to high-dynamic-range content.

Window Lists and Images 5

Types for enumerating on-screen windows and capturing their composited images.

  • St
    CGWindowListOption
    A structure of options that control which windows a window list includes.
  • St
    CGWindowImageOption
    A structure of options that control how a window image is composited.
  • En
    CGWindowSharingType
    Constants that specify how a window's contents may be shared with other processes.
  • En
    CGWindowBackingType
    Constants that identify the type of backing store used by a window.
  • En
    CGWindowLevelKey
    Constants that identify standard window levels in the on-screen window ordering.

Events and Input 18

Types for creating, posting, and intercepting low-level keyboard, mouse, and scroll events.

  • Cl
    CGEvent
    An object that represents a low-level keyboard, mouse, scroll, or tablet event.
  • Cl
    CGEventSource
    An object that represents the source state used to create and post events.
  • En
    CGEventType
    Constants that identify the kind of a low-level event.
  • En
    CGEventField
    Constants that identify the data fields that can be read from or written to an event.
  • St
    CGEventFlags
    A structure of modifier-key and state flags associated with an event.
  • En
    CGEventSourceStateID
    Constants that identify the source state used when creating events.
  • En
    CGEventTapLocation
    Constants that specify where in the event stream an event tap is installed.
  • En
    CGEventTapPlacement
    Constants that specify whether an event tap is inserted before or after existing taps.
  • En
    CGEventTapOptions
    Constants that specify whether an event tap can modify events or only observe them.
  • St
    __CGEventTapInformation
    A structure that describes the configuration and state of an installed event tap.
  • St
    CGEventFilterMask
    A structure of flags that specify which event types an event filter passes.
  • En
    CGEventMouseSubtype
    Constants that identify the subtype of a mouse event.
  • En
    CGEventSuppressionState
    Constants that specify how local hardware events are suppressed when posting events.
  • En
    CGMouseButton
    Constants that identify the mouse button associated with an event.
  • En
    CGScrollEventUnit
    Constants that specify whether scroll amounts are measured in pixels or lines.
  • En
    CGScrollPhase
    Constants that describe the phase of a scroll gesture.
  • En
    CGMomentumScrollPhase
    Constants that describe the momentum phase of a continuous scroll gesture.
  • En
    CGGesturePhase
    Constants that describe the phase of a continuous gesture.

Errors 1

Result codes reported by Core Graphics operations.

  • En
    CGError
    Result codes that report the outcome of a Core Graphics operation.

Structures 1

  • St
    CGBitmapParametersiOS 26.0+

Type Aliases 66

  • Ty
    CGBitmapContextReleaseDataCallback
  • Ty
    CGDataConsumerPutBytesCallback
  • Ty
    CGDataConsumerReleaseInfoCallback
  • Ty
    CGDataProviderGetBytesCallback
  • Ty
    CGDataProviderSkipForwardCallback
  • Ty
    CGDataProviderRewindCallback
  • Ty
    CGDataProviderReleaseInfoCallback
  • Ty
    CGDataProviderGetBytePointerCallback
  • Ty
    CGDataProviderReleaseBytePointerCallback
  • Ty
    CGDataProviderGetBytesAtPositionCallback
  • Ty
    CGDataProviderReleaseDataCallback
  • Ty
    CGDirectDisplayID
  • Ty
    CGOpenGLDisplayMask
  • Ty
    CGRefreshRate
  • Ty
    CGGammaValue
  • Ty
    CGDisplayCount
Show 50 more
  • Ty
    CGDisplayErr
  • Ty
    CGDisplayConfigRef
  • Ty
    CGDisplayReconfigurationCallBack
  • Ty
    CGDisplayFadeReservationToken
  • Ty
    CGDisplayBlendFraction
  • Ty
    CGDisplayFadeInterval
  • Ty
    CGDisplayReservationInterval
  • Ty
    CGDisplayStreamFrameAvailableHandler
  • Ty
    CGErrorCallback
  • Ty
    CGEventTimestamp
  • Ty
    CGEventMask
  • Ty
    CGEventTapProxy
  • Ty
    CGEventTapCallBack
  • Ty
    CGEventTapInformation
  • Ty
    CGEventSourceKeyboardType
  • Ty
    CGFontIndex
  • Ty
    CGGlyph
  • Ty
    CGFunctionEvaluateCallback
  • Ty
    CGFunctionReleaseInfoCallback
  • Ty
    CGPDFArrayApplierBlock
  • Ty
    CGPDFContentStreamRef
  • Ty
    CGPDFDictionaryApplierFunction
  • Ty
    CGPDFDictionaryApplierBlock
  • Ty
    CGPDFBoolean
  • Ty
    CGPDFInteger
  • Ty
    CGPDFReal
  • Ty
    CGPDFOperatorTableRef
  • Ty
    CGPDFOperatorCallback
  • Ty
    CGPDFScannerRef
  • Ty
    CGPSConverterBeginDocumentCallback
  • Ty
    CGPSConverterEndDocumentCallback
  • Ty
    CGPSConverterBeginPageCallback
  • Ty
    CGPSConverterEndPageCallback
  • Ty
    CGPSConverterProgressCallback
  • Ty
    CGPSConverterMessageCallback
  • Ty
    CGPSConverterReleaseInfoCallback
  • Ty
    CGPathApplierFunction
  • Ty
    CGPathApplyBlock
  • Ty
    CGPatternDrawPatternCallback
  • Ty
    CGPatternReleaseInfoCallback
  • Ty
    CGEventErr
  • Ty
    CGButtonCount
  • Ty
    CGWheelCount
  • Ty
    CGCharCode
  • Ty
    CGKeyCode
  • Ty
    CGScreenRefreshCallback
  • Ty
    CGScreenUpdateMoveCallback
  • Ty
    CGRectCount
  • Ty
    CGWindowID
  • Ty
    CGWindowLevel

Extends 6

CGPointCGRectCGAffineTransformCGVectorCGSizeCGAffineTransformComponents
← Graphics, Imaging & Compositing