Java Graphics Settings getRenderingHints(Graphics2D g2d, Map hintsToSave, RenderingHints savedHints)

Here you can find the source of getRenderingHints(Graphics2D g2d, Map hintsToSave, RenderingHints savedHints)

Description

Get rendering hints from a Graphics instance.

License

Open Source License

Parameter

Parameter Description
g2d the graphics surface
hintsToSave the list of rendering hints to set on the graphics
savedHints a set where to save the previous rendering hints, might be null

Return

the previous set of rendering hints

Declaration

public static RenderingHints getRenderingHints(Graphics2D g2d, Map<?, ?> hintsToSave,
        RenderingHints savedHints) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Graphics2D;
import java.awt.RenderingHints;

import java.util.Map;

public class Main {
    /**/*from ww w  .j av  a2  s  .c om*/
     * Get rendering hints from a Graphics instance. "hintsToSave" is a Map of
     * RenderingHint key-values. For each hint key present in that map, the
     * value of that hint is obtained from the Graphics and stored as the value
     * for the key in savedHints.
     *
     * @param g2d         the graphics surface
     * @param hintsToSave the list of rendering hints to set on the graphics
     * @param savedHints  a set where to save the previous rendering hints,
     *                    might
     *                    be null
     *
     * @return the previous set of rendering hints
     */
    public static RenderingHints getRenderingHints(Graphics2D g2d, Map<?, ?> hintsToSave,
            RenderingHints savedHints) {
        if (savedHints == null)
            savedHints = new RenderingHints(null);
        else
            savedHints.clear();
        if (hintsToSave.isEmpty())
            return savedHints;
        /* RenderingHints.keySet() returns Set */
        for (Object o : hintsToSave.keySet()) {
            RenderingHints.Key key = (RenderingHints.Key) o;
            Object value = g2d.getRenderingHint(key);
            savedHints.put(key, value);
        }
        return savedHints;
    }
}

Related

  1. getDefaultGraphicsConfiguration()
  2. getDefaultGraphicsConfiguration()
  3. getDefaultGraphicsConfiguration()
  4. getMaxWindowBounds(final GraphicsConfiguration gc, final boolean applyScreenInsets)
  5. getRenderingHints(final Graphics2D g2d, final Map hintsToSave, Map savedHints)
  6. getRenderingHints(Graphics2D g2d, RenderingHints hintsToSave, RenderingHints savedHints)
  7. getSecondWindowConfiguration()
  8. getTransparentGraphicsConfiguration()
  9. gradientFillShape(Graphics2D g, Color startColor, Color endColor, Shape shape)