window.onload = function() { canvas.width = 1152 canvas.height = 768 image.src = 'img-lg.jpg' image.onload = function() { offCanvas.width = image.width offCanvas.height = image.height scale = offCanvas.width / canvas.width //原图大小是画布的3陪 context.drawImage(image, 0, 0, canvas.width, canvas.height) offContext.drawImage(image, 0, 0) } }
canvas(注意不是offCanvas)中绘制的原图大小是画布的3陪,为什么可以将整张图片绘制进去,drawImage()应该不是自带缩放的吧?求解答。
相关分类