Cover Page by Gary Cornell, Cay S. Horstmann

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

7.9. Rendering Hints

In the preceding sections you have seen that the rendering process is quite complex. Although the Java 2D API is surprisingly fast in most cases, sometimes you would like to have control over trade-offs between speed and quality. You can achieve this by setting rendering hints. The setRenderingHint method of the Graphics2D class lets you set a single hint. The hints’ keys and values are declared in the RenderingHints class. Table 7.2 summarizes the choices. The values that end in _DEFAULT denote the defaults that are chosen by a particular implementation as a good trade-off between performance and quality.

Table 7.2. Rendering Hints

The most useful of these settings involves antialiasing. This technique removes the “jaggies” ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required