Korilakkuma / CanvasView

Android Application Library
Other
183 stars 72 forks source link

Eraser Mode #2

Open DardanBala opened 9 years ago

DardanBala commented 9 years ago

Hi, Eraser is not done correctly what actually does is just paint with a white color.

Korilakkuma commented 9 years ago

I resolve this problem by the following code.

paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
paint.setARGB(0, 0, 0, 0);
amandeepcodes commented 8 years ago

Below code didn't work for eraser. paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); paint.setARGB(0, 0, 0, 0);

satodiasmit commented 8 years ago

O'sum library,just a small problem same as above.Unable to use erase option using MainActivity.this.canvas.setMode(CanvasView.Mode.ERASER); It just draw the line.Kindly give me vision on how i can erase my previous drawing.I'm in hurry.

kthilt commented 8 years ago

In case anyone else is having this problem, a quick fix in my case was calling setAlpha(0.99f) on either your CanvasView object or a view containing it. It's not ideal, since the drawing is no longer fully opaque, but it allows your erase path to be transparent.

jackmiras commented 8 years ago

@kthilt can you share the code snippet of your solution? Actually I don't understand where you set alpha to 0.99f.

kthilt commented 8 years ago

@jackmiras I'm setting the alpha for the instance of CanvasView I'm using. For example, in your activity onCreate(), you could do, CanvasView myCanvasView = (CanvasView)findViewById(R.id.my_canvas_view_id); myCanvasView.setAlpha(0.99f);

jackmiras commented 8 years ago

Hey guys I've fixed the problem with erase mode... Check out my pull request or my fork of the project to see how the problem was solved and fix your code if you need.

hpdeveloper28 commented 7 years ago

@jackmiras , I am having still Eraser issue, canvas getting draw instead of erase. I hope that you can help me for the erasing thing. Rest of it works fine for me.

jackmiras commented 7 years ago

@hpdeveloper28 Have you checked my pull request? If not, this is the link to the file that I have changed in the fork that I made from Korilakkuma/CanvasView.

hpdeveloper28 commented 7 years ago

@jackmiras , thanks a lot, it worked for me. Appreciated.

hpdeveloper28 commented 7 years ago

@jackmiras , I have one more issue, when I set Background image for CanvasView and I try to erase then Background image getting clear, pleae let me know if you have any solution for the same. device-2016-12-02-130155

jackmiras commented 7 years ago

Hi @hpdeveloper28 I doesn't face this problem because I don't work this much with the project. But I remember that everything that you draw will be put in the same canvas and one of the things that I hoped to implement in the future is put the draw in a new layer in order to have things in different layers.

RiteshAdulkar commented 5 years ago

hi @jackmiras, I am still not able to erase anything on canvas image, it's drawing eraser with a white background which is not useful while erasing anything on Image. Please suggest me what I need to do to erase draw things on an image?

MahmoudHooda2019 commented 2 years ago

@hpdeveloper28 Have you checked my pull request? If not, this is the link to the file that I have changed in the fork that I made from Korilakkuma/CanvasView.

Hello @jackmiras your link it is not work