problems to rotate rectangular images

Hello,

I wrote code to rotate BMP images, and it works very good with square images. But it doesn't work with rectangular ones. When I try to rotate them, I obtain an images with all pixels in a wrong position, so that it is impossible to understand the content... WHY ?

thank you

//BufferedImage toStore

BufferedImage toStore =new BufferedImage(Width,Height,BufferedImage.TYPE_INT_RGB );

Graphics2D g2d =toStore.createGraphics();

//double centerX = (Height - Width)/2.0;

//double centerY = (Width - Height)/2.0;

double centerX = Width/2.0;

double centerY = Height/2.0;

AffineTransform rotationTransform =new AffineTransform();

rotationTransform.rotate(Math.toRadians(Degrees), Width/2.0, Height/2.0);

// draw the image using the AffineTransform

g2d.drawImage(img, rotationTransform,null);

[1168 byte] By [aneuryzmaa] at [2007-11-27 6:19:28]
# 1
nobody can help me ?
aneuryzmaa at 2007-7-12 17:34:06 > top of Java-index,Java Essentials,Java Programming...
# 2
I don't know what your problem is, but does the code work with an angle of 0 radians?Then adjust the code to use a small angle, and work your way up.
Hippolytea at 2007-7-12 17:34:06 > top of Java-index,Java Essentials,Java Programming...
# 3
If the images are rectangular it doesn't work even with a 0 degree angle.If they are square images the rotation works always
aneuryzmaa at 2007-7-12 17:34:06 > top of Java-index,Java Essentials,Java Programming...
# 4
ok sorry. I made a stupid mistake some lines after.thank you anyway!
aneuryzmaa at 2007-7-12 17:34:06 > top of Java-index,Java Essentials,Java Programming...
# 5
> ok sorry. I made a stupid mistake some lines after.> thank you anyway!Ah yes. It's always where you least expect it.
Hippolytea at 2007-7-12 17:34:06 > top of Java-index,Java Essentials,Java Programming...