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. -->
<link rel="match" href="2d.layer.ctm.filter-expected.html">
<title>Canvas test: 2d.layer.ctm.filter</title>
<h1>2d.layer.ctm.filter</h1>
<p class="desc">Checks that parent transforms affect layer filters.</p>
<canvas id="canvas" width="200" height="200">
<p class="fallback">FAIL (fallback content)</p>
</canvas>
<script>
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext('2d');
// Transforms inside the layer should not apply to the layer's filter.
ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'});
ctx.translate(30, 90);
ctx.scale(2, 2);
ctx.rotate(Math.PI / 2);
ctx.fillRect(-30, -5, 60, 10);
ctx.endLayer();
// Transforms in the layer's parent should apply to the layer's filter.
ctx.translate(80, 90);
ctx.scale(2, 2);
ctx.rotate(Math.PI / 2);
ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'});
ctx.fillRect(-30, -5, 60, 10);
ctx.endLayer();
</script>