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

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

Description

Get rendering hints from a Graphics instance.

License

Open Source License

Declaration

private static RenderingHints getRenderingHints(Graphics2D g2d,
        RenderingHints hintsToSave, RenderingHints savedHints) 

Method Source Code

//package com.java2s;

import java.awt.*;

import java.util.*;

public class Main {
    /**/*w w w. ja va2 s. co  m*/
     * 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.
     */
    private static RenderingHints getRenderingHints(Graphics2D g2d,
            RenderingHints hintsToSave, RenderingHints savedHints) {
        if (savedHints == null) {
            savedHints = new RenderingHints(null);
        } else {
            savedHints.clear();
        }
        if (hintsToSave == null || hintsToSave.size() == 0) {
            return savedHints;
        }
        /* RenderingHints.keySet() returns Set*/
        Set objects = hintsToSave.keySet();
        for (Object o : objects) {
            RenderingHints.Key key = (RenderingHints.Key) o;
            Object value = g2d.getRenderingHint(key);
            savedHints.put(key, value);
        }

        return savedHints;
    }
}

Related

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