.ig >>
<STYLE TYPE="text/css">
<!--
        A:link{text-decoration:none}
        A:visited{text-decoration:none}
        A:active{text-decoration:none}
        OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }

        H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
        H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
        H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
        H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>ploticus: proc drawcommands</title>
<body bgcolor=D0D0EE vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550><tr>
<td>
  <table cellpadding=2 width=550><tr>
  <td><br><h2>proc drawcommands</h2></td>
  <td align=right>
  <small>
  <a href="../doc/welcome.html"><img src="../doc/ploticus.gif" border=0></a><br>
  Version 2.40 Jan'08
     </small><br><a href="../doc/scripthome.html">Scripts</a>
  <td></tr></table>
</td></tr>
<td>
<br>
<br>
.>>

.TH proc_drawcommands PL "15-JAN-2008   PL ploticus.sourceforge.net"

.LP
.ig >>
<center><a href="../gallery/drawcom.htm">drawcom<br><img src="../gallery/drawcom.gif"></a></center>
.>>

.LP
\fBproc drawcommands\fR reads and executes sets of commands which specify low-level drawing operations.
.LP
The commands may be one of \fBtwo distinct types\fR:
.IP \(bu
a ploticus drawdump file  
.ig >>
&nbsp; &nbsp;
.>>
- a file that has been created previously by running \fCpl -drawdump\fR or \fCpl -drawdumpa\fR .
Often used with prefabs as a
.ig >>
<a href="prefabs.html#drawdump">
.>>
\0a convenient way to overlay or combine graphs.
.ig >>
</a>
.>>
.ig >>
<br><br>
.>>
.IP \(bu
ploticus draw commands
.ig >>
&nbsp; &nbsp;
.>>
- a command language described below for creating
lines, polygons, and text, in either absolute space
or scaled space.  May be useful as a flexible way to add annotation, 
or to add graphics that the other plotting procedures cannot produce,
or to import graphics generated programatically.
.LP
If you use the \fCdumpfile\fR attribute, drawdump content is expected.  Otherwise, ploticus draw commands
are expected.
.LP
See also the 
.ig >>
<a href="prefab_draw.html">
.>>
\0draw prefab
.ig >>
</a>
.>>
which provides a convenient command line interface for processing drawdump files or drawcommands.


.LP

.ig >>
<br><br><br>
.>>


.SH Attributes

.LP
\fBdumpfile\fR
.ig >>
&nbsp; &nbsp;
.>>
filename
.IP \0
A file containing a drawdump (as generated using \fCpl -drawdump\fR or \fCpl -drawdumpa\fR).
.IP
Security concern: user-supplied values (such as CGI variables) should not be used to build the filename, unless
proper measures are taken to detect and remove the \fC../\fR construct (used as a hack 
to see higher levels of the file system).


.ig >>
<br><br>
.>>

.LP
\fBcommands\fR 
.ig >>
&nbsp; &nbsp;
.>>
.ig >>
<a href="attributetypes.html#text">
.>>
\0multiline-text
.ig >>
</a>
.>>
.IP \0
A list of one or more ploticus draw commands (see below).  One command per line.
Ends with a blank line.

.ig >>
<br><br>
.>>

.LP
\fBfile\fR 
.ig >>
&nbsp; &nbsp;
.>>
\fIfilename\fR
.IP \0
A file containing ploticus draw commands (see below).  May be \fCstdin\fR to
read draw commands from standard input.
.IP
Security concern: user-supplied values (such as CGI variables) should not be used to build the filename, unless
proper measures are taken to detect and remove the \fC../\fR construct (used as a hack 
to see higher levels of the file system).


.ig >>
<br><br><br>
.>>

.SH Example of draw commands
For a quick tutorial on draw commands, see below.
.nf
.ft C
\0#proc drawcommands
commands:
  color blue
  linetype 0 2 1
  mov 1 1
  lin 1 2
  lin 2 2
  lin 1 1
.ft R
.fi
.LP
A Gallery example where \fBproc drawcommands\fR is used is
.ig >>
<a href="../gallery/drawcom.htm">
.>>
\0drawcom
.ig >>
</a>
.>>

.ig >>
<a name=commandset></a>
.>>
.ig >>
<br><br><br>
.>>

.SH The draw command set
Here is a summary of the draw command set.
The commands are interpreted, and should be given one per line.
Quoting is never used for string literals.  
Note that proc drawcommands have nothing to do with proc getdata or the "current data set".
For an explanation of absolute units and scaled units, see
.ig >>
<a href="scaleunits.html">
.>>
\0scaleunits.
.ig >>
</a>
.>>
.ig >>
<br>
<br>
<table cellpadding=2 width=500 border=1>
<tr bgcolor=FFFFEC><td>Command</td><td>Description</td></tr>
.>>
 .
.IP 
.ig >>
</td></tr><tr><td>
.>>
mov \fIx y\fR
.ig >>
</td><td>
.>>
 = move to (x,y) in absolute units


.IP 
.ig >>
</td></tr><tr><td>
.>>
lin \fIx y\fR 
.ig >>
</td><td>
.>>
= line to (x,y) in absolute units

.IP 
.ig >>
</td></tr><tr><td>
.>>
path \fIx y\fR 
.ig >>
</td><td>
.>>
= extend current polygon fill path to (x,y) in absolute units
(see also \fCfill\fR below).

.IP 
.ig >>
</td></tr><tr><td>
.>>
movs, lins, paths 
.ig >>
</td><td>
.>>
= same as above but for scaled units (assumes proc areadef
has already been used to set up a scaled space).

.IP 
.ig >>
</td></tr><tr><td>
.>>
movp, linp, pathp 
.ig >>
</td><td>
.>>
= same as above but operands may be in either
absolute space or scaled space.  If an operand ends with \fC(s)\fR
it is assumed to be in scaled space; otherwise it is assumed to
be in absolute space.

.IP 
.ig >>
</td></tr><tr><td>
.>>
text \fIs\fR 
.ig >>
</td><td>
.>>
= display text string s left adjusted at current location.  
s should not be enclosed in quotes.

.IP 
.ig >>
</td></tr><tr><td>
.>>
centext \fIs\fR 
.ig >>
</td><td>
.>>
= display text string s centered around current location
s should not be enclosed in quotes.

.IP 
.ig >>
</td></tr><tr><td>
.>>
rightjust \fIs\fR 
.ig >>
</td><td>
.>>
= display text string s right-aligned to current location
s should not be enclosed in quotes.

.IP 
.ig >>
</td></tr><tr><td>
.>>
cblock \fIx1 y1 x2 y2 color outline\fR 
.ig >>
</td><td>
.>>
= display a colored rectangle.  The
lower left is at (x1,y1) in absolute units; upper right is at (x2,y2) 
in absolute units; color is the color; outline is 1 to produce an outline, 0 not.

.IP 
.ig >>
</td></tr><tr><td>
.>>
fill 
.ig >>
</td><td>
.>>
= close and fill the polygon path with the current color.

.IP 
.ig >>
</td></tr><tr><td>
.>>
mark 
.ig >>
<a href="attributetypes.html#xy">
.>>
\0 x y 
.ig >>
</a>
.>>
sym r\fR 
.ig >>
</td><td>
.>>
= produce a symbol at (x,y).
sym is a graphcore data point symbol code as described
in 
.ig >>
<a href="symboldetails.html">
.>>
\0symboldetails.
.ig >>
</a>
.>>
r is the radius in absolute units.

.IP 
.ig >>
</td></tr><tr><td>
.>>
color \fIc\fR 
.ig >>
</td><td>
.>>
= set the current color to c

.ig >>
</td></tr><tr><td>
.>>
.IP 
textsize \fIp\fR 
.ig >>
</td><td>
.>>
= set the current text size to p points

.IP
.ig >>
</td></tr><tr><td>
.>>
linetype style width dashscale 
.ig >>
</td><td>
.>>
= set the current 
.ig >>
<a href="linedetails.html">
.>>
\0line details.
.ig >>
</a>
.>>

.IP 
.ig >>
</td></tr><tr><td>
.>>
clr 
.ig >>
</td><td>
.>>
= clear the display

.IP 
.ig >>
</td></tr><tr><td>
.>>
backcolor \fIc\fR 
.ig >>
</td><td>
.>>
= set the current background color to c

.ig >>
</table>
.>>

.ig >>
<br><br><br>
.>>
.SH How to use draw commands
Suppose you have an imaginary pen,
.LP
\fCcolor blue\fR sets the pen color to blue  
.br
\fCmov x1 y1\fR would move the "pen" to x1,y1 in inches from lower left corner
.br
\fClin x2 y2\fR would lower the "pen" and then draw a line to x2,y2
.br
\fClin x3 y3\fR would continue the line to x3,y3
.LP
If you don't want to use inches, you can set up a plotting area
with whatever xrange and yrange you want.  Then..
.br
\fCmovs x1 y1\fR would move the pen to x1,y1 relative to xrange and yrange   
.br
\fClins x2 y2\fR would lower the pen and then draw a line to x2,y2
.br
\fClins x3 y3\fR would continue the line to x3,y3
.LP
This is fine for drawing lines, but what about filled shapes?
To do shapes, you do the same thing as above, but use \fCpath\fR instead
of \fClin\fR, or \fCpaths\fR instead of \fClins\fR.  When you have drawn one
shape, you fill it in using:
.br
\fCfill red\fR
.LP
Then you can begin the next shape.


.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="../doc/welcome.html">
<img src="../doc/ploticus.gif" border=0></a><br><small>data display engine &nbsp; <br>
<a href="../doc/Copyright.html">Copyright Steve Grubb</a>
<br>
<br>
<center>
<img src="../gallery/all.gif"> 
</center>
</td></tr>
</table>
<br>
<center>
Ploticus is hosted at http://ploticus.sourceforge.net <br>
<img src="http://sourceforge.net/sflogo.php?group_id=38453" width="88" height="31" border="0" alt="SourceForge Logo">
</center>
.>>
