Example usage for java.awt Graphics2D setTransform

List of usage examples for java.awt Graphics2D setTransform

Introduction

In this page you can find the example usage for java.awt Graphics2D setTransform.

Prototype

public abstract void setTransform(AffineTransform Tx);

Source Link

Document

Overwrites the Transform in the Graphics2D context.

Usage

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToRotation(0.2, Math.PI / 6, Math.PI / 6);
    at.translate(100, 0);//from  w ww  . j ava  2  s  .c o m

    g2.setTransform(at);
    g2.draw(shape);

}

From source file:BasicDraw.java

public void paint(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    AffineTransform tx = new AffineTransform();

    double shiftx = .1;
    double shifty = .3;
    tx.shear(shiftx, shifty);//  w w w  . j a  v a 2 s.  c o m

    g2d.setTransform(tx);
    g2d.drawImage(new ImageIcon("a.png").getImage(), tx, this);
}

From source file:BasicDraw.java

public void paint(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    AffineTransform tx = new AffineTransform();

    double scalex = .5;
    double scaley = 1;
    tx.scale(scalex, scaley);//  w w  w. jav  a2 s. com

    g2d.setTransform(tx);

    g2d.drawImage(new ImageIcon("a.png").getImage(), tx, this);
}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToRotation(0.2, 0.2, Math.PI / 6, Math.PI / 6);
    at.translate(100, 0);//from   w w  w .  j  a  v a  2s . com

    g2.setTransform(at);
    g2.draw(shape);

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getScaleX());

    g2.setTransform(at);
    g2.draw(shape);/*from w w  w.  j  a  va2  s .c  om*/

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getShearY());

    g2.setTransform(at);
    g2.draw(shape);//from ww w  . ja  v  a 2s. c  o m

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getScaleY());

    g2.setTransform(at);
    g2.draw(shape);/*from www  .j  a v a 2 s  . c  o  m*/

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getShearX());

    g2.setTransform(at);
    g2.draw(shape);/*from   w w  w  . j  av a 2  s. com*/

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getTranslateX());

    g2.setTransform(at);
    g2.draw(shape);//from   w w  w  .  ja v a2  s  .c  om

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getTranslateY());

    g2.setTransform(at);
    g2.draw(shape);/*from w  w w  . ja  va 2  s . c  o m*/

}