libbpg/html/index.html
2015-01-16 13:46:18 +01:00

30 lines
637 B
HTML

<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="bpgdec8b.js"></script>
</head>
<body>
<h1>BPG Decoding Demo</h1>
IMG tag:<br>
<img src="lena512color.bpg">
<p>
Dynamic loading in a canvas:<br>
<canvas id="mycanvas" width="512" height="512"></canvas>
<script>
(function ()
{
var img, canvas, ctx;
canvas = document.getElementById("mycanvas");
ctx = canvas.getContext("2d");
img = new BPGDecoder(ctx);
img.onload = function() {
/* draw the image to the canvas */
ctx.putImageData(this.imageData, 0, 0);
};
img.load("lena512color.bpg");
})();
</script>
</body>
</html>