Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I'm trying to rotate image matrix 45,90,180,270 and 360 using java language
so i will apply the equations in next link to rotate matrix

http://homepages.inf.ed.ac.uk/rbf/HIPR2/rotate.htm[^]

but i think (x0,y0)are the co-ordinate of the center of image
i need to calculate this center
If anyone could help that would be great!

Regards!
Posted
Updated 30-Mar-14 0:29am
v3

Center is easy:
X Center: X(Top Left) + (Width / 2)
Y Center: Y(Top Left) + (Height / 2)
 
Share this answer
 
Comments
Bebo_1 30-Mar-14 6:27am    
but how i can find out top left using java ?
Regards
OriginalGriff 30-Mar-14 6:33am    
Well, if you are just looking at the image in isolation, then it's zero, zero...

If you are looking at it relative to a from, or screen, then it's the location of the image (these are generally TLHC these days)
Bebo_1 30-Mar-14 6:41am    
Thank you for your attention !
but i still don't under stand :(
If you could clear more that would be great!
reagards
Maciej Los 30-Mar-14 7:04am    
+5!
Have a look at similar question at SO: http://stackoverflow.com/questions/14300520/rotate-image-in-overriden-paintcomponent-method[^]. There you'll find complete code ;)
 
Share this answer
 
Comments
Bebo_1 30-Mar-14 7:09am    
Really Thanks, I will try it !
Regards :)
Maciej Los 30-Mar-14 7:18am    
You're welcome. If it would be helpful, please, mark this answer as a solution (green button).
Bebo_1 30-Mar-14 7:32am    
sure :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900