OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 img { |
| 4 display: none; |
| 5 } |
| 6 canvas { |
| 7 width: 1000px; |
| 8 height: 1000px; |
| 9 image-rendering: pixelated; |
| 10 } |
| 11 .under { |
| 12 position: absolute; |
| 13 top: 0; |
| 14 left: 0; |
| 15 z-index: 1; |
| 16 } |
| 17 .over { |
| 18 position: absolute; |
| 19 top: 250px; |
| 20 left: 250px; |
| 21 z-index: 2; |
| 22 } |
| 23 </style> |
| 24 <body> |
| 25 <img src="resources/dice_alpha.png"> |
| 26 <!-- One canvas should be overlaid on the other at an offset. Both canvases
should be upscaled without blurring. --> |
| 27 <canvas class="under" width="300" height="300"></canvas> |
| 28 <canvas class="over" width="300" height="300"></canvas> |
| 29 </body> |
| 30 <script> |
| 31 // Ignore the render tree. |
| 32 if (window.testRunner) |
| 33 window.testRunner.dumpAsTextWithPixelResults(); |
| 34 |
| 35 var image = document.getElementsByTagName("img")[0]; |
| 36 |
| 37 function drawToContext(context) { |
| 38 context.drawImage(image, -0.5, -0.5, 300, 300); |
| 39 } |
| 40 |
| 41 function draw() { |
| 42 drawToContext(document.getElementsByTagName("canvas")[0].getContext("2d"
)); |
| 43 drawToContext(document.getElementsByTagName("canvas")[1].getContext("2d"
)); |
| 44 } |
| 45 window.onload = draw; |
| 46 </script> |
OLD | NEW |