imageBitmap-from-imageData-no-image-rotation-expected.html (479B)
1 <html> 2 <body> 3 <canvas id="myCanvas" width="400" height="400"></canvas> 4 </body>> 5 <script> 6 var canvas = document.getElementById('myCanvas'); 7 ctx = canvas.getContext('2d'); 8 image = document.createElement("img"); 9 image.src = "../../../resources/black_white.png" 10 image.onload = function() { 11 Promise.all([ 12 createImageBitmap(image, { imageOrientation: 'flipY' }), 13 ]).then(function(sprites) { 14 // Draw image onto the canvas 15 ctx.drawImage(sprites[0], 0, 0); 16 }); 17 } 18 </script>