List of usage examples for java.awt RenderingHints VALUE_ANTIALIAS_ON
Object VALUE_ANTIALIAS_ON
To view the source code for java.awt RenderingHints VALUE_ANTIALIAS_ON.
Click Source Link
From source file:lucee.runtime.img.Image.java
public void setAntiAliasing(boolean antiAlias) throws ExpressionException { this.antiAlias = antiAlias ? ANTI_ALIAS_ON : ANTI_ALIAS_OFF; Graphics2D graphics = getGraphics(); if (antiAlias) { graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } else {/*from w ww.j a va 2 s . com*/ graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } }
From source file:freemind.controller.Controller.java
public Object setEdgesRenderingHint(Graphics2D g) { Object renderingHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, (getAntialiasEdges()) ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); return renderingHint; }
From source file:freemind.controller.Controller.java
public void setTextRenderingHint(Graphics2D g) { g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, (getAntialiasAll()) ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, (getAntialiasAll()) ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); }
From source file:ro.nextreports.engine.exporter.ResultExporter.java
private BufferedImage toBufferedImage(Image src) { int w = src.getWidth(null); int h = src.getHeight(null); int type = BufferedImage.TYPE_INT_RGB; BufferedImage dest = new BufferedImage(w, h, type); Graphics2D g2 = dest.createGraphics(); g2.drawImage(src, 0, 0, null);/* w w w.j a v a 2 s .c om*/ g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.dispose(); return dest; }
From source file:edmondskarp.Gui.EdmondsKarpGui.java
@Override public void paintComponent(Graphics g) { super.paintComponent(g); RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ((Graphics2D) g).setRenderingHints(rh); gui.update(g);//ww w . j av a 2 s.co m }
From source file:edu.ku.brc.specify.tasks.subpane.qb.QueryFieldPanel.java
@Override public void paint(Graphics g) { // TODO Auto-generated method stub super.paint(g); if (selected) { //this block was copied from RolloverCommand.paintComp() g.setColor(RolloverCommand.getActiveColor()); Insets insets = getInsets(); insets.set(1, 1, 1, 1);// www .ja va 2s . c o m Dimension size = getSize(); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); RoundRectangle2D.Double rr = new RoundRectangle2D.Double(insets.left, insets.top, size.width - insets.right - insets.left, size.height - insets.bottom - insets.top, 10, 10); g2d.draw(rr); rr = new RoundRectangle2D.Double(insets.left + 1, insets.top + 1, size.width - insets.right - insets.left - 2, size.height - insets.bottom - insets.top - 2, 10, 10); g2d.draw(rr); } }
From source file:au.org.ala.biocache.web.WMSController.java
public static ImgObj create(int width, int height) { BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = (Graphics2D) img.getGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); return new ImgObj(g, img); }
From source file:DefaultGraphics2D.java
/** * Get the rendering context of the <code>Font</code> within this * <code>Graphics2D</code> context. The {@link FontRenderContext} * encapsulates application hints such as anti-aliasing and fractional * metrics, as well as target device specific information such as * dots-per-inch. This information should be provided by the application when * using objects that perform typographical formatting, such as * <code>Font</code> and <code>TextLayout</code>. This information should * also be provided by applications that perform their own layout and need * accurate measurements of various characteristics of glyphs such as advance * and line height when various rendering hints have been applied to the text * rendering.// www .j a v a 2 s .co m * * @return a reference to an instance of FontRenderContext. * @see java.awt.font.FontRenderContext * @see java.awt.Font#createGlyphVector(FontRenderContext,char[]) * @see java.awt.font.TextLayout * @since JDK1.2 */ public FontRenderContext getFontRenderContext() { // // Find if antialiasing should be used. // Object antialiasingHint = hints.get(RenderingHints.KEY_TEXT_ANTIALIASING); boolean isAntialiased = true; if (antialiasingHint != RenderingHints.VALUE_TEXT_ANTIALIAS_ON && antialiasingHint != RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT) { // If antialias was not turned off, then use the general rendering // hint. if (antialiasingHint != RenderingHints.VALUE_TEXT_ANTIALIAS_OFF) { antialiasingHint = hints.get(RenderingHints.KEY_ANTIALIASING); // Test general hint if (antialiasingHint != RenderingHints.VALUE_ANTIALIAS_ON && antialiasingHint != RenderingHints.VALUE_ANTIALIAS_DEFAULT) { // Antialiasing was not requested. However, if it was not turned // off explicitly, use it. if (antialiasingHint == RenderingHints.VALUE_ANTIALIAS_OFF) isAntialiased = false; } } else isAntialiased = false; } // // Find out whether fractional metrics should be used. // boolean useFractionalMetrics = true; if (hints.get(RenderingHints.KEY_FRACTIONALMETRICS) == RenderingHints.VALUE_FRACTIONALMETRICS_OFF) useFractionalMetrics = false; FontRenderContext frc = new FontRenderContext(defaultTransform, isAntialiased, useFractionalMetrics); return frc; }
From source file:edu.ku.brc.ui.UIHelper.java
/** * @param g2d// w w w .ja va 2 s .c o m * @param color * @param x * @param y * @param w * @param h * @param arcSizeW * @param arcSizeH */ public static void drawRoundedRect(final Graphics2D g2d, final Color color, final int x, final int y, final int w, final int h, final int arcSizeW, final int arcSizeH) { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setStroke(UIHelper.getStdLineStroke()); g2d.setColor(color); g2d.drawRoundRect(x, y, w, h, arcSizeW, arcSizeH); }
From source file:org.forester.archaeopteryx.TreePanel.java
final void setTextAntialias() { if ((_phylogeny != null) && !_phylogeny.isEmpty()) { if (_phylogeny.getNumberOfExternalNodes() <= LIMIT_FOR_HQ_RENDERING) { _rendering_hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); } else {/*from w ww. ja v a2s. c o m*/ _rendering_hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); } } if (getMainPanel().getOptions().isAntialiasScreen()) { if (getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR) { _rendering_hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } else { _rendering_hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } try { _rendering_hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); } catch (final Throwable e) { _rendering_hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } } else { _rendering_hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); _rendering_hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } }