方法缩放一个位图之间的差异 [英] difference between methods to scale a bitmap
问题描述
有至少两种方法按比例在机器人的位图, 一种是使用inScaled,强度气体,inTargetDensity,在BitmapFactory.Options当德codeA位图源。 另一种是使用一个黑客帝国中Bitmap.createBitmap
There are at least two methods to scale a bitmap in Android, One is to use "inScaled, inDensity, inTargetDensity" in "BitmapFactory.Options" when decode a bitmap source. The other is to use a "Matrix" in "Bitmap.createBitmap".
我很好奇的是这两种方法之间的区别是什么? 怎么样产生的位图的质量?并且怎么样的内存使用情况? 等等...
What I am curious is what the difference between these two method is? What about the quality of produced bitmap? And what about the memory usage? etc...
推荐答案
使用 BitmapFactory
用正确的inScale选项可以让你更加的内存效率比使用任何 Bitmap.createScaledBitmap()
或 Bitmap.createBitmap()
与基体的规模。然而,这是更复杂的
Using BitmapFactory
with the proper inScale options will allow you to be more memory efficient than using either Bitmap.createScaledBitmap()
or Bitmap.createBitmap()
with a matrix scale. However, it is more complicated.
查看<一个href="http://stackoverflow.com/questions/7051025/how-do-i-scale-a-streaming-bitmap-in-place-without-reading-the-whole-image-first/7051089#7051089">How我缩放流的位图的就地无一读的整体形象?了解详细信息。
这篇关于方法缩放一个位图之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!