javascript - How to replaceByImage() instead of drawImage() on html canvas (ignore opacity)? -


i draw image (which can have transparent parts) on canvas, totally replacing canvas content sourve image (unlike in source-over composition operation).

the resulting canvas have exact same values source image. can't find composition operation perform this.

i can clear canvas before calling drawimage() wondering if there faster/better way.

you can use copy mode if want replace (as seem text in question):

ctx.globalcompositeoperation = "copy"; 

if want remove parts of canvas, ie. area content drawn to, clearrect can used:

ctx.clearrect(x, y, width, height);   // replace values 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -