Java Graphics Settings setRenderingHints(Graphics2D g)

Here you can find the source of setRenderingHints(Graphics2D g)

Description

set optimal rendering

License

Open Source License

Declaration

public static void setRenderingHints(Graphics2D g) 

Method Source Code

//package com.java2s;
/*// ww  w .j  ava2  s. co  m
 * This file is part of the Jose Project
 * see http://jose-chess.sourceforge.net/
 * (c) 2002-2006 Peter Sch?fer
 *
 * This program 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 2 of the License, or
 * (at your option) any later version.
 *
 */

import java.awt.*;

public class Main {
    /**
     * set optimal rendering
     */
    public static void setRenderingHints(Graphics2D g) {
        g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
                RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
        g.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
        g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
        g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    }
}

Related

  1. getSecondWindowConfiguration()
  2. getTransparentGraphicsConfiguration()
  3. gradientFillShape(Graphics2D g, Color startColor, Color endColor, Shape shape)
  4. gradientPaint(Graphics2D g2d, Point2D startPosition, Color startColor, Point2D endPosition, Color endColor, int sx, int sy, int ex, int ey)
  5. setClip(Graphics g, Rectangle clipBounds)
  6. setRenderingHints(Graphics2D g2d)
  7. setTextRenderingHints(Graphics2D g2d)
  8. setupGraphics(Graphics2D pG2d)