I have been told that calling getWindow().setFormat(PixelFormat.XXXX);
should set the pixel format for the window in an activity to XXXX (e.g. RGBA_8888
). I have tried calling getWindow().setFormat(PixelFormat.XXXX);
in the onCreate method of my activity, but can see no difference in the characteristics of my displayed images regardless of what parameter I use. In particular I am rendering some bitmaps that contain subtle changes of colour that have been showing banding on the android devices. But I can neither make the banding better or worse regardless of what PixelFormat I use (e.g. RGB_332
appears no worse). I strongly suspect that getWindow().setFormat(PixelFormat.XXXX);
is not having any effect at all - or that somehow some subsequent code is changing the Format, for example when I create a canvas,? or a view? or on onResume??
I can confirm that there is no banding when I look at the png of the bitmaps on my development PC (32 bit graphics).
EDIT: I just added some test code to draw a set of thin lines across the screen (canvas.drawLine(x,y,x2,y2,paint);
) where the paint separately has red green and blue scanning from 0 to 255. The resulting image is here
There appear to be 32 bands of colour for red and blue and 64 for green... implying that the screen format is five bits for each of red and blue and six bits for green - looks like "RGB_565" to me. I then tried getWindow().setFormat(PixelFormat.RGBA8888); early in onCreate and it made no difference - still 32/64 bands.