Bitmap.Config 詳解,bitmap.config詳解
前言
Android是一個記憶體相當吃緊的系統,那麼在做程式的過程中使用記憶體就需要相當謹慎,而我們接觸最大的大對象估計就是Bitmap了,那麼下面就根據Bitmap.Config值的介紹來看下Bitmap在記憶體中儲存的形式,那麼在根據實際情境選擇合適的配置進行Bitmap儲存
原文地址:http://www.cnblogs.com/luoaz/p/4374886.html
Bitmap.Config
Possible bitmap configurations. A bitmap configuration describes how pixels are stored. This affects the quality (color depth) as well as the ability to display transparent/translucent colors.
首先這是一個枚舉型,它代表了Bitmap可以的配置情況。一個配置描述的是這些像素資訊是如何儲存的。這個影響到了圖片品質和透明度。
ALPHA_8:Each pixel is stored as a single translucency (alpha) channel.
每個像素資訊只儲存了alpha這一項資訊。
ARGB_4444:This field was deprecated in API level 13. Because of the poor quality of this configuration, it is advised to use ARGB_8888 instead.
這個值在level 13的時候就已經不被建議使用了,因為他是一個低品質的配置,它被建議使用ARGB_8888
ARGB_8888:Each pixel is stored on 4 bytes. This configuration is very flexible and offers the best quality. It should be used whenever possible.
每個像素資訊佔用4個位元組(即32個二進位位)的儲存空間,alpha、red、green、blue各佔8個二進位位。這個配置項是非常靈活,並提供了最好的品質。他應該在可能的情況下盡量被使用。
RGB_565:Each pixel is stored on 2 bytes and only the RGB channels are encoded: red is stored with 5 bits of precision (32 possible values), green is stored with 6 bits of precision (64 possible values) and blue is stored with 5 bits of precision.This configuration may be useful when using opaque bitmaps that do not require high color fidelity
每個像素資訊佔用2個位元組(即16位二進位位)並且至儲存了RGB的資訊沒有alpha資訊,其中Red5位,Green6位,Blue5位。這個配置項在不需要提供透明度的情況下更有用。
後記
以上就是配置項的詳細介紹,有了這些知識那麼我們在接下來出來圖片的時候就會更加得心應手了