2d.layer.nested-expected.html (1077B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <title>Canvas test: 2d.layer.nested</title> 5 <h1>2d.layer.nested</h1> 6 <p class="desc">Tests nested canvas layers.</p> 7 <canvas id="canvas" width="200" height="200"> 8 <p class="fallback">FAIL (fallback content)</p> 9 </canvas> 10 <script> 11 const canvas = document.getElementById("canvas"); 12 const ctx = canvas.getContext('2d'); 13 14 var circle = new Path2D(); 15 circle.arc(90, 90, 40, 0, 2 * Math.PI); 16 ctx.fill(circle); 17 18 ctx.globalCompositeOperation = 'source-in'; 19 20 canvas2 = document.createElement("canvas"); 21 ctx2 = canvas2.getContext("2d"); 22 23 ctx2.fillStyle = 'rgba(0, 0, 255, 1)'; 24 ctx2.fillRect(60, 60, 75, 50); 25 26 ctx2.globalAlpha = 0.5; 27 28 canvas3 = document.createElement("canvas"); 29 ctx3 = canvas3.getContext("2d"); 30 31 ctx3.fillStyle = 'rgba(225, 0, 0, 1)'; 32 ctx3.fillRect(50, 50, 75, 50); 33 ctx3.fillStyle = 'rgba(0, 255, 0, 1)'; 34 ctx3.fillRect(70, 70, 75, 50); 35 36 ctx2.drawImage(canvas3, 0, 0); 37 ctx.drawImage(canvas2, 0, 0); 38 </script>