I have a piece of code which draws an image to the background of the screen. The problem I am having is that the image looks poor, unless I use a Paint object with dithering set to true
Without a paint object, the canvas.drawBitmap() method takes roughly 15ms, with dithering, it can be up to more than three times that. As the application is intended to be a livewallpaper, this is of concern.
I have checked that the image is in ARGB_8888 format, but when drawn without the paint object, it looks closer to having 256 colors. I have tried using different image formats & bit-depths(32,24,16) but I still have this problem.
How come it is not possible to perform the dither on the image once, and use this version. Or why is my image being downsampled?
You could draw the background to the canvas once (with the paint enabled). Then you can save the canvas to a bitmap and from then on use that bitmap instead, avoiding the need for the paint.
It’s a bit of a crappy solution but it works. I’m guessing there is a better way to do this
then use background2 instead, and probably
recycle()background.