Open webee0317 opened 4 years ago
The pixel breaks when you reduce the large image to a smaller size. That's why I'm suggesting this code.
function _getCanvas(data) { ... ctx.imageSmoothingQuality = 'high'; ctx.drawImage(this.elements.preview, left, top, width, height, startX, startY, canvasWidth, canvasHeight); if (circle) { ctx.fillStyle = '#fff'; ctx.globalCompositeOperation = 'destination-in'; ctx.beginPath(); ctx.arc(canvas.width / 2, canvas.height / 2, canvas.width / 2, 0, Math.PI * 2, true); ctx.closePath(); ctx.fill(); } return canvas; }
The pixel breaks when you reduce the large image to a smaller size. That's why I'm suggesting this code.
function _getCanvas(data) { ... ctx.imageSmoothingQuality = 'high'; ctx.drawImage(this.elements.preview, left, top, width, height, startX, startY, canvasWidth, canvasHeight); if (circle) { ctx.fillStyle = '#fff'; ctx.globalCompositeOperation = 'destination-in'; ctx.beginPath(); ctx.arc(canvas.width / 2, canvas.height / 2, canvas.width / 2, 0, Math.PI * 2, true); ctx.closePath(); ctx.fill(); } return canvas; }