-
Notifications
You must be signed in to change notification settings - Fork 1
/
preview.html
75 lines (75 loc) · 1.61 KB
/
preview.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
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
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>图片预览</title>
<script src=".\data\board2.json"> </script>
<script>
c = [
[0, 0, 0],
[255, 255, 255],
[170, 170, 170],
[85, 85, 85],
[254, 211, 199],
[255, 196, 206],
[250, 172, 142],
[255, 139, 131],
[244, 67, 54],
[233, 30, 99],
[226, 102, 158],
[156, 39, 176],
[103, 58, 183],
[63, 81, 181],
[0, 70, 112],
[5, 113, 151],
[33, 150, 243],
[0, 188, 212],
[59, 229, 219],
[151, 253, 220],
[22, 115, 0],
[55, 169, 60],
[137, 230, 66],
[215, 255, 7],
[255, 246, 209],
[248, 203, 140],
[255, 235, 59],
[255, 193, 7],
[255, 152, 0],
[255, 87, 34],
[184, 63, 39],
[121, 85, 72]
];
function createPicture()
{
d=document.getElementById("qaq");
d.innerHTML="<canvas id=\"drawing\" width=999 height=599></canvas>";
var drawing=document.getElementById("drawing");
var context=drawing.getContext("2d");
var a=context.createImageData(999,599);
for (i=0;i<999*599;++i)
{
col=2;
a.data[i*4]=c[col][0];
a.data[i*4+1]=c[col][1];
a.data[i*4+2]=c[col][2];
a.data[i*4+3]=255;
}
for (i=0;i<board.length;++i)
{
x=board[i][0];
y=board[i][1];
col=board[i][2];
a.data[(y*999+x)*4]=c[col][0];
a.data[(y*999+x)*4+1]=c[col][1];
a.data[(y*999+x)*4+2]=c[col][2];
a.data[(y*999+x)*4+3]=255;
}
context.putImageData(a, 0, 0);
}
</script>
</head>
<body onload="createPicture()">
<div id="qaq">
</div>
</body>
</html>