paint2d-imageSmoothingQuality.low-ref.html (417B)
1 <!DOCTYPE html> 2 <canvas id="canvas" width="300" height="300"></canvas> 3 <script> 4 const canvas = document.getElementById('canvas'); 5 const ctx = canvas.getContext('2d'); 6 ctx.imageSmoothingQuality = 'low'; 7 ctx.fillStyle = 'green'; 8 ctx.fillRect(0, 0, 300, 300); 9 const image = new Image(); 10 image.src = './resources/html5.png'; 11 image.onload = () => { 12 ctx.drawImage(image, 0, 0, 200, 200); 13 }; 14 </script>