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

Quartz offers a number of advanced drawing capabilities that build on top of the basic graphic primitives and features you've already learned about patterns, shadows, transparency layers, and shadings. Patterns provide a way for you to create a repeating tile that contains arbitrary Quartz drawing and use that tile as a fill or stroke color. You've probably noticed the drop shadow that is present in the Aqua user interface in Mac OS X. Using Quartz, you can get that same look in your own drawing. Transparency layers allow you to group drawing elements together and treat them as a single unit for purposes of applying shadows or alpha transparency. Shadings, sometimes called gradients or blends, provide a way to smoothly vary color across a shape, giving the appearance of a continuous blending of colors.
The purpose of this chapter is to provide an in-depth discussion of these four advanced drawing features. You'll learn the concepts associated with each one and take a look at simple as well as complex examples of how to incorporate each feature in your drawing code.
A pattern is a graphic that is iteratively tiled across an object. You see patterns used every day in clothing, furniture, wallpaper, and many other objects, including virtual objects such as screen savers. Quartz provides the ability to define a pattern that you can then use as paint to fill or stroke any graphics. You can apply a pattern to any graphics that use stroke and fill...