0

I have an image with a softcrop.

i.e The image bounds are width 3 and height 5. In the image I have a soft crop at (x,y) 1,4 and bounds width 1 and height 1.

How can I get the new position (x,y) for the crop after I rotate the image 90 degrees?

AffineTransform perhaps?

4

1 回答 1

1

是的,您可以使用 AffineTransform。

您可以使用 AffineTransform.getRotateInstance 和 AffineTransform#transform(Point2D, Point2D)。

像这样使用它:

AffineTransform transform = AffineTransform.getRotateInstance(Math.PI / 2.0, width / 2.0, height / 2.0);
Point2D.Double point = new Point2D.Double(1, 4);
Point2D.Double result = new Point2D.Double();
transform.transform(point, result);

请注意,软裁剪区域的左上角点在旋转后将不再是左上角,而是左下角。

于 2013-11-11T10:17:56.763 回答