Written by members of the development team at Apple, Programming with Quartz is the first book to describe the sophisticated graphics system of Mac OS X. By using the methods described in this book, developers will be able to fully exploit the state-of-the-art graphics capabilities of Mac OS X in their applications, whether for Cocoa or Carbon development. This book also serves as an introduction to 2D graphics concepts, including how images are drawn and how color is rendered. It includes guidance for working with PDF documents, drawing bitmap graphics, using Quartz built-in color management, and drawing text. Programming with Quartz is a rich resource for new and experienced Mac OS X developers, Cocoa and Carbon programmers, UNIX developers who are migrating to Mac OS X, and anyone interested in powerful 2D graphics systems.
- This is the definitive guide to the revolutionary graphics system of Mac OS X that uses the Portable Document Format (PDF) as the basis of its imaging model
- It contains the latest on programming with Quartz for Mac OS X version 10. 4
- Carefully crafted and extensive code examples show how to accomplish most of the drawing tasks possible with Quartz
Inhaltsverzeichnis
1;front cover;1 2;copyright;5 3;table of contents;8 4;front matter;16 5;Foreword;16 6;Preface;20 6.1;Our Objective;20 6.2;Outline;21 6.3;Conventions and Assumptions;23 6.4;Source Code;24 6.5;Header Files;25 6.6;Quartz Technologies;26 6.7;See Also;27 6.8;Acknowledgments;29 7;body;30 8;1 Introducing Quartz 2D;30 8.1;A Bit of History;30 8.2;Quartz 2D Overview;37 8.3;What Software Can Use Quartz 2D?;39 8.4;Summary 1;41 8.5;See Also 1;41 9;2 Quartz 2D Drawing Basics;44 9.1;Quartz Graphics Contexts;44 9.2;Filling a Rectangle;45 9.3;Stroking a Rectangle;47 9.4;The Order of Fill and Stroke Operations;49 9.5;Transforming the Coordinate System;52 9.6;Painting with Alpha;59 9.7;Making Dashed Lines;61 9.8;Clipping a Drawing;65 9.9;Drawing PDF Content;67 9.10;More About Graphics Contexts;70 9.11;Summary 2;71 9.12;See Also 2;72 10;3 Using Quartz 2D in Cocoa;74 10.1;Xcode Overview;75 10.2;Creating a Cocoa Xcode Project in Tiger;75 10.3;Creating a View in Interface Builder;78 10.4;Connecting the Interface to the Code;82 10.5;Obtaining a Graphics Context in Cocoa;84 10.6;Writing the Drawing Code;85 10.7;Examining the Drawing Output;87 10.8;Cocoa Framework Drawing and Quartz;88 10.9;Summary 3;91 10.10;See Also 3;91 11;4 Using Quartz 2D in Carbon;94 11.1;Creating a Carbon Xcode Project;95 11.2;Setting Up a Carbon Window;97 11.3;Creating an Event Handler;102 11.4;Examining the Drawing Output;105 11.5;Using QDBeginCGContext;108 11.6;Summary 4;110 11.7;See Also 4;111 12;5 The Quartz Coordinate System and Coordinate Transformations;112 12.1;User Space and Device Space;112 12.2;Coordinate Transformations;115 12.3;The Current Transformation Matrix;116 12.4;The Mathematics of Affine Transforms;117 12.5;Saving and Restoring a Coordinate System;120 12.6;Affine Transform Convenience Functions;123 12.7;Creating a Skewed Coordinate System;127 12.8;Summary 5;129 12.9;See Also 5;130 13;6 Drawing with Paths;132 13.1;Properties of Paths;133 13.2;Path Construction Primitives;134 13.3;Path Construction
Convenience Functions;140 13.4;Stroking Paths;148 13.5;Filling Paths;155 13.6;Clipping with Paths;158 13.7;CGPath Objects (Jaguar);160 13.8;Anti-aliasing;163 13.9;Path Utility Functions;166 13.10;Summary 6;173 13.11;See Also 6;173 14;7 Color, Alpha Transparency, and the Quartz Graphics State;176 14.1;Color and Color Spaces;177 14.2;Alpha Transparency;195 14.3;Graphics State Parameters;202 14.4;Summary 7;210 14.5;See Also 7;211 15;8 Data Providers and Data Consumers;214 15.1;Data Providers;215 15.2;Data Consumers;227 15.3;Summary 8;231 15.4;See Also 8;231 16;9 Drawing Images;232 16.1;Creating CGImage Objects;233 16.2;Best Practices for Working with Images;270 16.3;Image Utility Functions;273 16.4;Writing Image Data Using CGImageDestination (Tiger);284 16.5;Exporting to JPEG Using a QuickTime Exporter;287 16.6;Summary 9;288 16.7;See Also 9;289 17;10 Image Masking;292 17.1;Creating an Image Mask;293 17.2;Masking an Image (Tiger);302 17.3;Using Color as a Mask (Tiger);308 17.4;Clipping to a Mask (Tiger);311 17.5;Summary 10;316 17.6;See Also 10;316 18;11 Text;318 18.1;Text Drawing Parameters;319 18.2;Drawing Text Using Quartz;325 18.3;Drawing Text Using Cocoa;335 18.4;Drawing Text Using Carbon;353 18.5;Drawing Text in a Flipped Coordinate System;367 18.6;Summary 11;370 18.7;See Also 11;370 19;12 Creating Bits;374 19.1;Bitmap Graphics Context;375 19.2;CGLayers (Tiger);400 19.3;Caching Drawing Offscreen;408 19.4;Replacing CopyBits;420 19.5;Summary 12;422 19.6;See Also 12;422 20;13 Opening and Drawing PDF Documents;426 20.1;PDF Document Properties;427 20.2;Opening a PDF Document;429 20.3;Using PDF as a Graphical Interchange;430 20.4;Drawing PDF Pages;435 20.5;Handling Protected PDF Documents (Jaguar);453 20.6;PDF Document Utility Functions;458 20.7;Summary 13;460 20.8;See Also 13;460 21;14 Creating and Examining PDF Documents;464 21.1;Creating New PDF Documents;464 21.2;Copying PDF Content to a Pasteboard;472 21.3;Adding Content to Existing PDF Documents;476 21.4;Adding Li
nks to PDF Documents (Tiger);484 21.5;Creating Encrypted PDF Output (Tiger);491 21.6;PDF Document Generation Issues;495 21.7;Examining PDF Document Content (Panther, Tiger);496 21.8;Summary 14;507 21.9;See Also 14;507 22;15 Advanced Drawing Features;510 22.1;Drawing with Patterns;510 22.2;Drawing with Shadows (Panther);541 22.3;Drawing with Transparency Layers (Panther);551 22.4;Drawing with Shadings (Jaguar);560 22.5;Summary 15;591 22.6;See Also 15;592 23;16 Supporting PostScript and EPS Data;594 23.1;Overview of the Conversion Process;595 23.2;Quartz Conversion Functions and Callbacks (Panther);596 23.3;Creating a PDF Data File from PostScript Data;598 23.4;Using Converted PostScript Data in Your Application;604 23.5;PSConverter Advanced Issues;609 23.6;Printing Source EPS Data;611 23.7;Guidelines for Supporting EPS Data in Your Application;618 23.8;Summary 16;619 23.9;See Also 16;620 24;17 Performance and Debugging;622 24.1;Optimizing Performance;622 24.2;Debugging Your Drawing;642 24.3;Summary 17;655 24.4;See Also 17;656 25;18 Creating Quartz Tools and Python Scripts;660 25.1;Python Scripting with Quartz (Panther);661 25.2;Using Quartz in UNIX Tools;666 25.3;The PDF Workflow in Printing (Jaguar);668 25.4;Summary 18;675 25.5;See Also 18;675 26;index;676