Java 2D Graphics Java 2D Graphics

Java 2D Graphics Java 2D Graphics

Preface ............................................................................... 2 Who Are You? ................................................................ 2 About This Book ............................................................. 2 About the Examples........................................................ 2 Font Conventions............................................................ 2 Request for Comments ................................................... 2 Acknowledgments........................................................... 2 Who Are You? ................................................................ 2 About This Book ............................................................. 3 About the Examples........................................................ 4 Font Conventions............................................................ 5 Request for Comments ................................................... 5 Acknowledgments........................................................... 6 Chapter 1. Introduction .................................................... 6 What Is Java 2D? ........................................................... 6 What Can Java 2D Do? .................................................. 7 Relatives ......................................................................... 9 Genesis........................................................................... 11 Where Do I Get a Graphics2D?...................................... 11 File Formats .................................................................... 13 Hello, 2D! ........................................................................ 14 Chapter 2. The Big Picture............................................... 18 Graphics2D ..................................................................... 18 The Rendering Pipeline .................................................. 19 All About Alpha ............................................................... 21 Compositing .................................................................... 23 Coordinate Space ........................................................... 24 Chapter 3. Geometry......................................................... 25 Points .............................................................................. 25 Find Your Inner Child ....................................................... 26 Shapes and Paths .......................................................... 27 If You're an Old Dog ......................................................... 27 Flattened Shapes .............................................................. 29 Lines and Curves ............................................................ 37 Rectangles...................................................................... 44 Ellipses and Arcs ............................................................ 48 Constructive Area Geometry .......................................... 51 Chapter 4. Painting and Stroking .................................... 54 Painting ........................................................................... 55 Stroking........................................................................... 66 Overlap ........................................................................... 70 Chapter 5. Rendering........................................................ 72 Transforming................................................................... 72 Angle Units ........................................................................ 79 Compositing .................................................................... 85 Clipping ........................................................................... 90 Rendering Hints .............................................................. 91 Chapter 6. Text .................................................................. 94 Overview ......................................................................... 94 Drawing Text................................................................... 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 ................................................................ 141 If You're Not Too Picky... ................................................ 141 Physics and Physiology .................................................. 145 Color Spaces .................................................................. 146 Profiles............................................................................ 150 Putting It All Together ..................................................... 152 Chapter 9. Images ............................................................. 152 Overview ......................................................................... 153 Where Do Images Come From? ..................................... 154 Displaying Images .......................................................... 158 Drawing on Images ......................................................... 164 Double Buffering ............................................................. 166 A Useful Class ................................................................ 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?............................................................... 206 Sample Models ............................................................... 216 Data Buffers.................................................................... 218 A PNG Decoder .............................................................. 219 Chapter 12. Devices.......................................................... 225 The Local Graphics Environment ................................... 226 The GraphicsDevice Class ............................................. 227 Device Configurations..................................................... 228 Chapter 13. Printing.......................................................... 230 How Printing Works ........................................................ 231 Controlling Printing ......................................................... 236 Power Printing ................................................................ 240 Chapter 14. Animation and Performance ....................... 253 It's Tougher Than You Might Think................................. 253 See for Yourself .............................................................. 254 Memory ........................................................................... 270 Optimizations .................................................................. 272 Figures............................................................................ 272 Figure 15-1 ..................................................................... 272 Figure 15-2 ..................................................................... 273 Figure 15-3 ..................................................................... 273 Figure 15-4 ..................................................................... 274 Figure 15-5 ..................................................................... 274 Figure 15-6 ..................................................................... 274 Figure 15-7 ..................................................................... 275 Figure 15-8 ..................................................................... 275 Figure 15-9 ..................................................................... 275 Figure 15-10 ................................................................... 275 Figure 15-11 ................................................................... 276 Figure 15-12 ................................................................... 276 Figure 15-13 ................................................................... 277 Figure 15-14 ................................................................... 277 Figure 15-15 ................................................................... 278 Figure 15-16 ................................................................... 278 Figure 15-17 ................................................................... 279 Figure 15-18 ..................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    291 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us