-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
35 lines (32 loc) · 1.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<title>Testing lanczos via webworker</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<canvas id="test_canvas" width="600" height="1500"></canvas>
<script type="text/javascript">
var elemz = document.getElementById('test_canvas');
elem = elemz.getContext("2d");
var worker = new Worker("lanczos.js");
img = new Image();
img.onload = function() {
var ctx = document.createElement("canvas");
ctx.height = img.height;
ctx.width = img.width;
ctx = ctx.getContext("2d");
ctx.drawImage(img, 0, 0, img.width, img.height);
imageData = ctx.getImageData(0, 0, img.width, img.height);
elem.fillStyle = "rgb(245,245,245)";
elem.fillRect (0, 0, 1500, 1500);
imageDataNew = elem.getImageData(0, 0, 1500, 1500);
worker.postMessage({'imageData':imageData, 'imageDataNew':imageDataNew, 'width':600, 'lobes': 5});
}
img.src = "image2.jpg";
worker.addEventListener('message', function(event) {
elem.putImageData(event.data.imageData, 0, 0);
}, false);
</script>
</body>
</html>