-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
160 lines (158 loc) · 4.84 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Fast Blurring in Javascript</title>
<link rel="stylesheet" href="./style.css" />
<script src="./js/main.js" defer type="module"></script>
</head>
<body>
<hr />
<section>
<button class="input load-image">Load an Image</button>
</section>
<hr />
<main hidden>
<section>
<div class="image">
<div class="main-img-cont"></div>
<button class="save-image-button">
<img src="./Download.svg" alt="Download" />
</button>
<div class="load-animation">
<table>
<tr>
<td id="one"></td>
<td id="two"></td>
<td id="three"></td>
</tr>
<tr>
<td id="four"></td>
<td id="five"></td>
<td id="six"></td>
</tr>
<tr>
<td id="seven"></td>
<td id="eight"></td>
<td id="nine"></td>
</tr>
</table>
</div>
</div>
</section>
<hr />
<section id="algorithms">
<label
class="slower"
for="box"
title="The basic box blur can be very slow, especially at higher blur radiuses and for bigger images. As such, it could freeze your browser tab"
>
<input type="radio" id="box" name="algorithm" value="box" />
Basic Box Blur
</label>
<label class="slower" for="box2">
<input type="radio" id="box2" name="algorithm" value="box2" />
Optimized Box Blur
</label>
<label class="slower" for="box3">
<input type="radio" id="box3" name="algorithm" value="box3" />
Further Optimized Box Blur
</label>
<label class="slower" for="box4">
<input type="radio" id="box4" name="algorithm" value="box4" />
Multiplied Box Blur
</label>
<label for="boxWasm">
<input type="radio" id="boxWasm" name="algorithm" value="boxWasm" />
Box Blur (WASM)
</label>
<br />
<label class="slower" for="stack">
<input type="radio" id="stack" name="algorithm" value="stack" />
Stackblur
</label>
<label class="slower" for="stack3">
<input type="radio" id="stack3" name="algorithm" value="stack3" />
Multiplied Stackblur
</label>
<label class="slower" for="stack2">
<input type="radio" id="stack2" name="algorithm" value="stack2" />
Optimized Stackblur
</label>
<label for="stackWasm">
<input
type="radio"
id="stackWasm"
name="algorithm"
value="stackWasm"
/>
Stackblur (WASM)
</label>
<br />
<label class="slower" for="gaussian">
<input type="radio" id="gaussian" name="algorithm" value="gaussian" />
Gaussian Blur
</label>
<label for="gaussianWasm">
<input
type="radio"
id="gaussianWasm"
name="algorithm"
value="gaussianWasm"
/>
Gaussian Blur (WASM)
</label>
</section>
<hr />
<section>
<div class="blur-radius">
<div>
Blur radius:
<span class="radius">0</span>
</div>
<input
class="radius-slider"
type="range"
min="0"
max="255"
value="0"
/>
</div>
</section>
<hr />
<section class="time-taken">Time Taken: <strong></strong></section>
<hr />
</main>
<section class="scale-down-and-show-slower">
<label for="scale-down"
><input type="checkbox" name="scale-down" id="scale-down" checked />
Scale down big images</label
>
<label for="show-slower">
<input
type="checkbox"
id="show-slower"
onchange="toggleSlowAlgorithmVisibility()"
/>
Show slower algorithms
</label>
<script>
toggleSlowAlgorithmVisibility();
function toggleSlowAlgorithmVisibility() {
let slower = document.querySelectorAll(".slower");
let checkbox = document.querySelector("#show-slower");
let lineBreaks = document.querySelectorAll("#algorithms br");
if (checkbox.checked) {
slower.forEach((e) => (e.hidden = false));
lineBreaks.forEach((e) => (e.hidden = false));
} else {
slower.forEach((e) => (e.hidden = true));
lineBreaks.forEach((e) => (e.hidden = true));
}
}
</script>
</section>
<hr />
</body>
</html>