You are previewing Java 2D Graphics.
O'Reilly logo
Java 2D Graphics

Book Description

One weakness of Java has been its graphics capabilities. Java 1.0 and 1.1 only included simple primitives for line drawing: lines could only be one pixel wide, they could only be solid, and there wasn't any good way to draw curves. Font management and color management were also weak. Java 2D (collectively called the "2D API") signals a major improvement in Java's graphics capabilities. It covers many of the classes in Java 1.2 that address graphics handling and improves on many weaknesses that were present in the previous versions of Java. The 2D API allows you to produce high-quality, professional images on a screen or printer. Java 2D Graphics describes the 2D API from top to bottom, demonstrating how to set line styles and pattern fills as well as more advanced techniques of image processing and font handling. You'll see how to create and manipulate the three types of graphics objects: shapes, text, and images. Other topics include image data storage, color management, font glyphs, and printing. Java 2D Graphics assumes no prior knowledge of graphics. Chock full of detailed explanations and examples, this book provides beginning Java programmers with a solid foundation in 2D graphics and helps more advanced programmers create and use high-quality images in their applications. Topics covered in the book include:

  • The rendering pipeline

  • Shapes and paths

  • Geometry

  • Painting with solid colors, gradients, and textures

  • Stroking paths, including dashed lines

  • Transformations: translation, rotation, shearing, and scaling

  • Alpha compositing

  • Clipping

  • Rasterizing and antialiasing

  • Fonts and text

  • Font metrics

  • Glyphs

  • Colors and color spaces

  • sRGB and CIEXYZ

  • ICC color profiles

  • Images, image color models, and image data

  • Image processing

  • Image data storage

  • Graphics devices

  • Printing

Table of Contents

  1. Copyright
  2. Preface
    1. Who Are You?
    2. About This Book
    3. About the Examples
    4. Font Conventions
    5. Request for Comments
    6. Acknowledgments
  3. Introduction
    1. What Is Java 2D?
    2. What Can Java 2D Do?
    3. Relatives
    4. Genesis
    5. Where Do I Get a Graphics2D?
    6. File Formats
    7. Hello, 2D!
  4. The Big Picture
    1. Graphics2D
    2. The Rendering Pipeline
    3. All About Alpha
    4. Compositing
    5. Coordinate Space
  5. Geometry
    1. Points
    2. Shapes and Paths
    3. Lines and Curves
    4. Rectangles
    5. Ellipses and Arcs
    6. Constructive Area Geometry
  6. Painting and Stroking
    1. Painting
    2. Stroking
    3. Overlap
  7. Rendering
    1. Transforming
    2. Compositing
    3. Clipping
    4. Rendering Hints
  8. Text
    1. Overview
    2. Drawing Text
    3. Fonts
    4. Font Metrics
  9. Advanced Text Layout
    1. Using the TextLayout Class
    2. Getting Close to the Metal
  10. Color
    1. If You're Not Too Picky...
    2. Physics and Physiology
    3. Color Spaces
    4. Profiles
    5. Putting It All Together
  11. Images
    1. Overview
    2. Where Do Images Come From?
    3. Displaying Images
    4. Drawing on Images
    5. Double Buffering
    6. A Useful Class
  12. Image Processing
    1. The New Model
    2. An Appetizer
    3. Predefined Operations
    4. Roll Your Own
  13. Image Guts
    1. BufferedImage
    2. Color Models
    3. Rasters
    4. Sample Models
    5. Data Buffers
    6. A PNG Decoder
  14. Devices
    1. The Local Graphics Environment
    2. The GraphicsDevice Class
    3. Device Configurations
  15. Printing
    1. How Printing Works
    2. Controlling Printing
    3. Power Printing
  16. Animation and Performance
    1. It's Tougher Than You Might Think
    2. See for Yourself
    3. Memory
    4. Optimizations
  17. Color Gallery
    1. Figure 15-1
    2. Figure 15-2
    3. Figure 15-3
    4. Figure 15-4
    5. Figure 15-5
    6. Figure 15-6
    7. Figure 15-7
    8. Figure 15-8
    9. Figure 15-9
    10. Figure 15-10
    11. Figure 15-11
    12. Figure 15-12
    13. Figure 15-13
    14. Figure 15-14
    15. Figure 15-15
    16. Figure 15-16
    17. Figure 15-17
    18. Figure 15-18
    19. Figure 15-19
    20. Figure 15-20
    21. Figure 15-21
    22. Figure 15-22
    23. Figure 15-23
    24. Figure 15-24
    25. Figure 15-25
    26. Figure 15-26
    27. Figure 15-27
    28. Figure 15-28
    29. Figure 15-29
    30. Figure 15-30
    31. Figure 15-31
    32. Figure 15-32
  18. Colophon
  19. Index