Below is a simple program to rotate an buffered Image which is not working.
I'm create a small rectangle and rotating the entire graphic, which int urn should rotate the rectangle as well.
I'm lost, as to why it is not writing the rotated image. It writes the image which is not rotated.
I would appreciate any suggestions.
Joined: Mar 22, 2005
Have you tried doing the rotation before the drawing?
Instead of doubling the size you should calculate the new width (and height!) using Math.cos, Math.sin and/or Math.tan. Although in this case it's a square that's rotated by 45 degrees so that makes the diagonal the width and height, and the diagonal is the width times the square root of 2 (1.4something; use Math.sqrt(2)).