Jonathan Knudsen - Java 2D Graphics.pdf

(2624 KB) Pobierz
Team[oR] 2001
[x] java
Preface ...............................................................................
Who Are You? ................................................................
About This Book .............................................................
About the Examples ........................................................
Font Conventions ............................................................
Request for Comments ...................................................
Acknowledgments ...........................................................
Who Are You? ................................................................
About This Book .............................................................
About the Examples ........................................................
Font Conventions ............................................................
Request for Comments ...................................................
Acknowledgments ...........................................................
Chapter 1. Introduction ....................................................
What Is Java 2D? ...........................................................
What Can Java 2D Do? ..................................................
Relatives .........................................................................
Genesis ...........................................................................
Where Do I Get a Graphics2D? ......................................
File Formats ....................................................................
Hello, 2D! ........................................................................
Chapter 2. The Big Picture ...............................................
Graphics2D .....................................................................
The Rendering Pipeline ..................................................
All About Alpha ...............................................................
Compositing ....................................................................
Coordinate Space ...........................................................
Chapter 3. Geometry .........................................................
Points ..............................................................................
Find Your Inner Child .......................................................
Shapes and Paths ..........................................................
If You’re an Old Dog .........................................................
Flattened Shapes ..............................................................
Lines and Curves ............................................................
Rectangles ......................................................................
Ellipses and Arcs ............................................................
Constructive Area Geometry ..........................................
2
2
2
2
2
2
2
2
3
4
5
5
6
6
6
7
9
11
11
13
14
18
18
19
21
23
24
25
25
26
27
27
29
37
44
48
51
Chapter 4. Painting and Stroking ....................................
Painting ...........................................................................
Stroking ...........................................................................
Overlap ...........................................................................
Chapter 5. Rendering........................................................
Transforming ...................................................................
Angle Units ........................................................................
Compositing ....................................................................
Clipping ...........................................................................
Rendering Hints ..............................................................
Chapter 6. Text ..................................................................
Overview .........................................................................
Drawing Text ...................................................................
54
55
66
70
72
72
79
85
90
91
94
94
96
What’s an Iterator? ........................................................... 99
Fonts ............................................................................... 109
Hint, Hint ............................................................................ 112
Font Metrics .................................................................... 114
Chapter 7. Advanced Text Layout ................................... 120
Using the TextLayout Class ............................................ 120
Getting Close to the Metal .............................................. 135
Chapter 8. Color ................................................................
If You’re Not Too Picky... ................................................
Physics and Physiology ..................................................
Color Spaces ..................................................................
Profiles ............................................................................
Putting It All Together .....................................................
Chapter 9. Images .............................................................
Overview .........................................................................
Where Do Images Come From? .....................................
Displaying Images ..........................................................
Drawing on Images .........................................................
Double Buffering .............................................................
A Useful Class ................................................................
141
141
145
146
150
152
152
153
154
158
164
166
168
Chapter 10. Image Processing......................................... 170
The New Model ............................................................... 170
Combining the Old and New Methods ............................ 171
An Appetizer ................................................................... 171
Predefined Operations .................................................... 178
Space and Time................................................................. 181
Roll Your Own ................................................................. 188
Chapter 11. Image Guts .................................................... 190
BufferedImage ................................................................ 191
Color Models ................................................................... 195
Who Was That Masked Bit? ............................................. 202
Rasters ........................................................................... 206
What’s a Raster? ...............................................................
Sample Models ...............................................................
Data Buffers ....................................................................
A PNG Decoder ..............................................................
Chapter 12. Devices ..........................................................
The Local Graphics Environment ...................................
The GraphicsDevice Class .............................................
Device Configurations .....................................................
Chapter 13. Printing ..........................................................
How Printing Works ........................................................
Controlling Printing .........................................................
Power Printing ................................................................
Chapter 14. Animation and Performance .......................
It’s Tougher Than You Might Think .................................
See for Yourself ..............................................................
Memory ...........................................................................
Optimizations ..................................................................
Figures ............................................................................
Figure 15-1 .....................................................................
Figure 15-2 .....................................................................
Figure 15-3 .....................................................................
Figure 15-4 .....................................................................
Figure 15-5 .....................................................................
Figure 15-6 .....................................................................
Figure 15-7 .....................................................................
Figure 15-8 .....................................................................
Figure 15-9 .....................................................................
206
216
218
219
225
226
227
228
230
231
236
240
253
253
254
270
272
272
272
273
273
274
274
274
275
275
275
Figure 15-10 ...................................................................
Figure 15-11 ...................................................................
Figure 15-12 ...................................................................
Figure 15-13 ...................................................................
Figure 15-14 ...................................................................
Figure 15-15 ...................................................................
Figure 15-16 ...................................................................
Figure 15-17 ...................................................................
Figure 15-18 ...................................................................
Figure 15-19 ...................................................................
Figure 15-20 ...................................................................
Figure 15-21 ...................................................................
Figure 15-22 ...................................................................
Figure 15-23 ...................................................................
Figure 15-24 ...................................................................
Figure 15-25 ...................................................................
Figure 15-26 ...................................................................
Figure 15-27 ...................................................................
Figure 15-28 ...................................................................
Figure 15-29 ...................................................................
Figure 15-30 ...................................................................
Figure 15-31 ...................................................................
Figure 15-32 ...................................................................
275
276
276
277
277
278
278
279
279
280
280
281
281
282
282
283
283
284
284
284
285
285
286
Colophon ........................................................................... 286
Zgłoś jeśli naruszono regulamin