Search code examples
androidandroid-layoutandroid-emulatorandroid-widgetandroid-canvas

How to code for the eraser as like paint in android canvas?


In my drawing application, I am doing painting with on canvas with this code:

currentPaint = new Paint();
            currentPaint.setDither(true);
            currentPaint.setColor(0x00000000);
            currentPaint.setStyle(Paint.Style.STROKE);
            currentPaint.setStrokeJoin(Paint.Join.ROUND);
            currentPaint.setStrokeCap(Paint.Cap.ROUND);
            //currentPaint.setStrokeWidth(3);

No i want to implement the eraser as same as paint. Is it possible to do it on canvas ? If yes then Please help me for it.

Thanks.


Solution

  • You could create graphical objects with the color of the background. Then it looks like the things behind the objects are deleted.