问题描述
我正在尝试在 java 中旋转缓冲图像.这是我正在使用的代码:
我查看了有关此主题的大量堆栈溢出问题和答案,但无法弄清楚为什么图像会像我尝试旋转它时那样被切碎.这是一个显示加载图像的示例:
还有这段代码……
我可以生成类似...
I am trying to rotate a buffered image in java. Here is the code I am using:
I have looked a numerous stack overflow questions and answers on this topic and not been able to figure out why the image is chopped up the way it is when I try to rotate it. Here is an example showing a loaded image: loaded image
After I click the rotate button which calls the above function with the buffered image and a 90.0 for the angle: chopped up image
Can someone help me understand what is happening and how to fix it?
As always, the Internet to the rescue. So, this is some code which I hobbled together from other resources/post/blogs which will return a new image which is sized so it will contain the rotated image
Updated
So, using this PNG:
And this code...
I can generate something like...
这篇关于在 Java 中旋转缓冲图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!