Created
August 28, 2010 01:07
-
-
Save mumumu/554495 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" | |
src="http://code.jquery.com/jquery-1.4.2.min.js"></script> | |
<!-- | |
<script type="text/javascript" src="./excanvas.js"></script> | |
--> | |
<script type="text/javascript"> | |
jQuery(document).ready(function() { | |
var canvas = document.getElementById('aoi_miyazaki_canvas'); | |
if (canvas.getContext) { | |
var img = new Image(); | |
img.src = | |
'http://img.f.hatena.ne.jp/images/fotolife/g/geinou_pics/20080106/20080106234351.jpg'; | |
img.onload = function() { | |
var ctx = canvas.getContext('2d'); | |
ctx.drawImage(img, 0, 0); | |
ctx.strokeStyle = "#ff0000"; | |
ctx.beginPath(); | |
ctx.moveTo(100, 20); | |
ctx.lineTo(300, 20); | |
ctx.lineTo(300, 280); | |
ctx.lineTo(100, 280); | |
ctx.lineTo(100, 20); | |
ctx.stroke(); | |
} | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="aoi_miyazaki"> | |
<canvas id="aoi_miyazaki_canvas" width="372" height="450"></canvas> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment