그려진 선 모양이 drawingAreaClone
의 자식이면 복제가 제대로 작동해야합니다. 또한,
var snapshot = new Image(); snapshot.src = canvas.toDataURL();
: 어떤 이유로 당신이 그와 함께 작동 할 수없는 경우
그러나, 당신은 캔버스의 스냅 샷을이 같은 img
형 가변적이고로 저장할 수 있습니다 당신은 전체 캔버스를 스냅 샷을하지 않으려면 초기 이미지를 저장 한 후, 당신은 이러한 추가 지침과 rectangle
에 그리기 영역을 제한 할 수 있습니다
var ctx = canvas.getContext('2d');
canvas.width = snapshot.width;
canvas.height = snapshot.height;
ctx.drawImage(snapshot, rectangle.x, rectangle.y, rectangle.width, rectangle.height, 0, 0, rectangle.width, rectangle.height);
snapshot.src = canvas.toDataURL();