public class RenderingOptions extends HashMap<RenderingHints.Key,Object>
Graphics2D
objects. Most methods can be used like a builder class.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
RenderingOptions()
No options set
|
RenderingOptions(Graphics g)
Copies the options defined by the given
Graphics object. |
Modifier and Type | Method and Description |
---|---|
RenderingOptions |
apply(Graphics g)
Apply this rendering settings to an
Graphics object. |
RenderingOptions |
apply(Graphics2D g,
boolean fullyReplace)
Apply this rendering settings to an
Graphics2D object. |
RenderingOptions |
apply(Graphics g,
boolean fullyReplace)
Apply this rendering settings to an
Graphics object. |
void |
copyOptionsFrom(Graphics g)
Try to cast to
Graphics2D and then copy its options |
void |
copyOptionsFrom(Graphics2D g)
Copy options of the given
Graphics2D object. |
Object |
put(RenderingHints.Key key,
Object value)
Set the rendering state for
RenderingHints.Key . |
void |
putAll(Map<? extends RenderingHints.Key,? extends Object> m) |
RenderingOptions |
set(RenderingHints.Key key,
Object value)
Set the rendering option.
|
RenderingOptions |
setAntiAliasing(Boolean on)
Sets the anti aliasing option.
|
RenderingOptions |
setAntiAliasingForText(Boolean on)
Sets the anti aliasing option for text drawing.
|
RenderingOptions |
setDithering(Boolean on)
Sets the dithering option.
|
RenderingOptions |
setEnhancedAlphaInterpolation(Boolean on)
Sets the enhanced alpha interpolation option.
|
RenderingOptions |
setEnhancedColorRednering(Boolean on)
Sets the enhanced color rendering option.
|
RenderingOptions |
setEnhancedInterpolation(Boolean on)
Sets the enhanced interpolation option.
|
RenderingOptions |
setEnhancedRednering(Boolean on)
Sets the enhanced rendering option.
|
RenderingOptions |
setFractionalMetrics(Boolean on)
Sets the fractional metrics option.
|
RenderingOptions |
setStrokeControl(Boolean on)
Sets the stroke control option.
|
RenderingOptions |
setTextLcdContrast(int contrast)
Controls the LCD contrast level.
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
public void copyOptionsFrom(Graphics g)
Graphics2D
and then copy its optionsg
- Graphics2D
used for copyingcopyOptionsFrom(Graphics2D)
public void copyOptionsFrom(Graphics2D g)
Graphics2D
object.g
- Graphics2D
used for copyingpublic void putAll(Map<? extends RenderingHints.Key,? extends Object> m)
putAll
in interface Map<RenderingHints.Key,Object>
putAll
in class HashMap<RenderingHints.Key,Object>
public Object put(RenderingHints.Key key, Object value)
RenderingHints.Key
. Only values accepted by this RenderingHints.Key
are
allowed.put
in interface Map<RenderingHints.Key,Object>
put
in class HashMap<RenderingHints.Key,Object>
key
- The rendering option, that should be configuredvalue
- The configuration value for the given optionRenderingHints.Key.isCompatibleValue(Object)
public RenderingOptions set(RenderingHints.Key key, Object value)
key
- The rendering option, that should be configuredvalue
- The configuration value for the given optionRenderingOptions
public RenderingOptions setAntiAliasing(Boolean on)
on
- The anti aliasing status used.RenderingHints.KEY_ANTIALIASING
public RenderingOptions setAntiAliasingForText(Boolean on)
on
- The anti aliasing status used.RenderingHints.KEY_TEXT_ANTIALIASING
public RenderingOptions setFractionalMetrics(Boolean on)
on
- The fractional metrics status used.RenderingHints.KEY_FRACTIONALMETRICS
public RenderingOptions setStrokeControl(Boolean on)
on
- The stroke control status used.RenderingHints.KEY_STROKE_CONTROL
public RenderingOptions setDithering(Boolean on)
on
- The dithering status used.RenderingHints.KEY_DITHERING
public RenderingOptions setEnhancedColorRednering(Boolean on)
on
- The enhanced status status used.RenderingHints.KEY_COLOR_RENDERING
public RenderingOptions setEnhancedRednering(Boolean on)
on
- The enhanced status status used.RenderingHints.KEY_RENDERING
public RenderingOptions setEnhancedInterpolation(Boolean on)
on
- The enhanced status status used.RenderingHints.KEY_INTERPOLATION
public RenderingOptions setEnhancedAlphaInterpolation(Boolean on)
on
- The enhanced status status used.RenderingHints.KEY_ALPHA_INTERPOLATION
public RenderingOptions setTextLcdContrast(int contrast)
contrast
- The used contrast levelRenderingHints.KEY_TEXT_LCD_CONTRAST
public RenderingOptions apply(Graphics g)
Graphics
object. Previous options will remain and
aren't overwritten.g
- The Graphics
object used for configuration purposeapply(Graphics,boolean)
public RenderingOptions apply(Graphics g, boolean fullyReplace)
Graphics
object. This will try to cast it to a
Graphics2D
object, as only this will support those settings.g
- The Graphics
object used for configuration purposefullyReplace
- If true, all options set before will be discardedapply(Graphics2D,boolean)
public RenderingOptions apply(Graphics2D g, boolean fullyReplace)
Graphics2D
object. Behaves like
Graphics2D.addRenderingHints(java.util.Map)
.g
- The Graphics
object used for configuration purposefullyReplace
- If true, all options set before will be discardedCopyright © 2017. All rights reserved.