I just displayed a bitmap on a samsung galaxy 10.2. The image was created in photoshop showing some subtle change from a light red to a slightly darker red, it looked perfect on my PC, but the rendering on the tablet showed multiple bands.
I know this can be caused by insufficient colour depth... but I don't know what colour depth android devices have. Does android even specify a minimum colour depth? Is the colour depth something you can request more or less of at runtime? Is it just up to the manufacturer of the device?
This is a perfect reading: Bitmap quality, banding and dithering by Romain Guy.
Answering your questions:
Android < 2.3 loads bitmaps with 16 bits color depth by default. Android >= 2.3 loads bitmaps with 32 bits by default. Quoting Romain Guy from the given article:
The minimum for bitmaps is 8 bits,
Bitmap.Config.ALPHA_8
, but on 99% you shouldn't use this, but ratherBitmap.Config.ARGB_8888
.Set your
Window
to 32 bits (Bitmap.Config.ARGB_8888
) and decode your bitmaps with 32 bits (PixelFormat.RGBA_8888
). How to do it, below.You can set color depth of a
Window
or aBitmap
at anytime during the runtime.Window
withsetFormat()
andPixelFormat
.Bitmap
withPixelFormat
.