0
Loading images onto canvas
I have a doubt that i want to load images on canvas , i want to , which (method) one is best to do this .
3 Réponses
+ 4
Use CanvasRenderingContext2D.prototype.putImageData() method.
It has two standard syntax:
1) void ctx.putImageData(imageData, dx, dy);
2) void ctx.putImageData(imageData, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight);
Read:
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/putImageData
0
Var image=document.getElementById("image_id");
ctx.fillImage(image,x,y,dx,dy )