O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Role of Quartz

Quartz is the foundation of Cocoa’s 2D graphics capabilities. It provides many advanced graphics capabilities, including color management, path-based drawing, transparency, and anti-aliasing. It uses the same fundamental model of drawing as Adobe’s Portable Document Format (PDF).

Quartz is actually two individual pieces of software in Mac OS X—Quartz Compositor and Quartz 2D. The Quartz Compositor is the underlying system service responsible for drawing the graphical user interface to screen from sources such as Quartz 2D, QuickTime, OpenGL, and QuickDraw. Quartz 2D, on the other hand, is an Application Programming Interface (API) for drawing and manipulating 2D graphics. This chapter concentrates on Quartz 2D’s drawing functionality.

You can access the Quartz 2D API directly through the CoreGraphics framework, but it is far more convenient to use the Cocoa classes that provide an easy-to-use interface to Quartz, including NSBezierPath, NSView, NSImage, and NSGraphicsContext. These classes provide the functionality to render paths, text, and images to screen or to the printed page.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required