Skip to content

Instantly share code, notes, and snippets.

@kfly8
Created November 20, 2012 12:54
Show Gist options
  • Save kfly8/4117766 to your computer and use it in GitHub Desktop.
Save kfly8/4117766 to your computer and use it in GitHub Desktop.
透過つきpng8
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=320,height=device-height,user-scalable=0">
<script type="text/javascript">
window.onload = function(){
draw();
}
function draw() {
var canvas = document.getElementById('hoge');
var ctx = canvas.getContext('2d');
var img = new Image();
img.src = "/img/hoge.png"; //透過つきpng8
img.onload = function() {
ctx.drawImage(img, 0, 0);
}
}
</script>
</head>
<body>
<canvas id="hoge"></canvas>
<img src="/img/hoge.png" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment