Example usage for java.awt.geom AffineTransform AffineTransform

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

Introduction

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

Prototype

public AffineTransform() 

Source Link

Document

Constructs a new AffineTransform representing the Identity transformation.

Usage

From source file:Main.java

public void paint(Graphics g) {
    try {/*w w  w.ja  v a 2 s .c o m*/
        Graphics2D g2D;
        g2D = (Graphics2D) g;
        g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        String fileName = "a.jpg";
        Image img = getToolkit().getImage(fileName);
        AffineTransform aTran = new AffineTransform();
        aTran.translate(50.0f, 20.0f);
        g2D.transform(aTran);
        g2D.drawImage(img, new AffineTransform(), this);
    } catch (Exception e) {
    }
}

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.setTransform(AffineTransform.getRotateInstance(0.5));

    g2.setTransform(at);//from w  w w.ja  v  a 2  s  . c o  m
    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.rotate(0.3, 0.2, 0.5, 0.3);//from ww w .  j  av  a  2 s  . c  o m

    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);//from w w w . j  a  v a2s. c om

    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.setToTranslation(Math.PI / 6, Math.PI / 6);

    g2.setTransform(at);//from   w w  w  . ja v a2s .  c o m
    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.rotate(0.2, 0.5, 0.3);/*from  w  ww. j a v  a2 s  .  c  o  m*/

    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.rotate(0.5);//from  w  ww .j  a  v  a 2 s  .c  om

    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.scale(0.3, 0.2);/*w w w .  j a v a 2s .  c om*/

    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);

    g2.setTransform(at);//from w ww  .ja  v a 2s  .c  om
    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.rotate(0.5, 0.3);//from   ww w  .j  a v  a  2 s . c  o m

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

}