Programming with Quartz: 2D and PDF Graphics in Mac OS X

Chapter 3: Using Quartz 2D in Cocoa

Quartz 2D provides the foundation for Cocoa drawing. Cocoa 2D graphics facilities are built on top of Quartz 2D, and the Cocoa imaging model is that of Quartz 2D. Applications that use the Cocoa framework can use the Cocoa drawing methods that are built on top of Quartz and can call Quartz 2D directly as well. Most of this book discusses using Quartz directly rather than the Cocoa drawing methods that are built on top of Quartz. This chapter is no exception, but you will see how to call Quartz from the Cocoa framework.

Cocoa is a rich object-oriented programming toolkit. Programming in Cocoa requires knowledge of object-oriented programming techniques and the Objective-C language. This chapter does not teach Cocoa programming or discuss object-oriented programming but focuses on how to use Quartz 2D API calls in a Cocoa application and when you might want to use Quartz instead of the Cocoa drawing methods. It discusses the aspects of Cocoa programming that are important when creating an application that performs Quartz drawing. The sample application in this chapter draws the series of alpha composited rectangles shown in Figure 2.10 (page 31).

The first section of this chapter provides a brief overview of Xcode. The next three sections show how to create a Cocoa application in Xcode. Nothing in these sections is specific to drawing with Quartz in Cocoa. Experienced Xcode developers who have written at least one Cocoa application can skip these sections.

The sections "Obtaining a Graphics Context in Cocoa"...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Computer-Aided Design (CAD) Services
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.