blob: 94b94865147041b623508556363ab3bf85b645af (
plain)
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
|
<!DOCTYPE html>
<html>
<title>WebGPU canvas_composite_alpha_premultiplied (ref)</title>
<meta charset="utf-8" />
<link rel="help" href="https://gpuweb.github.io/gpuweb/" />
<style>
body { background-color: #F0E68C; }
#c-canvas { background-color: #8CF0E6; }
</style>
<canvas id="c-body" width="20" height="20" style="width: 20px; height: 20px;"></canvas>
<canvas id="c-canvas" width="20" height="20" style="width: 20px; height: 20px;"></canvas>
<script>
document.querySelectorAll('canvas').forEach(canvas => {
const ctx = canvas.getContext('2d');
ctx.globalAlpha = 1.0;
ctx.fillStyle = '#660000';
ctx.fillRect(0, 0, 15, 15);
ctx.fillStyle = '#006600';
ctx.fillRect(5, 0, 15, 15);
ctx.fillStyle = '#000066';
ctx.fillRect(0, 5, 15, 20);
ctx.fillStyle = '#666600';
ctx.fillRect(5, 5, 20, 20);
});
</script>
</html>
|