Example usage for java.awt.geom AffineTransform createTransformedShape

List of usage examples for java.awt.geom AffineTransform createTransformedShape

Introduction

In this page you can find the example usage for java.awt.geom AffineTransform createTransformedShape.

Prototype

public Shape createTransformedShape(Shape pSrc) 

Source Link

Document

Returns a new Shape object defined by the geometry of the specified Shape after it has been transformed by this transform.

Usage

From source file:BasicShapes.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.rotate(0.5);/*w ww.j a  v  a  2 s .  c  om*/
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);
}

From source file:BasicShapes.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.scale(1, 1);/*w w  w  .ja  v  a  2 s . c o  m*/
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

}

From source file:BasicShapes.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.shear(1, 1);/*w w  w. ja v  a2s . c om*/
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

}

From source file:Main.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.scale(1, 1);/*from  w  w  w  . j a  va2 s .  c  o m*/
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

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

From source file:Main.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.rotate(0.5);//from   w w  w.j ava 2s.co  m
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

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

From source file:Main.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.shear(1, 1);//w ww  . j a v a 2 s. co  m
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

    System.out.println("done");

}

From source file:BasicShapes.java

public static void main(String[] args) {

    AffineTransform tx = new AffineTransform();
    tx.translate(1, 10);/*from  www  . j a v a2s. co m*/
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

}

From source file:Main.java

public static void main(String[] args) {

    AffineTransform tx = new AffineTransform();
    tx.translate(1, 10);//  w w w  .  j a v  a 2  s  . c  o  m
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

    System.out.println("done");

}

From source file:Main.java

/**
 * Creates and returns a translated shape.
 *
 * @param shape  the shape (<code>null</code> not permitted).
 * @param transX  the x translation (in Java2D space).
 * @param transY  the y translation (in Java2D space).
 *
 * @return The translated shape.//w  ww .j av  a2 s .c  o m
 */
public static Shape createTranslatedShape(final Shape shape, final double transX, final double transY) {
    if (shape == null) {
        throw new IllegalArgumentException("Null 'shape' argument.");
    }
    final AffineTransform transform = AffineTransform.getTranslateInstance(transX, transY);
    return transform.createTransformedShape(shape);
}

From source file:Main.java

/**
 * Rotates a shape about the specified coordinates.
 *
 * @param base  the shape (<code>null</code> permitted, returns
 *              <code>null</code>).
 * @param angle  the angle (in radians).
 * @param x  the x coordinate for the rotation point (in Java2D space).
 * @param y  the y coordinate for the rotation point (in Java2D space).
 *
 * @return the rotated shape./*  w ww.j a  v  a2s.  c o m*/
 */
public static Shape rotateShape(final Shape base, final double angle, final float x, final float y) {
    if (base == null) {
        return null;
    }
    final AffineTransform rotate = AffineTransform.getRotateInstance(angle, x, y);
    final Shape result = rotate.createTransformedShape(base);
    return result;
}