Thread: Rotation
View Single Post
Old 11-13-2004, 01:10 AM   #1 (permalink)
freesoft_2000
Code Monkey
 
Join Date: Oct 2004
Posts: 51
freesoft_2000 is on a distinguished road
Question Rotation

Hi everyone,

I am trying to rotate a jpeg image but it seems that the image gets clipped and there seems to be an ugly black rectangle drawn behind the image after it has been rotated by me. I am really not very sure what i am doind wrong.

Here is the function that is responsible for the image rotation

public BufferedImage imagerotate(BufferedImage SourceImage3, double Degrees1)
{
AffineTransform AT1 = new AffineTransform();
BufferedImage Image5;
int width, height;
double Radians1;
Radians1 = Math.toRadians(Degrees1);
width = (int)(SourceImage3.getWidth());
height = (int)(SourceImage3.getHeight());
Image5 = new BufferedImage(width, height, SourceImage3.getType());
Graphics2D g2 = (Graphics2D)Image5.getGraphics();
AT1.rotate(Radians1);
g2.drawImage(SourceImage3, AT1, null);
return Image5;
}

What i need is for the image not to clipped in anyway and there not to be an ugly black rectangle behind the image after the rotation has taken place.

I hope someone can help me with this

Thank You

Yours Sincerely

Richard West
freesoft_2000 is offline   Reply With Quote