| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>Line Width Test</title> |
| 5 |
<style> |
| 6 |
|
| 7 |
body { |
| 8 |
text-align: center |
| 9 |
} |
| 10 |
|
| 11 |
</style> |
| 12 |
|
| 13 |
<script> |
| 14 |
|
| 15 |
window.onload = function() { |
| 16 |
var ctx = document.getElementById('c').getContext('2d'); |
| 17 |
|
| 18 |
ctx.strokeStyle = 'black'; |
| 19 |
ctx.lineWidth = 1; |
| 20 |
for (var i = 0; i < 100; i++) { |
| 21 |
ctx.beginPath(); |
| 22 |
ctx.moveTo(49 + i / 100, i); |
| 23 |
ctx.lineTo(49 + i / 100, i + 1); |
| 24 |
ctx.closePath(); |
| 25 |
ctx.stroke(); |
| 26 |
} |
| 27 |
|
| 28 |
for (var i = 0; i < 100; i++) { |
| 29 |
ctx.beginPath(); |
| 30 |
ctx.moveTo(i, 49 + i / 100); |
| 31 |
ctx.lineTo(i + 1, 49 + i / 100); |
| 32 |
ctx.closePath(); |
| 33 |
ctx.stroke(); |
| 34 |
} |
| 35 |
}; |
| 36 |
|
| 37 |
</script> |
| 38 |
</head> |
| 39 |
<body> |
| 40 |
|
| 41 |
<canvas id=c width=100 height=100></canvas> |
| 42 |
|
| 43 |
<p>This tests that lines work in the same way in different browsers when you are |
| 44 |
using sub pixel coordinates.</p> |
| 45 |
|
| 46 |
</body> |
| 47 |
</html> |