Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: gh-pages
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (31 sloc) 0.732 kb
<!DOCTYPE html>
<html>
<head>
<title>Canvas Test</title>
</head>
<body>
<canvas id="canvas"></canvas>
<script src="js/utils.js"></script>
<script>
var
canvas,
context,
image;
window.onload = function() {
canvas = document.getElementById("canvas");
context = canvas.getContext("2d");
image = new Image();
image.src = "img/target.jpg"
image.onload = function() {
var width = image.width;
var height = image.height;
canvas.width = width;
canvas.height = height;
canvas.style.width = width;
canvas.style.height = height;
context.drawImage(image, 0, 0, width, height);
};
};
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.