Difference between revisions of "SHIP:Sail:draw"

From Serious Documentation
Jump to: navigation, search
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
{{SailFuncTableStart|}}<onlyinclude>
 
{{SailFuncTableStart|}}<onlyinclude>
|{{SailFunc|draw}}||No return value||style="text-align:center;"|v5.0||Causes run-time drawing in a {{Node|canvas}}</onlyinclude>
+
|{{SailFunc|draw}}||||style="text-align:center;"|v5.0||Causes run-time drawing in a {{Node|canvas}}</onlyinclude>
 
|}
 
|}
 
== See Also: ==
 
== See Also: ==
Line 9: Line 9:
 
*{{SailFunc|image}}, {{SailFunc|qr}}
 
*{{SailFunc|image}}, {{SailFunc|qr}}
 
== Prototype ==
 
== Prototype ==
<code>{{SailFunc|draw}}({{DataType|Node}} canvas, [[SHIP:Sail:draw:Commands|draw-command]] [, arg, arg, ...], ...);</code>
+
<code>{{SailFunc|draw}}({{DataType|Node}} canvas, [[SHIP:Sail:draw:Commands|drawCmd]] [, arg, arg, ...], ...);</code>
  
 
== Parameters/Return Value ==
 
== Parameters/Return Value ==
Line 19: Line 19:
 
|canvas||{{DataType|Node}}||Canvas to draw on
 
|canvas||{{DataType|Node}}||Canvas to draw on
 
|-
 
|-
|draw-command||[[SHIP:Sail:draw:Commands|draw-command]]||Commands to execute
+
|drawCmd||[[SHIP:Sail:draw:Commands|drawCmd]]||Commands to execute
 
|-
 
|-
|...||[[SHIP:Sail:draw:Commands|draw-command]]||Multiple draw-commands can be entered in a single command
+
|...||[[SHIP:Sail:draw:Commands|drawCmd]]||Multiple drawCmds can be entered in a single draw function
 
|-
 
|-
 
! scope="col" style="text-align:left" | Return
 
! scope="col" style="text-align:left" | Return
Line 38: Line 38:
 
|<code>{{SailFunc|draw}}(homeCanvas, CLEAR, colorBg);</code> ||||Clear canvas to colorBg
 
|<code>{{SailFunc|draw}}(homeCanvas, CLEAR, colorBg);</code> ||||Clear canvas to colorBg
 
|-
 
|-
|<code>{{SailFunc|draw}}(PENCOLOR colorBlk, MOVEABSXY, 0, 0);</code> ||||Pen color is black, moved to 0,0 coord
+
|<code>{{SailFunc|draw}}(homeCanvas, PENCOLOR colorBlk, MOVEABSXY, 0, 0);</code> ||||Pen color is black, moved to 0,0 coord
 
|}
 
|}
  
 
[[Category:Canvas Functions]]
 
[[Category:Canvas Functions]]

Latest revision as of 09:38, 10 November 2016

Function Returns Introduced Description
draw v5.0 Causes run-time drawing in a canvas

See Also:

Prototype

draw(Node canvas, drawCmd [, arg, arg, ...], ...);

Parameters/Return Value

Parameter Data Type Description
canvas Node Canvas to draw on
drawCmd drawCmd Commands to execute
... drawCmd Multiple drawCmds can be entered in a single draw function
Return No return

Detailed Description

Although you would expect many of these commands to use Dimension for their arguments, note how many use Float. The pen position and orientation is maintained by the system in a floating point coordinate in order to retain drawing precision across numerous relative movements, for example drawing a star or box using a series of MOVE and ROTATE commands, such that the ending spot joins well with the starting spot.

Examples

Example Results Notes
draw(homeCanvas, CLEAR, colorBg); Clear canvas to colorBg
draw(homeCanvas, PENCOLOR colorBlk, MOVEABSXY, 0, 0); Pen color is black, moved to 0,0 coord