This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
How can i transform a shape ?
Posted by Francisco Ca�ete on June 07, 2000 at 5:23 PM
Hello, i hope u can help me. I rotate rectangle by executing these sentences: ... r2 = new Rectangle2D.Float(50,50,50,100); AffineTransform rot45 = AffineTransform.getRotateInstance(90,0.0,0.0); g2d.setTransform(rot45); g2d.draw(r2); But what i really want is to get the new coordinates of the rotated rectangle, because if i ask for X,Y points the response will be (50,50), although the rectangle has been rotated 90 degrees. If I try to create a new rectangle by calling createTransformedShape, i get an executing error?!! This is the code: Rectangle b = new Rectangle((Rectangle)rot45.createTransformedShape(r2)); I 've tried the same with line2d and the same has happened. Can tell me how can i get the new coordinates of a shape after rotating it ? Thanks for all
Replies:
|