This commit is contained in:
pplokijuhyg 2020-02-11 14:15:37 +08:00
parent e0e5788ba1
commit d3103d5f7b

View File

@ -1,18 +1,14 @@
```
let rem = parseFloat($("html").css("font-size"))
let width = 17.25 * rem
var canvas2 = document.createElement("canvas");
var _canvas = document.getElementById('app');
var w = parseInt(window.getComputedStyle(_canvas).width);
var h = parseInt(window.getComputedStyle(_canvas).height);
//将canvas画布放大若干倍然后盛放在较小的容器内就显得不模糊了
var times = 3;
// var times = 20;
canvas2.width = w * times * window.devicePixelRatio;
canvas2.height = h * times * window.devicePixelRatio;
canvas2.style.width = w + "px";
canvas2.style.height =h + "px";
console.log(w,h)
var context = canvas2.getContext("2d");
context.scale(times, times);
console.log(canvas2.style.width)