Bitmap.Config 詳解,bitmap.config詳解

來源:互聯網
上載者:User

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位。這個配置項在不需要提供透明度的情況下更有用。

 

後記

  以上就是配置項的詳細介紹,有了這些知識那麼我們在接下來出來圖片的時候就會更加得心應手了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.