Home > Store

Quartz 2D Graphics for Mac OS X Developers

Register your product to gain access to bonus material or receive a coupon.

Quartz 2D Graphics for Mac OS X Developers


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2006
  • Dimensions: 7" x 9-1/4"
  • Pages: 352
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-33663-1
  • ISBN-13: 978-0-321-33663-7

Core Graphics is the new graphics framework for Mac OS X. Quartz, the 2D drawing system, and Core Image, which processes both video and still images, are the key new technologies in this framework and provide the tools Mac OS X developers need to create and draw graphics for their applications that target the design-savvy Mac consumer audience. With the evolution of Mac OS X, Apple is phasing out use of its previous graphics framework, QuickDraw, and encouraging all developers to begin using Core Graphics. The model for Quartz is completely unique and entirely different from QuickDraw creating a steep learning curve for all developers moving over. This book is in an introduction and guide to working with Core Graphics, specifically Quartz and Core Image. It carries the developer through the fundamental Quartz models and basic concepts such as drawing, coordinating system basics, virtual paint, and CGContext. Once the fundamentals are covered, author Scott Thompson delves into more advanced topics such as shading, patterns, and manipulating image effects. Practical code examples enhance the discussion and offer Mac developers the information they need to incorporate these powerful graphics into their own Mac OS X Applications.

Sample Content

Online Sample Chapter

From QuickDraw to Quartz 2D

Downloadable Sample Chapter

Download the Sample Chapter related to this title.

Table of Contents

Preface  xv

Chapter 1: Getting Started  1

Chapter 2: From QuickDraw to Quartz 2D  15

Chapter 3: Introduction to Quartz 2D  37

Chapter 4: The Graphics Context  69

Chapter 5: Transformations  103

Chapter 6: Line Art–Building Paths  135

Chapter 7: Line Art–Drawing  163

Chapter 8: Image Basics  177

Chapter 9: Importing and Exporting Images  211

Chapter 10: Drawing with Core Image  223

Chapter 11: Drawing Text with Quartz 2D  249

Chapter 12: Drawing Offscreen  265

Chapter 13: Shadings and Patterns  277

Chapter 14: Working with PDF  299

Index: 313


Untitled Document


The graphics systems available to Macintosh applications have evolved very quickly over the past few years. Prior to the introduction of Mac OS X, the primary focus of all Macintosh graphics was the QuickDraw graphics library. QuickDraw not only provided the tools that applications needed to draw into their windows, but it also played a role in managing the screen, handling events, and changing the cursor. As the demands placed on the graphics system increased, Apple discovered that a reliance on QuickDraw imparted some limitations to their capability to expand the graphics system. During the transition to Mac OS X, many of QuickDraw's responsibilities migrated to other portions of the system. To handle many of the drawing and screen management tasks, Apple introduced a new graphics system called Quartz. In programming circles, Quartz is also known as Core Graphics.

Quartz not only handles many of the responsibilities of QuickDraw, it is the platform on which many of the innovations in the Mac OS X graphics system are built. For example, Core Graphics has taken over the job of collecting the images of windows and combing them on the screen. In performing this task, it takes advantage of modern graphics hardware to improve performance and introduce features such as translucent windows to the system. The end result is a remarkably flexible graphics system. Quartz allows applications to seamlessly integrate technologies as diverse as the motion graphics of QuickTime and the 3D graphics of OpenGL onto the same screen or even into the same window.

With the introduction of Mac OS X 10.4, Tiger, Apple has deprecated QuickDraw—and that library will not evolve any farther. Applications that only rely on QuickDraw for drawing will not enjoy any innovations Apple makes in the graphics system. Even worse, in the future, applications that rely on QuickDraw may actually pay a performance penalty. Any program that wants to take full advantage of the graphics system on Mac OS X will have to replace their QuickDraw drawing code with a more modern alternative. Apple recommends that application developers replace their QuickDraw graphics code with similar code that uses Quartz 2D.

Quartz 2D is a part of the Core Graphics system. It is a modern graphics library based on the imaging model that Adobe created originally for PostScript printers and later as part of the PDF graphics file format. This is the same imaging model that graphics professionals have used for several years to create the artwork on everything from books and advertisements to application splash screens and on-line games.

The Quartz 2D drawing model allows you to create sophisticated graphics with a simple API. The Quartz 2D imaging model is quite different from the drawing models of other graphics libraries. Its library can draw to many kinds of graphics devices while maximizing the fidelity of the graphics on each device. As a result, developers familiar other graphics libraries such as QuickDraw, GDI from Microsoft Windows, or the graphics portions of X11's XLib face a learning curve when trying to work with the device and resolution independent drawing model in Quartz 2D.

The objective of this book is to present a practical introduction to Quartz 2D. Its aim is to help all programmers understand the Quartz 2D imaging model and make effective use of the library from any application environment. Most importantly, the text compares and contrasts the Quartz 2D imaging model with the pixel-based graphics models of other libraries. While this will be of particular value to developers making the transition from QuickDraw or GDI to Quartz 2D, it also provides valuable insight into how to use Quartz 2D effectively. The hope is that this information will be invaluable to anyone trying to draw graphics using Quartz 2D.


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership