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

Java examples for 2D Graphics:Transform

Description

Scaling, Shearing, Translating, and Rotating a Shape

import java.awt.Shape;
import java.awt.geom.AffineTransform;

public class Main {

  public static void main(String[] argv) {
    AffineTransform tx = new AffineTransform();
    tx.scale(scalex, scaley);
    tx.shear(shiftx, shifty);
    tx.translate(x, y);
    tx.rotate(radians);
    Shape newShape = tx.createTransformedShape(shape);
  }
}

Related Tutorials