public class RenderingHints extends java.lang.Object implements java.util.Map<java.lang.Object,java.lang.Object>, java.lang.Cloneable
Graphics2D rendering pipeline. Because these
items are hints only, they may be ignored by a particular
Graphics2D implementation.| Modifier and Type | Class and Description |
|---|---|
static class |
RenderingHints.Key
The base class used to represent keys.
|
| Modifier and Type | Field and Description |
|---|---|
static RenderingHints.Key |
KEY_ALPHA_INTERPOLATION
A key for the 'alpha interpolation' hint.
|
static RenderingHints.Key |
KEY_ANTIALIASING
A key for the 'antialiasing' hint.
|
static RenderingHints.Key |
KEY_COLOR_RENDERING
A key for the 'color rendering' hint.
|
static RenderingHints.Key |
KEY_DITHERING
A key for the 'dithering' hint.
|
static RenderingHints.Key |
KEY_FRACTIONALMETRICS
A key for the 'fractional metrics' hint.
|
static RenderingHints.Key |
KEY_INTERPOLATION
A key for the 'interpolation' hint.
|
static RenderingHints.Key |
KEY_RENDERING
A key for the 'rendering' hint.
|
static RenderingHints.Key |
KEY_STROKE_CONTROL
A key for the 'stroke control' hint.
|
static RenderingHints.Key |
KEY_TEXT_ANTIALIASING
A key for the 'text antialiasing' hint.
|
static java.lang.Object |
VALUE_ALPHA_INTERPOLATION_DEFAULT
This value is for use with the
KEY_ALPHA_INTERPOLATION key. |
static java.lang.Object |
VALUE_ALPHA_INTERPOLATION_QUALITY
This value is for use with the
KEY_ALPHA_INTERPOLATION key. |
static java.lang.Object |
VALUE_ALPHA_INTERPOLATION_SPEED
This value is for use with the
KEY_ALPHA_INTERPOLATION key. |
static java.lang.Object |
VALUE_ANTIALIAS_DEFAULT
This value is for use with the
KEY_ANTIALIASING key. |
static java.lang.Object |
VALUE_ANTIALIAS_OFF
This value is for use with the
KEY_ANTIALIASING key. |
static java.lang.Object |
VALUE_ANTIALIAS_ON
This value is for use with the
KEY_ANTIALIASING key. |
static java.lang.Object |
VALUE_COLOR_RENDER_DEFAULT
This value is for use with the
KEY_COLOR_RENDERING key. |
static java.lang.Object |
VALUE_COLOR_RENDER_QUALITY
This value is for use with the
KEY_COLOR_RENDERING key. |
static java.lang.Object |
VALUE_COLOR_RENDER_SPEED
This value is for use with the
KEY_COLOR_RENDERING key. |
static java.lang.Object |
VALUE_DITHER_DEFAULT
This value is for use with the
KEY_DITHERING key. |
static java.lang.Object |
VALUE_DITHER_DISABLE
This value is for use with the
KEY_DITHERING key. |
static java.lang.Object |
VALUE_DITHER_ENABLE
This value is for use with the
KEY_DITHERING key. |
static java.lang.Object |
VALUE_FRACTIONALMETRICS_DEFAULT
This value is for use with the
KEY_FRACTIONALMETRICS key. |
static java.lang.Object |
VALUE_FRACTIONALMETRICS_OFF
This value is for use with the
KEY_FRACTIONALMETRICS key. |
static java.lang.Object |
VALUE_FRACTIONALMETRICS_ON
This value is for use with the
KEY_FRACTIONALMETRICS key. |
static java.lang.Object |
VALUE_INTERPOLATION_BICUBIC
This value is for use with the
KEY_INTERPOLATION key. |
static java.lang.Object |
VALUE_INTERPOLATION_BILINEAR
This value is for use with the
KEY_INTERPOLATION key. |
static java.lang.Object |
VALUE_INTERPOLATION_NEAREST_NEIGHBOR
This value is for use with the
KEY_INTERPOLATION key. |
static java.lang.Object |
VALUE_RENDER_DEFAULT
This value is for use with the
KEY_RENDERING key. |
static java.lang.Object |
VALUE_RENDER_QUALITY
This value is for use with the
KEY_RENDERING key. |
static java.lang.Object |
VALUE_RENDER_SPEED
This value is for use with the
KEY_RENDERING key. |
static java.lang.Object |
VALUE_STROKE_DEFAULT
This value is for use with the
KEY_STROKE_CONTROL key. |
static java.lang.Object |
VALUE_STROKE_NORMALIZE
This value is for use with the
KEY_STROKE_CONTROL key. |
static java.lang.Object |
VALUE_STROKE_PURE
This value is for use with the
KEY_STROKE_CONTROL key. |
static java.lang.Object |
VALUE_TEXT_ANTIALIAS_DEFAULT
This value is for use with the
KEY_TEXT_ANTIALIASING key. |
static java.lang.Object |
VALUE_TEXT_ANTIALIAS_OFF
This value is for use with the
KEY_TEXT_ANTIALIASING key. |
static java.lang.Object |
VALUE_TEXT_ANTIALIAS_ON
This value is for use with the
KEY_TEXT_ANTIALIASING key. |
| Constructor and Description |
|---|
RenderingHints(java.util.Map<RenderingHints.Key,?> init)
Creates a new collection of hints containing all the (key, value) pairs
in the specified map.
|
RenderingHints(RenderingHints.Key key,
java.lang.Object value)
Creates a new collection containing a single (key, value) pair.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(RenderingHints hints)
Adds all the hints from a collection to this collection.
|
void |
clear()
Clears all the hints from this collection.
|
java.lang.Object |
clone()
Creates a clone of this instance.
|
boolean |
containsKey(java.lang.Object key)
Returns
true if the collection of hints contains the
specified key, and false otherwise. |
boolean |
containsValue(java.lang.Object value)
Returns
true if the collection of hints contains the
specified value, and false otherwise. |
java.util.Set<java.util.Map.Entry<java.lang.Object,java.lang.Object>> |
entrySet()
Returns a set of entries from the collection.
|
boolean |
equals(java.lang.Object o)
Checks this collection for equality with an arbitrary object.
|
java.lang.Object |
get(java.lang.Object key)
Returns the value associated with the specified key, or
null
if there is no value defined for the key. |
int |
hashCode()
Returns a hash code for the collection of hints.
|
boolean |
isEmpty()
Returns
true if there are no hints in the collection,
and false otherwise. |
java.util.Set<java.lang.Object> |
keySet()
Returns a set containing the keys from this collection.
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Adds a (key, value) pair to the collection of hints (if the
collection already contains the specified key, then the
value is updated).
|
void |
putAll(java.util.Map<?,?> m)
Adds a collection of (key, value) pairs to the collection.
|
java.lang.Object |
remove(java.lang.Object key)
Removes a hint from the collection.
|
int |
size()
Returns the number of hints in the collection.
|
java.lang.String |
toString()
Returns a string representation of this instance.
|
java.util.Collection<java.lang.Object> |
values()
Returns a collection of the values from this hint collection.
|
public static final RenderingHints.Key KEY_ANTIALIASING
VALUE_ANTIALIAS_OFF |
Render without antialiasing (better speed). |
VALUE_ANTIALIAS_ON |
Render with antialiasing (better quality). |
VALUE_ANTIALIAS_DEFAULT |
Use the default value for antialiasing. |
public static final java.lang.Object VALUE_ANTIALIAS_ON
KEY_ANTIALIASING key.public static final java.lang.Object VALUE_ANTIALIAS_OFF
KEY_ANTIALIASING key.public static final java.lang.Object VALUE_ANTIALIAS_DEFAULT
KEY_ANTIALIASING key.public static final RenderingHints.Key KEY_RENDERING
VALUE_RENDER_SPEED |
Prefer speed over quality when rendering. |
VALUE_RENDER_QUALITY |
Prefer quality over speed when rendering. |
VALUE_RENDER_DEFAULT |
Use the default value for quality vs. speed when rendering. |
public static final java.lang.Object VALUE_RENDER_SPEED
KEY_RENDERING key.public static final java.lang.Object VALUE_RENDER_QUALITY
KEY_RENDERING key.public static final java.lang.Object VALUE_RENDER_DEFAULT
KEY_RENDERING key.public static final RenderingHints.Key KEY_DITHERING
VALUE_DITHER_DISABLE |
Disable dithering. |
VALUE_DITHER_ENABLE |
Enable dithering. |
VALUE_DITHER_DEFAULT |
Use the default value for dithering. |
public static final java.lang.Object VALUE_DITHER_DISABLE
KEY_DITHERING key.public static final java.lang.Object VALUE_DITHER_ENABLE
KEY_DITHERING key.public static final java.lang.Object VALUE_DITHER_DEFAULT
KEY_DITHERING key.public static final RenderingHints.Key KEY_TEXT_ANTIALIASING
VALUE_TEXT_ANTIALIAS_ON |
Render text with antialiasing (better quality usually). |
VALUE_TEXT_ANTIALIAS_OFF |
Render test without antialiasing (better speed). |
VALUE_TEXT_ANTIALIAS_DEFAULT |
Use the default value for text antialiasing. |
public static final java.lang.Object VALUE_TEXT_ANTIALIAS_ON
KEY_TEXT_ANTIALIASING key.public static final java.lang.Object VALUE_TEXT_ANTIALIAS_OFF
KEY_TEXT_ANTIALIASING key.public static final java.lang.Object VALUE_TEXT_ANTIALIAS_DEFAULT
KEY_TEXT_ANTIALIASING key.public static final RenderingHints.Key KEY_FRACTIONALMETRICS
VALUE_FRACTIONALMETRICS_OFF |
Render text with fractional metrics off. |
VALUE_FRACTIONALMETRICS_ON |
Render text with fractional metrics on. |
VALUE_FRACTIONALMETRICS_DEFAULT |
Use the default value for fractional metrics. |
public static final java.lang.Object VALUE_FRACTIONALMETRICS_OFF
KEY_FRACTIONALMETRICS key.public static final java.lang.Object VALUE_FRACTIONALMETRICS_ON
KEY_FRACTIONALMETRICS key.public static final java.lang.Object VALUE_FRACTIONALMETRICS_DEFAULT
KEY_FRACTIONALMETRICS key.public static final RenderingHints.Key KEY_INTERPOLATION
VALUE_INTERPOLATION_NEAREST_NEIGHBOR |
Use nearest neighbour interpolation. |
VALUE_INTERPOLATION_BILINEAR |
Use bilinear interpolation. |
VALUE_INTERPOLATION_BICUBIC |
Use bicubic interpolation. |
public static final java.lang.Object VALUE_INTERPOLATION_NEAREST_NEIGHBOR
KEY_INTERPOLATION key.public static final java.lang.Object VALUE_INTERPOLATION_BILINEAR
KEY_INTERPOLATION key.public static final java.lang.Object VALUE_INTERPOLATION_BICUBIC
KEY_INTERPOLATION key.public static final RenderingHints.Key KEY_ALPHA_INTERPOLATION
VALUE_ALPHA_INTERPOLATION_SPEED |
Prefer speed over quality. |
VALUE_ALPHA_INTERPOLATION_QUALITY |
Prefer quality over speed. |
VALUE_ALPHA_INTERPOLATION_DEFAULT |
Use the default setting. |
public static final java.lang.Object VALUE_ALPHA_INTERPOLATION_SPEED
KEY_ALPHA_INTERPOLATION key.public static final java.lang.Object VALUE_ALPHA_INTERPOLATION_QUALITY
KEY_ALPHA_INTERPOLATION key.public static final java.lang.Object VALUE_ALPHA_INTERPOLATION_DEFAULT
KEY_ALPHA_INTERPOLATION key.public static final RenderingHints.Key KEY_COLOR_RENDERING
VALUE_COLOR_RENDER_SPEED |
Prefer speed over quality. |
VALUE_COLOR_RENDER_QUALITY |
Prefer quality over speed. |
VALUE_COLOR_RENDER_DEFAULT |
Use the default setting. |
public static final java.lang.Object VALUE_COLOR_RENDER_SPEED
KEY_COLOR_RENDERING key.public static final java.lang.Object VALUE_COLOR_RENDER_QUALITY
KEY_COLOR_RENDERING key.public static final java.lang.Object VALUE_COLOR_RENDER_DEFAULT
KEY_COLOR_RENDERING key.public static final RenderingHints.Key KEY_STROKE_CONTROL
VALUE_STROKE_DEFAULT |
Use the default setting. |
VALUE_STROKE_NORMALIZE |
XXX |
VALUE_STROKE_PURE |
XXX |
public static final java.lang.Object VALUE_STROKE_DEFAULT
KEY_STROKE_CONTROL key.public static final java.lang.Object VALUE_STROKE_NORMALIZE
KEY_STROKE_CONTROL key.public static final java.lang.Object VALUE_STROKE_PURE
KEY_STROKE_CONTROL key.public RenderingHints(java.util.Map<RenderingHints.Key,?> init)
init - a map containing a collection of hints (null
permitted).public RenderingHints(RenderingHints.Key key, java.lang.Object value)
key - the key.value - the value.public int size()
size in interface java.util.Map<java.lang.Object,java.lang.Object>public boolean isEmpty()
true if there are no hints in the collection,
and false otherwise.isEmpty in interface java.util.Map<java.lang.Object,java.lang.Object>public boolean containsKey(java.lang.Object key)
true if the collection of hints contains the
specified key, and false otherwise.containsKey in interface java.util.Map<java.lang.Object,java.lang.Object>key - the key (null not permitted).java.lang.NullPointerException - if key is null.java.lang.ClassCastException - if key is not a RenderingHints.Key.public boolean containsValue(java.lang.Object value)
true if the collection of hints contains the
specified value, and false otherwise.containsValue in interface java.util.Map<java.lang.Object,java.lang.Object>value - the value.public java.lang.Object get(java.lang.Object key)
null
if there is no value defined for the key.get in interface java.util.Map<java.lang.Object,java.lang.Object>key - the key (null permitted).null).java.lang.ClassCastException - if key is not a RenderingHints.Key.containsKey(Object)public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put in interface java.util.Map<java.lang.Object,java.lang.Object>key - the key.value - the value.null if the key
didn't have a value yet.Map.containsKey(Object)public void add(RenderingHints hints)
hints - the hint collection.public void clear()
clear in interface java.util.Map<java.lang.Object,java.lang.Object>public java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Map<java.lang.Object,java.lang.Object>key - the key.null if
the key was not part of the collectionjava.lang.ClassCastException - if the key is not a subclass of
RenderingHints.Key.public void putAll(java.util.Map<?,?> m)
putAll in interface java.util.Map<java.lang.Object,java.lang.Object>m - a map containing (key, value) items.java.lang.ClassCastException - if the map contains a key that is not
a subclass of RenderingHints.Key.java.lang.IllegalArgumentException - if the map contains a value that is
not compatible with its key.Map.put(Object, Object)public java.util.Set<java.lang.Object> keySet()
keySet in interface java.util.Map<java.lang.Object,java.lang.Object>public java.util.Collection<java.lang.Object> values()
RenderingHints instance,
so updates to one will affect the other.values in interface java.util.Map<java.lang.Object,java.lang.Object>public java.util.Set<java.util.Map.Entry<java.lang.Object,java.lang.Object>> entrySet()
entrySet in interface java.util.Map<java.lang.Object,java.lang.Object>Map.Entrypublic boolean equals(java.lang.Object o)
equals in interface java.util.Map<java.lang.Object,java.lang.Object>equals in class java.lang.Objecto - the object (null permitted)Object.hashCode()public int hashCode()
hashCode in interface java.util.Map<java.lang.Object,java.lang.Object>hashCode in class java.lang.ObjectObject.equals(Object),
System.identityHashCode(Object)public java.lang.Object clone()
clone in class java.lang.ObjectCloneablepublic java.lang.String toString()
toString in class java.lang.ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)