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       <code>
36       setpos 50 50;
37       text_here 10 30 'hello';
38       setcolor black;
39       text_here 10 0 'there';
40       line_here 5 20;
41       </code>
42
43       This  example starts at Column 50, Row 50 of the input image and writes
44       the word 'hello' there in 10 pixel high white letters at  a  30  degree
45       angle up from horizontal.  Then, from where that leaves off, the script
46       writes 'there' in 10 pixel high black letters  horizontally.   Finally,
47       it  draws a black line to a point 5 pixels over and 20 pixels down from
48       the end of 'there.'
49
50       If you don't specify ppmfile, ppmdraw reads its input  PPM  image  from
51       Standard Input.
52
53       The output image goes to Standard Output.
54
55       ppmdraw  works  on multi-image streams.  It executes the same script on
56       each input image and produces an output stream with one image for  each
57       input  image.  But before Netpbm 10.32 (February 2006), ppmdraw ignored
58       every image after the first.
59
60       If you just want to add a single line of text to an image, ppmlabel may
61       be more what you want.
62
63
64

OPTIONS

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

SCRIPT

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

HISTORY

219       ppmdraw was new in Netpbm 10.29 (August 2005).
220
221
222

SEE ALSO

224       ppmlabel(1), ppm(1)
225
226
227
228netpbm documentation             22 June 2005           Ppmdraw User Manual(0)
Impressum