CONTENTS | PREV | NEXT | Java 2D API |
To specify a preference in the trade-off between speed and quality when an object is rendered, you set the rendering hints in the Graphics2D context. Setting a rendering hint does not guarantee that a particular rendering algorithm will be used; not all platforms support modification of the rendering mode.
To enable antialiasing, call setRenderingHints:
setRenderingHints(ANTIALIASING, ANTIALIAS_ON);
To disable antialiasing, call setRenderingHints and specify the hint category ANTIALIASING and the value ANTIALIAS_OFF. To return to the default setting, specify the hint value ANTIALIAS_DEFAULT.Enabling or disabling antialiasing does not guarantee that objects will or will not be antialiased; not all platforms support modification of the rendering mode.
To specify a preference for speed over quality, call setRenderingHints:
setRenderingHints(RENDERING, RENDER_SPEED);
To specify a preference for quality, call setRenderingHints with the hint value RENDER_QUALITY. To return to the default setting, specify the hint value RENDER_DEFAULT.Not all platforms support modification of the rendering mode, so specifying a preference for speed or quality might not have an effect.