タイトルだけ書いて、とてつもなく大仰なタイトルだよなオイと思った(藁
要するに下記のようなことをJSでできないの? と聞かれてHTML5(っぽいもの。validではない)でやってみただけです。ハイ。

canvasって HTML5 の丁度いい入門だと思う。何ができるのって人はこのエントリのはじめに張った MDCのリンクを是非見ると良いと思います。また、IE で下記のコードを動かすには explorercanvas が必要です。
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> |