Module java.desktop
Package java.awt

Class RenderingHints

java.lang.Object
java.awt.RenderingHints
All Implemented Interfaces:
Cloneable, Map<Object,Object>

public class RenderingHints extends Object implements Map<Object,Object>, Cloneable
The RenderingHints class defines and manages collections of keys and associated values which allow an application to provide input into the choice of algorithms used by other classes which perform rendering and image manipulation services. The Graphics2D class, and classes that implement BufferedImageOp and RasterOp all provide methods to get and possibly to set individual or groups of RenderingHints keys and their associated values. When those implementations perform any rendering or image manipulation operations they should examine the values of any RenderingHints that were requested by the caller and tailor the algorithms used accordingly and to the best of their ability.

Note that since these keys and values are hints, there is no requirement that a given implementation supports all possible choices indicated below or that it can respond to requests to modify its choice of algorithm. The values of the various hint keys may also interact such that while all variants of a given key are supported in one situation, the implementation may be more restricted when the values associated with other keys are modified. For example, some implementations may be able to provide several types of dithering when the antialiasing hint is turned off, but have little control over dithering when antialiasing is on. The full set of supported keys and hints may also vary by destination since runtimes may use different underlying modules to render to the screen, or to BufferedImage objects, or while printing.

Implementations are free to ignore the hints completely, but should try to use an implementation algorithm that is as close as possible to the request. If an implementation supports a given algorithm when any value is used for an associated hint key, then minimally it must do so when the value for that key is the exact value that specifies the algorithm.

The keys used to control the hints are all special values that subclass the associated RenderingHints.Key class. Many common hints are expressed below as static constants in this class, but the list is not meant to be exhaustive. Other hints may be created by other packages by defining new objects which subclass the Key class and defining the associated values.