Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/canvas/element/manual/context-attributes/fillRect_alpha_false.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>CanvasRenderingContext 2D with alpha=flase, fillRect with semi-transparent color.</title>
<link rel="author" title="Justin Novosad" href="mailto:junov@chromium.org">
<link rel="match" href="fillRect_alpha_false-ref.html">
<meta name="assert" content="Canvas pixels remain opaque black when drawing semi-transparent rectangle.">
<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 = "rgba(0, 0, 0, 0.5)";
ctx.fillRect(25, 25, 50, 50);
</script>