Java 图片切圆角,消除锯齿
public static BufferedImage setBorderRadius(BufferedImage srcImage, int radius){ int width = srcImage.getWidth(); int height = srcImage.getHeight(); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = image.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.fillRoundRect(0, 0, width, height, radius, radius); g2d.setComposite(AlphaComposite.SrcIn); g2d.drawImage(srcImage, 0, 0, width, height, null); return image; }