Here you can find the source of getRenderingHints(final Graphics2D g2d, final Map hintsToSave, Map savedHints)
Parameter | Description |
---|---|
g2d | Graphics instance |
hintsToSave | map of RenderingHint key-values |
savedHints | map to save hints into |
private static Map getRenderingHints(final Graphics2D g2d, final Map hintsToSave, Map savedHints)
//package com.java2s; /*/*from w w w .j av a 2 s .c om*/ * This file is part of WebLookAndFeel library. * * WebLookAndFeel library is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * WebLookAndFeel library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with WebLookAndFeel library. If not, see <http://www.gnu.org/licenses/>. */ import java.awt.*; import java.util.*; public class Main { /** * Returns map with rendering hints from a Graphics instance. * * @param g2d Graphics instance * @param hintsToSave map of RenderingHint key-values * @param savedHints map to save hints into * @return map with rendering hints from a Graphics instance */ private static Map getRenderingHints(final Graphics2D g2d, final Map hintsToSave, Map savedHints) { if (savedHints == null) { savedHints = new RenderingHints(null); } else { savedHints.clear(); } if (hintsToSave == null || hintsToSave.size() == 0) { return savedHints; } final Set objects = hintsToSave.keySet(); for (final Object o : objects) { final RenderingHints.Key key = (RenderingHints.Key) o; final Object value = g2d.getRenderingHint(key); if (value != null) { savedHints.put(key, value); } } return savedHints; } /** * Returns component size represented as a rectangle with zero X and Y coordinates. * * @param component component to process * @return component size rectangle */ public static Rectangle size(final Component component) { return new Rectangle(0, 0, component.getWidth(), component.getHeight()); } }