2d.composite.uncovered.image.source-out.html (1172B)
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>OffscreenCanvas test: 2d.composite.uncovered.image.source-out</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/html/canvas/resources/canvas-tests.js"></script> 8 9 <h1>2d.composite.uncovered.image.source-out</h1> 10 <p class="desc">drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> 11 12 13 <script> 14 promise_test(async t => { 15 16 var canvas = new OffscreenCanvas(100, 50); 17 var ctx = canvas.getContext('2d'); 18 19 ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; 20 ctx.fillRect(0, 0, 100, 50); 21 ctx.globalCompositeOperation = 'source-out'; 22 const response = await fetch('/images/yellow.png') 23 const blob = await response.blob(); 24 const bitmap = await createImageBitmap(blob); 25 ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); 26 _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); 27 28 }, "drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); 29 </script>