1Ppmdraw User Manual(0)                                  Ppmdraw User Manual(0)
2
3
4

NAME

6       ppmdraw - draw lines, text, etc on a PPM image
7
8

SYNOPSIS

10       ppmdraw
11
12       { -script=script | -scriptfile=filename } [-verbose]
13
14       [ppmfile]
15
16       All  options  can  be abbreviated to their shortest unique prefix.  You
17       may use two hyphens instead of one to designate an option.  You may use
18       either  white  space  or  an equals sign between an option name and its
19       value.
20
21
22

DESCRIPTION

24       This program is part of Netpbm(1).
25
26       ppmdraw draws lines, shapes, text, etc. on a PPM image.  It  is  essen‐
27       tially  an easy-to-program front end to libnetpbm's "ppmd" subroutines.
28       It lets you create a human-friendly  script  to  describe  the  drawing
29       rather than write a C program.
30
31       You  supply drawing instructions with a script, which you supply either
32       in a file named by a -scriptfile option or as the value  of  a  -script
33       option.  Here is an example script:
34
35       setpos 50 50;
36       text_here 10 30 "hello";
37       setcolor black;
38       text_here 10 0 "there";
39       line_here 5 20;
40
41       This  example starts at Column 50, Row 50 of the input image and writes
42       the word "hello" there in 10 pixel high white letters at  a  30  degree
43       angle up from horizontal.  Then, from where that leaves off, the script
44       writes "there" in 10 pixel high black letters  horizontally.   Finally,
45       it  draws a black line to a point 5 pixels over and 20 pixels down from
46       the end of "there."
47
48       If you don't specify ppmfile, ppmdraw reads its input  PPM  image  from
49       Standard Input.
50
51       The output image goes to Standard Output.
52
53       ppmdraw  works  on multi-image streams.  It executes the same script on
54       each input image and produces an output stream with one image for  each
55       input  image.  But before Netpbm 10.32 (February 2006), ppmdraw ignored
56       every image after the first.
57
58       If you just want to add a single line of text to an image, ppmlabel may
59       be more what you want.
60
61
62

OPTIONS

64       In  addition  to  the options common to all programs based on libnetpbm
65       (most notably -quiet, see
66        Common Options ⟨index.html#commonoptions⟩ ),  ppmdraw  recognizes  the
67       following command line options:
68
69
70
71
72       -script=script
73              This option gives the script.  See Script ⟨#script⟩ .
74
75              You may not specify both -script and -scriptfile.
76
77
78       -scriptfile=filename
79              This  option  names  a  file  that contains the script.  - means
80              Standard Input.
81
82              You may not specify both -script and -scriptfile.
83
84              You may not specify - (Standard Input) for both -scriptfile  and
85              the input image file.
86
87
88
89
90

SCRIPT

92       The heart of ppmdraw function is its script.  The script is a character
93       stream.  The stream consists of commands.  Commands  are  separated  by
94       semicolons.   White  space  is  regarded just like in C: Any contiguous
95       stretch of unquoted white space is equivalent to a single space charac‐
96       ter.  Note that this means newlines have no particular significance.
97
98       A  command  is  composed  of tokens, separated from each other by white
99       space.  To write a token that contains white space, enclose it in  dou‐
100       ble  quotes.   Everything  between  two  matched quotation marks is one
101       token.
102
103       The first token of a command is the verb, which  determines  the  basic
104       function  of  the  command.   The rest of the tokens of the command are
105       arguments, the meaning of which depends upon the verb.   The  following
106       list  gives all the valid verbs, and for each its meaning and its argu‐
107       ments.
108
109       Many command have arguments that specify  a  position  on  the  canvas,
110       which  you  specify by row and column.  Row 0 is the top row.  Column 0
111       is the leftmost column.  You may specify negative numbers (but  such  a
112       position would necessarily be off the canvas).
113
114       Your drawing instructions may involve positions not on the canvas.  But
115       any pixels you draw there just get discarded.
116
117
118
119       setpos Set the "current position" in the  image.   This  affects  where
120              subsequent commands draw things.  The 2 arguments are the column
121              and row number.
122
123              At the start of the script, the current position is (0,0).
124
125
126       setlinetype
127              The 1  argument  is  "normal"  or  "nodiag.".   This  effects  a
128              ppmd_setlinetype()  call.   Further  details  are  not yet docu‐
129              mented.
130
131
132       setlineclip
133              This effects a ppmd_setlineclip() call.  Not yet documented.
134
135
136       setcolor
137              This sets the "current color", which  determines  the  color  in
138              which  subsequent  drawing commands draw.  Before the first set‐
139              color, the current color is white.
140
141              There is one argument.  It specifies the color as described  for
142              the   argument   of   the   pnm_parsecolor()   library   routine
143              ⟨libnetpbm_image.html#colorname⟩ .
144
145
146       setfont
147              This sets the "current font", which determines the font in which
148              subsequent  text  drawing  commands draw.  Before the first set‐
149              font, the current font is a built in font called "standard."
150
151              The argument of this command is a file name.  It is the name  of
152              a Netpbm PPMD font file.
153
154              A  Netpbm  PPMD  font  file  typically  has  a name that ends in
155              ".ppmdfont" and its first 8 bytes  are  the  ASCII  encoding  of
156              "ppmdfont".
157
158              There  is only one of these fonts as far as we know.  It is dis‐
159              tributed with Netpbm as  the  file  standard.ppmdfont,  but  you
160              don't  need to use that file because the same font is built into
161              the Netpbm library and is the default.  If you want  to  make  a
162              new  font,  you  can  find  the format of a ppmdfont file in the
163              Netpbm interface header file ppmdfont.h, but you'll have to make
164              your  own  tools  to build it.  The program ppmdmkfont generates
165              standard.ppmdfont, so you can use that as an example.
166
167
168       line   This draws a one pixel wide line in the current  color.   The  4
169              arguments  are:  starting  column,  starting row, ending column,
170              ending row.
171
172              This command does not affect the current position.
173
174
175       line_here
176              This is like line, except it works in a more relative way.
177
178              The line starts at the current point.  The two arguments are the
179              rightward  and  downward displacement from there to the terminal
180              point.  The command moves the current position to  the  terminal
181              point after drawing.
182
183
184       spline3
185              This draws a spline in the current color between 2 points, using
186              a third as a control point.  It approximates a cubic spline seg‐
187              ment.
188
189              The shape of the curve is such that it passes through the speci‐
190              fied endpoints, and lines tangent to the  curve  at  those  end‐
191              points intersect at the control point.  Controlling the tangents
192              allows you to connect this curve to other curves  generated  the
193              same way without having corners at the connection points.
194
195              The  6  arguments  are the starting point column, starting point
196              row, control point column, control point row, ending point  col‐
197              umn, and ending point row.
198
199              This command does not affect the current position.
200
201
202       circle This  command  draws  a  circle in the current color.  The three
203              arguments are the column number and row number of the center  of
204              the circle and the radius of the circle in pixels.
205
206
207       filledrectangle
208              This command draws a rectangle filled with the current color.
209
210              The 4 arguments are the column and row numbers of the upper left
211              corner of the rectangle, the width of  the  rectangle,  and  the
212              height of the rectangle.
213
214
215       text   This  command  draws  text  in the current color in the built-in
216              font.  The 5 arguments are:
217
218
219
220       ·      column number of starting point of baseline
221
222       ·      row number of starting point of baseline
223
224       ·      height of characters, in pixels
225
226       ·      angle of baseline in degrees elevated from the horizontal
227
228       ·      text
229
230
231              Note that if your text contains white space, you'll have to  use
232              double quotes to cause it to be a single token.
233
234
235       text_here
236              This  is  like text, except that the baseline starts at the cur‐
237              rent position and the command updates the  current  position  to
238              the other end of the baseline after it draws.
239
240              Bear  in  mind that a script starts with the current position in
241              the top line, so if you leave it there, only the bottom line  of
242              your text will be within the image!
243
244
245
246

HISTORY

248       ppmdraw was new in Netpbm 10.29 (August 2005).
249
250
251

SEE ALSO

253       ppmlabel(1), ppm(1) libnetpbm_draw(1)
254

DOCUMENT SOURCE

256       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
257       source.  The master documentation is at
258
259              http://netpbm.sourceforge.net/doc/ppmdraw.html
260
261netpbm documentation             22 June 2005           Ppmdraw User Manual(0)
Impressum