Reputation: 23606
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.
Upvotes: 0
Views: 2052
Reputation: 31
use this code:
mPaint.setMaskFilter(null);
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
Upvotes: 0
Reputation: 133560
currentPaint.setAlpha(0xFF);
currentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
Call invalidate
and the draw gets refreshed.
Upvotes: 3
Reputation: 5208
You could create graphical objects with the color of the background. Then it looks like the things behind the objects are deleted.
Upvotes: 2