<html>
<head>
<script type="application/javascript">
function init() {
var canvas = document.getElementById("canvas");
if (canvas.getContext)
{
var ctx = canvas.getContext("2d");
// Create a new image object
var flower = new Image();
//Provide the source directory of the image you are about to upload.
flower.src = "flower.png";
//Secify the offset and color of the shadow
ctx.shadowOffsetX = 3;
ctx.shadowOffsetY = 3;
ctx.shadowBlur = 3;
ctx.shadowColor = "black";
// Make sure the image is loaded before you draw it on the canvas
flower.onload = function() {
// Draw the image at location (10,10).
ctx.drawImage(flower, 10, 10);
}
}
}
</script>
</head>
<body onload="init();">
<canvas id="canvas" width="900"
height="500"></canvas><br>
</body>
</html>
|