summaryrefslogtreecommitdiffstats
path: root/examples/script/context2d/scripts/moveto2.js
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /examples/script/context2d/scripts/moveto2.js
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'examples/script/context2d/scripts/moveto2.js')
-rw-r--r--examples/script/context2d/scripts/moveto2.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/script/context2d/scripts/moveto2.js b/examples/script/context2d/scripts/moveto2.js
new file mode 100644
index 0000000..021f47b
--- /dev/null
+++ b/examples/script/context2d/scripts/moveto2.js
@@ -0,0 +1,24 @@
+var canvas = document.getElementById('tutorial');
+
+ // Make sure we don't execute when canvas isn't supported
+ if (canvas.getContext){
+
+ // use getContext to use the canvas for drawing
+ var ctx = canvas.getContext('2d');
+
+ // Filled triangle
+ ctx.beginPath();
+ ctx.moveTo(25,25);
+ ctx.lineTo(105,25);
+ ctx.lineTo(25,105);
+ ctx.fill();
+
+ // Stroked triangle
+ ctx.beginPath();
+ ctx.moveTo(125,125);
+ ctx.lineTo(125,45);
+ ctx.lineTo(45,125);
+ ctx.closePath();
+ ctx.stroke();
+
+ }