summaryrefslogtreecommitdiff
path: root/src/ghost
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2008-10-26 16:10:50 +0000
committerRoger Leigh <rleigh@debian.org>2008-10-26 16:10:50 +0000
commiteb5718390731a9746c556317e641320b671f2091 (patch)
tree762876b4adf298c1281142328e2ae87007330904 /src/ghost
Imported Upstream version 4.2.0
Diffstat (limited to 'src/ghost')
-rw-r--r--src/ghost/.cvsignore20
-rw-r--r--src/ghost/COPYING339
-rw-r--r--src/ghost/Makefile.am113
-rw-r--r--src/ghost/README1245
-rw-r--r--src/ghost/README.bsd57
-rw-r--r--src/ghost/contrib.mak.addon.in17
-rw-r--r--src/ghost/contrib.mak.addon.old51
-rw-r--r--src/ghost/debian-patch40
-rw-r--r--src/ghost/debian-patch-stp34
-rw-r--r--src/ghost/devs.mak.addon-5.1051
-rw-r--r--src/ghost/gdevstp.c735
11 files changed, 2702 insertions, 0 deletions
diff --git a/src/ghost/.cvsignore b/src/ghost/.cvsignore
new file mode 100644
index 0000000..a50caae
--- /dev/null
+++ b/src/ghost/.cvsignore
@@ -0,0 +1,20 @@
+Makefile
+Makefile.in
+gdevstp-canon.c
+gdevstp-color.c
+gdevstp-dither.c
+gdevstp-dither-matrices.c
+gdevstp-escp2.c
+gdevstp-lexmark.c
+gdevstp-pcl.c
+gdevstp-printers.c
+gdevstp-ps.c
+gdevstp-util.c
+gdevstp-weave.c
+gdevstp-print.h
+gdevstp-print-internal.h
+gdevstp-print-intl-internal.h
+gdevstp-quickmatrix257.h
+gdevstp-ran.367.179.h
+gdevstp-ran.509.131.h
+contrib.mak.addon
diff --git a/src/ghost/COPYING b/src/ghost/COPYING
new file mode 100644
index 0000000..a43ea21
--- /dev/null
+++ b/src/ghost/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/src/ghost/Makefile.am b/src/ghost/Makefile.am
new file mode 100644
index 0000000..9a34a59
--- /dev/null
+++ b/src/ghost/Makefile.am
@@ -0,0 +1,113 @@
+## $Id: Makefile.am,v 1.17 2001/10/17 12:12:07 rlk Exp $
+## Copyright (C) 2000 Roger Leigh
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+## Process this file with automake to produce Makefile.in.
+
+AUTOMAKE_OPTIONS = 1.4 gnu
+
+@SET_MAKE@
+
+MAINT_CHARSET = latin1
+
+## Use old compatability method for now...
+
+## Variables
+
+MAINCODE = canon.c color.c dither.c escp2.c lexmark.c pcl.c printers.c ps.c util.c weave.c dither-matrices.c
+
+MAINHEADERS = print.h print-internal.h print-intl-internal.h quickmatrix257.h ran.367.179.h ran.509.131.h
+
+MAINFILES = $(MAINCODE) $(MAINHEADERS)
+
+if BUILD_GHOST
+ALL_LOCAL_DEPS = $(srcdir)/$(addprefix gdevstp-,$(MAINCODE)) $(srcdir)/$(addprefix gdevstp-,$(MAINHEADERS))
+else
+ALL_LOCAL_DEPS =
+endif
+
+
+## Rules
+
+all-local: $(ALL_LOCAL_DEPS)
+
+GHCODE = -e 's/print-printers.c/gdevstp-printers.c/' -e 's/^\\\#include "\(gimp\-\)*\(.*\)\.h"$$/\\\#include "gdevstp-\2.h"/' -e 's/^\\\#include <gimp-print\/gimp-print\(.*\)\.h>$$/\\\#include "gdevstp-print\1.h"/'
+
+$(srcdir)/gdevstp-print.h: $(top_srcdir)/include/gimp-print/gimp-print.h
+ sed $(GHCODE) $< > $(srcdir)/$@
+
+$(srcdir)/gdevstp-print-internal.h: $(top_srcdir)/src/main/gimp-print-internal.h
+ sed $(GHCODE) $< > $(srcdir)/$@
+
+$(srcdir)/gdevstp-print-intl-internal.h: $(top_srcdir)/include/gimp-print/gimp-print-intl-internal.h
+ sed $(GHCODE) $< > $(srcdir)/$@
+
+gdevstp-%.h: $(srcdir)/../main/%.h Makefile
+ cd $(srcdir) ; sed $(GHCODE) $< > $@
+
+gdevstp-printers.c: ../main/print-printers.c
+ sed $(GHCODE) $< > $@
+
+gdevstp-%: $(srcdir)/../main/print-% Makefile
+ cd $(srcdir) ; sed $(GHCODE) $< > $@
+
+../main/print-printers.c: ../printdef/printdef $(srcdir)/../main/printers.xml
+ ../printdef/printdef < $(srcdir)/../main/printers.xml > $(top_builddir)/src/main/print-printers.c
+
+printdefl.o: printdefy.o
+
+../printdef/printdef: $(addprefix ../printdef/, printdefl.l printdefy.y printdef.h)
+ cd ../printdef ; \
+ $(MAKE)
+
+
+## Clean
+
+CLEANFILES = \
+ $(srcdir)/gdevstp-printers.c \
+ $(srcdir)/gdevstp-ran.367.179.h \
+ $(srcdir)/gdevstp-ran.509.131.h \
+ $(srcdir)/gdevstp-color.c \
+ $(srcdir)/gdevstp-print.h \
+ $(srcdir)/gdevstp-print-internal.h \
+ $(srcdir)/gdevstp-print-intl-internal.h \
+ $(srcdir)/gdevstp-quickmatrix257.h \
+ $(srcdir)/gdevstp-util.c \
+ $(srcdir)/gdevstp-weave.c \
+ $(srcdir)/gdevstp-canon.c \
+ $(srcdir)/gdevstp-dither.c \
+ $(srcdir)/gdevstp-dither-matrices.c \
+ $(srcdir)/gdevstp-escp2.c \
+ $(srcdir)/gdevstp-lexmark.c \
+ $(srcdir)/gdevstp-pcl.c \
+ $(srcdir)/gdevstp-ps.c
+
+# End of old compatability cruft
+
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = \
+ COPYING \
+ Makefile \
+ Makefile.am \
+ README \
+ README.bsd \
+ contrib.mak.addon.in \
+ contrib.mak.addon.old \
+ debian-patch \
+ debian-patch-stp \
+ devs.mak.addon-5.10 \
+ gdevstp.c \
diff --git a/src/ghost/README b/src/ghost/README
new file mode 100644
index 0000000..a9193b6
--- /dev/null
+++ b/src/ghost/README
@@ -0,0 +1,1245 @@
+INTRODUCTION:
+-------------
+
+ Gimp-Print 4.2 includes an associated Ghostscript driver, which is
+ named `stp'. That name originally referred to Epson Stylus Photo
+ printers; this is the first Ghostscript driver which supported those
+ printers with high quality. The same driver now supports many Canon,
+ HP, and Lexmark printers.
+
+ This driver works with GhostScript 5.10, 5.50, and 6.51. It should
+ work with any later releases on the 6.5x GNU Ghostscript line, such
+ as 6.52XS. Due to incompatibilities between the Aladdin Free Public
+ License (AFPL) and the GNU General Public License (GPL), this driver
+ may not be combined and distributed with versions of GhostScript not
+ covered by the GPL. We will not fix bugs reported against
+ combinations of this driver with AFPL-only versions of GhostScript.
+
+
+AUTHOR:
+-------
+
+ This Ghostscript frontend was originally written by Henryk Richter
+ (buggs@comlab.uni-rostock.de); it since has been fully integrated
+ into gimp-print. Gimp-Print itself was originally written by Michael
+ Sweet <mike@easysw.com>, who released up to version 2.0; Robert
+ Krawitz released version 3.0. The gimp-print development team
+ (http://gimp-print.sourceforge.net) now maintains the entire package.
+
+
+LICENSE:
+--------
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+BUILD AND INSTALLATION:
+----- --- -------------
+
+1) Get a recent Ghostscript (5.10, 5.50, or 6.51 or its successors)
+ and prepare the sources as described in the documentation (don`t
+ forget zlib, libpng and libjpeg when downloading the source) for
+ compiling
+
+2) If you are using Ghostscript 5.50 or 6.51, you have two choices.
+ The recommended (newer) method follows. This method builds the stp
+ driver by linking against the libgimpprint library that is
+ installed on your system. If you wish to use the older method (or
+ you're using Ghostscript 5.10), which actually installs all of the
+ Gimp-Print source files into your Ghostscript source tree, please
+ skip to step 7. We strongly recommend that all Ghostscript users,
+ except for those who cannot upgrade from 5.10, use the new method.
+
+
+3) The recommended (newer) method requires you to build and install
+ Gimp-print, and links against the installed libgimpprint.so or
+ libgimpprint.a. Run
+
+ ./configure
+ make
+ make install
+
+ in the top level directory (../.. from here).
+
+ "make install" typically needs to be run as root. You may also
+ need to run "ldconfig" as root following "make install".
+
+ You may optionally run
+
+ ./configure --without-gimp
+
+ if you do not wish to build the Gimp Print plugin. Note that you
+ do *not* need to run "./configure --with-ghost" as before.
+
+4) Copy the file "gdevstp.c" from this directory into the Ghostscript
+ source directory. Depending upon the version of Ghostscript you
+ use, this may be either the top level of your Ghostscript source
+ distribution, or the "src/" subdirectory.
+
+5) Edit the file "contrib.mak" (in either the top level or src/
+ subdirectory, depending upon your version of Ghostscript) by adding
+ the contents of "contrib.mak.addon", which should have been created
+ by running configure. Be careful to add *exactly* the contents of
+ this file; if you cut and paste it, you may find that the tab
+ characters in contrib.mak.addon get transformed into spaces, and as
+ a result when you run 'make' it will fail.
+
+ If you reinstall Gimp-Print in a new location (by using configure
+ --prefix, configure --exec-prefix, or configure --includedir), you
+ must edit the contrib.mak file appropriately. The contrib.mak.addon
+ file in this directory is automatically updated by running configure.
+
+6) Skip to step 11.
+
+
+7) If you are using Ghostscript 5.10, or prefer to use the old, tried
+ and true method for building the driver, run
+
+ ./configure --with-ghost
+ make
+
+ in the top level directory (../.. from here).
+
+ You may optionally run
+
+ ./configure --without-gimp --with-ghost
+
+ if you do not wish to build the Gimp Print plugin.
+
+8) Copy all "*.c" and "*.h" files from this directory to the
+ Ghostscript source directory. Depending upon the version of
+ Ghostscript you use, this may be either the top level of your
+ Ghostscript source distribution, or the "src/" subdirectory.
+
+9) If you are using Ghostscript 5.50 or 6.51: edit the file
+ "contrib.mak" (in either the top level or src/ subdirectoy,
+ depending upon your version of Ghostscript) by adding the contents
+ of "contrib.mak.addon.old". Be careful to add *exactly* the
+ contents of this file; if you cut and paste it, you may find that
+ the tab characters in contrib.mak.addon get transformed into
+ spaces, and as a result when you run 'make' it will fail.
+
+10) If you are using Ghostscript 5.10: edit the file "devs.mak" (in
+ either the top level or src/ subdirectoy, depending upon your
+ version of Ghostscript) by adding the contents of
+ "devs.mak.addon-5.10". Be careful to add *exactly* the contents of
+ this file; if you cut and paste it, you may find that the tab
+ characters in contrib.mak.addon get transformed into spaces, and as
+ a result when you run 'make' it will fail.
+
+
+11) Add "$(DD)stp.dev" to the line "DEVICE_DEVS6=..." in the makefile
+ used by Ghostscript (this is usually accessible as "makefile" in
+ the top level Ghostscript source, but that is normally just a
+ symbolic link to a system-specific makefile, such as unix-gcc.mak).
+ If there are multiple lines that start with DEVICE_DEVS6=, you may
+ add this to any such line. If there is no DEVICE_DEVS6= line, you
+ may add it to any other DEVICE_DEVSx line that is present.
+
+12) Compile and install gs as described in the Ghostscript
+ documentation. After a successful compiler run you get a new
+ driver named "stp". Check this by calling "gs -h" with the newly
+ compiled Ghostscript.
+
+The distribution includes a utility named "escputil" that performs
+many utility functions, such as head cleaning, nozzle alignment, and
+the like, for Epson Stylus printers. This is normally compiled by
+"make" and installed by "make install".
+
+
+DEBIAN:
+-------
+
+Debian users can try the following (contributed by Stuart Miles and
+updated by Dan Christensen <jdc@julian.uwo.ca>): versions are current
+as of 5 October 2000. The Debian installation procedure is being
+extensively redone as of February 2001.
+
+As of version 5.50 and 6.61, the current Debian packages in testing
+(woody) and unstable (sid) are linked with libgimpprint, thus
+saving you the effort of doing any patching yourself! Because it
+uses a shared object (libgimpprint.so), you may upgrade the
+gimp-print drivers simply by installing a newer version of the
+libgimpprint library.
+
+NOTE: the script 'scripts/make-deb.sh' does the following for you.
+ It is probably better to upgrade to a new 5.50 or 6.51 release;
+ only use this if you are running stable (potato) or earlier.
+
+Download the debianised sources for gs-aladdin and libjpeg to the
+directory containing the print-x.xxx directory:
+
+# apt-get source gs libjpeg62
+
+(Make sure you have a deb-src entry in /etc/apt/sources.list first!
+See the sources.list(5) man page for more info on setting up apt.)
+
+The name of the libjpeg package may vary.
+
+This will download the .dsc, orig.tar.gz and diff.gz files, unpack and
+patch the files for you.
+
+Rename the libjpegxxx (currently libjpeg6b-6b) directory to libjpeg.
+
+To compile gs you will also need the following installed:
+
+# apt-get install sharutils zlib1g-dev svgalibg1-dev libpng2-dev vflib2-dev
+
+The name of the packages may vary. The above corresponds to
+
+sharutils 4.2.1-2 shar, unshar, uuencode, uudecode
+zlib1g-dev 1.1.3-11 compression library - development
+svgalibg1-dev 1.4.1-2 Shared, non-x, graphics library used by Ghos
+libpng2-dev 1.0.8-1 PNG library - development
+vflib2-dev 2.25.1-5 Vector Font Library for Japanese Character C
+
+but current versions (and possibly older versions) will probably
+work as well.
+
+Next do the following:
+
+# mkdir gs-x.xx/contrib/stp
+# cd print-x.xxx/Ghost
+# cp gdevstp* *.mak.addon* ../../gs-x.xx/contrib/stp
+# cp README ../../gs-x.xx/contrib/stp/README.stp
+# cp debian-patch ../../gs-x.xx/debian
+# cp debian-patch-stp ../../gs-x.xx/debian/patches/stp
+# cd ../../gs-x.xx/debian
+# patch < debian-patch [patches control and rules files]
+# chmod u+x addentry [maybe this should be fixed in the tar file?]
+# cd .. [now we are in gs-x.xx]
+# debian/rules binary
+
+The rules script will copy the sourcefiles and README.stp into the
+main gs directory, patch contrib.mak, add the stp entry to
+unix-gcc.mak, compile gs, package it all up as a .deb package
+(gs-stp_5.10-9.1_i386.deb) and put the resulting file in the directory
+above gs.
+
+To install it:
+
+# cd ..
+# dpkg -i gs-stp_5.10-9.1_i386.deb
+
+If you have gs or gs-aladdin installed, it will be removed.
+
+DISCLAIMER:
+
+This is not an official Debian package. This method works for at
+least one person. To be really neat and tidy other files need
+modifying to ensure that this custom package gets marked as such and
+_not_ an official package. The only problem I've found is that I
+the gs-pdfencrypt insists on having gs installed rather than gs-stp.
+If you know how to fix this, please update this README.
+
+
+OPTIONS:
+--------
+
+Overview:
+---------
+
+Options for the stp driver are given in normal Ghostscript
+manner. The resolution of the image calculated by Ghostscript is not
+bound to the resolution of the printer output. It is for example
+possible to specify "-r360" to gs and print the output in 1440x720
+dpi (see below for driver parameter). The result is a somewhat faster
+operation of the driver.
+
+The driver will not permit use of invalid settings.
+
+The options for this driver are very complex. We strongly recommend
+use of a printer management system such as Foomatic rather than
+configuring a spooler manually with this driver.
+
+
+Printer Model Selection:
+------- ----- ----------
+
+-sModel=name
+
+This option must be supplied. There is no default.
+
+bjc-30 CANON BJC 30
+bjc-50 CANON BJC 50
+bjc-55 CANON BJC 55
+bjc-80 CANON BJC 80
+bjc-85 CANON BJC 85
+bjc-210 CANON BJC 210
+bjc-240 CANON BJC 240
+bjc-250 CANON BJC 250
+bjc-1000 CANON BJC 1000
+bjc-2000 CANON BJC 2000
+bjc-3000 CANON BJC 3000
+bjc-4300 CANON BJC 4300
+bjc-4400 CANON BJC 4400 photo
+bjc-6000 CANON BJC 6000
+bjc-6100 CANON BJC 6100
+bjc-7000 CANON BJC 7000
+bjc-7100 CANON BJC 7100
+bjc-8200 CANON BJC 8200
+bjc-s400 CANON S400
+bjc-s450 CANON S450
+bjc-s800 CANON S800
+bjc-s4500 CANON S4500
+escp2-c20sx EPSON Stylus C20SX
+escp2-c20ux EPSON Stylus C20UX
+escp2-c40sx EPSON Stylus C40SX
+escp2-c40ux EPSON Stylus C40UX
+escp2-c60 EPSON Stylus C60
+escp2-c70 EPSON Stylus C70
+escp2-c80 EPSON Stylus C80
+escp2 EPSON Stylus Color
+escp2-pro EPSON Stylus Color Pro
+escp2-pro-xl EPSON Stylus Color Pro XL
+escp2-400 EPSON Stylus Color 400
+escp2-440 EPSON Stylus Color 440
+escp2-460 EPSON Stylus Color 460
+escp2-480 EPSON Stylus Color 480
+escp2-500 EPSON Stylus Color 500
+escp2-580 EPSON Stylus Color 580
+escp2-600 EPSON Stylus Color 600
+escp2-640 EPSON Stylus Color 640
+escp2-660 EPSON Stylus Color 660
+escp2-670 EPSON Stylus Color 670
+escp2-680 EPSON Stylus Color 680
+escp2-740 EPSON Stylus Color 740
+escp2-760 EPSON Stylus Color 760
+escp2-777 EPSON Stylus Color 777
+escp2-800 EPSON Stylus Color 800
+escp2-850 EPSON Stylus Color 850
+escp2-860 EPSON Stylus Color 860
+escp2-880 EPSON Stylus Color 880
+escp2-83 EPSON Stylus Color 83
+escp2-900 EPSON Stylus Color 900
+escp2-980 EPSON Stylus Color 980
+escp2-1160 EPSON Stylus Color 1160
+escp2-1500 EPSON Stylus Color 1500
+escp2-1520 EPSON Stylus Color 1520
+escp2-3000 EPSON Stylus Color 3000
+escp2-photo EPSON Stylus Photo
+escp2-700 EPSON Stylus Photo 700
+escp2-ex EPSON Stylus Photo EX
+escp2-720 EPSON Stylus Photo 720
+escp2-750 EPSON Stylus Photo 750
+escp2-780 EPSON Stylus Photo 780
+escp2-785 EPSON Stylus Photo 785EPX
+escp2-790 EPSON Stylus Photo 790
+escp2-810 EPSON Stylus Photo 810
+escp2-820 EPSON Stylus Photo 820
+escp2-870 EPSON Stylus Photo 870
+escp2-875 EPSON Stylus Photo 875
+escp2-890 EPSON Stylus Photo 890
+escp2-895 EPSON Stylus Photo 895
+escp2-1200 EPSON Stylus Photo 1200
+escp2-1270 EPSON Stylus Photo 1270
+escp2-1280 EPSON Stylus Photo 1280
+escp2-1290 EPSON Stylus Photo 1290
+escp2-2000 EPSON Stylus Photo 2000P
+escp2-5000 EPSON Stylus Pro 5000
+escp2-5500 EPSON Stylus Pro 5500
+escp2-7000 EPSON Stylus Pro 7000
+escp2-7500 EPSON Stylus Pro 7500
+escp2-9000 EPSON Stylus Pro 9000
+escp2-9500 EPSON Stylus Pro 9500
+escp2-10000 EPSON Stylus Pro 10000
+escp2-scan2000 EPSON Stylus Scan 2000
+escp2-scan2500 EPSON Stylus Scan 2500
+pcl-340 HP DeskJet 340
+pcl-400 HP DeskJet 400
+pcl-500 HP DeskJet 500
+pcl-501 HP DeskJet 500C
+pcl-520 HP DeskJet 520
+pcl-540 HP DeskJet 540C
+pcl-550 HP DeskJet 550C
+pcl-560 HP DeskJet 560C
+pcl-600 HP DeskJet 600/600C (Single Cartridge)
+pcl-601 HP DeskJet 600 series (2 Cartridge)
+pcl-690 HP DeskJet 690 series (Photo-Ink capable)
+pcl-750 HP DesignJet 750
+pcl-810 HP DeskJet 810C
+pcl-812 HP DeskJet 812C
+pcl-840 HP DeskJet 840C
+pcl-842 HP DeskJet 842C
+pcl-845 HP DeskJet 845C
+pcl-850 HP DeskJet 850C
+pcl-855 HP DeskJet 855C
+pcl-870 HP DeskJet 870C
+pcl-890 HP DeskJet 890C
+pcl-895 HP DeskJet 895C
+pcl-900 HP DeskJet 900 series
+pcl-P1000 HP PhotoSmart P1000
+pcl-1100 HP DeskJet 1100C
+pcl-P1100 HP PhotoSmart P1100
+pcl-1120 HP DeskJet 1120C
+pcl-1200 HP DeskJet 1200C
+pcl-1220 HP DeskJet 1220C
+pcl-1600 HP DeskJet 1600C
+pcl-2000 HP DeskJet 2000 series
+pcl-2500 HP DeskJet 2500 series
+pcl-2 HP LaserJet II series
+pcl-3 HP LaserJet III series
+pcl-4 HP LaserJet 4 series
+pcl-4v HP LaserJet 4V, 4Si
+pcl-5 HP LaserJet 5 series
+pcl-5si HP LaserJet 5Si
+pcl-6 HP LaserJet 6 series
+lexmark-4076 Lexmark 4076 (PCL printer)
+lexmark-z42 Lexmark Z42
+lexmark-z43 Lexmark Z43
+lexmark-z52 Lexmark Z52
+
+Most or all of the Epson Stylus printers are fully functional. The
+others vary. In particular, all of the listed Epson Stylus Photo
+printers print in full 6-color photo mode; most of the others do not.
+The color output has also been better tuned for Epson Stylus printers
+than for others.
+
+
+Print Resolution Selection:
+----- ---------- ----------
+
+-sQuality=quality
+
+The meaning of this is model-specific. Two names are listed for each
+resolution; the first (short) name is the value that must be passed to
+-sQuality, and the second (long) name is descriptive. Each printer
+has its own default value; for most printers, this is a reasonable 300
+or 360 DPI resolution.
+
+
+For Epson Stylus printers:
+
+Within each specified resolution, the quality is generally listed from
+worst to best (and generally higher quality means lower speed). For
+example, 360 DPI Unidirectional is usually better than 360 DPI.
+Characteristics of specific models and individual printers may affect
+the orderings to some degree; on many printers, with certain papers,
+unidirectional printing will improve quality substantially more than
+using an otherwise better quality printing mode.
+
+The difference between different quality settings lies in the number
+of passes made over each line. "High" and "Highest" quality settings
+perform more passes, printing fewer dots with each pass over the same
+line and using different nozzles for each pass. This reduces banding
+effects, but requires more time.
+
+"Microweave" modes use algorithms within the printer to generate the
+sequence of rows printed. These algorithms generally only work well
+at low printing resolutions. Many printers do not support this kind
+of printing at resolutions of 720 DPI and above, and some printers
+that do actually print just one row (using just one nozzle per color)
+at a time. While this particular use will produce extremely high
+quality (no banding whatsoever, normally), it is extremely slow and
+may eventually damage the print head due to ink pooling. All printers
+that we are aware of have no such trouble at 360 DPI.
+
+We generally recommend the following resolutions for the following
+purposes:
+
+360x90 Fast economy draft output on plain paper (output will be very
+360x120 banded and not very dark).
+
+180 Economy draft output on plain paper (output will not be very
+ dark).
+
+360x180 Draft output on plain paper (output will not be solidly
+360x240 black); economy draft output on good quality inkjet paper.
+
+360 Standard quality output on plain paper (output will be
+ solidly black); draft output on good quality inkjet paper.
+
+720x360 High quality output on plain paper; standard output on good
+ quality inkjet paper.
+
+720 Maximum quality on plain paper; high quality on good inkjet
+ paper; proofs on photo-quality paper. On many printers,
+ there will be little difference between this and 720x360 on
+ plain paper.
+
+1440x720 High quality on photo paper; use 1440x720 Highest Quality to
+ reduce microbanding if needed. While this will work on plain
+ paper, it usually offers little improvement over 720 DPI.
+
+2880x720 Highest quality on photo paper. While this may yield
+ slightly improved quality, it will generally not be markedly
+ superior to 1440x720 Highest Quality, except on the Stylus
+ Color 980 and Stylus C70 and C80, where it may yield a
+ noticeable improvement. It takes as long to print as
+ 1440x720 highest quality, but twice as long to generate the
+ output.
+
+1440x1440 An unsupported mode that offers higher quality than 2880x720
+ for certain types of images on very high quality paper. It
+ does not appear to offer any advantage on smooth tones, but
+ fine detail (particularly vertical, and to a lesser extent
+ near-horizontal) it shows noticeable improvement. It takes
+ as long to print as 2880x720. 1440x1440 highest quality
+ takes twice as long to print.
+
+2880x1440 An unsupported mode that may offer higher quality than
+ 2880x720 for certain types of images on very high quality
+ paper. Experiments conducted thus far demonstrate little if
+ any improvement over 1440x1440. It takes twice as long to
+ print as 2880x720 or 1440x1440, and as long to print as
+ 1440x1440 highest quality.
+
+
+The following resolutions are supported on printers other than the
+Stylus Pro (5000, 5500, 7000, 7500, 9000, 9500, and 10000) printers.
+Resolutions for those printers are listed in a later section. Please
+see the notes at the end of this section.
+
+360x90dpi 360 x 90 DPI Fast Economy Draft (1)
+
+180dpi 180 DPI Economy Draft (2)
+
+360x180dpi 360 x 180 DPI Draft (2)
+360x180sw 360 x 180 DPI Draft (3)
+
+360x120dpi 360 x 120 DPI Economy Draft (4)
+360x120sw 360 x 120 DPI Economy Draft (5)
+
+360x240dpi 360 x 240 DPI Draft (4)
+360x240sw 360 x 240 DPI Draft (5)
+
+360dpi 360 DPI (6)
+360uni 360 DPI Unidirectional (6)
+360mw 360 DPI Microweave (6, *)
+360mwuni 360 DPI Microweave Unidirectional (6)
+360sw 360 DPI (7, *)
+360swuni 360 DPI Unidirectional (7)
+360hq 360 DPI High Quality (7, 8)
+360hquni 360 DPI High Quality Unidirectional (7, 8)
+
+720x360sw 720 x 360 DPI (9, 10)
+720x360swuni 720 x 360 DPI Unidirectional (9, 10)
+
+720mw 720 DPI Microweave (11)
+720mwuni 720 DPI Microweave Unidirectional (11)
+720sw 720 DPI (9)
+720swuni 720 DPI Unidirectional (9)
+720hq 720 DPI High Quality (9)
+720hquni 720 DPI High Quality Unidirectional (9)
+720hq2 720 DPI Highest Quality (9)
+
+1440x720mw 1440 x 720 DPI Microweave (12)
+1440x720mwuni 1440 x 720 DPI Microweave Unidirectional (12)
+1440x720sw 1440 x 720 DPI (13)
+1440x720swuni 1440 x 720 DPI Unidirectional (13, 14)
+1440x720hq 1440 x 720 DPI Highest Quality (13)
+
+2880x720sw 2880 x 720 DPI (15)
+2880x720swuni 2880 x 720 DPI Unidirectional (15)
+
+1440x1440sw 1440 x 1440 DPI (16)
+1440x1440hq2 1440 x 1440 DPI Highest Quality (16)
+
+2880x1440sw 2880 x 1440 DPI (16)
+
+(*) This resolution is the default on all printers supporting this
+ setting.
+
+(1) Works on printers that have a basic vertical spacing of 1/90".
+ This includes the Stylus Color, Stylus Color 440, 460, 600, 640,
+ 660, 670, and 1500, and Stylus Photo, Stylus Photo 700, 720, and
+ EX.
+
+(2) Works on printers most that have a basic vertical spacing of 1/90,
+ 1/180, or 1/360 inch. This includes Stylus Color, Stylus Color
+ 440, 460, 600, 640, 660, 670, 800, 850, 900, 980, 1500, 1520,
+ 3000, and Stylus Photo, Stylus Photo 700, 720 and EX.
+
+(3) Works on Stylus C70 and C80.
+
+(4) Works on older printers with dot spacing of 1/120 inch. This
+ includes the Stylus Color Pro, Pro XL, 400, and 500.
+
+(5) Works on newer printers with dot spacing of 1/120 inch. This
+ includes the Stylus C20, C40, and C60, the Stylus Color 480, 580,
+ 680, 740, 760, 777, 860, 880, 83, and 1160, and the Stylus Photo
+ 750, 780, 785, 790, 810, 820, 870, 875, 890, 895, 1270, 1280,
+ 1290, and 2000P, and the Stylus Scan 2000.
+
+(6) Works on all printers that do not support variable drop sizes.
+ This includes the Stylus Color, Stylus Color 400, 440, 460, 500,
+ 600, 640, 660, 800, 850, 1500, 1520, and 3000, and Stylus Color
+ Pro, and Stylus Photo, Stylus Photo 700, and EX.
+
+(7) Works on all printers that do support variable drop sizes. This
+ includes all supported Epson Stylus printers except for those
+ listed in note (6).
+
+(8) Recommended only on processors slower than 200 MHz, the system is
+ heavily loaded with a faster processor, or if problems are
+ experienced at 720x360.
+
+(9) Works on all supported printers except for Stylus Color, Stylus
+ Color Pro, Stylus Color Pro XL, Stylus Color 1500, 1520, and 3000.
+
+(10) On printers that do not support variable drop size (see note (4)),
+ this will print as fast as 360 DPI, and faster than 360 DPI High
+ Quality. It will take twice as long to generate output, which may
+ be important on a heavily loaded system or a processor slower than
+ 200 MHz.
+
+(11) Works on some older printers, including the Stylus Color, Stylus
+ Color 400, 500, 600, 800, 850, 1500, 1520, and 3000, Stylus Color
+ Pro, and Stylus Color Pro XL. Not recommended except for the
+ Stylus Color, Stylus Color 1500, 1520, and 3000.
+
+(12) Works on Stylus Color 600, 800, 850, 1520, and 3000. Not
+ recommended unless other 1440x720 modes do not work.
+
+(13) Works on all printers that support 1440x720 DPI. This includes
+ all supported printers except for the Stylus Color, Stylus Color
+ Pro, Pro XL, 400, 440, 460, 480, 500, and 1500, and Stylus Photo.
+ In addition, this may not work correctly on Stylus Color 1520 and
+ Stylus Color 3000.
+
+(14) This is identical to 1440 x 720 Highest Quality (1440x720hq) on
+ the Stylus Color 900.
+
+(15) Works on all printers that support 2880x720 DPI. This includes
+ the Stylus C60, C70, and C80, the Stylus Color 680, 777, 880, 83,
+ and 980, and Stylus Photo 780, 790, 810, 820, 890, 1280, and 1290.
+
+(16) Works on Stylus C70 and Stylus C80. These resolutions are not
+ supported by Epson and may not work on all C70 or C80 printers.
+
+
+The Stylus Pro printers (Stylus Pro 5000, 5500, 7000, 7500, 9000,
+9500, and 10000) support additional microweave modes known as Full
+Overlap (FOL), Four Pass, and FOL2. The Stylus Pro 5500, 7500, 9500,
+and 10000 additionally have a mode called MW2. These modes can only
+be used at certain resolutions. Stylus Pro printers support the
+following resolutions:
+
+180dpi 180 DPI
+
+360dpi 360 DPI
+360uni 360 DPI Unidirectional
+360mw 360 DPI Microweave
+360mwuni 360 DPI Microweave Unidirectional
+360fol 360 DPI Full Overlap
+360foluni 360 DPI Full Overlap Unidirectional
+360fol2 360 DPI FOL2
+360fol2uni 360 DPI FOL2 Unidirectional
+360mw2 360 DPI MW2
+360mw2uni 360 DPI MW2 Unidirectional
+
+720x360dpi 720 x 360 DPI
+720x360uni 720 x 360 DPI Unidirectional
+720x360fol 720 x 360 DPI FOL
+720x360foluni 720 x 360 DPI FOL Unidirectional
+720x360fol2 720 x 360 DPI FOL2
+720x360fol2uni 720 x 360 DPI FOL2 Unidirectional
+720x360mw2 720 x 360 DPI MW2
+720x360mw2uni 720 x 360 DPI MW2 Unidirectional
+
+720dpi 720 DPI
+720uni 720 DPI Unidirectional
+720mw 720 DPI Microweave
+720mwuni 720 DPI Microweave Unidirectional
+720fol 720 DPI Full Overlap
+720foluni 720 DPI Full Overlap Unidirectional
+720fourp 720 DPI Four Pass
+720fourpuni 720 DPI Four Pass Unidirectional
+
+1440x720dpi 1440 x 720 DPI
+1440x720uni 1440 x 720 DPI Unidirectional
+1440x720mw 1440 x 720 DPI Microweave
+1440x720mwuni 1440 x 720 DPI Microweave Unidirectional
+1440x720fol 1440 x 720 DPI FOL
+1440x720foluni 1440 x 720 DPI FOL Unidirectional
+1440x720fourp 1440 x 720 DPI Four Pass
+1440x720fourpuni 1440 x 720 DPI Four Pass Unidirectional
+
+
+For PCL printers (including Hewlett-Packard and Lexmark 4076):
+
+150dpi 150x150 DPI (should work on all printers)
+300dpi 300x300 DPI (should work on all printers, C-RET on
+ DJ 850/855/870/890)
+600x300dpi 600x300 DPI (DJ 6xx/810/812/840/842/895)
+600mono 600x600 DPI monochrome
+ (DJ 6xx (except 69x) /8xx/1100/1120)
+600dpi 600x600 DPI (DJ 69x/840/9xx/1220/2000/2500,
+ PhotoSmart P1000/P1100, LJ5/5Si/6)
+
+Note: the higher resolutions of newer PCL printers using "Photo-Ret" are
+not yet supported.
+
+
+For Lexmark printers other than the 4076:
+
+300x600dpi 300 DPI x 600 DPI
+600dpi 600 DPI
+600hq 600 DPI high quality
+600uni 600 DPI Unidirectional
+1200dpi 1200 DPI
+1200hq 1200 DPI high quality
+1200hq2 1200 DPI highest quality
+1200uni 1200 DPI Unidirectional
+2400x1200dpi 2400 DPI x 1200 DPI (Z52)
+2400x1200hq 2400 DPI x 1200 DPI high quality (Z52)
+2400x1200hq2 2400 DPI x 1200 DPI highest quality (Z52)
+
+
+For Canon printers:
+
+1200 DPI printers (BJC 7000, BJC 7100, BJC 8200, BJC 8500):
+
+300dpi 300x300 DPI
+300dmt 300x300 DPI DMT
+600dpi 600x600 DPI
+600dmt 600x600 DPI DMT
+1200x600dpi 1200x600 DPI
+1200dpi 1200x1200 DPI
+
+1440 DPI printers (BJC 1000, BJC 2000, BJC 3000, BJC 4300, BJC 4400,
+ BJC 5100, BJC 5500, BJC 6000, BJC 6100, BJC 6500, BJC 8200):
+
+360dpi 360x360 DPI
+360dmt 360x360 DPI DMT
+720x360dpi 720x360 DPI
+720dpi 720x720 DPI
+1440x720dpi 1440x720 DPI
+1440dpi 1440x1440 DPI
+
+
+Ink Types
+--- -----
+
+This is printer type specific. The option names are case sensitive.
+The option names are case sensitive. Two names are listed for each
+resolution; the first (short) name is the value that must be passed to
+-sInkType, and the second (long) name is descriptive. Not all ink
+types are supported on all printers.
+
+-sInkType=inktype
+
+
+For Epson and Lexmark (other than the 4076) printers:
+
+Six color printers can print using four color inks or all six colors.
+Six color mode is recommended for photographs. Four color mode may be
+useful when printing text with embedded graphics to reduce ink
+consumption, or to print higher quality with Ordered, Fast, or Very
+Fast dithering (see below).
+
+The "Composite" modes use only color inks (no black) to produce all
+colors and black. These ink types are rarely useful, but on certain
+types of paper they may produce a smoother image than that produced by
+mixing black ink in. The Epson Stylus Color 1500 cannot mix black ink
+with colored inks; on this printer, Three Color Composite must be
+used.
+
+As of this writing (September 2001), no seven color printers are sold
+in North America. When such a printer is sold, the Seven Color
+Enhanced and Six Color Enhanced Composite modes will utilize all of
+these inks.
+
+Photo7 Seven Color Enhanced
+PhotoEnhance Six Color Enhanced Composite
+PhotoCMYK Six Color Photo
+PhotoCMY Five Color Photo Composite
+CMYK Four Color Standard
+RGB Three Color Composite
+
+
+For Canon printers:
+
+Gray Black
+RGB Color
+CMYK Black/Color
+PhotoCMY Photo/Color
+PhotoCMYK Photo
+
+
+For PCL (Hewlett-Packard and Lexmark 4076) color printers:
+
+CMYK Color + Black Cartridges
+Photo Color + Photo Cartridges (For Deskjet 69x only)
+
+Black and white PCL printers (laser printers, in particular) do not
+allow any value to be specified for the ink type.
+
+
+Media Types
+----- -----
+
+This is printer type specific. The option names are case sensitive.
+Two names are listed for each resolution; the first (short) name is
+the value that must be passed to -sMediaType, and the second (long) name
+is descriptive.
+
+-sMediaType=mediatype
+
+
+For Epson and Lexmark (other than the 4076) inkjet printers:
+
+Plain Plain Paper
+PlainFast Plain Paper Fast Load
+Postcard Postcard
+GlossyFilm Glossy Film
+Transparency Transparencies
+Envelope Envelopes
+BackFilm Back Light Film
+Matte Matte Paper
+Inkjet Inkjet Paper
+Coated Photo Quality Inkjet Paper
+GlossyPhoto Premium Glossy Photo Paper
+Luster Premium Luster Photo Paper
+Photo Photo Paper
+Glossy Photo Quality Glossy Paper
+Ilford Ilford Heavy Paper
+Other Other
+
+We have found that glossy photo papers not specifically designed for
+Epson printers generally perform poorly in Epson printers. The ink
+tends to pool on the paper, causing muddy shadows and possibly leaving
+ink on the printer rollers. Use of the highest quality printing modes
+(1440x720 highest quality and 2880x720 unidirectional) produces the
+best result on such papers, probably because printing is slower and
+there is more time for the ink to dry.
+
+
+For Canon printers:
+
+Plain Plain Paper
+Transparency Transparencies
+BackFilm Back Print Film
+Fabric Fabric Sheets
+Envelope Envelope
+Coated High Resolution Paper
+TShirt T-Shirt Transfers
+GlossyFilm High Gloss Film
+GlossyPaper Glossy Photo Paper
+GlossyCards Glossy Photo Cards
+GlossyPro Photo Paper Pro
+
+
+For PCL (Hewlett-Packard and Lexmark 4076) inkjet printers:
+
+Plain Plain
+Bond Bond
+Premium Premium
+Glossy Glossy/Photo
+Transparency Transparency
+GlossyQD Quick-dry Photo
+TransparencyQD Quick-dry Transparency
+
+PCL laser printers do not allow specification of any media type.
+
+
+Media Sources
+----- -------
+
+This is printer type specific. The option names are case sensitive.
+
+-sInputSlot=mediasource
+
+For Epson printers:
+
+Standard Standard
+Roll Roll Feed (for certain Stylus Photo and Stylus
+ Pro models only)
+
+
+For Canon printers:
+
+Auto Auto Sheet Feeder
+Manual Manual with Pause
+ManualNP Manual without Pause
+
+
+For PCL (Hewlett-Packard and Lexmark 4076) printers. Different
+printers allow different choices out of this set.
+
+Standard Standard (Feed from printer defined source)
+Manual Manual
+MultiPurpose Tray 1
+Upper Tray 2
+Lower Tray 3
+LargeCapacity Tray 4
+Portable Portable Sheet Feeder
+Desktop Desktop Sheet Feeder
+Tray Tray
+Tray2 Tray 2
+Optional Optional Source
+Auto Autoselect
+
+
+For Lexmark printers other than the 4076:
+
+Auto Auto Sheet Feeder
+Manual Manual with Pause
+ManualNP Manual without Pause
+
+
+Media Sizes
+----- -----
+
+This is printer-specific; we cannot list the correct values for each
+printer here. The option names are case-sensitive. Two names are
+listed for each resolution; the first (short) name is the value that
+must be passed to -sPaperSize, and the second (long) name is
+descriptive. This option does not set GhostScript up to use a paper
+size other than the default; it only tells the driver to set up the
+printer for a different paper size. The default paper size is
+'Letter'.
+
+-sPaperSize=papersize
+
+
+ * Common English paper sizes
+
+Letter Letter 8.5in x 11in
+Legal Legal 8.5in x 14in
+Tabloid Tabloid 11in x 17in
+Executive Executive 7.25in x 10.5in
+Postcard Postcard 100mm x 147mm
+w216h360 3x5
+w288h432 4x6
+w324h495 Epson 4x6 Photo Paper
+w360h504 5x7
+w360h576 5x8
+8x10 8x10
+Statement Manual 5.5in x 8.5in
+TabloidExtra 12x18
+SuperB 13x19
+
+ * Common photographic paper sizes
+
+w576h864 8x12 Sometimes used for 35 mm
+w792h1008 11x14
+w1152h1440 16x20
+w1152h1728 16x24 20x24 for 35 mm
+w1440h1728 20x24
+w1440h2160 20x30 24x30 for 35 mm
+w1728h2160 24x30
+w1728h2592 24x36 Sometimes used for 35 mm
+w2160h2880 30x40
+
+ International Paper Sizes (mostly taken from BS4000:1968)
+
+ * "A" series: Paper and boards, trimmed sizes
+ *
+ * "A" sizes are in the ratio 1 : sqrt(2). A0 has a total area
+ * of 1 square metre. Everything is rounded to the nearest
+ * millimetre. Thus, A0 is 841mm x 1189mm. Every other A
+ * size is obtained by doubling or halving another A size.
+
+w4768h6749 4A 1682mm x 2378mm
+w3370h4768 2A 1189mm x 1682mm
+A0 A0 841mm x 1189mm
+A1 A1 594mm x 841mm
+A2 A2 420mm x 594mm
+A3 A3 297mm x 420mm
+A4 A4 210mm x 297mm
+A5 A5 148mm x 210mm
+A6 A6 105mm x 148mm
+A7 A7 74mm x 105mm
+A8 A8 52mm x 74mm
+A9 A9 37mm x 52mm
+A10 A10 26mm x 37mm
+
+ * Stock sizes for normal trims.
+ * Allowance for trim is 3 millimetres.
+
+w2437h3458 RA0 860mm x 1220mm
+w1729h2437 RA1 610mm x 860mm
+w1218h1729 RA2 430mm x 610mm
+w864h1218 RA3 305mm x 430mm
+w609h864 RA4 215mm x 305mm
+
+ * Stock sizes for bled work or extra trims.
+
+w2551h3628 SRA0 900mm x 1280mm
+w1814h2551 SRA1 640mm x 900mm
+w1275h1814 SRA2 450mm x 640mm
+w907h1275 SRA3 320mm x 450mm
+w637h907 SRA4 225mm x 320mm
+
+ * "B" series: Posters, wall charts and similar items.
+
+w5669h8016 4B ISO 2000mm x 2828mm
+w4008h5669 2B ISO 1414mm x 2000mm
+ISOB0 B0 ISO 1000mm x 1414mm
+ISOB1 B1 ISO 707mm x 1000mm
+ISOB2 B2 ISO 500mm x 707mm
+ISOB3 B3 ISO 353mm x 500mm
+ISOB4 B4 ISO 250mm x 353mm
+ISOB5 B5 ISO 176mm x 250mm
+ISOB6 B6 ISO 125mm x 176mm
+ISOB7 B7 ISO 88mm x 125mm
+ISOB8 B8 ISO 62mm x 88mm
+ISOB9 B9 ISO 44mm x 62mm
+ISOB10 B10 ISO 31mm x 44mm
+
+B0 B0 JIS
+B1 B1 JIS
+B2 B2 JIS
+B3 B3 JIS
+B4 B4 JIS
+B5 B5 JIS
+B6 B6 JIS
+B7 B7 JIS
+B8 B8 JIS
+B9 B9 JIS
+B10 B10 JIS
+
+ * "C" series: Envelopes or folders suitable for A size stationery.
+
+C0 C0 917mm x 1297mm
+C1 C1 648mm x 917mm
+C2 C2 458mm x 648mm
+C3 C3 324mm x 458mm
+C4 C4 229mm x 324mm
+C5 C5 162mm x 229mm
+w354h918 B6-C4 125mm x 324mm
+C6 C6 114mm x 162mm
+DL DL 110mm x 220mm
+w229h459 C7-6 81mm x 162mm
+C7 C7 81mm x 114mm
+C8 C8 57mm x 81mm
+C9 C9 40mm x 57mm
+C10 C10 28mm x 40mm
+
+ * US CAD standard paper sizes
+
+ARCHA ArchA 9x12in
+ARCHB ArchB 12x18in
+ARCHC ArchC 18x24in
+ARCHD ArchD 24x36in
+ARCHE ArchE 36x48in
+
+ * Foolscap
+
+w612h936 American foolscap
+w648h936 European foolscap
+
+ * Sizes for book production
+ * The BPIF and the Publishers Association jointly recommend ten
+ * standard metric sizes for case-bound titles as follows:
+
+w535h697 Crown Quarto 189mm x 246mm
+w569h731 Large Crown Quarto 201mm x 258mm
+w620h782 Demy Quarto 219mm x 276mm
+w671h884 Royal Quarto 237mm x 312mm
+w348h527 Crown Octavo 123mm x 186mm
+w365h561 Large Crown Octavo 129mm x 198mm
+w391h612 Demy Octavo 138mm x 216mm
+w442h663 Royal Octavo 156mm x 234mm
+
+ * Paperback sizes in common usage
+
+w314h504 Small paperback 111mm x 178mm
+w314h513 Penguin small paperback 111mm x 181mm
+w365h561 Penguin large paperback 129mm x 198mm
+
+ * Miscellaneous sizes
+
+w283h420 Hagaki Card 100 x 148 mm
+w420h567 Oufuku Card 148 x 200 mm
+w340h666 Long 3 Japanese long envelope #3
+w255h581 Long 4 Japanese long envelope #4
+w680h941 Kaku Japanese Kaku envelope #4
+COM10 Commercial 10 US Commercial 10 env
+w315h414 A2 Invitation US A2 invitation
+
+
+Color Balancing Values: (min,max,default)
+----- --------- ------- -----------------
+
+All of the values below are interpreted as being relative to norms for
+a particular printer established through testing, not "absolute"
+values of any kind.
+
+-dCyan=xxx xxx: 0.0 ... 4.0 (1.0)
+-dMagenta=xxx xxx: 0.0 ... 4.0 (1.0)
+-dYellow=xxx xxx: 0.0 ... 4.0 (1.0)
+
+ These three options allow specification of the cyan, magenta, and
+ yellow levels independently, for rebalancing the levels. Normally,
+ these should be adjusted to yield neutral gray, but they can be used
+ for other effects.
+
+-dBrightness=xxx xxx: 0.0 ... 2.0 (1.0)
+
+ Adjust the brightness of the image. 0.0 gives a fully black image;
+ 2.0 gives a fully white image. Values greater than 1 will result in
+ black not being solid and highlights turning white; values less than
+ 1 will result in white not being perfectly clear and shadows turning
+ black.
+
+-dContrast=xxx xxx: 0.0 ... 4.0 (1.0)
+
+ Adjust the contrast of the image. 0.0 gives a solid gray for the
+ entire image, the exact gray depending upon the brightness chosen.
+
+-dGamma=xxx xxx: 0.1 ... 4.0 (1.0)
+
+ Adjust the gamma of the image, over and above the printer-specific
+ correction. Gamma less than 1.0 will result in a darker image; gamma
+ greater than 1.0 will result in a lighter image. Unlike brightness,
+ gamma adjustment does not change the endpoints; it merely changes the
+ shape of the input->output curve.
+
+-dDensity=xxx xxx: 0.1 ... 2.0 (1.0)
+
+ Adjust the amount of ink deposited on the paper. If you've chosen
+ the correct paper type and you're getting ink bleeding through the
+ paper or puddling, try reducing the density to the lowest value you
+ can while still achieving solid black. If you're not getting solid
+ black, even with the contrast and brightness at 1.0, try increasing
+ the density.
+
+ All of the printers supported here actually need less than 100% ink
+ density in most cases, so the actual density is something other than
+ the nominal density setting. The effective density setting cannot go
+ above 100%, so if a value specified will result in an excessively
+ high density level, it will be silently limited to 1.0.
+
+-dSaturation=xxx xxx: 0.0 ... 9.0 (1.0)
+
+ Adjust the brilliance of colors. 0.0 results in pure grayscale;
+ using this with -dColor=1 is one way of getting grayscale (see below
+ under -dColor for a full discussion). Saturation of less than 1.0
+ results in more muted colors; saturation of greater than 1.0 results
+ in more vibrant colors. Very high saturation often results in very
+ strange effects, including posterization and banding that might not
+ be expected. For normal purposes, the saturation should generally be
+ less than 1.5.
+
+
+Dithering Algorithms:
+--------- -----------
+
+The option names are case sensitive. Two names are listed for each
+resolution; the first (short) name is the value that must be passed to
+-sDither, and the second (long) name is descriptive.
+
+-sDither=algorithm
+
+Adaptive Adaptive Hybrid
+Ordered Ordered
+Fast Fast
+VeryFast Very Fast
+Floyd Hybrid Floyd-Steinberg
+
+For highest quality, we recommend use of Adaptive Hybrid dithering.
+For continuous tone images, Ordered works just as well and is somewhat
+faster. Ordered dithering yields noticeably inferior results with
+text and intricate line art, particularly at high resolutions.
+
+Fast dithering, which is a simplified version of ordered dither, is
+significantly faster, but color accuracy is worse, particularly on six
+color printers and printer using variable dot sizes. On simple four
+color printers, the quality is quite reasonable, although color
+printing will show more speckling in dark tones than Ordered dither.
+For single dot size printers, printing grayscale, this algorithm
+yields almost identical results to Ordered with some performance
+improvement. On three color printers, the results should be very
+similar to Ordered.
+
+Very Fast is even faster than Fast, with even more loss of quality.
+It shows even more speckling, and the output is heavily patterned. On
+laser printers, and possibly on certain kinds of text and line art,
+Very Fast dithering may actually yield the best quality.
+
+Error diffusion algorithms (Hybrid Floyd-Steinberg is such an
+algorithm) perform very well at high densities, and are capable of
+rendering very fine detail well, but they tend to exhibit artifacts in
+the form of "waves" or "worms" of dots which results in noticeable
+texturing in pale areas. Furthermore, pale areas immediately adjacent
+to white take a while to "build up" sufficient error to print at all.
+This is sometimes called "tearing". Its use is not recommended.
+
+
+Output Type
+------ ----
+
+-dColor=x x: 0 ... 2 (1 on color printers, 0 otherwise)
+
+0 Grayscale
+1 Color
+2 Black and white
+
+ Choose color vs. grayscale output. Color output is the default.
+ Choosing -dColor=0 results in only black ink (no color ink) being
+ used, which is faster and usually results in the most accurate
+ grayscale, but at the expense of smoothness. If you want composite
+ color (using a mixture of color and black inks to produce gray), use
+ -dColor=1 and -dSaturation=0.0 (see -dSaturation above).
+
+ In addition, using -dColor=0 uses luminance (perceived brightness) of
+ red, green, and blue to choose output levels. Blue of a given
+ intensity is perceived to be much darker than red, which in turn
+ appears darker than green. -dColor=1 and -dSaturation=0.0 does not
+ use luminance.
+
+ -dColor=2 prints only black and white (thresholding). This option
+ always uses Fast dithering unless you specify Very Fast.
+
+
+Image type (to optimize the dither):
+----- ---- --- -------- --- --------
+
+-dImageType=x x: 0 ... 2 (0)
+Select the image type most representative of what's being printed.
+
+0 Line art (color or gray scale)
+1 Primarily solid colors or smooth gradients (color or gray scale)
+2 Continuous-tone photographs (color or gray scale)
+
+Option 0 is the fastest. It generates strong, but not particularly
+accurate, colors. There may be some fairly sharp color transitions in
+this mode.
+
+Option 1 generates more accurate colors, but is slower.
+
+Option 2 generates the most accurate colors, but is considerably
+slower.
+
+Note that any of the modes may be used with either color or black &
+white output. If black and white output is requested, but a color
+mode used, composite color will be printed. This generally offers
+smoother tone, but less purity of gray or black, than pure black ink.
+Furthermore, it is possible to tune the color of the gray (to achieve
+warmer or cooler effects) using the color controls in this fashion.
+
+Specifying a lower GhostScript resolution (with -r) results in faster
+color conversion. For example, if you print at 1440x720 DPI, but
+specify a Ghostscript resolution of 360 DPI (with -r360), output will
+be significantly faster and there will be much less difference in
+performance between the three image type options.
+
+
+EXAMPLES:
+---------
+
+Example 1 (print charts to file, color, 360 dpi):
+gs -sDEVICE=stp -sModel=escp2-ex -dDensity=1.6 -dGamma=1.5 -dSaturation=0.9 \
+ -dBrightness=.4 -dImageType=1 -sOutputFile=itsyourchoice.prn foo.ps
+
+Example 2 (print color photograph to /dev/lp0 at maximum quality):
+gs -q -dSAFER -dNOPAUSE -sDEVICE=stp -sModel=escp2-870 -dDensity=0.8 \
+ -r1440x720 -sQuality=1440x720hq -dImageType=2 -sOutputFile=/dev/lp0 foo.ps
+
+Example 3 (print pure black text to stdout)
+gs -q -dSAFER -dNOPAUSE -sDEVICE=stp -sModel=escp2-660 -dDensity=0.8 -r720 \
+ -sQuality=720sw -dColor=2 -sOutputFile=- foo.ps
diff --git a/src/ghost/README.bsd b/src/ghost/README.bsd
new file mode 100644
index 0000000..c6729db
--- /dev/null
+++ b/src/ghost/README.bsd
@@ -0,0 +1,57 @@
+stp printing with FreeBSD
+=========================
+
+by Philipp Huber <uebs@gmx.at> (C) 2000
+
+The Ghostcsript6 Port of FreeBSD does not include the stp driver,
+therefore it's necesseray to do some changes by hand :)
+
+First of all, the Ghostscript6 Ports has to be downloaded, extracted and
+patching must be done.
+
+ cd /usr/ports/print/ghostscript6
+ make patch
+
+After this, download print-4.0b2 (or another version, i did it with this
+one) from
+
+ http://download.sourceforge.net/gimp-print/print-4.0b2.tar.gz
+
+Place the file into the workdir of the ghostscript6 port and unzip it:
+
+ cp print-4.0b2.tar.gz /usr/ports/print/ghostscript6/work/gs6.01
+ cd /usr/ports/print/ghostscript6/work/gs6.01
+ tar xzf print-4.0b2.tar.gz
+
+Follow the directions as described in "Ghost/README":
+First, copy all *.c and *.h files into the ghostscript src directory.
+
+ cd print-4.0b2/Ghost
+ cp *.c ../../src/
+ cp *.h ../../src/
+
+Edit "contrib.mak" in the src directory of ghosts
+cript (where the *.c and
+*.h files where copied to in the previous step). Add the contents of the
+file "contrib.mak.addon" in the "print-4.0b2/Ghost" directory at the end of the
+"contrib.mak" file.
+The next step is to add "$(DD)stp.dev to the line "DEVICE_DEVS6=" in
+"unix-gcc.mak".
+
+After all these changes have been made, do a
+
+ cd /usr/ports/print/ghostscript6 ; make install
+
+All should compile fine, and after that you have ghostscript6 with the
+stp driver compiled in. Run "gs -h" to be absolutely sure :)
+
+Don't forget to update or adjust your filters!
+See print-4.0b2/Ghost/README for further details and examples.
+
+All this should work with NetBSD and OpenBSD as well, but i didn't
+test it anyway. Good luck and have fun :)
+
+Please note that the current Ghostscript 6 license (Aladdin Free
+Public License) is not compatible with the GPL, and thus you cannot
+distribute the result. However, you may apply this procedure for your
+own use.
diff --git a/src/ghost/contrib.mak.addon.in b/src/ghost/contrib.mak.addon.in
new file mode 100644
index 0000000..b41d477
--- /dev/null
+++ b/src/ghost/contrib.mak.addon.in
@@ -0,0 +1,17 @@
+### --------------- Gimp-Print/stp Driver ---------------------------- ###
+### Be careful to add the exact contents of this file; cut and paste ###
+### may corrupt the file and cause mysterious make errors ###
+
+stp_=$(GLOBJ)gdevstp.$(OBJ)
+
+STPINCDIR=-I@includedir@
+STPLIBDIR=-L@libdir@
+STPLIB=gimpprint
+
+$(DD)stp.dev: $(stp_) $(DD)page.dev
+ $(SETPDEV) $(DD)stp $(stp_)
+ $(ADDMOD) $(DD)stp -link $(STPLIBDIR)
+ $(ADDMOD) $(DD)stp -lib $(STPLIB)
+
+$(GLOBJ)gdevstp.$(OBJ) : $(GLSRC)gdevstp.c $(PDEVH)
+ $(GLCC) $(GLO_)gdevstp.$(OBJ) $(C_) $(STPINCDIR) $(GLSRC)gdevstp.c
diff --git a/src/ghost/contrib.mak.addon.old b/src/ghost/contrib.mak.addon.old
new file mode 100644
index 0000000..7fd6e2f
--- /dev/null
+++ b/src/ghost/contrib.mak.addon.old
@@ -0,0 +1,51 @@
+### --------------- Gimp-Print/stp Driver ---------------------------- ###
+### Be careful to add the exact contents of this file; cut and paste ###
+### may corrupt the file and cause mysterious make errors ###
+
+stp_=$(GLOBJ)gdevstp.$(OBJ) \
+ $(GLOBJ)gdevstp-dither.$(OBJ) \
+ $(GLOBJ)gdevstp-dither-matrices.$(OBJ) \
+ $(GLOBJ)gdevstp-util.$(OBJ) \
+ $(GLOBJ)gdevstp-color.$(OBJ) \
+ $(GLOBJ)gdevstp-weave.$(OBJ) \
+ $(GLOBJ)gdevstp-escp2.$(OBJ) \
+ $(GLOBJ)gdevstp-lexmark.$(OBJ) \
+ $(GLOBJ)gdevstp-pcl.$(OBJ) \
+ $(GLOBJ)gdevstp-canon.$(OBJ) \
+ $(GLOBJ)gdevstp-ps.$(OBJ)
+
+$(DD)stp.dev: $(stp_) $(DD)page.dev
+ $(SETPDEV) $(DD)stp $(stp_)
+
+$(GLOBJ)gdevstp.$(OBJ) : $(GLSRC)gdevstp.c $(PDEVH) $(GLSRC)gdevstp-print.h
+ $(GLCC) $(GLO_)gdevstp.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp.c
+
+$(GLOBJ)gdevstp-util.$(OBJ) : $(GLSRC)gdevstp-util.c $(GLSRC)gdevstp-printers.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-util.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-util.c
+
+$(GLOBJ)gdevstp-weave.$(OBJ) : $(GLSRC)gdevstp-weave.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-weave.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-weave.c
+
+$(GLOBJ)gdevstp-color.$(OBJ) : $(GLSRC)gdevstp-color.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-color.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-color.c
+
+$(GLOBJ)gdevstp-dither.$(OBJ) : $(GLSRC)gdevstp-dither.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-dither.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-dither.c
+
+$(GLOBJ)gdevstp-dither-matrices.$(OBJ) : $(GLSRC)gdevstp-dither-matrices.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-dither-matrices.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-dither-matrices.c
+
+$(GLOBJ)gdevstp-escp2.$(OBJ) : $(GLSRC)gdevstp-escp2.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-escp2.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-escp2.c
+
+$(GLOBJ)gdevstp-lexmark.$(OBJ) : $(GLSRC)gdevstp-lexmark.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-lexmark.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-lexmark.c
+
+$(GLOBJ)gdevstp-pcl.$(OBJ) : $(GLSRC)gdevstp-pcl.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-pcl.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-pcl.c
+
+$(GLOBJ)gdevstp-canon.$(OBJ) : $(GLSRC)gdevstp-canon.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-canon.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-canon.c
+
+$(GLOBJ)gdevstp-ps.$(OBJ) : $(GLSRC)gdevstp-ps.c $(PDEVH) $(GLSRC)gdevstp-print.h $(GLSRC)gdevstp-print-internal.h
+ $(GLCC) $(GLO_)gdevstp-ps.$(OBJ) $(C_) -DDISABLE_NLS $(GLSRC)gdevstp-ps.c
diff --git a/src/ghost/debian-patch b/src/ghost/debian-patch
new file mode 100644
index 0000000..1f654c0
--- /dev/null
+++ b/src/ghost/debian-patch
@@ -0,0 +1,40 @@
+diff -u -r /home/sharkey/gstemp/gs-5.10/debian/control ./control
+--- /home/sharkey/gstemp/gs-5.10/debian/control Sat May 13 09:14:33 2000
++++ ./control Sat May 13 08:48:54 2000
+@@ -36,3 +36,6 @@
+ .
+ This package also contains the hpdj driver contributed by
+ Martin Lottermoser and the hp8xx driver by Uli Wortmann.
++ .
++ This package is identical to the official gs package, except the
++ Gimp-Print printer driver suite (stp) has been added.
+--- gs-5.10/debian/rules Sat May 13 09:57:03 2000
++++ /home/sharkey/gstemp/gs-5.10/debian/rules Mon May 8 23:05:00 2000
+@@ -22,6 +22,7 @@
+ jpdrivers-support = $(INCLUDE_GPL)
+ lexmark-support = $(INCLUDE_GPL)
+ hpdj-support = $(INCLUDE_LGPL)
++stp-support = $(INCLUDE_GPL)
+
+ # Uncomment following line for conflicted jpdrivers support.
+ # Be sure to disable hp8xx-support and enable jpdrivers support.
+@@ -68,6 +69,7 @@
+ include debian/patches/jpdrivers
+ include debian/patches/lexmark
+ include debian/patches/hpdj
++include debian/patches/stp
+
+ patch-contrib: $(APPLY_PATCHES)
+ unpatch-contrib: $(UNAPPLY_PATCHES)
+--- gs-5.10/debian/changelog Sun Nov 12 18:31:32 2000
++++ /home/sharkey/gstemp/gs-5.10/debian/changelog Sun Nov 12 18:38:15 2000
+@@ -1,3 +1,9 @@
++gs (5.10stp-11) unstable; urgency=low
++
++ * Added Gimp-Print STP driver
++
++ -- Eric Sharkey <sharkey@debian.org> Sun, 4 Feb 2001 15:41:17 +0900
++
+ gs (5.10-11) unstable; urgency=low
+
+ * debian/control: Added build time dependency for libfreetype2-dev
diff --git a/src/ghost/debian-patch-stp b/src/ghost/debian-patch-stp
new file mode 100644
index 0000000..92d0cc3
--- /dev/null
+++ b/src/ghost/debian-patch-stp
@@ -0,0 +1,34 @@
+#This script is to be included into the Debian gs build scripts.
+#Do not execute it alone.
+
+ifeq ($(stp-support), yes)
+APPLY_PATCHES := $(APPLY_PATCHES) patch-stp
+UNAPPLY_PATCHES := unpatch-stp $(UNAPPLY_PATCHES)
+INSTALL_PATCHES := $(INSTALL_PATCHES) install-stp
+endif
+
+patch-stp: patch-stp-stamp
+patch-stp-stamp:
+ @echo -n Adding stp support...
+ @cp contrib/stp/*.[ch] .
+ @cp devs.mak devs.mak.stp-old
+ @cat contrib/stp/devs.mak.addon-5.10 >>devs.mak
+ @debian/addentry gcc-head.mak DEVICE_DEVS6 stp.dev
+ @touch $@
+ @echo done
+
+unpatch-stp:
+ @echo -n Removing stp support...
+ @if [ -f patch-stp-stamp ]; then \
+ mv devs.mak.stp-old devs.mak; \
+ debian/addentry --remove gcc-head.mak DEVICE_DEVS6 stp.dev; \
+ cd contrib/stp; \
+ for i in *.[ch]; do \
+ rm -f ../../$$i; \
+ done; \
+ fi
+ @echo done
+ @rm -f patch-stp-stamp
+
+install-stp:
+ install -m 644 contrib/stp/README.stp $(GSDOCDIR)
diff --git a/src/ghost/devs.mak.addon-5.10 b/src/ghost/devs.mak.addon-5.10
new file mode 100644
index 0000000..b855859
--- /dev/null
+++ b/src/ghost/devs.mak.addon-5.10
@@ -0,0 +1,51 @@
+### --------------- Gimp-Print/stp Driver ---------------------------- ###
+### Be careful to add the exact contents of this file; cut and paste ###
+### may corrupt the file and cause mysterious make errors ###
+
+stp_=gdevstp.$(OBJ) \
+ gdevstp-dither.$(OBJ) \
+ gdevstp-dither-matrices.$(OBJ) \
+ gdevstp-util.$(OBJ) \
+ gdevstp-color.$(OBJ) \
+ gdevstp-weave.$(OBJ) \
+ gdevstp-escp2.$(OBJ) \
+ gdevstp-lexmark.$(OBJ) \
+ gdevstp-pcl.$(OBJ) \
+ gdevstp-canon.$(OBJ) \
+ gdevstp-ps.$(OBJ)
+
+$(DD)stp.dev: $(stp_) $(DD)page.dev
+ $(SETPDEV) $(DD)stp $(stp_)
+
+gdevstp.$(OBJ) : gdevstp.c $(PDEVH) gdevstp-print.h
+ $(CCC) -DDISABLE_NLS gdevstp.c
+
+gdevstp-util.$(OBJ) : gdevstp-util.c gdevstp-printers.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-util.c
+
+gdevstp-weave.$(OBJ) : gdevstp-weave.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-weave.c
+
+gdevstp-color.$(OBJ) : gdevstp-color.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-color.c
+
+gdevstp-dither.$(OBJ) : gdevstp-dither.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-dither.c
+
+gdevstp-dither-matrices.$(OBJ) : gdevstp-dither-matrices.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-dither.c
+
+gdevstp-escp2.$(OBJ) : gdevstp-escp2.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-escp2.c
+
+gdevstp-lexmark.$(OBJ) : gdevstp-lexmark.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-lexmark.c
+
+gdevstp-pcl.$(OBJ) : gdevstp-pcl.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-pcl.c
+
+gdevstp-canon.$(OBJ) : gdevstp-canon.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-canon.c
+
+gdevstp-ps.$(OBJ) : gdevstp-ps.c $(PDEVH) gdevstp-print.h gdevstp-print-internal.h
+ $(CCC) -DDISABLE_NLS gdevstp-ps.c
diff --git a/src/ghost/gdevstp.c b/src/ghost/gdevstp.c
new file mode 100644
index 0000000..f73ce7f
--- /dev/null
+++ b/src/ghost/gdevstp.c
@@ -0,0 +1,735 @@
+/*
+
+ stp driver for ghostscript
+
+ -gs frontend derived from gdevbmp and gdevcdj
+
+
+ written in January 2000 by
+ Henryk Richter <buggs@comlab.uni-rostock.de>
+ for ghostscript 5.x/6.x
+
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+/*$Id: gdevstp.c,v 1.14 2001/10/27 17:16:38 rlk Exp $ */
+/* stp output driver */
+#include "gdevprn.h"
+#include "gdevpccm.h"
+#include "gsparam.h"
+#include <stdlib.h>
+
+#ifdef DISABLE_NLS
+#include "gdevstp-print.h"
+#else
+#include <gimp-print/gimp-print.h>
+#endif
+
+/* internal debugging output ? */
+
+private int stp_debug = 0;
+
+#define STP_DEBUG(x) do { if (stp_debug || getenv("STP_DEBUG")) x; } while (0)
+
+/* ------ The device descriptors ------ */
+
+#define X_DPI 360
+#define Y_DPI 360
+
+private dev_proc_map_rgb_color(stp_map_16m_rgb_color);
+private dev_proc_map_color_rgb(stp_map_16m_color_rgb);
+private dev_proc_print_page(stp_print_page);
+private dev_proc_get_params(stp_get_params);
+private dev_proc_put_params(stp_put_params);
+private dev_proc_open_device(stp_open);
+
+/* 24-bit color. ghostscript driver */
+private const gx_device_procs stpm_procs =
+prn_color_params_procs(
+ stp_open, /*gdev_prn_open,*/ /* open file, delegated */
+ gdev_prn_output_page, /* output page, delegated */
+ gdev_prn_close, /* close file, delegated */
+ stp_map_16m_rgb_color, /* map color (own) */
+ stp_map_16m_color_rgb, /* map color (own) */
+ stp_get_params, /* get params (own) */
+ stp_put_params /* put params (own) */
+ );
+
+gx_device_printer gs_stp_device =
+prn_device(stpm_procs, "stp",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 24, stp_print_page);
+
+/* private data structure */
+typedef struct
+{
+ int topoffset; /* top offset in pixels */
+ int bottom;
+ stp_vars_t v;
+} privdata_t;
+
+/* global variables, RO for subfunctions */
+private privdata_t stp_data =
+{ 0, 0, NULL };
+
+typedef struct
+{
+ gx_device_printer *dev;
+ privdata_t *data;
+ uint raster;
+} stp_priv_image_t;
+
+static const char *Image_get_appname(stp_image_t *image);
+static void Image_progress_conclude(stp_image_t *image);
+static void Image_note_progress(stp_image_t *image,
+ double current, double total);
+static void Image_progress_init(stp_image_t *image);
+static stp_image_status_t Image_get_row(stp_image_t *image,
+ unsigned char *data, int row);
+static int Image_height(stp_image_t *image);
+static int Image_width(stp_image_t *image);
+static int Image_bpp(stp_image_t *image);
+static void Image_rotate_180(stp_image_t *image);
+static void Image_rotate_cw(stp_image_t *image);
+static void Image_rotate_ccw(stp_image_t *image);
+static void Image_init(stp_image_t *image);
+
+static stp_image_t theImage =
+{
+ Image_init,
+ NULL, /* reset */
+ NULL, /* transpose */
+ NULL, /* hflip */
+ NULL, /* vflip */
+ NULL, /* crop */
+ Image_rotate_ccw,
+ Image_rotate_cw,
+ Image_rotate_180,
+ Image_bpp,
+ Image_width,
+ Image_height,
+ Image_get_row,
+ Image_get_appname,
+ Image_progress_init,
+ Image_note_progress,
+ Image_progress_conclude,
+ NULL
+};
+
+/* ------ Private definitions ------ */
+
+/***********************************************************************
+* ghostscript driver function calls *
+***********************************************************************/
+
+private void
+stp_dbg(const char *msg, const privdata_t *stp_data)
+{
+ fprintf(gs_stderr,"%s Settings: c: %f m: %f y: %f\n",
+ msg, stp_get_cyan(stp_data->v), stp_get_magenta(stp_data->v),
+ stp_get_yellow(stp_data->v));
+ fprintf(gs_stderr, "Ink type %s\n", stp_get_ink_type(stp_data->v));
+
+ fprintf(gs_stderr,"Settings: bright: %f contrast: %f\n",
+ stp_get_brightness(stp_data->v), stp_get_contrast(stp_data->v));
+
+ fprintf(gs_stderr,"Settings: Gamma: %f Saturation: %f Density: %f\n",
+ stp_get_gamma(stp_data->v), stp_get_saturation(stp_data->v),
+ stp_get_density(stp_data->v));
+ fprintf(gs_stderr, "Settings: width %d, height %d\n",
+ stp_get_page_width(stp_data->v), stp_get_page_height(stp_data->v));
+ fprintf(gs_stderr, "Settings: output type %d image type %d\n",
+ stp_get_output_type(stp_data->v), stp_get_image_type(stp_data->v));
+ fprintf(gs_stderr, "Settings: Quality %s\n",
+ stp_get_resolution(stp_data->v));
+ fprintf(gs_stderr, "Settings: Dither %s\n",
+ stp_get_dither_algorithm(stp_data->v));
+ fprintf(gs_stderr, "Settings: InputSlot %s\n",
+ stp_get_media_source(stp_data->v));
+ fprintf(gs_stderr, "Settings: MediaType %s\n",
+ stp_get_media_type(stp_data->v));
+ fprintf(gs_stderr, "Settings: MediaSize %s\n",
+ stp_get_media_size(stp_data->v));
+ fprintf(gs_stderr, "Settings: Model %s\n", stp_get_driver(stp_data->v));
+ fprintf(gs_stderr, "Settings: InkType %s\n", stp_get_ink_type(stp_data->v));
+ fprintf(gs_stderr, "Settings: OutputTo %s\n", stp_get_output_to(stp_data->v));
+}
+
+private void
+stp_print_dbg(const char *msg, gx_device_printer *pdev,
+ const privdata_t *stp_data)
+{
+ STP_DEBUG(if (pdev)
+ fprintf(gs_stderr,"%s Image: %d x %d pixels, %f x %f dpi\n",
+ msg, pdev->width, pdev->height, pdev->x_pixels_per_inch,
+ pdev->y_pixels_per_inch));
+ STP_DEBUG(stp_dbg(msg, stp_data));
+}
+
+private void
+stp_print_debug(const char *msg, gx_device *pdev,
+ const privdata_t *stp_data)
+{
+ STP_DEBUG(if (pdev)
+ fprintf(gs_stderr,"%s Image: %d x %d pixels, %f x %f dpi\n",
+ msg, pdev->width, pdev->height, pdev->x_pixels_per_inch,
+ pdev->y_pixels_per_inch));
+ STP_DEBUG(stp_dbg(msg, stp_data));
+}
+
+private void
+stp_init_vars(void)
+{
+ STP_DEBUG(fprintf(gs_stderr, "Calling "));
+ if (! stp_data.v)
+ {
+ STP_DEBUG(fprintf(gs_stderr, "and initializing "));
+ stp_init();
+ stp_data.v = stp_allocate_vars();
+ stp_set_driver(stp_data.v, "");
+/* stp_set_media_size(stp_data.v, "Letter"); */
+ }
+ STP_DEBUG(fprintf(gs_stderr, "stp_init_vars\n"));
+}
+
+
+private void
+stp_writefunc(void *file, const char *buf, size_t bytes)
+{
+ FILE *prn = (FILE *)file;
+ fwrite(buf, 1, bytes, prn);
+}
+
+private int
+stp_print_page(gx_device_printer * pdev, FILE * file)
+{
+ stp_priv_image_t gsImage;
+ private int printvars_merged = 0;
+ int code; /* return code */
+ stp_printer_t printer = NULL;
+ uint stp_raster;
+ byte *stp_row;
+ stp_papersize_t p;
+ theImage.rep = &gsImage;
+
+ stp_init_vars();
+ stp_print_dbg("stp_print_page", pdev, &stp_data);
+ code = 0;
+ stp_raster = gdev_prn_raster(pdev);
+ printer = stp_get_printer_by_driver(stp_get_driver(stp_data.v));
+ if (printer == NULL)
+ {
+ fprintf(gs_stderr, "Printer %s is not a known printer model\n",
+ stp_get_driver(stp_data.v));
+ return_error(gs_error_rangecheck);
+ }
+
+ if (!printvars_merged)
+ {
+ stp_merge_printvars(stp_data.v, stp_printer_get_printvars(printer));
+ printvars_merged = 1;
+ }
+ stp_row = gs_alloc_bytes(pdev->memory, stp_raster, "stp file buffer");
+
+ if (stp_row == 0) /* can't allocate row buffer */
+ return_error(gs_error_VMerror);
+
+ if (strlen(stp_get_resolution(stp_data.v)) == 0)
+ stp_set_resolution(stp_data.v,
+ ((*stp_printer_get_printfuncs(printer)->default_parameters)
+ (printer, NULL, "Resolution")));
+ if (strlen(stp_get_dither_algorithm(stp_data.v)) == 0)
+ stp_set_dither_algorithm(stp_data.v, stp_default_dither_algorithm());
+
+ stp_set_scaling(stp_data.v, -pdev->x_pixels_per_inch); /* resolution of image */
+
+ /* compute lookup table: lut_t*,float dest_gamma,float app_gamma,stp_vars_t* */
+ stp_set_app_gamma(stp_data.v, 1.7);
+
+ stp_data.topoffset = 0;
+ stp_set_cmap(stp_data.v, NULL);
+
+ stp_set_page_width(stp_data.v, pdev->MediaSize[0]);
+ stp_set_page_height(stp_data.v, pdev->MediaSize[1]);
+ if ((p = stp_get_papersize_by_size(stp_get_page_height(stp_data.v),
+ stp_get_page_width(stp_data.v))) != NULL)
+ stp_set_media_size(stp_data.v, stp_papersize_get_name(p));
+ stp_print_dbg("stp_print_page", pdev, &stp_data);
+
+ gsImage.dev = pdev;
+ gsImage.data = &stp_data;
+ gsImage.raster = stp_raster;
+ stp_set_outfunc(stp_data.v, stp_writefunc);
+ stp_set_errfunc(stp_data.v, stp_writefunc);
+ stp_set_outdata(stp_data.v, file);
+ stp_set_errdata(stp_data.v, gs_stderr);
+ if (stp_printer_get_printfuncs(printer)->verify(printer, stp_data.v))
+ (stp_printer_get_printfuncs(printer)->print)
+ (printer, &theImage, stp_data.v);
+ else
+ code = 1;
+
+ gs_free_object(pdev->memory, stp_row, "stp row buffer");
+ stp_row = NULL;
+
+ if (code)
+ return_error(gs_error_rangecheck);
+ else
+ return 0;
+}
+
+/* 24-bit color mappers (taken from gdevmem2.c). */
+
+/* Map a r-g-b color to a color index. */
+private gx_color_index
+stp_map_16m_rgb_color(gx_device * dev, gx_color_value r, gx_color_value g,
+ gx_color_value b)
+{
+ return gx_color_value_to_byte(b) +
+ ((uint) gx_color_value_to_byte(g) << 8) +
+ ((ulong) gx_color_value_to_byte(r) << 16);
+}
+
+/* Map a color index to a r-g-b color. */
+private int
+stp_map_16m_color_rgb(gx_device * dev, gx_color_index color,
+ gx_color_value prgb[3])
+{
+ prgb[2] = gx_color_value_from_byte(color & 0xff);
+ prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
+ prgb[0] = gx_color_value_from_byte(color >> 16);
+ return 0;
+}
+
+private int
+stp_write_float(gs_param_list *plist, const char *name, float value)
+{
+ return param_write_float(plist, name, &value);
+}
+
+private int
+stp_write_int(gs_param_list *plist, const char *name, int value)
+{
+ return param_write_int(plist, name, &value);
+}
+
+private char *
+c_strdup(const char *s)
+{
+ char *ret;
+ if (!s)
+ {
+ STP_DEBUG(fprintf(gs_stderr, "c_strdup null ptr\n"));
+ ret = malloc(1);
+ ret[0] = 0;
+ return ret;
+ }
+ else
+ {
+ STP_DEBUG(fprintf(gs_stderr, "c_strdup |%s|\n", s));
+ ret = malloc(strlen(s) + 1);
+ strcpy(ret, s);
+ return ret;
+ }
+}
+
+/*
+ * Get parameters. In addition to the standard and printer
+ * parameters, we supply a lot of options to play around with
+ * for maximum quality out of the photo printer
+*/
+/* Yeah, I could have used a list for the options but... */
+private int
+stp_get_params(gx_device *pdev, gs_param_list *plist)
+{
+ int code;
+ gs_param_string pinktype;
+ gs_param_string pmodel;
+ gs_param_string pmediatype;
+ gs_param_string pInputSlot;
+ gs_param_string palgorithm;
+ gs_param_string pquality;
+ char *pmediatypestr;
+ char *pInputSlotstr;
+ char *pinktypestr;
+ char *pmodelstr;
+ char *palgorithmstr;
+ char *pqualitystr;
+ stp_init_vars();
+
+ stp_print_debug("stp_get_params(0)", pdev, &stp_data);
+ code = gdev_prn_get_params(pdev, plist);
+ stp_print_debug("stp_get_params(1)", pdev, &stp_data);
+ pmodelstr = c_strdup(stp_get_driver(stp_data.v));
+ pInputSlotstr = c_strdup(stp_get_media_source(stp_data.v));
+ pmediatypestr = c_strdup(stp_get_media_type(stp_data.v));
+ pinktypestr = c_strdup(stp_get_ink_type(stp_data.v));
+ palgorithmstr = c_strdup(stp_get_dither_algorithm(stp_data.v));
+ pqualitystr = c_strdup(stp_get_resolution(stp_data.v));
+
+ param_string_from_string(pmodel, pmodelstr);
+ param_string_from_string(pInputSlot, pInputSlotstr);
+ param_string_from_string(pmediatype, pmediatypestr);
+ param_string_from_string(pinktype, pinktypestr);
+ param_string_from_string(palgorithm, palgorithmstr);
+ param_string_from_string(pquality, pqualitystr);
+
+ if (code < 0 ||
+ (code = stp_write_float(plist, "Cyan", stp_get_cyan(stp_data.v))) < 0 ||
+ (code = stp_write_float(plist, "Magenta", stp_get_magenta(stp_data.v))) < 0 ||
+ (code = stp_write_float(plist, "Yellow", stp_get_yellow(stp_data.v))) < 0 ||
+ (code = stp_write_float(plist, "Brightness", stp_get_brightness(stp_data.v))) < 0 ||
+ (code = stp_write_float(plist, "Contrast", stp_get_contrast(stp_data.v))) < 0 ||
+ (code = stp_write_int(plist, "Color", stp_get_output_type(stp_data.v))) < 0 ||
+ (code = stp_write_int(plist, "ImageType", stp_get_image_type(stp_data.v))) < 0 ||
+ (code = stp_write_float(plist, "Gamma", stp_get_gamma(stp_data.v))) < 0 ||
+ (code = stp_write_float(plist, "Saturation", stp_get_saturation(stp_data.v))) < 0 ||
+ (code = stp_write_float(plist, "Density", stp_get_density(stp_data.v))) < 0 ||
+ (code = param_write_string(plist, "Model", &pmodel)) < 0 ||
+ (code = param_write_string(plist, "Dither", &palgorithm)) < 0 ||
+ (code = param_write_string(plist, "Quality", &pquality)) < 0 ||
+ (code = param_write_string(plist, "InkType", &pinktype) < 0) ||
+ (code = param_write_string(plist, "MediaType", &pmediatype)) < 0 ||
+ (code = param_write_string(plist, "stpMediaType", &pmediatype)) < 0 ||
+ (code = param_write_string(plist, "InputSlot", &pInputSlot)) < 0
+ )
+ {
+ free(pmodelstr);
+ free(pInputSlotstr);
+ free(pmediatypestr);
+ free(pinktypestr);
+ free(palgorithmstr);
+ free(pqualitystr);
+ STP_DEBUG(fprintf(stderr, "stp_get_params returns %d\n", code));
+ return code;
+ }
+
+ return 0;
+}
+
+/* Put parameters. */
+/* Yeah, I could have used a list for the options but... */
+
+#define STP_PUT_PARAM(plist, gtype, v, name, param, ecode) \
+do { \
+ int code; \
+ gtype value; \
+ \
+ code = param_read_##gtype(plist, name, &value); \
+ switch (code) \
+ { \
+ case 0: \
+ if (value < stp_get_##param(lower) || value > stp_get_##param(upper)) \
+ { \
+ param_signal_error(plist, name, gs_error_rangecheck); \
+ ecode = -100; \
+ } \
+ else \
+ stp_set_##param(v, value); \
+ break; \
+ case 1: \
+ break; \
+ default: \
+ ecode = code; \
+ break; \
+ } \
+} while (0)
+
+private int
+stp_put_params(gx_device *pdev, gs_param_list *plist)
+{
+ const stp_vars_t lower = stp_minimum_settings();
+ const stp_vars_t upper = stp_maximum_settings();
+ gs_param_string pmediatype;
+ gs_param_string pInputSlot;
+ gs_param_string pinktype;
+ gs_param_string pmodel;
+ gs_param_string palgorithm;
+ gs_param_string pquality;
+ char *pmediatypestr;
+ char *pInputSlotstr;
+ char *pinktypestr;
+ char *pmodelstr;
+ char *palgorithmstr;
+ char *pqualitystr;
+ int code = 0;
+ stp_printer_t printer;
+ stp_init_vars();
+
+ stp_print_debug("stp_put_params(0)", pdev, &stp_data);
+
+ pmodelstr = c_strdup(stp_get_driver(stp_data.v));
+ pInputSlotstr = c_strdup(stp_get_media_source(stp_data.v));
+ pmediatypestr = c_strdup(stp_get_media_type(stp_data.v));
+ pinktypestr = c_strdup(stp_get_ink_type(stp_data.v));
+ palgorithmstr = c_strdup(stp_get_dither_algorithm(stp_data.v));
+ pqualitystr = c_strdup(stp_get_resolution(stp_data.v));
+
+ param_string_from_string(pmodel, pmodelstr);
+ param_string_from_string(pInputSlot, pInputSlotstr);
+ param_string_from_string(pmediatype, pmediatypestr);
+ param_string_from_string(pinktype, pinktypestr);
+ param_string_from_string(palgorithm, palgorithmstr);
+ param_string_from_string(pquality, pqualitystr);
+
+ STP_PUT_PARAM(plist, float, stp_data.v, "Cyan", cyan, code);
+ STP_PUT_PARAM(plist, float, stp_data.v, "Magenta", magenta, code);
+ STP_PUT_PARAM(plist, float, stp_data.v, "Yellow", yellow, code);
+ STP_PUT_PARAM(plist, float, stp_data.v, "Brightness", brightness, code);
+ STP_PUT_PARAM(plist, float, stp_data.v, "Contrast", contrast, code);
+ STP_PUT_PARAM(plist, int, stp_data.v, "Color", output_type, code);
+ STP_PUT_PARAM(plist, int, stp_data.v, "ImageType", image_type, code);
+ STP_PUT_PARAM(plist, float, stp_data.v, "Gamma", gamma, code);
+ STP_PUT_PARAM(plist, float, stp_data.v, "Saturation", saturation ,code);
+ STP_PUT_PARAM(plist, float, stp_data.v, "Density", density, code);
+ param_read_string(plist, "Quality", &pquality);
+ param_read_string(plist, "Dither", &palgorithm);
+ param_read_string(plist, "InputSlot", &pInputSlot);
+ param_read_string(plist, "stpMediaType", &pmediatype);
+ if (!pmediatype.data || pmediatype.size == 0)
+ param_read_string(plist, "MediaType", &pmediatype);
+ param_read_string(plist, "Model", &pmodel);
+ param_read_string(plist, "InkType", &pinktype);
+
+ if (stp_get_output_type(stp_data.v) == OUTPUT_RAW_CMYK)
+ {
+ param_signal_error(plist, "Color", gs_error_rangecheck);
+ code = -100;
+ }
+
+ if ( code < 0 )
+ {
+ free(pmodelstr);
+ free(pInputSlotstr);
+ free(pmediatypestr);
+ free(pinktypestr);
+ free(palgorithmstr);
+ free(pqualitystr);
+
+ return code;
+ }
+
+ STP_DEBUG(fprintf(gs_stderr, "pmodel.size %d pmodel.data %s\n",
+ pmodel.size, pmodel.data));
+ STP_DEBUG(fprintf(gs_stderr, "pinktype.size %d pinktype.data %s\n",
+ pinktype.size, pinktype.data));
+ STP_DEBUG(fprintf(gs_stderr, "pquality.size %d pquality.data %s\n",
+ pquality.size, pquality.data));
+ stp_set_driver_n(stp_data.v, pmodel.data, pmodel.size);
+ printer = stp_get_printer_by_driver(stp_get_driver(stp_data.v));
+ if (printer)
+ stp_set_printer_defaults(stp_data.v, printer, NULL);
+
+ if (pmediatype.data && pmediatype.size != 0)
+ stp_set_media_type_n(stp_data.v, pmediatype.data, pmediatype.size);
+ if (pInputSlot.data && pInputSlot.size != 0)
+ stp_set_media_source_n(stp_data.v, pInputSlot.data, pInputSlot.size);
+ if (pinktype.data && pinktype.size != 0)
+ stp_set_ink_type_n(stp_data.v, pinktype.data, pinktype.size);
+ if (palgorithm.data && palgorithm.size != 0)
+ stp_set_dither_algorithm_n(stp_data.v, palgorithm.data, palgorithm.size);
+ if (pquality.data && pquality.size != 0)
+ stp_set_resolution_n(stp_data.v, pquality.data, pquality.size);
+ stp_print_debug("stp_put_params(1)", pdev, &stp_data);
+
+ code = gdev_prn_put_params(pdev, plist);
+
+ free(pmodelstr);
+ free(pInputSlotstr);
+ free(pmediatypestr);
+ free(pinktypestr);
+ free(palgorithmstr);
+ free(pqualitystr);
+
+ return code;
+}
+
+private int
+stp_open(gx_device *pdev)
+{
+ /* Change the margins if necessary. */
+ float st[4];
+ int left,right,bottom,top,width,height;
+ stp_printer_t printer;
+ stp_init_vars();
+ stp_print_debug("stp_open", pdev, &stp_data);
+ printer = stp_get_printer_by_driver(stp_get_driver(stp_data.v));
+ if (!printer)
+ {
+ if (strlen(stp_get_driver(stp_data.v)) == 0)
+ fprintf(gs_stderr, "Printer must be specified with -sModel\n");
+ else
+ fprintf(gs_stderr, "Printer %s is not a known model\n",
+ stp_get_driver(stp_data.v));
+ return_error(gs_error_undefined);
+ }
+
+ stp_set_page_width(stp_data.v, pdev->MediaSize[0]);
+ stp_set_page_height(stp_data.v, pdev->MediaSize[1]);
+
+ (*stp_printer_get_printfuncs(printer)->media_size)
+ (printer, stp_data.v, &width, &height);
+
+ (*stp_printer_get_printfuncs(printer)->imageable_area)
+ (printer, stp_data.v, &left, &right, &bottom, &top);
+
+ st[1] = (float)bottom / 72; /* bottom margin */
+ st[3] = (float)(height-top) / 72; /* top margin */
+ st[0] = (float)left / 72; /* left margin */
+ st[2] = (float)(width-right) / 72; /* right margin */
+
+ stp_set_top(stp_data.v, 0);
+ stp_data.bottom = bottom + height-top;
+
+ stp_print_debug("stp_open", pdev, &stp_data);
+ STP_DEBUG(fprintf(gs_stderr, "margins: l %f b %f r %f t %f\n",
+ st[0], st[1], st[2], st[3]));
+
+ gx_device_set_margins(pdev, st, true);
+ return gdev_prn_open(pdev);
+}
+
+
+/***********************************************************************
+* driver function callback routines *
+***********************************************************************/
+
+/* get one row of the image */
+private stp_image_status_t
+Image_get_row(stp_image_t *image, unsigned char *data, int row)
+{
+ stp_priv_image_t *im = (stp_priv_image_t *) (image->rep);
+ memset(data, 0, im->dev->width * 3);
+ if (im->dev->x_pixels_per_inch == im->dev->y_pixels_per_inch)
+ {
+ gdev_prn_copy_scan_lines(im->dev, im->data->topoffset+row,
+ data, im->raster);
+ }
+ else if (im->dev->x_pixels_per_inch > im->dev->y_pixels_per_inch)
+ {
+ /*
+ * If xres > yres, duplicate rows
+ */
+ int ratio = (im->dev->x_pixels_per_inch / im->dev->y_pixels_per_inch);
+ gdev_prn_copy_scan_lines(im->dev, (im->data->topoffset + row) / ratio,
+ data, im->raster);
+ }
+ else
+ {
+ /*
+ * If xres < yres, skip rows
+ */
+ int ratio = (im->dev->y_pixels_per_inch / im->dev->x_pixels_per_inch);
+ gdev_prn_copy_scan_lines(im->dev, (im->data->topoffset + row) * ratio,
+ data, im->raster);
+ }
+ return STP_IMAGE_OK;
+}
+
+/* return bpp of picture (24 here) */
+private int
+Image_bpp(stp_image_t *image)
+{
+ return 3;
+}
+
+/* return width of picture */
+private int
+Image_width(stp_image_t *image)
+{
+ stp_priv_image_t *im = (stp_priv_image_t *) (image->rep);
+ return im->dev->width;
+}
+
+/*
+ return height of picture and
+ subtract margins from image size so that the
+ driver only reads the correct number of lines from the
+ input
+
+*/
+private int
+Image_height(stp_image_t *image)
+{
+ stp_priv_image_t *im = (stp_priv_image_t *) (image->rep);
+ float tmp,tmp2;
+
+ /* top margin + bottom margin */
+ tmp = stp_get_top(im->data->v) + im->data->bottom;
+
+ /* calculate height in 1/72 inches */
+ tmp2 = (float)(im->dev->height) / (float)(im->dev->y_pixels_per_inch) * 72.;
+
+ tmp2 -= tmp; /* subtract margins from sizes */
+
+ /* calculate new image height */
+ tmp2 *= (float)(im->dev->x_pixels_per_inch) / 72.;
+
+ STP_DEBUG(fprintf(gs_stderr,"corrected page height %f\n",tmp2));
+
+ return (int)tmp2;
+}
+
+private void
+Image_rotate_ccw(stp_image_t *image)
+{
+ /* dummy function, Landscape printing unsupported atm */
+}
+
+private void
+Image_rotate_cw(stp_image_t *image)
+{
+ /* dummy function, Seascape printing unsupported atm */
+}
+
+private void
+Image_rotate_180(stp_image_t *image)
+{
+ /* dummy function, upside down printing unsupported atm */
+}
+
+private void
+Image_init(stp_image_t *image)
+{
+ /* dummy function */
+}
+
+private void
+Image_progress_init(stp_image_t *image)
+{
+ /* dummy function */
+}
+
+/* progress display */
+private void
+Image_note_progress(stp_image_t *image, double current, double total)
+{
+ STP_DEBUG(fprintf(gs_stderr, "."));
+}
+
+private void
+Image_progress_conclude(stp_image_t *image)
+{
+ STP_DEBUG(fprintf(gs_stderr, "\n"));
+}
+
+private const char *
+Image_get_appname(stp_image_t *image)
+{
+ return "GhostScript/stp";
+}