diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2009-03-23 09:34:13 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-23 09:34:13 (GMT) |
commit | 67ad0519fd165acee4a4d2a94fa502e9e4847bd0 (patch) | |
tree | 1dbf50b3dff8d5ca7e9344733968c72704eb15ff /examples/script/context2d/scripts/linecap.js | |
download | Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.zip Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.gz Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.bz2 |
Long live Qt!
Diffstat (limited to 'examples/script/context2d/scripts/linecap.js')
-rw-r--r-- | examples/script/context2d/scripts/linecap.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/script/context2d/scripts/linecap.js b/examples/script/context2d/scripts/linecap.js new file mode 100644 index 0000000..18ceb23 --- /dev/null +++ b/examples/script/context2d/scripts/linecap.js @@ -0,0 +1,24 @@ +var ctx = document.getElementById('tutorial').getContext('2d'); + var lineCap = ['butt','round','square']; + + // Draw guides + ctx.save(); + ctx.strokeStyle = '#09f'; + ctx.beginPath(); + ctx.moveTo(10,10); + ctx.lineTo(140,10); + ctx.moveTo(10,140); + ctx.lineTo(140,140); + ctx.stroke(); + + // Draw lines + ctx.strokeStyle = 'black'; + for (i=0;i<lineCap.length;i++){ + ctx.lineWidth = 15; + ctx.lineCap = lineCap[i]; + ctx.beginPath(); + ctx.moveTo(25+i*50,10); + ctx.lineTo(25+i*50,140); + ctx.stroke(); + } + ctx.restore(); |