Skip to content

Commit

Permalink
aaaa
Browse files Browse the repository at this point in the history
  • Loading branch information
guoguangkun committed Nov 1, 2018
1 parent e770fd5 commit 9310752
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 14 deletions.
37 changes: 23 additions & 14 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions _posts/2017-10-17-canvas-retina.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title : 解决canvas在Retina屏上模糊问题
layout: post
date: 2017-10-17
categories: 技术文章
---

##### 不废话直接上代码
```
* Retina-enable the given `canvas`.
// 去除锯齿
let canvas = document.querySelector('#gauge')
const width = canvas.width,height=canvas.height;
const cxt = canvas.getContext('2d')
if (window.devicePixelRatio) {
canvas.style.width = width + "px";
canvas.style.height = height + "px";
canvas.height = height * window.devicePixelRatio;
canvas.width = width * window.devicePixelRatio;
cxt.scale(window.devicePixelRatio, window.devicePixelRatio);
};
```

0 comments on commit 9310752

Please sign in to comment.