有没有办法在不复制位图的情况下旋转位图?或者可能是保存位图的 ImageView ?现在我有类似的东西:
Bitmap bm = BitmapFactory.decodeFile(...
// get the orientation
Matrix m = new Matrix
m.postRotate(orientation)
Bitmap new = Bitmap.createFromBitmap(bm, ..., m);
最佳答案
如果没有一个完全独立的新位置来放置旋转的副本,然后删除当前(未旋转的)副本,那么从算法上来说确实没有一种简单的方法来执行此旋转。我可以想到一种潜在的算法,您基本上必须拥有一个像素的内存,但我将不得不花更多时间来弄清楚实际的算法。
另请查看此 StackOverflow 链接: Algorithm to rotate an image 90 degrees in place? (No extra memory)
关于Android旋转位图而不制作副本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10884060/