1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
|
.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.33 Jun'06
</small><br><a href="../doc/scripthome.html">Scripts</a>
<td></tr></table>
</td></tr>
<td>
<br>
<br>
.>>
.TH proc_drawcommands PL "02-JUN-2006 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 >>
.>>
- 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 >>
.>>
- 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 >>
.>>
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 >>
.>>
.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 >>
.>>
\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 <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>
.>>
|