在Java中的图像比的AffineTransform一个更有效的

在Java中的图像比的AffineTransform一个更有效的

本文介绍了有旋转在Java中的图像比的AffineTransform一个更有效的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我环顾四周的方式在Java中旋转的BufferedImage 和所有我所发现的是的AffineTransform 。这很好,但似乎有点矫枉过正,如果所有我想要做的就是旋转90度。会是更有效的就去做逐像素?有一些其他的方法,我可以用?

I've looked around for ways to rotate BufferedImages in Java and all I have found is AffineTransform. That's fine, but it seems like a bit of overkill if all I want to do is rotate 90 degrees. Would it be more efficient to just do it pixel-by-pixel? Is there some other method I could use?

推荐答案

从类的你提到的Javadoc:

From the Javadoc of the class you mention:

处理90度旋转

在在AffineTransform类的rotate方法的一些变化,一个双precision参数指定的旋转弧度的角度。这些方法具有大约90度(包括倍数如180,270,和360度),旋转的特殊处理,以便象限旋转的常见的情况是更有效的处理。

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.

这使得它看起来就像你不应该担心没有确凿的证据与此相反的表现。

That makes it seem like you shouldn't worry about performance without solid proof to the contrary.

另外请注意以下方法: quadrantRotate(INT numQuadrants)

In addition take note of the following method: quadrantRotate(int numQuadrants)

这篇关于有旋转在Java中的图像比的AffineTransform一个更有效的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 16:50