![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e596. Scaling, Shearing, Translating, and Rotating a Drawn ImageSee also e575 The Quintessential Drawing Program and e594 Reading an Image or Icon from a File.public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; AffineTransform tx = new AffineTransform(); double scalex = .5; double scaley = 1; tx.scale(scalex, scaley); double shiftx = .1; double shifty = .3; tx.shear(shiftx, shifty); double x = 50; double y = 50; tx.translate(x, y); double radians = -Math.PI/4; tx.rotate(radians); g2d.drawImage(image, tx, this); }
e595. Drawing an Image e597. Creating a Gray Version of an Icon
© 2002 Addison-Wesley. |