rotation creates garbage?

Hello everyone, i am makinga top down view shooter game and i currently have the character facing where ever the mouse it. I am doing so using the graphics2d rotation method. It works fine and all, but i noticed that around the edge of the image there are white pixels scattered. Is this normal? Is there any way to get rid of it?
Thanks a lot in advanced!

Do you use a certain library to do that?

Sounds like the ‘dirty rectangle’ is too small during rotation. Is there a call to repaint(rect) in play somehwere?

well, here’s my code


public void paint(Graphics g) 
{
     //draw the background
     g.drawImage(background,0,0,this);
      
     Graphics2D g2d = (Graphics2D)g;
     AffineTransform origXform = g2d.getTransform();
     AffineTransform newXform = (AffineTransform)(origXform.clone());

     //Center of rotation is the center of player
     newXform.rotate(GetAngle(), playerX, playerY);
     g2d.setTransform(newXform);
     
     //draw image of player
     int x = (playerX - Lil_Man.getWidth(this)/2);
     int y = playerY - Lil_Man.getWidth(this)/2;

     g2d.drawImage(Lil_Man, x, y, this);
     g2d.setTransform(origXform);

}

thanks a lot for any help!

[edit]: the getAngle() method returns a double of how much angle is needed to rotate to face the mouse

My guess (and its only that, a guess) is that you are using color-key transparency and when you rotate anti-aliasing shifts the color of the edge pixels enough to show up.

If so one solution would be to make your bounding box larger then necessary and leave the edges out when you BLT.

well, after reading your post i decided to try to use a different format for the image. I switched from using gif, to using png, and now it doesn’t have the white pixels around the edge anymore! :smiley: Thanks a lot!

Now i have another quesetion. When i rotate the image, the image gets aliased, is there a method or something that i can call to get it anti aliased?
Thanks a lot in advanced!