FreeDrawView icon indicating copy to clipboard operation
FreeDrawView copied to clipboard

implement eraser using PorterDuff Xfer mode

Open bizzguy opened this issue 7 years ago • 8 comments

This requires a bump for minimum SDK from 9 to 11 because of the View setLayer method. This commit also has a bunch of changes to the layouts that occurred just because of reformatting.

Erases get added to undo/redo stack properly.

Also tested with screen rotation.

bizzguy avatar Apr 13 '17 09:04 bizzguy

Thanks (again) for the pull request! I'm reviewing this in a few days, this weekend max

RiccardoMoro avatar Apr 13 '17 09:04 RiccardoMoro

I'm having a problem on KitKat and below, the eraser seems to be painting black instead of actually canceling the previous paint

RiccardoMoro avatar Apr 18 '17 08:04 RiccardoMoro

But when I take the "screenshot" of the draw, the erased content is rendered correctly even on KitKat-

RiccardoMoro avatar Apr 18 '17 08:04 RiccardoMoro

Also, if you add just a dot, it's rendered with the paint, instead of erasing

RiccardoMoro avatar Apr 18 '17 09:04 RiccardoMoro

I was having a similar problem (painting in black) until I added the "setLayer" command which solved it for API 21 and above.

I'll try to do some more testing on KitKat and see what I can find.

This is turning out to be harder than I thought.

There is another approach - specify a background color and then paint in the background color for erase.

This might be more robust than the Xfer mode approach.

I'll try again.

Thanks

Jim

On Tue, Apr 18, 2017 at 4:54 AM, Riccardo Moro [email protected] wrote:

Also, if you add just a dot, it's rendered with the paint, instead of erasing

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RiccardoMoro/FreeDrawView/pull/12#issuecomment-294756199, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUn0u9uqFX_O6wfVOSIaSHfjqmwZQrtks5rxIhlgaJpZM4M8dgp .

bizzguy avatar Apr 18 '17 14:04 bizzguy

If we add a background for the image, the above trick won't work..

rajajawahar avatar May 15 '17 15:05 rajajawahar

@rajajawahar correct..

RiccardoMoro avatar May 15 '17 16:05 RiccardoMoro

Is there a way we can remove the HistoryPath when user in EraserMode.. Something like that.. I was trying to acheive it.. But it din't worked at all.. Can you help me out for eraser.. If I add Image to the view from Gallery or Camera..

rajajawahar avatar May 15 '17 18:05 rajajawahar