FileDocCategorySizeDatePackage
RenderingHints.javaAPI DocAndroid 1.5 API18049Wed May 06 22:41:54 BST 2009java.awt

RenderingHints

public class RenderingHints extends Object implements Cloneable, Map
The RenderingHints class represents preferences for the rendering algorithms. The preferences are arbitrary and can be specified by Map objects or by key-value pairs.
since
Android 1.0

Fields Summary
public static final Key
KEY_ALPHA_INTERPOLATION
The Constant KEY_ALPHA_INTERPOLATION - alpha interpolation rendering hint key.
public static final Object
VALUE_ALPHA_INTERPOLATION_DEFAULT
The Constant VALUE_ALPHA_INTERPOLATION_DEFAULT - alpha interpolation rendering hint value.
public static final Object
VALUE_ALPHA_INTERPOLATION_SPEED
The Constant VALUE_ALPHA_INTERPOLATION_SPEED - alpha interpolation rendering hint value.
public static final Object
VALUE_ALPHA_INTERPOLATION_QUALITY
The Constant VALUE_ALPHA_INTERPOLATION_QUALITY - alpha interpolation rendering hint value.
public static final Key
KEY_ANTIALIASING
The Constant KEY_ANTIALIASING - antialiasing rendering hint key.
public static final Object
VALUE_ANTIALIAS_DEFAULT
The Constant VALUE_ANTIALIAS_DEFAULT - antialiasing rendering hint value.
public static final Object
VALUE_ANTIALIAS_ON
The Constant VALUE_ANTIALIAS_ON - antialiasing rendering hint value.
public static final Object
VALUE_ANTIALIAS_OFF
The Constant VALUE_ANTIALIAS_OFF - antialiasing rendering hint value.
public static final Key
KEY_COLOR_RENDERING
The Constant KEY_COLOR_RENDERING - color rendering hint key.
public static final Object
VALUE_COLOR_RENDER_DEFAULT
The Constant VALUE_COLOR_RENDER_DEFAULT - color rendering hint value.
public static final Object
VALUE_COLOR_RENDER_SPEED
The Constant VALUE_COLOR_RENDER_SPEED - color rendering hint value.
public static final Object
VALUE_COLOR_RENDER_QUALITY
The Constant VALUE_COLOR_RENDER_QUALITY - color rendering hint value.
public static final Key
KEY_DITHERING
The Constant KEY_DITHERING - dithering rendering hint key.
public static final Object
VALUE_DITHER_DEFAULT
The Constant VALUE_DITHER_DEFAULT - dithering rendering hint value.
public static final Object
VALUE_DITHER_DISABLE
The Constant VALUE_DITHER_DISABLE - dithering rendering hint value.
public static final Object
VALUE_DITHER_ENABLE
The Constant VALUE_DITHER_DISABLE - dithering rendering hint value.
public static final Key
KEY_FRACTIONALMETRICS
The Constant KEY_FRACTIONALMETRICS - fractional metrics rendering hint key.
public static final Object
VALUE_FRACTIONALMETRICS_DEFAULT
The Constant VALUE_FRACTIONALMETRICS_DEFAULT - fractional metrics rendering hint value.
public static final Object
VALUE_FRACTIONALMETRICS_ON
The Constant VALUE_FRACTIONALMETRICS_ON - fractional metrics rendering hint value.
public static final Object
VALUE_FRACTIONALMETRICS_OFF
The Constant VALUE_FRACTIONALMETRICS_OFF - fractional metrics rendering hint value.
public static final Key
KEY_INTERPOLATION
The Constant KEY_INTERPOLATION - interpolation rendering hint key.
public static final Object
VALUE_INTERPOLATION_BICUBIC
The Constant VALUE_INTERPOLATION_BICUBIC - interpolation rendering hint value.
public static final Object
VALUE_INTERPOLATION_BILINEAR
The Constant VALUE_INTERPOLATION_BILINEAR - interpolation rendering hint value.
public static final Object
VALUE_INTERPOLATION_NEAREST_NEIGHBOR
The Constant VALUE_INTERPOLATION_NEAREST_NEIGHBOR - interpolation rendering hint value.
public static final Key
KEY_RENDERING
The Constant KEY_RENDERING - rendering hint key.
public static final Object
VALUE_RENDER_DEFAULT
The Constant VALUE_RENDER_DEFAULT - rendering hint value.
public static final Object
VALUE_RENDER_SPEED
The Constant VALUE_RENDER_SPEED - rendering hint value.
public static final Object
VALUE_RENDER_QUALITY
The Constant VALUE_RENDER_QUALITY - rendering hint value.
public static final Key
KEY_STROKE_CONTROL
The Constant KEY_STROKE_CONTROL - stroke control hint key.
public static final Object
VALUE_STROKE_DEFAULT
The Constant VALUE_STROKE_DEFAULT - stroke hint value.
public static final Object
VALUE_STROKE_NORMALIZE
The Constant VALUE_STROKE_NORMALIZE - stroke hint value.
public static final Object
VALUE_STROKE_PURE
The Constant VALUE_STROKE_PURE - stroke hint value.
public static final Key
KEY_TEXT_ANTIALIASING
The Constant KEY_TEXT_ANTIALIASING - text antialiasing hint key.
public static final Object
VALUE_TEXT_ANTIALIAS_DEFAULT
The Constant VALUE_TEXT_ANTIALIAS_DEFAULT - text antialiasing hint key.
public static final Object
VALUE_TEXT_ANTIALIAS_ON
The Constant VALUE_TEXT_ANTIALIAS_ON - text antialiasing hint key.
public static final Object
VALUE_TEXT_ANTIALIAS_OFF
The Constant VALUE_TEXT_ANTIALIAS_OFF - text antialiasing hint key.
private HashMap
map
The map.
Constructors Summary
public RenderingHints(Map map)
Instantiates a new rendering hints object from specified Map object with defined key/value pairs or null for empty RenderingHints.

param
map the Map object with defined key/value pairs or null for empty RenderingHints.


                                                                 
        
        super();
        if (map != null) {
            putAll(map);
        }
    
public RenderingHints(Key key, Object value)
Instantiates a new rendering hints object with the specified key/value pair.

param
key the key of hint property.
param
value the value of hint property.

        super();
        put(key, value);
    
Methods Summary
public voidadd(java.awt.RenderingHints hints)
Adds the properties represented by key/value pairs from the specified RenderingHints object to current object.

param
hints the RenderingHints to be added.

        map.putAll(hints.map);
    
public voidclear()
Clears the RenderingHints of all key/value pairs.

        map.clear();
    
public java.lang.Objectclone()
Returns the clone of the RenderingHints object with the same contents.

return
the clone of the RenderingHints instance.

        RenderingHints clone = new RenderingHints(null);
        clone.map = (HashMap<Object, Object>)this.map.clone();
        return clone;
    
public booleancontainsKey(java.lang.Object key)
Checks whether or not current RenderingHints object contains the key which is equal to the specified Object.

param
key the specified Object.
return
true, if the RenderingHints object contains the specified Object as a key, false otherwise.

        if (key == null) {
            throw new NullPointerException();
        }

        return map.containsKey(key);
    
public booleancontainsValue(java.lang.Object value)
Checks whether or not current RenderingHints object contains at least one the value which is equal to the specified Object.

param
value the specified Object.
return
true, if the specified object is assigned to at least one RenderingHint's key, false otherwise.

        return map.containsValue(value);
    
public java.util.SetentrySet()
Returns a set of Map.Entry objects which contain current RenderingHint key/value pairs.

return
the a set of mapped RenderingHint key/value pairs.

        return map.entrySet();
    
public booleanequals(java.lang.Object o)
Compares the RenderingHints object with the specified object.

param
o the specified Object to be compared.
return
true, if the Object is a Map whose key/value pairs match this RenderingHints' key/value pairs, false otherwise.

        if (!(o instanceof Map)) {
            return false;
        }

        Map<?, ?> m = (Map<?, ?>)o;
        Set<?> keys = keySet();
        if (!keys.equals(m.keySet())) {
            return false;
        }

        Iterator<?> it = keys.iterator();
        while (it.hasNext()) {
            Key key = (Key)it.next();
            Object v1 = get(key);
            Object v2 = m.get(key);
            if (!(v1 == null ? v2 == null : v1.equals(v2))) {
                return false;
            }
        }
        return true;
    
public java.lang.Objectget(java.lang.Object key)
Gets the value assigned to the specified key.

param
key the rendering hint key.
return
the object assigned to the specified key.

        return map.get(key);
    
public inthashCode()
Returns the hash code for this RenderingHints object.

return
the hash code for this RenderingHints object.

        return map.hashCode();
    
public booleanisEmpty()
Checks whether or not the RenderingHints object contains any key/value pairs.

return
true, if the RenderingHints object is empty, false otherwise.

        return map.isEmpty();
    
public java.util.SetkeySet()
Returns a set of rendering hints keys for current RenderingHints object.

return
the set of rendering hints keys.

        return map.keySet();
    
public java.lang.Objectput(java.lang.Object key, java.lang.Object value)
Puts the specified value to the specified key. Neither the key nor the value can be null.

param
key the rendering hint key.
param
value the rendering hint value.
return
the previous rendering hint value assigned to the key or null.

        if (!((Key)key).isCompatibleValue(value)) {
            throw new IllegalArgumentException();
        }

        return map.put(key, value);
    
public voidputAll(java.util.Map m)
Puts all of the preferences from the specified Map into the current RenderingHints object. These mappings replace all existing preferences.

param
m the specified Map of preferences.

        if (m instanceof RenderingHints) {
            map.putAll(((RenderingHints)m).map);
        } else {
            Set<?> entries = m.entrySet();

            if (entries != null) {
                Iterator<?> it = entries.iterator();
                while (it.hasNext()) {
                    Map.Entry<?, ?> entry = (Map.Entry<?, ?>)it.next();
                    Key key = (Key)entry.getKey();
                    Object val = entry.getValue();
                    put(key, val);
                }
            }
        }
    
public java.lang.Objectremove(java.lang.Object key)
Removes the specified key and corresponding value from the RenderingHints object.

param
key the specified hint key to be removed.
return
the object of previous rendering hint value which is assigned to the specified key, or null.

        return map.remove(key);
    
public intsize()
Returns the number of key/value pairs in the RenderingHints.

return
the number of key/value pairs.

        return map.size();
    
public java.lang.StringtoString()
Returns the string representation of the RenderingHints object.

return
the String object which represents RenderingHints object.

        return "RenderingHints[" + map.toString() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
    
public java.util.Collectionvalues()
Returns a Collection of values contained in current RenderingHints object.

return
the Collection of RenderingHints's values.

        return map.values();