| 1 |
The core of this program is derived from Martin Weber's |
| 2 |
([email protected]) Autotrace. Bryan Henderson adapted it to Netpbm in |
| 3 |
February 2006. |
| 4 |
|
| 5 |
Much of the Autotrace code has been rewritten to be easier to read and match |
| 6 |
Netpbm coding style. |
| 7 |
|
| 8 |
Pieces of Autotrace that duplicate other Netpbm programs or just don't fit |
| 9 |
the Netpbm philosophy have been removed. In particular, Autotrace has the |
| 10 |
ability to take formats other than Netpbm formats for input, to despeckle |
| 11 |
the image before tracing, and to quantize colors before tracing. Pamtosvg |
| 12 |
has none of that. |
| 13 |
|
| 14 |
Pamtosvg uses libnetpbm to read the input image, process the command line, |
| 15 |
manage memory, and do several other minor things. Autotrace has its own |
| 16 |
code for those things. |
| 17 |
|
| 18 |
Autotrace uses a shmaltzy trick to deal with open outlines. There is a |
| 19 |
piece of the program that divides an outline at its corners and then creates |
| 20 |
a curve for the pieces between every two corners. For an open outline, |
| 21 |
there are segments of the outline at each end that are not between two |
| 22 |
corners. One piece of code finds the corners, and another computes the |
| 23 |
curves between them. |
| 24 |
|
| 25 |
In order to use the closed outline code for the open outline case, |
| 26 |
Autotrace includes a dummy corner at the start of the outline in the |
| 27 |
list of corners. The curve-finding code then has a special case for |
| 28 |
the segment after the last corner. Pamtosvg uses a cleaner approach. |
| 29 |
The corner list is an actual list of corners -- there is no dummy |
| 30 |
corner. The curve-finding code has two special cases for open |
| 31 |
outlines -- one for the segment before the first corner, and one for |
| 32 |
the segment after the last corner. |
| 33 |
|
| 34 |
|
| 35 |
STRATEGY |
| 36 |
-------- |
| 37 |
|
| 38 |
Autotrace is capable of many more vector graphics output formats |
| 39 |
besides SVG. The basic curve tracing is the same for all; it just has |
| 40 |
output formatting modules. Netpbm ought to be able to generate those |
| 41 |
formats as well. SVG is just the beginning. |
| 42 |
|
| 43 |
Of course, having a program that generates multiple output formats based |
| 44 |
on command line options is not the Netpbm way to approach it. A pure |
| 45 |
traditional Netpbm approach would be to have a converter between PAM |
| 46 |
and each of the vector graphics formats. |
| 47 |
|
| 48 |
That isn't practical because of the information that gets lost when you |
| 49 |
convert from vector to raster form, and also because 99% of the logic |
| 50 |
in converting between PAM and a vector graphics format is the same for |
| 51 |
all the vector graphics formats. |
| 52 |
|
| 53 |
Therefore, the strategy is to adopt a single vector graphics format |
| 54 |
and use it as the common intermediate format. Right now, it looks |
| 55 |
like SVG would be a good choice for that. However, it may turn out to |
| 56 |
be better to create a vector graphics format specially for Netpbm. |
| 57 |
The reason for that is that an intermediate Netpbm format has a rather |
| 58 |
different requirement from all these other formats -- it isn't meant |
| 59 |
to be transmitted or stored, but it is meant to be easy for a |
| 60 |
programmer to work with. |
| 61 |
|
| 62 |
We need a program to go the other way -- to convert from SVG to PAM. |
| 63 |
I.e. a curve drawing program. The Ppmdraw program does this kind of |
| 64 |
curve drawing (in fact, a Ppmdraw script can be considered a vector |
| 65 |
graphics format). Ppmdraw itself might not be adaptable, but the |
| 66 |
library routines it uses are probably all we need to convert SVG to |
| 67 |
PAM. |
| 68 |
|
| 69 |
The Pamtosvg code should be reworked to use a libnetpbm tuple array |
| 70 |
instead of its at_bitmap_type for the raster. |
| 71 |
|
| 72 |
Nobody has any plans to do any of this work. I document the strategy |
| 73 |
only so that if someone decides to do some work, he can go in the |
| 74 |
right direction. |
| 75 |
|
| 76 |
|
| 77 |
COPYRIGHT CONSIDERATIONS |
| 78 |
------------------------ |
| 79 |
|
| 80 |
Bryan took the code and has distributed it under a copyright license |
| 81 |
granted to him, as a member of the public, by the authors. That |
| 82 |
license is the GNU Lesser Public License Version 2.1. All the authors |
| 83 |
offer that same license for Pamtosvg to the public. A copy of it is |
| 84 |
in the Netpbm doc/ directory. |
| 85 |
|
| 86 |
|
| 87 |
CREDITS |
| 88 |
------- |
| 89 |
|
| 90 |
Autotrace's source code listed the following as contributors to it: |
| 91 |
|
| 92 |
Martin Weber <[email protected]> |
| 93 |
Bernhard Herzog (Postscript, svg and sk export filter) |
| 94 |
Ian MacPhedran (xfig export filter) |
| 95 |
Martin Kroeker (bugfixes) |
| 96 |
Tobias Polzin (bugfixes) |
| 97 |
Kevin O'Gorman (Shockwave support) |
| 98 |
MenTaLguY (png import filter) |
| 99 |
Peter Cucka (bugfixes) |
| 100 |
Enrico Persiani (emf export) |
| 101 |
Johannes Schindelin (Magick import filter) |
| 102 |
Masatake YAMATO (library, help with cvs) |
| 103 |
Steffen Politzky (dxf export) |
| 104 |
David A. Bartold (part of despeckle) |
| 105 |
Han-Wen Nienhuys (rpm-spec file) |
| 106 |
R. P. C. Rodgers (man page) |
| 107 |
Allen Barnett (improved emf export) |
| 108 |
Andrew Elia (dr2d export filter) |
| 109 |
Ralf Stubner (bugfixes about pstoedit usage) |