首页javatransformJava Graphics - 如何缩放形状

Java Graphics - 如何缩放形状

我们想知道如何缩放形状。
 


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

public class Main {
  public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.scale(1, 1);
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

    System.out.println("done");
  }
}