List of usage examples for java.awt RenderingHints KEY_FRACTIONALMETRICS
Key KEY_FRACTIONALMETRICS
To view the source code for java.awt RenderingHints KEY_FRACTIONALMETRICS.
Click Source Link
From source file:org.executequery.gui.erd.ErdTable.java
protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); drawTable(g2d, 0, 0);//ww w . ja v a 2 s.c o m }
From source file:org.jcurl.core.swing.RockLocationDisplayBase.java
public void exportPng(File dst) throws IOException { final BufferedImage img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); final Graphics2D g2 = (Graphics2D) img.getGraphics(); {//from w w w.ja v a 2 s.c o m final Map hints = new HashMap(); hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); hints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); hints.put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2.addRenderingHints(hints); } this.paintComponent(g2); g2.dispose(); if (!dst.getName().endsWith(".png")) dst = new File(dst.getName() + ".png"); ImageIO.write(img, "png", dst); }
From source file:org.jcurl.core.swing.WCComponent.java
private BufferedImage renderPng(final String watermark) { final BufferedImage img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); final Graphics2D g2 = (Graphics2D) img.getGraphics(); {/*from ww w .j a v a 2 s . c o m*/ final Map<Key, Object> hints = new HashMap<Key, Object>(); hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); hints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); hints.put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2.addRenderingHints(hints); } final Font f0 = g2.getFont(); paint(g2); g2.setTransform(new AffineTransform()); if (watermark != null) { if (log.isDebugEnabled()) log.debug(f0); g2.setFont(f0); g2.setColor(new Color(0, 0, 0, 128)); g2.drawString(watermark, 10, 20); } g2.dispose(); return img; }
From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.internal.PdfGraphics2D.java
private PdfGraphics2D() { dg2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); }
From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.internal.PdfGraphics2D.java
/** * Constructor for PDFGraphics2D.// w ww . ja v a2s.c o m */ public PdfGraphics2D(final PdfContentByte cb, final float width, final float height, final PdfOutputProcessorMetaData metaData) { this.metaData = metaData; dg2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); this.transform = new AffineTransform(); paint = Color.black; background = Color.white; setFont(new Font("sanserif", Font.PLAIN, 12)); this.cb = cb; cb.saveState(); this.width = width; this.height = height; clip = new Area(new Rectangle2D.Float(0, 0, width, height)); clip(clip); oldStroke = strokeOne; stroke = strokeOne; originalStroke = strokeOne; setStrokeDiff(stroke, null); cb.saveState(); }
From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.internal.PdfGraphics2D.java
/** * @see Graphics2D#getFontRenderContext() *///from w w w .j a v a 2 s . c o m @Override public FontRenderContext getFontRenderContext() { final boolean antialias = RenderingHints.VALUE_TEXT_ANTIALIAS_ON .equals(getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING)); final boolean fractions = RenderingHints.VALUE_FRACTIONALMETRICS_ON .equals(getRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS)); return new FontRenderContext(new AffineTransform(), antialias, fractions); }
From source file:org.squidy.designer.shape.VisualShape.java
@Override protected final void paint(PPaintContext paintContext) { super.paint(paintContext); Graphics2D g = paintContext.getGraphics(); // Set default font. g.setFont(internalFont);/*from w w w . ja va 2 s. c o m*/ // if (!renderingHintsSet) { if (isRenderPrimitive()) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED); g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED); g.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE); g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); } else { // Use anti aliasing -> May slow down performance. g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); g.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DEFAULT); g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT); 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); } // renderingHintsSet = true; // } // Paint the shapes visual representation. paintShape(paintContext); // Allows visual debugging if enabled. if (DebugConstants.ENABLED) { paintDebug(paintContext); } }
From source file:tufts.vue.RichTextBox.java
public void paintComponent(Graphics g) { if (TestDebug || DEBUG.TEXT) out("paintComponent @ " + getX() + "," + getY() + " parent=" + getParent()); final MapViewer viewer = (MapViewer) javax.swing.SwingUtilities.getAncestorOfClass(MapViewer.class, this); Graphics2D g2d = (Graphics2D) g; if (viewer != null) { g2d.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING, viewer.AA_ON); g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); }/* w w w.ja va 2 s . com*/ // turn on anti-aliasing -- the cursor repaint loop doesn't // set anti-aliasing, so text goes jiggy around cursor/in selection if we don't do this //// g.clipRect(0, 0,getWidth(), getAdjustedHeight()); super.paintComponent(g2d); //super.paintComponent(g); if (true) { // draw a border (we don't want to add one because that changes the preferred size at a bad time) // g.setColor(Color.gray); g.setClip(null); final int xpad = 1; final int ypad = 1; g.drawRect(-xpad, -ypad, (int) ((getWidth()) + xpad * 2 - 1), (int) ((getHeight()) + ypad * 2 - 1)); } }