summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/element/manual/context-attributes/fill_alpha_false.html
blob: 7872a7938039f7c576a47e5e06c1655aa68b5874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<meta charset="utf-8">
<title>CanvasRenderingContext 2D with alpha=flase, path fill with transparent color and 'copy' composite operation.</title>
<link rel="author" title="Justin Novosad" href="mailto:junov@chromium.org">
<link rel="help" href="https://html.spec.whatwg.org/#concept-canvas-alpha">
<link rel="match" href="fill_alpha_false-ref.html">
<meta name="assert" content="Canvas pixels remain opaque black when filling path with tranparent pixels and 'copy' compisite op.">
<p>Test passes if a 100x100 black square is displayed below.</p>
<canvas id="c" width=100 height=100></canvas>
<script>
const ctx = document.getElementById("c").getContext("2d", {alpha: false});
ctx.fillColor = 'red';
ctx.fillRect(25, 25, 50, 25); // will be overwritten.
ctx.fillColor = "rgba(0, 0, 0, 0.0)";
ctx.globalCompositeOperation = 'copy';
ctx.rect(25, 25, 50, 50);
ctx.fill();
</script>