[APPLE] Quartz 2D Programming Guide (2010).pdf
(
27278 KB
)
Pobierz
Quartz 2D Programming Guide
Graphics & Animation: 2D Drawing
2010-11-19
Apple Inc.
© 2001, 2010 Apple Inc.
All rights reserved.
No part of this publication may be reproduced,
stored in a retrieval system, or transmitted, in
any form or by any means, mechanical,
electronic, photocopying, recording, or
otherwise, without prior written permission of
Apple Inc., with the following exceptions: Any
person is hereby authorized to store
documentation on a single computer for
personal use only and to print copies of
documentation for personal use provided that
the documentation contains Apple’s copyright
notice.
The Apple logo is a trademark of Apple Inc.
No licenses, express or implied, are granted
with respect to any of the technology described
in this document. Apple retains all intellectual
property rights associated with the technology
described in this document. This document is
intended to assist application developers to
develop applications only for Apple-labeled
computers.
Apple Inc.
1 Infinite Loop
Cupertino, CA 95014
408-996-1010
Apple, the Apple logo, Cocoa, ColorSync, eMac,
Mac, Mac OS, Objective-C, Pages, Quartz,
QuickTime, Spaces, Tiger, and Xcode are
trademarks of Apple Inc., registered in the
United States and other countries.
Adobe, Acrobat, and PostScript are trademarks
or registered trademarks of Adobe Systems
Incorporated in the U.S. and/or other countries.
Adobe, Acrobat, and PostScript are trademarks
or registered trademarks of Adobe Systems
Incorporated in the U.S. and/or other countries.
Adobe, Acrobat, and PostScript are trademarks
or registered trademarks of Adobe Systems
Incorporated in the U.S. and/or other countries.
Helvetica is a registered trademark of
Heidelberger Druckmaschinen AG, available
from Linotype Library GmbH.
IOS is a trademark or registered trademark of
Cisco in the U.S. and other countries and is used
under license.
OpenGL is a registered trademark of Silicon
Graphics, Inc.
Even though Apple has reviewed this document,
APPLE MAKES NO WARRANTY OR REPRESENTATION,
EITHER EXPRESS OR IMPLIED, WITH RESPECT TO
THIS DOCUMENT, ITS QUALITY, ACCURACY,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR
PURPOSE. AS A RESULT, THIS DOCUMENT IS
PROVIDED “AS IS,” AND YOU, THE READER, ARE
ASSUMING THE ENTIRE RISK AS TO ITS QUALITY
AND ACCURACY.
IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES RESULTING FROM ANY
DEFECT OR INACCURACY IN THIS DOCUMENT, even
if advised of the possibility of such damages.
THE WARRANTY AND REMEDIES SET FORTH ABOVE
ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORAL
OR WRITTEN, EXPRESS OR IMPLIED. No Apple
dealer, agent, or employee is authorized to make
any modification, extension, or addition to this
warranty.
Some states do not allow the exclusion or limitation
of implied warranties or liability for incidental or
consequential damages, so the above limitation or
exclusion may not apply to you. This warranty gives
you specific legal rights, and you may also have
other rights which vary from state to state.
Contents
Introduction
Introduction 15
Who Should Read This Document? 15
Organization of This Document 15
See Also 16
Chapter 1
Overview of Quartz 2D 19
The Page 19
Drawing Destinations: The Graphics Context 20
Quartz 2D Opaque Data Types 22
Graphics States 23
Quartz 2D Coordinate Systems 24
Memory Management: Object Ownership 26
Chapter 2
Graphics Contexts 29
Drawing to a View Graphics Context in iOS 29
Creating a Window Graphics Context in Mac OS X 29
Creating a PDF Graphics Context 31
Creating a Bitmap Graphics Context 35
Supported Pixel Formats 39
Anti-Aliasing 40
Obtaining a Graphics Context for Printing 41
Chapter 3
Paths 43
Path Creation and Path Painting 43
The Building Blocks 44
Points 45
Lines 45
Arcs 45
Curves 47
Closing a Subpath 48
Ellipses 49
Rectangles 49
Creating a Path 50
Painting a Path 51
Parameters That Affect Stroking 51
Functions for Stroking a Path 54
Filling a Path 54
Setting Blend Modes 55
3
2010-11-19 | © 2001, 2010 Apple Inc. All Rights Reserved.
CONTENTS
Clipping to a Path 64
Chapter 4
Color and Color Spaces 67
About Color and Color Spaces 67
The Alpha Value 68
Creating Color Spaces 69
Creating Device-Independent Color Spaces 70
Creating Generic Color Spaces 70
Creating Device Color Spaces 71
Creating Indexed and Pattern Color Spaces 71
Setting and Creating Colors 71
Setting Rendering Intent 73
Chapter 5
Transforms 75
About Quartz Transformation Functions 75
Modifying the Current Transformation Matrix 76
Creating Affine Transforms 80
Evaluating Affine Transforms 81
Getting the User to Device Space Transform 82
The Math Behind the Matrices 82
Chapter 6
Patterns 85
The Anatomy of a Pattern 85
Colored Patterns and Stencil (Uncolored) Patterns 88
Tiling 89
How Patterns Work 89
Painting Colored Patterns 90
Write a Callback Function That Draws a Colored Pattern Cell 90
Set Up the Colored Pattern Color Space 91
Set Up the Anatomy of the Colored Pattern 92
Specify the Colored Pattern as a Fill or Stroke Pattern 93
Draw With the Colored Pattern 93
A Complete Colored Pattern Painting Function 93
Painting Stencil Patterns 95
Write a Callback Function That Draws a Stencil Pattern Cell 95
Set Up the Stencil Pattern Color Space 96
Set Up the Anatomy of the Stencil Pattern 97
Specify the Stencil Pattern as a Fill or Stroke Pattern 97
Drawing with the Stencil Pattern 98
A Complete Stencil Pattern Painting Function 98
4
2010-11-19 | © 2001, 2010 Apple Inc. All Rights Reserved.
CONTENTS
Chapter 7
Shadows 101
How Shadows Work 102
Shadow Drawing Conventions Vary Based on the Context 102
Painting with Shadows 102
Chapter 8
Gradients 105
Axial and Radial Gradient Examples 105
A Comparison of CGShading and CGGradient Objects 108
Extending Color Beyond the End of a Gradient 109
Using a CGGradient Object 110
Using a CGShading Object 113
Painting an Axial Gradient Using a CGShading Object 114
Painting a Radial Gradient Using a CGShading Object 120
See Also 124
Chapter 9
Transparency Layers 125
How Transparency Layers Work 126
Painting to a Transparency Layer 126
Chapter 10
Data Management in Quartz 2D 129
Moving Data into Quartz 2D 130
Moving Data out of Quartz 2D 131
Moving Data Between Quartz 2D and Core Image in Mac OS X 132
Chapter 11
Bitmap Images and Image Masks 135
About Bitmap Images and Image Masks 135
Bitmap Image Information 136
Decode Array 137
Pixel Format 137
Color Spaces and Bitmap Layout 137
Creating Images 139
Creating an Image From Part of a Larger Image 140
Creating an Image from a Bitmap Graphics Context 142
Creating an Image Mask 142
Masking Images 143
Masking an Image with an Image Mask 143
Masking an Image with an Image 145
Masking an Image with Color 146
Masking an Image by Clipping the Context 149
Using Blend Modes with Images 151
Normal Blend Mode 152
5
2010-11-19 | © 2001, 2010 Apple Inc. All Rights Reserved.
Plik z chomika:
Ryjufka
Inne pliki z tego folderu:
[SAMS] Cocoa Programming (Scott Anguish) (2002).pdf
(9155 KB)
Advanced Graphics Programming Using OpenGL (Tom McReynolds, David Blythe).pdf
(13052 KB)
Absolute FreeBSD (Michael W. Lucas).pdf
(7836 KB)
Beginning iOS Game Development (Patrick Alessi).pdf
(20539 KB)
Begining iPad Development for iPhone Developers (Jack Nutting).pdf
(6606 KB)
Inne foldery tego chomika:
[Eng] Android books
BPM Business Process Modeling
IT Ebooks Mega Pack
IT Ebooks Programming
IT epub
Zgłoś jeśli
naruszono regulamin