Here you can find the source of transformImage(BufferedImage image, AffineTransform transform)
public static BufferedImage transformImage(BufferedImage image, AffineTransform transform)
//package com.java2s; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; public class Main { public static BufferedImage transformImage(BufferedImage image, AffineTransform transform) { AffineTransformOp op = new AffineTransformOp(transform, null); BufferedImage destImage = op.createCompatibleDestImage(image, image.getColorModel());//from ww w .j a v a 2 s . c o m Graphics2D g2d = destImage.createGraphics(); g2d.drawImage(image, transform, null); g2d.dispose(); return destImage; /* Graphics2D g = destinationImage.createGraphics(); g.setBackground(Color.WHITE); g.clearRect(0, 0, destinationImage.getWidth(), destinationImage.getHeight()); destinationImage = op.filter(image, destinationImage); return destinationImage; */ } }