Clip images inside shapes with "source-in"

suggest change
context.globalCompositeOperation = "source-in";

source-in compositing keeps only the overlap of the new drawing and the existing pixels. Everything else, including the previous drawing outside that overlap, is cleared.

context.drawImage(oval,0,0);
context.globalCompositeOperation='source-in';  // picture clipped inside oval
context.drawImage(picture,0,0);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents