.TL
Ppmdraw User Manual
.SH 1
ppmdraw
.LP
Updated: 22 June 2005
.br
Table Of Contents
.SH 2
NAME
.LP
ppmdraw - draw lines, text, etc on a PPM image
.SH 2
SYNOPSIS
.LP
\fBppmdraw\fR
{
\fB-script=\fR\fIscript\fR
|
\fB-scriptfile=\fR\fIfilename\fR
}
[\fB-verbose\fR]
[\fIppmfile\fR]
.LP
All options can be abbreviated to their shortest unique prefix.
You may use two hyphens instead of one to designate an option. You
may use either white space or an equals sign between an option name
and its value.
.SH 2
DESCRIPTION
.LP
.LP
This program is part of Netpbm.
.LP
\fBppmdraw\fR draws lines, shapes, text, etc. on a PPM image. It is
essentially an easy-to-program front end to \fBlibnetpbm\fR's
"ppmd" subroutines. It lets you create a human-friendly
script to describe the drawing rather than write a C program.
.LP
You supply drawing instructions with a script, which you supply either
in a file named by a \fB-scriptfile\fR option or as the value of a
\fB-script\fR option. Here is an example script:
.DS L
setpos 50 50;
text_here 10 30 "hello";
setcolor black;
text_here 10 0 "there";
line_here 5 20;
.DE
.LP
This example starts at Column 50, Row 50 of the input image and
writes the word "hello" there in 10 pixel high white letters
at a 30 degree angle up from horizontal. Then, from where that leaves
off, the script writes "there" in 10 pixel high black
letters horizontally. Finally, it draws a black line to a point 5
pixels over and 20 pixels down from the end of "there."
.LP
If you don't specify \fIppmfile\fR, \fBppmdraw\fR reads its input
PPM image from Standard Input.
.LP
The output image goes to Standard Output.
.LP
\fBppmdraw\fR works on multi-image streams. It executes the same
script on each input image and produces an output stream with one image
for each input image. But before Netpbm 10.32 (February 2006),
\fBppmdraw\fR ignored every image after the first.
.LP
If you just want to add a single line of text to an image,
\fBppmlabel\fR may be more what you want.
.SH 2
OPTIONS
.LP
.RS
.IP "\fB-script=\fR\fIscript\fR"
This option gives the script. See Script.
.LP
You may not specify both \fB-script\fR and \fB-scriptfile\fR.
.IP "\fB-scriptfile=\fR\fIfilename\fR"
This option names a file that contains the script. \fB-\fR
means Standard Input.
.LP
You may not specify both \fB-script\fR and \fB-scriptfile\fR.
.LP
You may not specify \fB-\fR (Standard Input) for both
\fB-scriptfile\fR and the input image file.
.RE
.SH 2
SCRIPT
.LP
.LP
The heart of \fBppmdraw\fR function is its script. The script is
a character stream. The stream consists of commands. Commands are
separated by semicolons. White space is regarded just like in C: Any
contiguous stretch of unquoted white space is equivalent to a single
space character. Note that this means newlines have no particular
significance.
.LP
A command is composed of tokens, separated from each other by
white space. To write a token that contains white space, enclose
it in double quotes. Everything between two matched quotation marks
is one token.
.LP
The first token of a command is the verb, which determines the
basic function of the command. The rest of the tokens of the command
are arguments, the meaning of which depends upon the verb. The
following list gives all the valid verbs, and for each its meaning and
its arguments.
.RS
.IP "setpos"
Set the "current position" in the image. This affects
where subsequent commands draw things. The 2 arguments are the column
and row number.
.LP
At the start of the script, the current position is (0,0).
.IP "setlinetype"
The 1 argument is "normal" or "nodiag.". This
effects a \fBppmd_setlinetype()\fR call. Further details are not yet
documented.
.IP "setlineclip"
This effects a \fBppmd_setlineclip()\fR call. Not yet documented.
.IP "setcolor"
This sets the "current color", which determines the color
in which subsequent drawing commands draw. Before the first
\fBsetcolor\fR, the current color is white.
.IP "setfont"
This sets the "current font", which determines the font
in which subsequent text drawing commands draw. Before the first
\fBsetfont\fR, the current color is a built in font called
"standard."
.LP
The argument of this command is a file name. It is the name of a
Netpbm PPMD font file.
.LP
A Netpbm PPMD font file typically has a name that ends in
".ppmdfont" and its first 8 bytes are the ASCII encoding of
"ppmdfont".
.LP
There is only one of these fonts as far as we know. It is
distributed with Netpbm as the file \fBstandard.ppmdfont\fR, but you
don't need to use that file because the same font is built into the
Netpbm library and is the default. If you want to make a new font,
you can find the format of a ppmdfont file in the Netpbm interface
header file \fBppmdfont.h\fR, but you'll have to make your own tools
to build it.
.IP "line"
This draws a one pixel wide line in the current color. The 4 arguments
are: starting column, starting row, ending column, ending row.
.LP
This command does not affect the current position.
.IP "line_here"
This is like \fBline\fR, except it works in a more relative way.
.LP
The line starts at the current point. The two arguments are the
rightward and downard displacement from there of the terminal point.
The command moves the current position to the terminal point after drawing.
.IP "spline3"
This draws a spline in the current color through 3 points. The 6
arguments are the starting column, starting row, middle column, middle
row, ending column, and ending row.
.LP
This command does not affect the current position.
.IP "circle"
This command draws a circle in the current color. The three
arguments are the column number and row number of the center of the
circle and the radius of the circle in pixels.
.IP "filledrectangle"
This command draws a rectangle filled with the current color.
The 4 arguments are the column and row numbers of the upper left corner
of the rectangle, the width of the rectangle, and the height of the
rectangle.
.IP "text"
This command draws text in the current color in the built-in font.
The 5 arguments are:
.IP 1
column number of starting point of baseline
.IP 2
row number of starting point of baseline
.IP 3
height of characters, in pixels
.IP 4
angle of baseline in degrees elevated from the horizontal
.IP 5
text
.LP
.LP
Note that if your text contains white space, you'll have to use double
quotes to cause it to be a single token.
.IP "text_here"
This is like \fBtext\fR, except that the baseline starts at
the current position and the command updates the current position to the
other end of the baseline after it draws.
.LP
Bear in mind that a script starts with the current position in the
top line, so if you leave it there, only the bottom line of your text
will be within the image!
.RE
.SH 2
HISTORY
.LP
.LP
\fBppmdraw\fR was new in Netpbm 10.29 (August 2005).
.SH 2
SEE ALSO
.LP
\fBppmlabel\fR,
\fBppm\fR
.br
\l'5i'
.SH 2
Table Of Contents
.LP
.IP \(bu
SYNOPSIS
.IP \(bu
DESCRIPTION
.IP \(bu
OPTIONS
.IP \(bu
SCRIPT
.IP \(bu
SEE ALSO
.LP
|