2d.layer.restore-style.html (983B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <link rel="match" href="2d.layer.restore-style-expected.html"> 5 <meta name=fuzzy content="maxDifference=0-1; totalPixels=0-950"> 6 <title>Canvas test: 2d.layer.restore-style</title> 7 <h1>2d.layer.restore-style</h1> 8 <p class="desc">Test that ensure layers restores style values upon endLayer.</p> 9 <canvas id="canvas" width="200" height="200"> 10 <p class="fallback">FAIL (fallback content)</p> 11 </canvas> 12 <script> 13 const canvas = new OffscreenCanvas(200, 200); 14 const ctx = canvas.getContext('2d'); 15 16 ctx.fillStyle = 'rgba(0,0,255,1)'; 17 ctx.fillRect(50, 50, 75, 50); 18 ctx.globalAlpha = 0.5; 19 20 ctx.beginLayer(); 21 ctx.fillStyle = 'rgba(225, 0, 0, 1)'; 22 ctx.fillRect(60, 60, 75, 50); 23 ctx.endLayer(); 24 25 ctx.fillRect(70, 70, 75, 50); 26 27 const outputCanvas = document.getElementById("canvas"); 28 outputCanvas.getContext('2d').drawImage(canvas, 0, 0); 29 </script>