【发布时间】:2012-05-23 20:13:18
【问题描述】:
如果图像本身,我如何在中心旋转图像? 此代码有效,但它会旋转屏幕左上角的图像:
AffineTransform oldtrans = new AffineTransform();
AffineTransform trans = new AffineTransform();
trans.setToIdentity();
trans.rotate(Math.toRadians(angle));
trans.translate(_x-(width/2), _y-(height/2));
g.setTransform(trans);
g.drawImage(this.getImage(), (int)_x, (int)_y, (int)width, (int)height, null);
trans.setToIdentity();
g.setTransform(oldtrans);
请帮忙!!!
【问题讨论】:
标签: java image rotation center