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:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);//from ww w . j av a 2 s. c o m BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); g2.setStroke(bs); GeneralPath path = new GeneralPath(); path.moveTo(30.0f, 90.0f); path.lineTo(150.0f, 20.0f); path.lineTo(270.0f, 90.0f); g2.draw(path); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);/*w ww . j ava 2s . c o m*/ BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); g2.setStroke(bs); GeneralPath path = new GeneralPath(); path.moveTo(30.0f, 90.0f); path.lineTo(150.0f, 20.0f); path.lineTo(270.0f, 90.0f); g2.draw(path); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);//from www.ja v a 2 s . com BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND); g2.setStroke(bs); GeneralPath path = new GeneralPath(); path.moveTo(30.0f, 90.0f); path.lineTo(150.0f, 20.0f); path.lineTo(270.0f, 90.0f); g2.draw(path); }
From source file:HorizontallyCenteredText.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setFont(new Font("Serif", Font.PLAIN, 48)); paintHorizontallyCenteredText(g2, "Java Source", 200, 75); paintHorizontallyCenteredText(g2, "and", 200, 125); paintHorizontallyCenteredText(g2, "Support", 200, 175); }
From source file:TextAttributesSize.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); AttributedString as1 = new AttributedString("1234567890"); as1.addAttribute(TextAttribute.SIZE, 40); g2d.drawString(as1.getIterator(), 15, 60); }
From source file:TextAttributesColor.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); AttributedString as1 = new AttributedString("1234567890"); as1.addAttribute(TextAttribute.FOREGROUND, Color.red, 0, 2); g2d.drawString(as1.getIterator(), 15, 60); }
From source file:TextAttributesBackground.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); AttributedString as1 = new AttributedString("1234567890"); as1.addAttribute(TextAttribute.BACKGROUND, Color.LIGHT_GRAY, 2, 9); g2d.drawString(as1.getIterator(), 15, 60); }
From source file:TextAttributesSuperscript.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); AttributedString as1 = new AttributedString("1234567890"); as1.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, 5, 7); g2d.drawString(as1.getIterator(), 15, 60); }
From source file:Main.java
/** * Resizes an image using bilinear filtering. * @param source the source image.//from w w w . ja v a2s . co m * @param newWidth the new image width. * @param newHeight the new image height. */ public static BufferedImage performResizeBilinear(BufferedImage source, int newWidth, int newHeight) { BufferedImage out = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = out.createGraphics(); g2d.setComposite(AlphaComposite.Src); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.drawImage(source, 0, 0, newWidth, newHeight, null); g2d.dispose(); return out; }
From source file:Main.java
/** * Resizes an image using trilinear filtering. * @param source the source image./*from w w w . j a v a 2s . c o m*/ * @param newWidth the new image width. * @param newHeight the new image height. */ public static BufferedImage performResizeTrilinear(BufferedImage source, int newWidth, int newHeight) { BufferedImage out = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = out.createGraphics(); g2d.setComposite(AlphaComposite.Src); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.drawImage(source, 0, 0, newWidth, newHeight, null); g2d.dispose(); return out; }