Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<meta charset="UTF-8">
<link rel="match" href="2d.layer.ctm.shadow-in-transformed-layer-expected.html">
<title>Canvas test: 2d.layer.ctm.shadow-in-transformed-layer</title>
<h1>2d.layer.ctm.shadow-in-transformed-layer</h1>
<p class="desc">Check shadows inside of a transformed layer.</p>
<canvas id="canvas" width="200" height="200">
<p class="fallback">FAIL (fallback content)</p>
</canvas>
<script>
const canvas = new OffscreenCanvas(200, 200);
const ctx = canvas.getContext('2d');
ctx.translate(80, 90);
ctx.scale(2, 2);
ctx.rotate(Math.PI / 2);
ctx.beginLayer();
ctx.shadowOffsetX = 10;
ctx.shadowOffsetY = 10;
ctx.shadowColor = 'grey';
ctx.fillRect(-30, -5, 60, 10);
const canvas2 = new OffscreenCanvas(100, 100);
const ctx2 = canvas2.getContext('2d');
ctx2.fillStyle = 'blue';
ctx2.fillRect(0, 0, 40, 10);
ctx.drawImage(canvas2, -30, -30);
ctx.endLayer();
const outputCanvas = document.getElementById("canvas");
outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
</script>