Flip Image with Graphics2D

前端 未结 5 978
一个人的身影
一个人的身影 2020-12-08 10:27

I\'ve been trying to figure out how to flip an image for a while, but haven\'t figured out yet.

I\'m using Graphics2D to draw an Image with

5条回答
  •  再見小時候
    2020-12-08 11:21

    You can use a transform on your Graphics, that should rotate the image just fine. Below is a sample code that you can use to acheive this:

    AffineTransform affineTransform = new AffineTransform(); 
    //rotate the image by 45 degrees 
    affineTransform.rotate(Math.toRadians(45), x, y); 
    g2d.drawImage(image, m_affineTransform, null); 
    

提交回复
热议问题