Skip to content Skip to sidebar Skip to footer

Color Banding And Artifacts With Gradients Despite Using Rgba_8888 Everywhere

I'm aware that colour banding is an old chestnut of a problem that has been discussed many times before with various solutions provided (which essentially boil down to use 32-bit t

Solution 1:

Just to wrap this up with an answer, the conclusion I have reached is that the Nexus 7 just has some hardware / firmware issue which means that it is utterly pants at rendering gradients.

Solution 2:

Have you tried setting the pixelformat for the surface view itself ?

finalSurfaceHolderholder= getHolder();
    holder.setFormat(PixelFormat.RGBA_8888);

Solution 3:

If you see no effect of setting the pixel format in ICS and up, it is most likely due to hardware acceleration which will always render to the native pixel format. Most of the time that should be just ARGB_8888 though. Make sure you also set the window pixel format of your activity, not just the pixel format on the SurfaceView.

You can easily verify if that is the case by turning acceleration off. You mention that you tested that, but you don't mention how you did that. Setting the target sdk level is not the most explicit way to do that.

From the top of my head the software rendering switched to ARGB_8888 by default in HoneyComb (3.0), but again you will need to set it explicitly to correctly support older devices where this is not the default.

Solution 4:

Why have you set to false the dithering on your paint. I would suggest to activate dithering

paint.setDither(true);

Android doc clearly says that it will downgrade your rendering:

setting or clearing the DITHER_FLAG bit Dithering affects how colors that are higher precision than the device are down-sampled. No dithering is generally faster, but higher precision colors are just truncated down (e.g. 8888 -> 565). Dithering tries to distribute the error inherent in this process, to reduce the visual artifacts.

You can also try to add the FLAG_DITHER to the window:

window.setFormat(PixelFormat.RGBA_8888);
window.setFlags(WindowManager.LayoutParams.FLAG_DITHER, WindowManager.LayoutParams.FLAG_DITHER);

Post a Comment for "Color Banding And Artifacts With Gradients Despite Using Rgba_8888 Everywhere"