要将视网膜大小的图像放置到HTML5画布中,请对画布尝试以下代码:
var context = myCanvas.getContext("2d"); context.attr("width", width * window.devicePixelRatio); context.attr("height", height * window.devicePixelRatio); context.scale(window.devicePixelRatio, window.devicePixelRatio); context.drawImage(img, x, y, width, height);