android.graphics.Bitmap.Config

Recently, I learned the API document. Open the android.graphics.bitmap class. There is an internal class, bitmap.config class, which will be used in the create bitmap (int width, int height, bitmap. Config) method of the bitmap class. Open this class and have a look

Enumerating variables

public static final Bitmap.Config ALPHA_ 8

public static final Bitmap.Config ARGB_ 4444

public static final Bitmap.Config ARGB_ 8888

public static final Bitmap.Config RGB_ 565


Look, it’s a little confused, alpha_ 8, ARGB_ 4444,ARGB_ 8888,RGB_ What is 565?


In fact, these are all color storage methods: we know that ARGB refers to a color mode, in which a represents alpha, R represents red, G represents green, and B represents blue. In fact, all visible colors are composed of right red, green, and blue, so red, green, and blue are also called three primary colors, and each primary color stores the information value of the color it represents

To put it bluntly, alpha_ 8 is alpha, which is composed of 8 bits

ARGB_ 4444 is composed of four 4 bits, namely 16 bits,

ARGB_ 8888 is composed of four 8 bits, namely 32 bits,

RGB_ 565 means that R is 5 bits, G is 6 bits, B is 5 bits, a total of 16 bits

thus it can be seen:

ALPHA_ 8 stands for 8-bit alpha bitmap

ARGB_ 4444 represents 16 bit ARGB bitmap

ARGB_ 8888 stands for 32-bit ARGB bitmap

RGB_ 565 stands for 8-bit RGB bitmap

The higher the number of bits in a bitmap, the more color information it can store. Of course, the more realistic the image is

Similar Posts: