Re: [android-developers] canvas.drawBitmap draws over screen image instead of replacing screen image

2016-03-03 Thread Igor Ganapolsky
This would actually draw a black color for your canvas. See screenshot. On Sunday, November 25, 2012 at 7:25:15 PM UTC-5, Romain Guy wrote: > > Surfaces are double (or even

[android-developers] canvas.drawBitmap draws over screen image instead of replacing screen image

2012-11-25 Thread Johan
I have some strange behaviour when repainting the screen with my live wallpaper. I'm scaling an image and drawing it to the screen, but on each draw (as the image is scaled smaller than the previous draw), I can still see the previous image below the new image. How do I clear the previous

Re: [android-developers] canvas.drawBitmap draws over screen image instead of replacing screen image

2012-11-25 Thread Romain Guy
Surfaces are double (or even triple) buffered. You are indeed not getting in your canvas what's currently on screen but what was on screen a frame ago. The easiest way to clear the surface is to call canvas.drawColor(0, PorterDuff.Mode.CLEAR) (you can also use 0xff00, PorterDuff.Mode.SRC).

Re: [android-developers] canvas.drawBitmap draws over screen image instead of replacing screen image

2012-11-25 Thread Johan
Thanks for the hint! Work's perfectly. paint.setXfermode(new PorterDuffXfermode(Mode.CLEAR)); canvas.drawPaint(paint); On Monday, November 26, 2012 11:31:12 AM UTC+11, Romain Guy (Google) wrote: Surfaces are double (or even triple) buffered. You are indeed not getting in

Re: [android-developers] canvas.drawBitmap draws over screen image instead of replacing screen image

2012-11-25 Thread Romain Guy
You should avoid creating a new paint every time though, which is why I mentioned the drawColor() alternative. On Sun, Nov 25, 2012 at 4:57 PM, Johan johan.wasser...@gmail.com wrote: Thanks for the hint! Work's perfectly. paint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));

Re: [android-developers] canvas.drawBitmap draws over screen image instead of replacing screen image

2012-11-25 Thread Johan
Thanks, yea I set everything in an init function, outside of the main draw function (that puts everything on screen). Learned a lesson there when setting too many things I ran out of memory (I set my emulator for only 512MB to help me make sure I'm aware of memory usage in my app). Thanks for