I’m trying to create an application similar to Finger Paint example from Android SDK. I was trying to implement Undo/Redo functionality to my test app and used the accepted answer in this question : Android FingerPaint Undo/Redo implementation.
The example there is working, but there is a strange things which I’ve noticed. If I select eraser mode for example on some button click, the default implementation acts like a eraser, but using onDraw() as in the question mentioned above is not doing this. Instead of it’s acting like a normal brush and drawing with a black stroke (depending on the given color).
If I try to add another effects to the current brush, for example I drew 15 lines and after that select add blur option, after I draw the new one, all lines before get blurred too.
if (mPaint.getMaskFilter() != mBlur) {
mPaint.setMaskFilter(mBlur);
} else {
mPaint.setMaskFilter(null);
}
return true;
So my question is..any ideas how can I separate old lines from new ones and setting effects only for them and using clear mode as it should be?
Thanks for any kind of help!
You would rather hold history in an object like the following one than just holding the path objects..
Then while drawing each path pick each corresponding info from these objects