The Rendering Pipeline

The original JDK 1.0 had a very simple mechanism for drawing shapes. You select color and paint mode, and call methods of the Graphics class such as drawRect or fillOval. The Java 2D API supports many more options.

  • You can easily produce a wide variety of shapes.

  • You have control over the stroke, the pen that traces shape boundaries.

  • You can fill shapes with solid colors, varying hues, and repeating patterns.

  • You can use transformations to move, scale, rotate, or stretch shapes.

  • You can clip shapes to restrict them to arbitrary areas.

  • You can select composition rules to describe how to combine the pixels of a new shape with existing pixels.

  • You can give rendering hints to make trade-offs between speed and drawing quality.

To ...

Get Core Java™ 2 Volume II - Advanced Features, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.