20,741
edits
mNo edit summary |
|||
| Line 136: | Line 136: | ||
! Screenshot !! Code | ! Screenshot !! Code | ||
|- | |- | ||
| [[ | | [[File:Openvg-via-canvas.png|thumb|screen shot showing a simple Canvas GUI dialog demonstrating how to use OpenVG-path drawing via Nasal and Canvas]] | ||
| {{Note|This assumes that you already have a top-level root group set up, and named it '''root'''.}} | | {{Note|This assumes that you already have a top-level root group set up, and named it '''root'''.}} | ||
<syntaxhighlight lang="nasal" enclose="div"> | <syntaxhighlight lang="nasal" enclose="div"> | ||
var graph = root.createChild("group"); | var graph = root.createChild("group"); | ||
var x_axis = graph.createChild("path", "x-axis") | var x_axis = graph.createChild("path", "x-axis") | ||
.moveTo(10, | .moveTo(10, height/2) | ||
.lineTo( | .lineTo(width-10, height/2) | ||
.setColor(1,0,0) | .setColor(1,0,0) | ||
.setStrokeLineWidth(3); | .setStrokeLineWidth(3); | ||
var y_axis = graph.createChild("path", "y-axis") | var y_axis = graph.createChild("path", "y-axis") | ||
.moveTo(10, | .moveTo(10, 10) | ||
.lineTo(10, | .lineTo(10, height-10) | ||
.setColor( | .setColor(0,0,1) | ||
. | .setStrokeLineWi</syntaxhighlight> | ||
</syntaxhighlight> | |||
|- | |- | ||
|} | |} | ||