Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Introduction to Quartz Programming Guide for QuickDraw Developers
Quartz is an advanced, two-dimensional drawing engine accessible from all Mac OS X application environments outside of the kernel. It provides low-level, lightweight 2D rendering with unmatched output fidelity regardless of display or printing device. Quartz is the Mac OS X replacement for QuickDraw. Quartz not only replaces QuickDraw, but because its imaging model is substantially different than that of QuickDraw, Quartz can offer more advanced drawing capabilities. The differences between imaging models mean that QuickDraw functions can’t simply be replaced by Quartz functions. Transitioning a QuickDraw application to one that uses only Quartz requires a thoughtful approach.
The purpose of this document is to help developers replace their QuickDraw code with Quartz code that achieves equivalent (or more) functionality. It provides strategies and guidance along with routines that use Quartz to achieve functionality similar to QuickDraw routines.
Who Should Read This Document?
Any developer who uses QuickDraw functions in their Mac OS X application will benefit from reading this document. This document assumes that the reader has programming experience with the QuickDraw API. It also assumes basic knowledge of the Quartz imaging model. Before starting this document, you may want to read the overview of Quartz in Quartz 2D Programming Guide. As you read this document, you may find it helpful to keep the programming guide as well as Quartz 2D Reference Collection handy.
Organization of This Document
This document is organized into the following chapters:
Strategies lists the tasks you should complete before rewriting your code and provides strategies for analyzing and revising your code. This chapter is important to read first, because it points to relevant sections in other chapters, or to other relevant resources.
Basic Drawing covers the fundamentals of drawing in Quartz with an emphasis on what’s different from QuickDraw.
Using Color discusses QuickDraw and Quartz colors and shows how to create color spaces.
Converting PICT Data shows how to convert PICT data so that it can be used in Quartz and shows how to move data to and from the pasteboard in Mac OS X.
Working With Bitmap Image Data shows how, using Quartz, to accomplish a variety of image manipulation tasks that are equivalent to the sorts of tasks you could accomplish using QuickDraw.
Masking, discusses how to replace mask regions in QuickDraw using masking techniques in Quartz.
Updating Regions provides strategies and code examples for how to update windows and use overlay windows in Quartz in place of updating regions in QuickDraw.
Hit Testing describes Quartz functions that are suited for hit testing and provides routines you can use for hit testing in Quartz.
Offscreen Drawing discusses how to use bitmap graphics contexts and CGLayer objects for offscreen drawing.
Performance outlines coding practices that ensure your code performs well.
Glossary lists common QuickDraw terms and defines them in terms of Quartz terminology.
You might find these items of value as you move QuickDraw code to Quartz:
JustDraw and MouseTracking code samples. These are available from the Graphics & Imaging Quartz Reference Library on the ADC website.
Color and Color Management. This document provides a brief introduction to the principles of color perception, color spaces, and color management systems. To use color effectively in Quartz, you’ll want to be familiar with the concepts related to color and color spaces.
Mailing lists. Join the quartz-dev mailing list to discuss problems using Quartz in Mac OS X. If you’re having a problem, chances are other developers have faced the same challenge and may be able to help you. Others like you are moving to Quartz from QuickDraw!
Technical notes and Technical Q&As. Keep up to date on the latest technical information by visiting the Graphics & Imaging Quartz Reference Library. Technical notes and Q&A documents typically provide solutions for thorny problems that don’t crop up too often. If you can’t find a solution in a programming guide, look at these.