我四处寻找在 Java 中旋转 BufferedImage
的方法,我发现的只是 AffineTransform
。这很好,但如果我只想旋转 90 度,那就有点矫枉过正了。逐个像素地进行处理会更有效吗?我还可以使用其他方法吗?
最佳答案
来自您提到的类的 Javadoc:
Handling 90-Degree Rotations
In some variations of the rotate methods in the AffineTransform class, a double-precision argument specifies the angle of rotation in radians. These methods have special handling for rotations of approximately 90 degrees (including multiples such as 180, 270, and 360 degrees), so that the common case of quadrant rotation is handled more efficiently.
这使得您似乎不必担心性能,除非有确凿的相反证据。
此外请注意以下方法:quadrantRotate(int numQuadrants)
关于java - 在 Java 中是否有比 AffineTransform 更有效的旋转图像的方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25826838/