Scaling, Shearing, Translating, and Rotating a Buffered Image - Java 2D Graphics

Java examples for 2D Graphics:BufferedImage Scale

Description

Scaling, Shearing, Translating, and Rotating a Buffered Image

import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;

public class Main {
  public void main(String[] argv) {
    AffineTransform tx = new AffineTransform();
    tx.scale(scalex, scaley);
    tx.shear(shiftx, shifty);
    tx.translate(x, y);
    tx.rotate(radians, bufferedImage.getWidth() / 2,
        bufferedImage.getHeight() / 2);

    AffineTransformOp op = new AffineTransformOp(tx,
        AffineTransformOp.TYPE_BILINEAR);
    bufferedImage = op.filter(bufferedImage, null);
  }
}

Related Tutorials