Java Code Examples for java.awt.RenderingHints#putAll()
The following examples show how to use
java.awt.RenderingHints#putAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractGraphics2D.java From pumpernickel with MIT License | 5 votes |
/** Clones the properties of the <code>AbstractGraphics2D</code> argument. */ public AbstractGraphics2D(AbstractGraphics2D g) { hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_DEFAULT); hints.remove(RenderingHints.KEY_RENDERING); hints.putAll(g.hints); composite = g.composite; paint = g.paint; background = g.background; stroke = g.stroke; transform = new AffineTransform(); setClip(g.clipping); // set *before* transform transform.setTransform(g.transform); font = g.font; int i = g.name.lastIndexOf(' '); if (i == -1) { name = g.name + " " + 2; } else { String end = g.name.substring(i + 1); try { int ctr = Integer.parseInt(end); ctr++; name = g.name.substring(0, i) + " " + ctr; } catch (NumberFormatException e) { name = g.name + " " + 2; } } }
Example 2
Source File: SunGraphics2D.java From Bytecoder with Apache License 2.0 | 4 votes |
RenderingHints makeHints(Map<?,?> hints) { RenderingHints model = new RenderingHints(null); if (hints != null) { model.putAll(hints); } model.put(SunHints.KEY_RENDERING, SunHints.Value.get(SunHints.INTKEY_RENDERING, renderHint)); model.put(SunHints.KEY_ANTIALIASING, SunHints.Value.get(SunHints.INTKEY_ANTIALIASING, antialiasHint)); model.put(SunHints.KEY_TEXT_ANTIALIASING, SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING, textAntialiasHint)); model.put(SunHints.KEY_FRACTIONALMETRICS, SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS, fractionalMetricsHint)); model.put(SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST, Integer.valueOf(lcdTextContrast)); Object value; switch (interpolationHint) { case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR: value = SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; break; case SunHints.INTVAL_INTERPOLATION_BILINEAR: value = SunHints.VALUE_INTERPOLATION_BILINEAR; break; case SunHints.INTVAL_INTERPOLATION_BICUBIC: value = SunHints.VALUE_INTERPOLATION_BICUBIC; break; default: value = null; break; } if (value != null) { model.put(SunHints.KEY_INTERPOLATION, value); } model.put(SunHints.KEY_STROKE_CONTROL, SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL, strokeHint)); return model; }
Example 3
Source File: SunGraphics2D.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
RenderingHints makeHints(Map<?,?> hints) { RenderingHints model = new RenderingHints(null); if (hints != null) { model.putAll(hints); } model.put(SunHints.KEY_RENDERING, SunHints.Value.get(SunHints.INTKEY_RENDERING, renderHint)); model.put(SunHints.KEY_ANTIALIASING, SunHints.Value.get(SunHints.INTKEY_ANTIALIASING, antialiasHint)); model.put(SunHints.KEY_TEXT_ANTIALIASING, SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING, textAntialiasHint)); model.put(SunHints.KEY_FRACTIONALMETRICS, SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS, fractionalMetricsHint)); model.put(SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST, Integer.valueOf(lcdTextContrast)); Object value; switch (interpolationHint) { case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR: value = SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; break; case SunHints.INTVAL_INTERPOLATION_BILINEAR: value = SunHints.VALUE_INTERPOLATION_BILINEAR; break; case SunHints.INTVAL_INTERPOLATION_BICUBIC: value = SunHints.VALUE_INTERPOLATION_BICUBIC; break; default: value = null; break; } if (value != null) { model.put(SunHints.KEY_INTERPOLATION, value); } model.put(SunHints.KEY_STROKE_CONTROL, SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL, strokeHint)); return model; }
Example 4
Source File: ImageContext.java From pumpernickel with MIT License | 4 votes |
/** Replace all current rendering hints with the argument. */ public void setRenderingHints(RenderingHints hints) { renderingHints = new RenderingHints( new HashMap<RenderingHints.Key, Object>()); renderingHints.putAll(hints); }