首页 > 代码库 > canvas draw a image

canvas draw a image

var c = context.getContext("2d");

var cimg = new Image();

cimg.src = "http://www.mamicode.com/img path";//path either relative or absolute position

cimg.onload = function(){//callback function

  c.drawImage(cimg,100,100);

}

canvas draw a image