Home arrow static arrow Java Programming [Archive] - image rotation
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - image rotation
This topic has 3 replies on 1 page.

Posts:208
Registered: 4/23/03
image rotation  
Jul 2, 2004 12:48 AM



 
does anybody know how to do image rotation? by 90 degrees either side that is. AffineTransform is incomprehensible and the sun tutorial example isnt too clear. i have the image in an imageicon...

is there anyway to rotate an image stored in an imageicon?
 

Posts:147
Registered: 26.01.04
Re: image rotation  
Jul 2, 2004 12:55 AM (reply 1 of 3)



 
affinetransformation is the only way i can think of right now.
do a search on this boards on "image rotation" and it will give u plenty of examples.
 

Posts:11,200
Registered: 7/22/99
Re: image rotation  
Jul 2, 2004 1:52 AM (reply 2 of 3)



 
rotating Math.PI/2 radians around the center point of the image should suffice, you get a transform for that from one of the factory methods of AffineTransform:

AffineTransfrom rotate = AffineTransfrom.getRotateInstance(Math.PI/2, midpointX, midpointY);

Then just construct the AffineTransformOp and filter the image..
 

Posts:147
Registered: 26.01.04
Re: image rotation  
Jul 2, 2004 3:12 AM (reply 3 of 3)



 
ack these god **** radians...
took me forever to figure out they always want that for sin/cos calculations...

however Math has static methods to convert degrees/radians. Math.toRadians(Double degrees) i think, or something...
(pi = 180�)
 
This topic has 3 replies on 1 page.