-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest3.html
More file actions
63 lines (43 loc) · 1.11 KB
/
Copy pathtest3.html
File metadata and controls
63 lines (43 loc) · 1.11 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<html>
<head>
<script src="./screen.js"></script>
</head>
<style>
body{ padding:0; margin:0; background:#cccccc; width:100%; height:100%; overflow:hidden; }
</style>
<input type='number' value="8" min="0" id="hdl1" >
<center><canvas style="border:1px solid #cecece; margin:10px; cursor:cross;" width="480px" height="600px" id="screen"> </canvas></center>
<script>
var monitor, gui = graphicalUserInterface( ( monitor = {
width: 480, height:600,
monitor: document.getElementById('screen'),
modulo:8,
} ) ).resetScreen( 0x000000 ).refresh( );
var img;
(img = (new Image( ) ) ).src="./test.jpg";
img.onload = function( ){
gui.resize(
img.width,
img.height
);
gui.drawImage( img );
test( );
gui.refresh( );
};
document.getElementById('hdl1').onchange = function( ){
gui.drawImage( img );
this.value = monitor.modulo = ( monitor.modulo = parseInt( this.value ) );
test( );
};
function test( ){
gui.each(function( addr ){
!(addr%monitor.modulo) ?
this.setRawPixel(
addr*4 ,
0xffffff
) : void 0;
}).refresh( );
}
test( );
</script>
</html>