Here you can find the source of getRenderingHints(Graphics2D g2d, Map, ?> hintsToSave, RenderingHints savedHints)
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 |
public static RenderingHints getRenderingHints(Graphics2D g2d, Map<?, ?> hintsToSave, RenderingHints savedHints)
//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; } }