Android无需复制即可旋转位图

时间:2012-06-04 15:41:01

标签: android image-processing bitmap rotation

有没有办法旋转位图而不复制它?或者也许是持有位图的imageview?现在我有类似的东西:

Bitmap bm = BitmapFactory.decodeFile(...
// get the orientation
Matrix m = new Matrix
m.postRotate(orientation)
Bitmap new = Bitmap.createFromBitmap(bm, ..., m);

1 个答案:

答案 0 :(得分:1)

实际上算法并不是一种简单的方法来执行此旋转,而没有完全独立的新位置来放置旋转的副本,然后删除当前(非旋转的)副本。我可以想到一个潜在的算法,你基本上必须有一个像素的内存,但我将花费更多的时间来计算实际的算法。

另请参阅此StackOverflow链接: Algorithm to rotate an image 90 degrees in place? (No extra memory)