kzh*_*dev 16 canvas html5-canvas dart
根据Paul Lewis的文章,高DPI画布:你需要考虑context.backingStorePixelRatio
解决模糊问题.
如果不推荐使用此属性,飞镖会处理高清设备上的模糊问题吗?
Bas*_*der 33
我认为完全相同的事情并且问题跟踪器告诉我:
是的,所以当Safari的后备存储比率为2时,文章被回写.在Chrome中,它一直是1.
正如你所说,解决这个问题的方法是:
canvas.width = width * window.devicePixelRatio;
canvas.height = height * window.devicePixelRatio;
canvas.style.width = width + 'px';
canvas.style.height = height + 'px';
凡
width
和height
是,但是你想他们(可能window.innerWidth和innerHeight全视恶作剧.)然后你只需要调整你用以下内容放大画布的事实:
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
那么你有解决方案.
归档时间: |
|
查看次数: |
3479 次 |
最近记录: |