HTML Canvas clip and putImageData
问题 I have a canvas with a large image in the background and a smaller round image in front of it. I achieved this round image effect by using clip like so ctx.save(); ctx.beginPath(); ctx.arc(x,y,r,0,Math.PI*2, true); ctx.closePath(); ctx.clip(); ctx.drawImage(img,x-r,y-r,2*r,2*r); // draw the image ctx.restore(); then I want to rotate the round image, so I use a second context and rotate and redraw like so backCanvas=document.createElement('canvas'); backContext=backCanvas.getContext('2d');