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 .

12th Jun 2020, 8:46 AM
Priyanshu Gupta(ą¤Ŗą„ą¤°ą¤æą¤Æą¤¾ą¤‚ą¤¶ą„ ą¤—ą„ą¤Ŗą„ą¤¤ą¤¾)
Priyanshu Gupta(ą¤Ŗą„ą¤°ą¤æą¤Æą¤¾ą¤‚ą¤¶ą„ ą¤—ą„ą¤Ŗą„ą¤¤ą¤¾) - avatar
2 Answers
+ 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
12th Jun 2020, 9:02 AM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar
0
Var image=document.getElementById("image_id"); ctx.fillImage(image,x,y,dx,dy )
12th Jun 2020, 10:29 AM
Ayush kumar singh arya
Ayush kumar singh arya - avatar