Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Flip and rotation on an Image

843805Dec 14 2005 — edited Mar 3 2008
Hello,
I would like to perform flip and +/-90� rotation on an image but after a rotation, the flip is performed in the wrong direction my code looks like this :
/*axis at the center of image*/
g2D.translate(width/2,height/2);
g2D.scale(-1,1);
g2D.rotate(Math.PI); 

/*image orientation correction*/    
g2D.scale(1,-1);
       
/*rotation and flip*/      
g2D.rotate(flipHorizontal*flipVectical*Math.toRadians(angle));
g2D.scale(flipHorizontal,flipVectical); //1 or -1

/* drawing the image */    
g2D.drawImage(imageToDraw, centreToX,centreToY, null);

// than positioning the axis back to origine 
I've tried to say that if the image as already been rotated then invert the flips, but in that case, after one flip the rotation is performed in the wrong direction...

Does anybody know how to solve this problem???
Thank you in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 31 2008
Added on Dec 14 2005
11 comments
343 views