Skip to content

Instantly share code, notes, and snippets.

@mumumu
Created August 28, 2010 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mumumu/554495 to your computer and use it in GitHub Desktop.
Save mumumu/554495 to your computer and use it in GitHub Desktop.
<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