當前位置:編程學習大全網 - 編程軟體 - Android Bitmap 與 Drawable之間的區別和轉換

Android Bitmap 與 Drawable之間的區別和轉換

Bitmap - 稱作位圖,壹般位圖的文件格式後綴為bmp,當然編碼器也有很多如RGB565、RGB888。作為壹種逐像素的顯示對象執行效率高,但是缺點也很明顯存儲效率低。我們理解為壹種存儲對象比較好。

Drawable - 作為Android平下通用的圖形對象,它可以裝載常用格式的圖像,比如GIF、PNG、JPG,當然也支持BMP,當然還提供壹些高級的可視化對象,比如漸變、圖形等。

A bitmap is a Drawable. A Drawable is not necessarily a bitmap. Like all thumbs are fingers but not all fingers are thumbs.

Bitmap是Drawable . Drawable不壹定是Bitmap .就像拇指是指頭,但不是所有的指頭都是拇指壹樣.

The API dictates: API規定:

Though usually not visible to the application, Drawables may take a variety of forms: 盡管通常情況下對於應用是不可見的,Drawables 可以采取很多形式:

Bitmap: the simplest Drawable, a PNG or JPEG image. Bitmap: 簡單化的Drawable, PNG 或JPEG圖像.

Nine Patch: an extension to the PNG format allows it to specify

information about how to stretch it and place things inside of it.

Shape: contains simple drawing commands instead of a raw bitmap, allowing it to resize better in some cases.

Layers: a compound drawable, which draws multiple underlying drawables on top of each other.

States: a compound drawable that selects one of a set of drawables based on its state.

Levels: a compound drawable that selects one of a set of drawables based on its level.

Scale: a compound drawable with a single child drawable, whose overall size is modified based on the current level.

  • 上一篇:#Scratch小技巧#將文字內容逐字顯示出來
  • 下一篇:知道plc的原則是什麽嗎
  • copyright 2024編程學習大全網