Quartz 2D Programming Guide
PDF
Introduction
Overview of Quartz 2D
The Page
Drawing Destinations: The Graphics Context
Quartz 2D Opaque Data Types
Graphics States
Quartz 2D Coordinates
Memory Management: Object Ownership
Quartz Performance: A Look Under the Hood
Graphics Contexts
Creating a Window Graphics Context
Window Graphics Context in Cocoa
Window Graphics Context in Carbon: HIView
Windows Graphics Context: QuickDraw
Creating a PDF Graphics Context
Creating a Bitmap Graphics Context
Supported Pixel Formats
Anti-Aliasing
Obtaining a Graphics Context for Printing
Paths
Path Creation and Path Painting
The Building Blocks
Points
Lines
Arcs
Curves
Ellipses
Rectangles
Creating a Path
Painting a Path
Parameters That Affect Stroking
Functions for Stroking a Path
Filling a Path
Setting Blend Modes
Normal Blend Mode
Multiply Blend Mode
Screen Blend Mode
Overlay Blend Mode
Darken Blend Mode
Lighten Blend Mode
Color Dodge Blend Mode
Color Burn Blend Mode
Soft Light Blend Mode
Hard Light Blend Mode
Difference Blend Mode
Exclusion Blend Mode
Hue Blend Mode
Saturation Blend Mode
Color Blend Mode
Luminosity Blend Mode
Clipping to a Path
Color and Color Spaces
About Color and Color Spaces
The Alpha Value
Creating Color Spaces
Creating Device-Independent Color Spaces
Creating Generic Color Spaces
Creating Device Color Spaces (Deprecated in Mac OS X v10.4)
Creating Indexed and Pattern Color Spaces
Setting and Creating Colors
Setting Rendering Intent
Transforms
About Quartz Transformation Functions
Modifying the Current Transformation Matrix
Creating Affine Transforms
Evaluating Affine Transforms
Getting the User to Device Space Transform
The Math Behind the Matrices
Patterns
The Anatomy of a Pattern
Colored Patterns and Stencil (Uncolored) Patterns
Tiling
How Patterns Work
Painting Colored Patterns
Write a Callback Function That Draws a Colored Pattern Cell
Set Up the Colored Pattern Color Space
Set Up the Anatomy of the Colored Pattern
Specify the Colored Pattern as a Fill or Stroke Pattern
Draw With the Colored Pattern
A Complete Colored Pattern Painting Function
Painting Stencil Patterns
Write a Callback Function That Draws a Stencil Pattern Cell
Set Up the Stencil Pattern Color Space
Set Up the Anatomy of the Stencil Pattern
Specify the Stencil Pattern as a Fill or Stroke Pattern
Draw With the Stencil Pattern
A Complete Stencil Pattern Painting Function
Shadows
How Shadows Work
Painting With Shadows
Gradients
Axial and Radial Gradient Examples
A Comparison of CGShading and CGGradient Objects
Extending Color Beyond the End of a Gradient
Using a CGGradient Object
Using a CGShading Object
Painting an Axial Gradient Using a CGShading Object
Set Up a CGFunction Object to Compute Color Values
Create a CGShading Object for an Axial Gradient
Clip the Context
Paint the Axial Gradient Using a CGShading Object
Release Objects
A Complete Routine for an Axial Gradient Using a CGShading Object
Painting a Radial Gradient Using a CGShading Object
Set Up a CGFunction Object to Compute Color Values
Create a CGShading Object for a Radial Gradient
Paint a Radial Gradient Using a CGShading Object
Release Objects
A Complete Routine for Painting a Radial Gradient Using a CGShading Object
See Also
Transparency Layers
How Transparency Layers Work
Painting to a Transparency Layer
Data Management
Moving Data Into Quartz 2D
Moving Data Out Of Quartz 2D
Moving Data Between Quartz 2D and Core Image
Bitmap Images and Image Masks
About Bitmap Images and Image Masks
Bitmap Image Information
Decode Array
Pixel Format
Color Spaces and Bitmap Layout
Creating Images
Creating an Image From a JPEG File
Creating an Image From Part of a Larger Image
Creating an Image From a Bitmap Graphics Context
Creating an Image Mask
Masking Images
Masking an Image With an Image Mask
Masking an Image With an Image
Masking an Image With Color
Masking an Image by Clipping the Context
Using Blend Modes With Images
Normal Blend Mode
Multiply Blend Mode
Screen Blend Mode
Overlay Blend Mode
Darken Blend Mode
Lighten Blend Mode
Color Dodge Blend Mode
Color Burn Blend Mode
Soft Light Blend Mode
Hard Light Blend Mode
Difference Blend Mode
Exclusion Blend Mode
Hue Blend Mode
Saturation Blend Mode
Color Blend Mode
Luminosity Blend Mode
CGLayer Drawing
How CGLayer Drawing Works
Drawing With a CGLayer
Create a CGLayer Initialized With an Existing Graphics Context
Get a Graphics Context for the CGLayer
Draw to the CGLayer Graphics Context
Draw the CGLayer to the Destination Graphics Context
Example: Using Multiple CGLayer objects to Draw a Flag
PDF Document Creation, Viewing, and Transforming
Opening and Viewing a PDF
Creating a Transform for a PDF Page
Creating a PDF File
Adding Links
Protecting PDF Content
PDF Document Parsing
Inspecting PDF Document Structure
Parsing PDF Content
Write Callbacks for Operators
Create and Set Up the Operator Table
Open the PDF Document
Scan the Content Stream For Each Page
PostScript Conversion
Writing Callbacks
Filling a Callbacks Structure
Creating a PostScript Converter Object
Creating Data Provider and Data Consumer Objects
Performing the Conversion
Python Bindings for Quartz 2D
Text
How Quartz 2D Draws Text
Controlling How Text Looks
Drawing Text
Measuring Text Before Drawing
Copying Font Variations
PostScript Fonts
See Also
Revision History
Glossary