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       -script=script
65              This option gives the script.  See Script ⟨#script⟩ .
66
67              You may not specify both -script and -scriptfile.
68
69
70       -scriptfile=filename
71              This  option  names  a  file  that contains the script.  - means
72              Standard Input.
73
74              You may not specify both -script and -scriptfile.
75
76              You may not specify - (Standard Input) for both -scriptfile  and
77              the input image file.
78
79
80
81
82

SCRIPT

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

HISTORY

235       ppmdraw was new in Netpbm 10.29 (August 2005).
236
237
238

SEE ALSO

240       ppmlabel(1), ppm(1)
241
242
243
244netpbm documentation             22 June 2005           Ppmdraw User Manual(0)
Impressum