List of usage examples for java.awt.geom AffineTransform AffineTransform
public AffineTransform()
From source file:Scale.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(new Color(150, 150, 150)); g2d.fillRect(0, 0, 80, 50);/* w ww.j a v a 2s. c o m*/ AffineTransform tx1 = new AffineTransform(); tx1.translate(110, 20); tx1.scale(0.5, 0.5); g2d.setTransform(tx1); g2d.fillRect(0, 0, 80, 50); AffineTransform tx2 = new AffineTransform(); tx2.translate(200, 20); tx2.scale(1.5, 1.5); g2d.setTransform(tx2); g2d.fillRect(0, 0, 80, 50); }
From source file:BasicDraw.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; AffineTransform at = new AffineTransform(); at.setToRotation(Math.PI / 4.0); g2d.setTransform(at);//w ww .j a va2s . com g2d.drawString("aString", 200, 100); }
From source file:ImagePanel.java
public ImagePanel(Image i) { image = i; w = image.getWidth(this); h = image.getHeight(this); transform = new AffineTransform(); }
From source file:BasicDraw.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; AffineTransform tx = new AffineTransform(); double x = 50; double y = 50; tx.translate(x, y);/*from w w w .j av a 2 s . com*/ 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 radians = -Math.PI / 4; tx.rotate(radians);//from 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 shiftx = .1; double shifty = .3; tx.shear(shiftx, shifty);/* w w w.j ava 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);//from www . j av a 2 s . c o m g2d.setTransform(tx); g2d.drawImage(new ImageIcon("a.png").getImage(), tx, this); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Ellipse2D e1 = new Ellipse2D.Double(20.0, 20.0, 80.0, 70.0); Ellipse2D e2 = new Ellipse2D.Double(20.0, 70.0, 40.0, 40.0); Area a1 = new Area(e1); Area a2 = new Area(e2); a1.subtract(a2);//from w w w . j av a 2 s. c om a1.transform(new AffineTransform()); g2.setColor(Color.orange); g2.fill(a1); g2.setColor(Color.black); g2.drawString("subtract", 20, 140); }
From source file:BasicDraw.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.drawString("aString", 100, 100); AffineTransform at = new AffineTransform(); at.setToRotation(Math.PI / 4.0); g2d.setTransform(at);//from w w w.ja v a2s . c o m g2d.drawString("aString", 100, 100); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); gp1.createContext(ColorModel.getRGBdefault(), new Rectangle(0, 0, 30, 40), new Rectangle(0, 0, 30, 40), new AffineTransform(), null); System.out.println(gp1.getTransparency()); g2d.setPaint(gp1);/*from ww w . j a va 2 s. co m*/ g2d.fillRect(20, 20, 300, 40); }