I have a canvas on which drawimage() is the background.
I have an eraser tool with which I want to erase what I am painting, but not the image that I have on canvas. I know that I can put the image as a separate element behind the canvas, but this is not what I want, because I want to save what is on the canvas as an image.
My drawing function is here:
function draw (event) { if (event == 'mousedown') { context.beginPath(); context.moveTo(xStart, yStart); } else if (event == 'mousemove') { context.lineTo(xEnd, yEnd); } else if (event == 'touchstart') { context.beginPath(); context.moveTo(xStart, yStart); } else if (event == 'touchmove') { context.lineTo(xEnd, yEnd); } context.lineJoin = "round"; context.lineWidth = gadget_canvas.radius; context.stroke(); }
If I need to explain further, I will.
Thanks in advance.
source share