Android的旋转位图不进行复制 [英] Android rotate bitmap without making a copy

查看:183
本文介绍了Android的旋转位图不进行复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法,以位图旋转而不做它的一个副本?或者,也许ImageView的是的控股位图?现在我已经得到了类似的东西:

 位图BM = BitmapFactory.de codeFILE(...
//获取方向
矩阵M =新的Matrix
m.postRotate(方向)
位图的新= Bitmap.createFromBitmap(宽多重峰,...,M);
 

解决方案

有真正算法心不是没有一个完全独立的新的地方进行这种旋转把循环副本,然后删除当前(非旋转)副本的简单方法。我能想到的一个潜在的算法,你将从根本上必须有一个内存像素的价值,但我将不得不花费更多的时间搞清楚实际的算法。

另外,也要看看这个计算器链接: <一href="http://stackoverflow.com/questions/2968397/algorithm-to-rotate-an-image-90-degrees-in-place-no-extra-memory">Algorithm旋转图像90度的地方? (没有额外的内存)

Is there a way to rotate a bitmap without making a copy of it? Or maybe the imageview that's holding the bitmap? Right now I've got something similar to:

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

解决方案

There really algorithmically isnt an EASY way of performing this rotation without a completely separate new place to put the rotated copy, then deleting the current (non-rotated) copy. I can think of a potential algorithm where you would essentially have to have one pixel' worth of memory but I would have to spend more time figuring out the actual algorithm.

Also look at this StackOverflow Link: Algorithm to rotate an image 90 degrees in place? (No extra memory)

这篇关于Android的旋转位图不进行复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆