このサンプルではイメージリソースをロードしたら表示するようにするサンプルです。
サンプル:
http://html5next.appspot.com/image1.html
ソース:
<script type="text/javascript">
// Load the gnu image
var objImage = new Image();
objImage.src = "gnu.jpg";
// Once the image is loaded, draw on the canvas
objImage.onload = function () {
formload();
}
function formload()
{
try
{
var objCanvas = document.getElementById("cvs01");
var context = objCanvas.getContext("2d");
// Draw the objImage pattern image where
// the filled rectangle was before
context.drawImage(objImage, 10, 10, 112, 109);
context.drawImage(objImage, 130, 10, 112, 109);
context.drawImage(objImage, 10, 130, 112, 109);
}
catch(e)
{
alert(e.description);
}
}
</script>
0 件のコメント:
コメントを投稿