summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGangHeok Kim <gangheok.kim@samsung.com>2013-10-23 16:18:47 +0900
committerGangHeok Kim <gangheok.kim@samsung.com>2013-10-23 16:18:47 +0900
commit611f37e618c791af28225aad10d475e2769e3da1 (patch)
treedfa38aa5a1284778cf10350614014ae9714cbb27
parent7cc32e73951fd66486d247d9f57d5a8baf9761c4 (diff)
downloadcups-filters-accepted/tizen_ivi_panda.tar.gz
cups-filters-accepted/tizen_ivi_panda.tar.bz2
cups-filters-accepted/tizen_ivi_panda.zip
Change-Id: Ide49658010969dae57d0e40a14700367f729827b
-rw-r--r--COPYING23
-rw-r--r--INSTALL10
-rw-r--r--Makefile.am89
-rw-r--r--Makefile.in608
-rw-r--r--NEWS162
-rw-r--r--README235
-rw-r--r--aclocal.m452
-rw-r--r--config.h.in18
-rwxr-xr-xconfigure815
-rw-r--r--configure.ac235
-rw-r--r--cupsfilters/image-tiff.c7
-rw-r--r--cupsfilters/raster.c1039
-rw-r--r--cupsfilters/raster.h55
-rw-r--r--debian/changelog56
-rw-r--r--filter/PDFError.h7
-rw-r--r--filter/colord.c462
-rw-r--r--filter/colord.h (renamed from filter/pdftoopvp/OPVPError.h)35
-rw-r--r--filter/gstopxl184
-rwxr-xr-xfilter/gstopxl.in184
-rw-r--r--filter/gstoraster.c756
-rw-r--r--filter/pdftoijs.cxx86
-rw-r--r--filter/pdftoopvp/99pdftoopvp.conf18
-rw-r--r--filter/pdftoopvp/OPVPOutputDev.cxx1990
-rw-r--r--filter/pdftoopvp/OPVPOutputDev.h250
-rw-r--r--filter/pdftoopvp/oprs/OPRS.cxx594
-rw-r--r--filter/pdftoopvp/oprs/OPRS.h188
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplash.cxx2336
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplash.h244
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplashClip.cxx91
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplashClip.h30
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplashPath.cxx185
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplashPath.h28
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplashState.cxx183
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplashState.h95
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplashXPath.cxx426
-rw-r--r--filter/pdftoopvp/oprs/OPVPSplashXPath.h39
-rw-r--r--filter/pdftoopvp/oprs/OPVPWrapper.cxx904
-rw-r--r--filter/pdftoopvp/oprs/OPVPWrapper.h205
-rw-r--r--filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx1172
-rw-r--r--filter/pdftoopvp/oprs/OPVPWrapper_0_2.h127
-rw-r--r--filter/pdftoopvp/opvp/opvp.h292
-rw-r--r--filter/pdftoopvp/opvp/opvp_0_2_0.h299
-rw-r--r--filter/pdftoopvp/opvp/opvp_common.h54
-rw-r--r--filter/pdftoopvp/pdftoopvp.cxx789
-rw-r--r--filter/pdftopdf/nup.cc2
-rw-r--r--filter/pdftopdf/pdftopdf.cc74
-rw-r--r--filter/pdftopdf/pdftopdf_processor.cc17
-rw-r--r--filter/pdftopdf/pdftopdf_processor.h5
-rw-r--r--filter/pdftopdf/qpdf_cm.cc2
-rw-r--r--filter/pdftopdf/qpdf_pdftopdf.cc9
-rw-r--r--filter/pdftopdf/qpdf_pdftopdf_processor.cc93
-rw-r--r--filter/pdftopdf/qpdf_pdftopdf_processor.h1
-rw-r--r--filter/pdftops.c76
-rw-r--r--filter/pdftoraster.cxx333
-rw-r--r--filter/pdfutils.c2
-rw-r--r--filter/textcommon.c9
-rw-r--r--filter/texttopdf.c4
-rw-r--r--fontembed/embed_sfnt.c2
-rw-r--r--ltmain.sh4
-rw-r--r--mime/cupsfilters.convs6
-rw-r--r--packaging/cups-filters.manifest (renamed from cups-filters.manifest)2
-rw-r--r--packaging/cups-filters.spec70
-rw-r--r--packaging/libcupsfilters1.manifest (renamed from libcupsfilters1.manifest)0
-rw-r--r--packaging/libfontembed.manifest (renamed from libfontembed.manifest)0
-rw-r--r--packaging/tizen-pdftoraster-oom-fix.patch4
-rw-r--r--ppd/pxlcolor.ppd215
-rw-r--r--ppd/pxlmono.ppd208
-rw-r--r--utils/cups-browsed.c2029
-rw-r--r--utils/cups-browsed.conf.in31
-rw-r--r--utils/cups-browsed.in154
70 files changed, 7662 insertions, 11347 deletions
diff --git a/COPYING b/COPYING
index f2a1e94..e378d15 100644
--- a/COPYING
+++ b/COPYING
@@ -7,7 +7,7 @@ Copyright 1993-2007 Easy Software Products
Copyright 2007-2011 Apple Inc.
Copyright 2012 Canonical Ltd.
Copyright 2006-2012 BBR Inc.
-Copyright 2008-2012 Till Kamppeter
+Copyright 2008-2013 Till Kamppeter
Copyright 2008,2012 Tobias Hoffmann
Copyright 2003 Robert Sander
Copyright 2003-2006 Red Hat, Inc.
@@ -53,12 +53,13 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-The filter textonly and its PPD file textonly.ppd and also the filters
-texttops and imagetops are provided under the terms of version 2 of
-the GNU General Public 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.
+The filters gstopxl, textonly, and its PPD files pxlcolor.ppd,
+pxlmono.ppd, and textonly.ppd and also the filters texttops and
+imagetops are provided under the terms of version 2 of the GNU General
+Public 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.
The filter bannertopdf and all their auxiliary files is provided under
the terms of version 3 of the GNU General Public License. This program
@@ -72,10 +73,10 @@ 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.
-The filters pdftoijs, pdftoopvp, pdftopdf, and pdftoraster and all
-their auxiliary files and also libfontembed in the filter/fontembed
-subdirectory (used by texttopdf) are also free software and are
-published under MIT license:
+The filters gstoraster, pdftoijs, pdftoopvp, pdftopdf, and pdftoraster
+and all their auxiliary files and also libfontembed in the
+filter/fontembed subdirectory (used by texttopdf) are also free
+software and are published under MIT license:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/INSTALL b/INSTALL
index c78f2cb..f635d09 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,4 +1,4 @@
-INSTALL - OpenPrinting CUPS Filters v1.0.25 - 2012-11-28
+INSTALL - OpenPrinting CUPS Filters v1.0.36 - 2013-08-13
--------------------------------------------------------
This file describes how to compile and install OpenPrinting CUPS
@@ -27,10 +27,18 @@ BEFORE YOU BEGIN
Poppler, libijs, freetype, fontconfig, and liblcms (liblcms2 recommended)
must be installed to be able to compile this package.
+ Note that Poppler has to be compiled with the
+ "--enable-poppler-cpp" configure option (or the
+ "libpoppler-cpp-dev(el)" package has to be installed if the
+ Poppler packages from a Linux distribution are used).
+
Besides these tools you'll want the JPEG, PNG, TIFF, ZLIB libraries for
image support. CUPS Filters will compile and run without these, however
you'll miss out on many of the features provided by CUPS Filters.
+ To get cups-browsed, the daemon to browse Bonjour broadcasts of
+ remote CUPS queues and make the queues available locally, you also
+ need libavahi-common and libavahi-client.
COMPILING THE BZR REPOSITORY CODE
diff --git a/Makefile.am b/Makefile.am
index b7588a5..2a366cd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -55,7 +55,8 @@ test1284_CFLAGS = $(CUPS_CFLAGS)
pkgfiltersincludedir = $(includedir)/cupsfilters
pkgfiltersinclude_DATA = \
cupsfilters/driver.h \
- cupsfilters/image.h
+ cupsfilters/image.h \
+ cupsfilters/raster.h
lib_LTLIBRARIES = libcupsfilters.la
@@ -103,6 +104,7 @@ libcupsfilters_la_SOURCES = \
cupsfilters/image-zoom.c \
cupsfilters/lut.c \
cupsfilters/pack.c \
+ cupsfilters/raster.c \
cupsfilters/rgb.c \
cupsfilters/srgb.c \
$(pkgfiltersinclude_DATA)
@@ -238,62 +240,15 @@ EXTRA_DIST += \
$(pkgfontembedinclude_DATA) \
fontembed/README
-# ===========
-# PDF to OPVP
-# ===========
pkgfilterdir = $(CUPS_SERVERBIN)/filter
-pkgfilter_PROGRAMS = pdftoopvp
-
pkgfontconfigdir = $(sysconfdir)/$(FONTDIR)
-pkgfontconfig_DATA = filter/pdftoopvp/99pdftoopvp.conf
-
-pdftoopvp_SOURCES = \
- filter/pdftoopvp/oprs/OPRS.cxx \
- filter/pdftoopvp/oprs/OPRS.h \
- filter/pdftoopvp/oprs/OPVPSplashClip.cxx \
- filter/pdftoopvp/oprs/OPVPSplashClip.h \
- filter/pdftoopvp/oprs/OPVPSplash.cxx \
- filter/pdftoopvp/oprs/OPVPSplash.h \
- filter/pdftoopvp/oprs/OPVPSplashPath.cxx \
- filter/pdftoopvp/oprs/OPVPSplashPath.h \
- filter/pdftoopvp/oprs/OPVPSplashState.cxx \
- filter/pdftoopvp/oprs/OPVPSplashState.h \
- filter/pdftoopvp/oprs/OPVPSplashXPath.cxx \
- filter/pdftoopvp/oprs/OPVPSplashXPath.h \
- filter/pdftoopvp/oprs/OPVPWrapper.cxx \
- filter/pdftoopvp/oprs/OPVPWrapper.h \
- filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx \
- filter/pdftoopvp/oprs/OPVPWrapper_0_2.h \
- filter/pdftoopvp/OPVPError.h \
- filter/pdftoopvp/opvp/opvp_common.h \
- filter/pdftoopvp/opvp/opvp.h \
- filter/pdftoopvp/opvp/opvp_0_2_0.h \
- filter/pdftoopvp/OPVPOutputDev.cxx \
- filter/pdftoopvp/OPVPOutputDev.h \
- filter/pdftoopvp/pdftoopvp.cxx
-pdftoopvp_CFLAGS = \
- $(CUPS_CFLAGS) \
- $(FREETYPE_CFLAGS) \
- $(FONTCONFIG_CFLAGS) \
- $(LIBPNG_CFLAGS) \
- $(POPPLER_CFLAGS) \
- -I$(srcdir)/filter/pdftoopvp/oprs \
- -I$(srcdir)/filter/pdftoopvp/opvp
-pdftoopvp_CXXFLAGS = $(pdftoopvp_CFLAGS)
-pdftoopvp_LDADD = \
- $(CUPS_LIBS) \
- $(FREETYPE_LIBS) \
- $(FONTCONFIG_LIBS) \
- $(LIBPNG_LIBS) \
- $(POPPLER_LIBS)
- $(DLOPEN_LIBS)
EXTRA_DIST += $(pkgfontconfig_DATA)
# ==========
# PDF to PDF
# ==========
-pkgfilter_PROGRAMS += pdftopdf
+pkgfilter_PROGRAMS = pdftopdf
pdftopdf_SOURCES = \
filter/pdftopdf/pdftopdf.cc \
@@ -329,6 +284,7 @@ pdftopdf_LDADD = \
# Simple filter binaries
# ======================
pkgfilter_SCRIPTS = \
+ filter/gstopxl \
filter/imagetops \
filter/pstopdf \
filter/textonly \
@@ -336,6 +292,7 @@ pkgfilter_SCRIPTS = \
pkgfilter_PROGRAMS += \
commandtoescpx \
commandtopclx \
+ gstoraster \
pdftoijs \
pdftops \
pdftoraster \
@@ -374,6 +331,18 @@ commandtopclx_CFLAGS = \
-I$(srcdir)/cupsfilters/
commandtopclx_LDADD = $(CUPS_LIBS)
+gstoraster_SOURCES = \
+ filter/gstoraster.c \
+ filter/colord.c \
+ filter/colord.h \
+ cupsfilters/raster.h
+gstoraster_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+gstoraster_LDADD = \
+ $(CUPS_LIBS) \
+ -lcupsfilters
+
imagetopdf_SOURCES = \
cupsfilters/image.h \
filter/common.c \
@@ -529,6 +498,8 @@ ppd_DATA = \
ppd/Generic-PDF_Printer-PDF.ppd \
ppd/HP-Color_LaserJet_CM3530_MFP-PDF.ppd \
ppd/HP-PhotoSmart_Pro_B8300-hpijs-pdftoijs.ppd \
+ ppd/pxlcolor.ppd \
+ ppd/pxlmono.ppd \
ppd/textonly.ppd
EXTRA_DIST += $(ppd_DATA)
@@ -554,3 +525,23 @@ EXTRA_DIST += \
distclean-local:
rm -rf *.cache *~
+
+install-data-hook:
+if RCLINKS
+ for level in $(RCLEVELS); do \
+ $(INSTALL) -d -m 755 $(DESTDIR)$(INITDIR)/rc$${level}.d; \
+ $(LN_S) -f ../init.d/cups-browsed $(DESTDIR)$(INITDIR)/rc$${level}.d/S$(RCSTART)cups-browsed; \
+ $(LN_S) -f ../init.d/cups-browsed $(DESTDIR)$(INITDIR)/rc$${level}.d/K$(RCSTOP)cups-browsed; \
+ done; \
+ $(INSTALL) -d -m 755 $(DESTDIR)$(INITDIR)/rc0.d; \
+ $(LN_S) -f ../init.d/cups-browsed $(DESTDIR)$(INITDIR)/rc0.d/K$(RCSTOP)cups-browsed;
+endif
+
+
+uninstall-hook:
+if RCLINKS
+ if test "x$(INITDIR)" != x; then \
+ $(RM) $(DESTDIR)$(BUILDROOT)$(INITDIR)/rc?.d/[SK]??cups-browsed || :; \
+ rmdir $(DESTDIR)$(BUILDROOT)$(INITDIR)/rc?.d || :;\
+ fi
+endif
diff --git a/Makefile.in b/Makefile.in
index bae9c2b..9309908 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -62,23 +62,26 @@ check_PROGRAMS = test1284$(EXEEXT) testcmyk$(EXEEXT) \
TESTS = testdither$(EXEEXT) test_analyze$(EXEEXT) test_pdf$(EXEEXT) \
test_ps$(EXEEXT) test_pdf1$(EXEEXT) test_pdf2$(EXEEXT)
bin_PROGRAMS = ttfread$(EXEEXT)
-pkgfilter_PROGRAMS = pdftoopvp$(EXEEXT) pdftopdf$(EXEEXT) \
+pkgfilter_PROGRAMS = pdftopdf$(EXEEXT) \
commandtoescpx$(EXEEXT) \
- commandtopclx$(EXEEXT) pdftoijs$(EXEEXT) pdftops$(EXEEXT) \
- pdftoraster$(EXEEXT) rastertoescpx$(EXEEXT) \
+ commandtopclx$(EXEEXT) gstoraster$(EXEEXT) pdftoijs$(EXEEXT) \
+ pdftops$(EXEEXT) pdftoraster$(EXEEXT) rastertoescpx$(EXEEXT) \
rastertopclx$(EXEEXT) texttopdf$(EXEEXT) \
$(am__EXEEXT_1)
@ENABLE_IMAGEFILTERS_TRUE@am__append_1 = \
@ENABLE_IMAGEFILTERS_TRUE@ imagetopdf \
@ENABLE_IMAGEFILTERS_TRUE@ imagetoraster
+sbin_PROGRAMS = cups-browsed$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libcupsfilters.pc.in $(srcdir)/libfontembed.pc.in \
- $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
- compile config.guess config.sub depcomp install-sh ltmain.sh \
- missing
+ $(top_srcdir)/configure $(top_srcdir)/filter/gstopxl.in \
+ $(top_srcdir)/utils/cups-browsed.conf.in \
+ $(top_srcdir)/utils/cups-browsed.in AUTHORS COPYING ChangeLog \
+ INSTALL NEWS compile config.guess config.sub depcomp \
+ install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
$(top_srcdir)/m4/ax_compare_version.m4 \
@@ -89,7 +92,8 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = libcupsfilters.pc libfontembed.pc
+CONFIG_CLEAN_FILES = libcupsfilters.pc libfontembed.pc filter/gstopxl \
+ utils/cups-browsed utils/cups-browsed.conf
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -120,9 +124,12 @@ am__uninstall_files_from_dir = { \
}
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(phpextensiondir)" \
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgbackenddir)" \
- "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(pkgfilterdir)" \
+ "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(sbindir)" \
+ "$(DESTDIR)$(initrcdir)" "$(DESTDIR)$(pkgfilterdir)" \
+ "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)" \
"$(DESTDIR)$(docdir)" \
"$(DESTDIR)$(pkgconfdir)" \
+ "$(DESTDIR)$(pkgcupsserverrootdir)" \
"$(DESTDIR)$(pkgdriverdir)" \
"$(DESTDIR)$(pkgfiltersincludedir)" \
"$(DESTDIR)$(pkgfontconfigdir)" \
@@ -145,8 +152,9 @@ am_libcupsfilters_la_OBJECTS = libcupsfilters_la-attr.lo \
libcupsfilters_la-image-sgilib.lo \
libcupsfilters_la-image-sun.lo libcupsfilters_la-image-tiff.lo \
libcupsfilters_la-image-zoom.lo libcupsfilters_la-lut.lo \
- libcupsfilters_la-pack.lo libcupsfilters_la-rgb.lo \
- libcupsfilters_la-srgb.lo $(am__objects_1)
+ libcupsfilters_la-pack.lo libcupsfilters_la-raster.lo \
+ libcupsfilters_la-rgb.lo libcupsfilters_la-srgb.lo \
+ $(am__objects_1)
libcupsfilters_la_OBJECTS = $(am_libcupsfilters_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -176,7 +184,7 @@ libphpcups_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@ENABLE_IMAGEFILTERS_TRUE@am__EXEEXT_1 = imagetopdf$(EXEEXT) \
@ENABLE_IMAGEFILTERS_TRUE@ imagetoraster$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(pkgbackend_PROGRAMS) \
- $(pkgfilter_PROGRAMS)
+ $(pkgfilter_PROGRAMS) $(sbin_PROGRAMS)
am_commandtoescpx_OBJECTS = commandtoescpx-commandtoescpx.$(OBJEXT)
commandtoescpx_OBJECTS = $(am_commandtoescpx_OBJECTS)
commandtoescpx_DEPENDENCIES = $(am__DEPENDENCIES_1)
@@ -190,6 +198,21 @@ commandtopclx_DEPENDENCIES = $(am__DEPENDENCIES_1)
commandtopclx_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(commandtopclx_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_cups_browsed_OBJECTS = cups_browsed-cups-browsed.$(OBJEXT)
+cups_browsed_OBJECTS = $(am_cups_browsed_OBJECTS)
+cups_browsed_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+cups_browsed_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cups_browsed_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_gstoraster_OBJECTS = gstoraster-gstoraster.$(OBJEXT) \
+ gstoraster-colord.$(OBJEXT)
+gstoraster_OBJECTS = $(am_gstoraster_OBJECTS)
+gstoraster_DEPENDENCIES = $(am__DEPENDENCIES_1)
+gstoraster_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(gstoraster_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
am_imagetopdf_OBJECTS = imagetopdf-common.$(OBJEXT) \
imagetopdf-imagetopdf.$(OBJEXT)
imagetopdf_OBJECTS = $(am_imagetopdf_OBJECTS)
@@ -219,23 +242,6 @@ pdftoijs_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
pdftoijs_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(pdftoijs_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am_pdftoopvp_OBJECTS = pdftoopvp-OPRS.$(OBJEXT) \
- pdftoopvp-OPVPSplashClip.$(OBJEXT) \
- pdftoopvp-OPVPSplash.$(OBJEXT) \
- pdftoopvp-OPVPSplashPath.$(OBJEXT) \
- pdftoopvp-OPVPSplashState.$(OBJEXT) \
- pdftoopvp-OPVPSplashXPath.$(OBJEXT) \
- pdftoopvp-OPVPWrapper.$(OBJEXT) \
- pdftoopvp-OPVPWrapper_0_2.$(OBJEXT) \
- pdftoopvp-OPVPOutputDev.$(OBJEXT) \
- pdftoopvp-pdftoopvp.$(OBJEXT)
-pdftoopvp_OBJECTS = $(am_pdftoopvp_OBJECTS)
-pdftoopvp_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
-pdftoopvp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(pdftoopvp_CXXFLAGS) \
- $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
am_pdftopdf_OBJECTS = pdftopdf-pdftopdf.$(OBJEXT) \
pdftopdf-pdftopdf_jcl.$(OBJEXT) \
pdftopdf-pdftopdf_processor.$(OBJEXT) \
@@ -341,7 +347,7 @@ texttopdf_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
am_ttfread_OBJECTS = main.$(OBJEXT)
ttfread_OBJECTS = $(am_ttfread_OBJECTS)
ttfread_DEPENDENCIES = libfontembed.la
-SCRIPTS = $(pkgfilter_SCRIPTS)
+SCRIPTS = $(initrc_SCRIPTS) $(pkgfilter_SCRIPTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -387,38 +393,41 @@ am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libcupsfilters_la_SOURCES) $(libfontembed_la_SOURCES) \
$(libphpcups_la_SOURCES) \
$(commandtoescpx_SOURCES) \
- $(commandtopclx_SOURCES) $(imagetopdf_SOURCES) \
+ $(commandtopclx_SOURCES) $(cups_browsed_SOURCES) \
+ $(gstoraster_SOURCES) $(imagetopdf_SOURCES) \
$(imagetoraster_SOURCES) $(parallel_SOURCES) \
- $(pdftoijs_SOURCES) $(pdftoopvp_SOURCES) $(pdftopdf_SOURCES) \
+ $(pdftoijs_SOURCES) $(pdftopdf_SOURCES) \
$(pdftops_SOURCES) $(EXTRA_pdftops_SOURCES) \
$(pdftoraster_SOURCES) $(rastertoescpx_SOURCES) \
$(rastertopclx_SOURCES) $(serial_SOURCES) $(test1284_SOURCES) \
$(test_analyze_SOURCES) $(test_pdf_SOURCES) \
$(test_pdf1_SOURCES) $(test_pdf2_SOURCES) $(test_ps_SOURCES) \
$(testcmyk_SOURCES) $(testdither_SOURCES) $(testimage_SOURCES) \
- $(testrgb_SOURCES) $(texttopdf_SOURCES) $(ttfread_SOURCES)
+ $(testrgb_SOURCES) $(texttopdf_SOURCES) $(ttfread_SOURCES) \
DIST_SOURCES = $(libcupsfilters_la_SOURCES) $(libfontembed_la_SOURCES) \
$(am__libphpcups_la_SOURCES_DIST) \
$(commandtoescpx_SOURCES) \
- $(commandtopclx_SOURCES) $(imagetopdf_SOURCES) \
+ $(commandtopclx_SOURCES) $(cups_browsed_SOURCES) \
+ $(gstoraster_SOURCES) $(imagetopdf_SOURCES) \
$(imagetoraster_SOURCES) $(parallel_SOURCES) \
- $(pdftoijs_SOURCES) $(pdftoopvp_SOURCES) $(pdftopdf_SOURCES) \
+ $(pdftoijs_SOURCES) $(pdftopdf_SOURCES) \
$(pdftops_SOURCES) $(EXTRA_pdftops_SOURCES) \
$(pdftoraster_SOURCES) $(rastertoescpx_SOURCES) \
$(rastertopclx_SOURCES) $(serial_SOURCES) $(test1284_SOURCES) \
$(test_analyze_SOURCES) $(test_pdf_SOURCES) \
$(test_pdf1_SOURCES) $(test_pdf2_SOURCES) $(test_ps_SOURCES) \
$(testcmyk_SOURCES) $(testdither_SOURCES) $(testimage_SOURCES) \
- $(testrgb_SOURCES) $(texttopdf_SOURCES) $(ttfread_SOURCES)
+ $(testrgb_SOURCES) $(texttopdf_SOURCES) $(ttfread_SOURCES) \
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DATA = $(doc_DATA) \
- $(pkgconf_DATA) \
- $(pkgfiltersinclude_DATA) $(pkgfontconfig_DATA) \
- $(pkgfontembedinclude_DATA) $(pkgmime_DATA) $(ppd_DATA)
+ $(pkgconf_DATA) $(pkgcupsdata_DATA) $(pkgcupsserverroot_DATA) \
+ $(pkgdriver_DATA) $(pkgfiltersinclude_DATA) \
+ $(pkgfontconfig_DATA) $(pkgfontembedinclude_DATA) \
+ $(pkgmime_DATA) $(ppd_DATA)
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
@@ -445,7 +454,12 @@ AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
+AVAHI_CFLAGS = @AVAHI_CFLAGS@
+AVAHI_GLIB_CFLAGS = @AVAHI_GLIB_CFLAGS@
+AVAHI_GLIB_LIBS = @AVAHI_GLIB_LIBS@
+AVAHI_LIBS = @AVAHI_LIBS@
AWK = @AWK@
+BROWSEREMOTEPROTOCOLS = @BROWSEREMOTEPROTOCOLS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -455,11 +469,15 @@ CUPSCONFIG = @CUPSCONFIG@
CUPS_ACROREAD = @CUPS_ACROREAD@
CUPS_CFLAGS = @CUPS_CFLAGS@
CUPS_DATADIR = @CUPS_DATADIR@
+CUPS_DEFAULT_DOMAINSOCKET = @CUPS_DEFAULT_DOMAINSOCKET@
CUPS_FONTPATH = @CUPS_FONTPATH@
CUPS_GHOSTSCRIPT = @CUPS_GHOSTSCRIPT@
CUPS_LIBS = @CUPS_LIBS@
+CUPS_PDFTOCAIRO = @CUPS_PDFTOCAIRO@
CUPS_PDFTOPS = @CUPS_PDFTOPS@
CUPS_SERVERBIN = @CUPS_SERVERBIN@
+CUPS_SERVERROOT = @CUPS_SERVERROOT@
+CUPS_STATEDIR = @CUPS_STATEDIR@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -483,9 +501,13 @@ FONTDIR = @FONTDIR@
FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
FREETYPE_LIBS = @FREETYPE_LIBS@
GETLINE = @GETLINE@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
IJS_CFLAGS = @IJS_CFLAGS@
IJS_LIBS = @IJS_LIBS@
+INITDDIR = @INITDDIR@
+INITDIR = @INITDIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -527,13 +549,18 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PHPCONFIG = @PHPCONFIG@
PHPDIR = @PHPDIR@
+PKGCONFIG = @PKGCONFIG@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POPPLER_CFLAGS = @POPPLER_CFLAGS@
POPPLER_LIBS = @POPPLER_LIBS@
RANLIB = @RANLIB@
+RCLEVELS = @RCLEVELS@
+RCSTART = @RCSTART@
+RCSTOP = @RCSTOP@
SED = @SED@
+SED_EXTENDED_REGEX_OPT = @SED_EXTENDED_REGEX_OPT@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRCASESTR = @STRCASESTR@
@@ -613,11 +640,11 @@ doc_DATA = \
EXTRA_DIST = $(doc_DATA) autogen.sh libcupsfilters.pc.in \
libfontembed.pc.in \
$(pkgfiltersinclude_DATA) cupsfilters/image.pgm \
- cupsfilters/image.ppm \
- $(pkgmime_DATA) $(pkgfontembedinclude_DATA) fontembed/README \
- $(pkgfontconfig_DATA) $(pkgfilter_SCRIPTS) filter/test.sh \
- $(ppd_DATA) scripting/perl scripting/php/README \
- scripting/php/phpcups.php
+ cupsfilters/image.ppm\
+ $(pkgmime_DATA) $(pkgfontembedinclude_DATA) \
+ fontembed/README $(pkgfontconfig_DATA) $(pkgfilter_SCRIPTS) \
+ filter/test.sh utils/cups-browsed.in $(ppd_DATA) \
+ scripting/perl scripting/php/README scripting/php/phpcups.php
# ========
# Backends
@@ -653,7 +680,8 @@ test1284_CFLAGS = $(CUPS_CFLAGS)
pkgfiltersincludedir = $(includedir)/cupsfilters
pkgfiltersinclude_DATA = \
cupsfilters/driver.h \
- cupsfilters/image.h
+ cupsfilters/image.h \
+ cupsfilters/raster.h
lib_LTLIBRARIES = libcupsfilters.la libfontembed.la
# testcmyk # fails as it opens some image.ppm which is nowerhe to be found.
@@ -691,6 +719,7 @@ libcupsfilters_la_SOURCES = \
cupsfilters/image-zoom.c \
cupsfilters/lut.c \
cupsfilters/pack.c \
+ cupsfilters/raster.c \
cupsfilters/rgb.c \
cupsfilters/srgb.c \
$(pkgfiltersinclude_DATA)
@@ -752,6 +781,12 @@ testrgb_LDADD = \
libcupsfilters.la \
-lm
+# ===========
+# CUPS Config
+# ===========
+pkgcupsserverrootdir = $(CUPS_SERVERROOT)
+pkgcupsserverroot_DATA = \
+ utils/cups-browsed.conf
# =====
# MIMEs
# =====
@@ -808,54 +843,8 @@ test_pdf_LDADD = libfontembed.la
test_ps_SOURCES = fontembed/test_ps.c
test_ps_LDADD = libfontembed.la
-# ===========
-# PDF to OPVP
-# ===========
pkgfilterdir = $(CUPS_SERVERBIN)/filter
pkgfontconfigdir = $(sysconfdir)/$(FONTDIR)
-pkgfontconfig_DATA = filter/pdftoopvp/99pdftoopvp.conf
-pdftoopvp_SOURCES = \
- filter/pdftoopvp/oprs/OPRS.cxx \
- filter/pdftoopvp/oprs/OPRS.h \
- filter/pdftoopvp/oprs/OPVPSplashClip.cxx \
- filter/pdftoopvp/oprs/OPVPSplashClip.h \
- filter/pdftoopvp/oprs/OPVPSplash.cxx \
- filter/pdftoopvp/oprs/OPVPSplash.h \
- filter/pdftoopvp/oprs/OPVPSplashPath.cxx \
- filter/pdftoopvp/oprs/OPVPSplashPath.h \
- filter/pdftoopvp/oprs/OPVPSplashState.cxx \
- filter/pdftoopvp/oprs/OPVPSplashState.h \
- filter/pdftoopvp/oprs/OPVPSplashXPath.cxx \
- filter/pdftoopvp/oprs/OPVPSplashXPath.h \
- filter/pdftoopvp/oprs/OPVPWrapper.cxx \
- filter/pdftoopvp/oprs/OPVPWrapper.h \
- filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx \
- filter/pdftoopvp/oprs/OPVPWrapper_0_2.h \
- filter/pdftoopvp/OPVPError.h \
- filter/pdftoopvp/opvp/opvp_common.h \
- filter/pdftoopvp/opvp/opvp.h \
- filter/pdftoopvp/opvp/opvp_0_2_0.h \
- filter/pdftoopvp/OPVPOutputDev.cxx \
- filter/pdftoopvp/OPVPOutputDev.h \
- filter/pdftoopvp/pdftoopvp.cxx
-
-pdftoopvp_CFLAGS = \
- $(CUPS_CFLAGS) \
- $(FREETYPE_CFLAGS) \
- $(FONTCONFIG_CFLAGS) \
- $(LIBPNG_CFLAGS) \
- $(POPPLER_CFLAGS) \
- -I$(srcdir)/filter/pdftoopvp/oprs \
- -I$(srcdir)/filter/pdftoopvp/opvp
-
-pdftoopvp_CXXFLAGS = $(pdftoopvp_CFLAGS)
-pdftoopvp_LDADD = \
- $(CUPS_LIBS) \
- $(FREETYPE_LIBS) \
- $(FONTCONFIG_LIBS) \
- $(LIBPNG_LIBS) \
- $(POPPLER_LIBS)
-
pdftopdf_SOURCES = \
filter/pdftopdf/pdftopdf.cc \
filter/pdftopdf/pdftopdf_jcl.cc \
@@ -893,6 +882,7 @@ pdftopdf_LDADD = \
# Simple filter binaries
# ======================
pkgfilter_SCRIPTS = \
+ filter/gstopxl \
filter/imagetops \
filter/pstopdf \
filter/textonly \
@@ -918,6 +908,20 @@ commandtopclx_CFLAGS = \
-I$(srcdir)/cupsfilters/
commandtopclx_LDADD = $(CUPS_LIBS)
+gstoraster_SOURCES = \
+ filter/gstoraster.c \
+ filter/colord.c \
+ filter/colord.h \
+ cupsfilters/raster.h
+
+gstoraster_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ -I$(srcdir)/cupsfilters/
+
+gstoraster_LDADD = \
+ $(CUPS_LIBS) \
+ -lcupsfilters
+
imagetopdf_SOURCES = \
cupsfilters/image.h \
filter/common.c \
@@ -1072,6 +1076,24 @@ texttopdf_LDADD = \
$(FONTCONFIG_LIBS) \
libfontembed.la
+cups_browsed_SOURCES = \
+ utils/cups-browsed.c
+
+cups_browsed_CFLAGS = \
+ $(CUPS_CFLAGS) \
+ $(AVAHI_CFLAGS) \
+ $(AVAHI_GLIB_CFLAGS) \
+ $(GLIB_CFLAGS)
+
+cups_browsed_CXXFLAGS = $(cups_browsed_CFLAGS)
+cups_browsed_LDADD = \
+ $(CUPS_LIBS) \
+ $(AVAHI_LIBS) \
+ $(AVAHI_GLIB_LIBS) \
+ $(GLIB_LIBS)
+
+initrcdir = $(INITDDIR)
+initrc_SCRIPTS = utils/cups-browsed
# ===
# PPD
@@ -1081,6 +1103,8 @@ ppd_DATA = \
ppd/Generic-PDF_Printer-PDF.ppd \
ppd/HP-Color_LaserJet_CM3530_MFP-PDF.ppd \
ppd/HP-PhotoSmart_Pro_B8300-hpijs-pdftoijs.ppd \
+ ppd/pxlcolor.ppd \
+ ppd/pxlmono.ppd \
ppd/textonly.ppd
@@ -1154,6 +1178,12 @@ libcupsfilters.pc: $(top_builddir)/config.status $(srcdir)/libcupsfilters.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
libfontembed.pc: $(top_builddir)/config.status $(srcdir)/libfontembed.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
+filter/gstopxl: $(top_builddir)/config.status $(top_srcdir)/filter/gstopxl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+utils/cups-browsed: $(top_builddir)/config.status $(top_srcdir)/utils/cups-browsed.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+utils/cups-browsed.conf: $(top_builddir)/config.status $(top_srcdir)/utils/cups-browsed.conf.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
@@ -1371,12 +1401,64 @@ clean-pkgfilterPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
+install-sbinPROGRAMS: $(sbin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-sbinPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+
+clean-sbinPROGRAMS:
+ @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
commandtoescpx$(EXEEXT): $(commandtoescpx_OBJECTS) $(commandtoescpx_DEPENDENCIES) $(EXTRA_commandtoescpx_DEPENDENCIES)
@rm -f commandtoescpx$(EXEEXT)
$(AM_V_CCLD)$(commandtoescpx_LINK) $(commandtoescpx_OBJECTS) $(commandtoescpx_LDADD) $(LIBS)
commandtopclx$(EXEEXT): $(commandtopclx_OBJECTS) $(commandtopclx_DEPENDENCIES) $(EXTRA_commandtopclx_DEPENDENCIES)
@rm -f commandtopclx$(EXEEXT)
$(AM_V_CCLD)$(commandtopclx_LINK) $(commandtopclx_OBJECTS) $(commandtopclx_LDADD) $(LIBS)
+cups-browsed$(EXEEXT): $(cups_browsed_OBJECTS) $(cups_browsed_DEPENDENCIES) $(EXTRA_cups_browsed_DEPENDENCIES)
+ @rm -f cups-browsed$(EXEEXT)
+ $(AM_V_CCLD)$(cups_browsed_LINK) $(cups_browsed_OBJECTS) $(cups_browsed_LDADD) $(LIBS)
+gstoraster$(EXEEXT): $(gstoraster_OBJECTS) $(gstoraster_DEPENDENCIES) $(EXTRA_gstoraster_DEPENDENCIES)
+ @rm -f gstoraster$(EXEEXT)
+ $(AM_V_CCLD)$(gstoraster_LINK) $(gstoraster_OBJECTS) $(gstoraster_LDADD) $(LIBS)
imagetopdf$(EXEEXT): $(imagetopdf_OBJECTS) $(imagetopdf_DEPENDENCIES) $(EXTRA_imagetopdf_DEPENDENCIES)
@rm -f imagetopdf$(EXEEXT)
$(AM_V_CCLD)$(imagetopdf_LINK) $(imagetopdf_OBJECTS) $(imagetopdf_LDADD) $(LIBS)
@@ -1389,9 +1471,6 @@ parallel$(EXEEXT): $(parallel_OBJECTS) $(parallel_DEPENDENCIES) $(EXTRA_parallel
pdftoijs$(EXEEXT): $(pdftoijs_OBJECTS) $(pdftoijs_DEPENDENCIES) $(EXTRA_pdftoijs_DEPENDENCIES)
@rm -f pdftoijs$(EXEEXT)
$(AM_V_CXXLD)$(pdftoijs_LINK) $(pdftoijs_OBJECTS) $(pdftoijs_LDADD) $(LIBS)
-pdftoopvp$(EXEEXT): $(pdftoopvp_OBJECTS) $(pdftoopvp_DEPENDENCIES) $(EXTRA_pdftoopvp_DEPENDENCIES)
- @rm -f pdftoopvp$(EXEEXT)
- $(AM_V_CXXLD)$(pdftoopvp_LINK) $(pdftoopvp_OBJECTS) $(pdftoopvp_LDADD) $(LIBS)
pdftopdf$(EXEEXT): $(pdftopdf_OBJECTS) $(pdftopdf_DEPENDENCIES) $(EXTRA_pdftopdf_DEPENDENCIES)
@rm -f pdftopdf$(EXEEXT)
$(AM_V_CXXLD)$(pdftopdf_LINK) $(pdftopdf_OBJECTS) $(pdftopdf_LDADD) $(LIBS)
@@ -1446,6 +1525,41 @@ texttopdf$(EXEEXT): $(texttopdf_OBJECTS) $(texttopdf_DEPENDENCIES) $(EXTRA_textt
ttfread$(EXEEXT): $(ttfread_OBJECTS) $(ttfread_DEPENDENCIES) $(EXTRA_ttfread_DEPENDENCIES)
@rm -f ttfread$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(ttfread_OBJECTS) $(ttfread_LDADD) $(LIBS)
+install-initrcSCRIPTS: $(initrc_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(initrc_SCRIPTS)'; test -n "$(initrcdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(initrcdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(initrcdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(initrcdir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(initrcdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-initrcSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(initrc_SCRIPTS)'; test -n "$(initrcdir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ dir='$(DESTDIR)$(initrcdir)'; $(am__uninstall_files_from_dir)
install-pkgfilterSCRIPTS: $(pkgfilter_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(pkgfilter_SCRIPTS)'; test -n "$(pkgfilterdir)" || list=; \
@@ -1491,12 +1605,15 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aglfn13.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commandtoescpx-commandtoescpx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commandtopclx-commandtopclx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cups_browsed-cups-browsed.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynstring.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/embed.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/embed_pdf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/embed_sfnt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontfile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frequent.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstoraster-colord.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstoraster-gstoraster.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imagetopdf-common.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imagetopdf-imagetopdf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imagetoraster-common.Po@am__quote@
@@ -1521,6 +1638,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-image.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-lut.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-pack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-raster.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-rgb.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcupsfilters_la-srgb.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libphpcups_la-phpcups.Plo@am__quote@
@@ -1528,16 +1646,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel-ieee1284.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel-parallel.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoijs-pdftoijs.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPRS.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPOutputDev.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplash.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplashClip.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplashPath.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplashState.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPSplashXPath.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPWrapper.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftoopvp-pdftoopvp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-intervalset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-nup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdftopdf-pdftopdf.Po@am__quote@
@@ -1738,6 +1846,13 @@ libcupsfilters_la-pack.lo: cupsfilters/pack.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-pack.lo `test -f 'cupsfilters/pack.c' || echo '$(srcdir)/'`cupsfilters/pack.c
+libcupsfilters_la-raster.lo: cupsfilters/raster.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-raster.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-raster.Tpo -c -o libcupsfilters_la-raster.lo `test -f 'cupsfilters/raster.c' || echo '$(srcdir)/'`cupsfilters/raster.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-raster.Tpo $(DEPDIR)/libcupsfilters_la-raster.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cupsfilters/raster.c' object='libcupsfilters_la-raster.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -c -o libcupsfilters_la-raster.lo `test -f 'cupsfilters/raster.c' || echo '$(srcdir)/'`cupsfilters/raster.c
+
libcupsfilters_la-rgb.lo: cupsfilters/rgb.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcupsfilters_la_CFLAGS) $(CFLAGS) -MT libcupsfilters_la-rgb.lo -MD -MP -MF $(DEPDIR)/libcupsfilters_la-rgb.Tpo -c -o libcupsfilters_la-rgb.lo `test -f 'cupsfilters/rgb.c' || echo '$(srcdir)/'`cupsfilters/rgb.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcupsfilters_la-rgb.Tpo $(DEPDIR)/libcupsfilters_la-rgb.Plo
@@ -1850,6 +1965,48 @@ commandtopclx-commandtopclx.obj: filter/commandtopclx.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(commandtopclx_CFLAGS) $(CFLAGS) -c -o commandtopclx-commandtopclx.obj `if test -f 'filter/commandtopclx.c'; then $(CYGPATH_W) 'filter/commandtopclx.c'; else $(CYGPATH_W) '$(srcdir)/filter/commandtopclx.c'; fi`
+cups_browsed-cups-browsed.o: utils/cups-browsed.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cups_browsed_CFLAGS) $(CFLAGS) -MT cups_browsed-cups-browsed.o -MD -MP -MF $(DEPDIR)/cups_browsed-cups-browsed.Tpo -c -o cups_browsed-cups-browsed.o `test -f 'utils/cups-browsed.c' || echo '$(srcdir)/'`utils/cups-browsed.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cups_browsed-cups-browsed.Tpo $(DEPDIR)/cups_browsed-cups-browsed.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utils/cups-browsed.c' object='cups_browsed-cups-browsed.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cups_browsed_CFLAGS) $(CFLAGS) -c -o cups_browsed-cups-browsed.o `test -f 'utils/cups-browsed.c' || echo '$(srcdir)/'`utils/cups-browsed.c
+
+cups_browsed-cups-browsed.obj: utils/cups-browsed.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cups_browsed_CFLAGS) $(CFLAGS) -MT cups_browsed-cups-browsed.obj -MD -MP -MF $(DEPDIR)/cups_browsed-cups-browsed.Tpo -c -o cups_browsed-cups-browsed.obj `if test -f 'utils/cups-browsed.c'; then $(CYGPATH_W) 'utils/cups-browsed.c'; else $(CYGPATH_W) '$(srcdir)/utils/cups-browsed.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cups_browsed-cups-browsed.Tpo $(DEPDIR)/cups_browsed-cups-browsed.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utils/cups-browsed.c' object='cups_browsed-cups-browsed.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cups_browsed_CFLAGS) $(CFLAGS) -c -o cups_browsed-cups-browsed.obj `if test -f 'utils/cups-browsed.c'; then $(CYGPATH_W) 'utils/cups-browsed.c'; else $(CYGPATH_W) '$(srcdir)/utils/cups-browsed.c'; fi`
+
+gstoraster-gstoraster.o: filter/gstoraster.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gstoraster_CFLAGS) $(CFLAGS) -MT gstoraster-gstoraster.o -MD -MP -MF $(DEPDIR)/gstoraster-gstoraster.Tpo -c -o gstoraster-gstoraster.o `test -f 'filter/gstoraster.c' || echo '$(srcdir)/'`filter/gstoraster.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstoraster-gstoraster.Tpo $(DEPDIR)/gstoraster-gstoraster.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/gstoraster.c' object='gstoraster-gstoraster.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gstoraster_CFLAGS) $(CFLAGS) -c -o gstoraster-gstoraster.o `test -f 'filter/gstoraster.c' || echo '$(srcdir)/'`filter/gstoraster.c
+
+gstoraster-gstoraster.obj: filter/gstoraster.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gstoraster_CFLAGS) $(CFLAGS) -MT gstoraster-gstoraster.obj -MD -MP -MF $(DEPDIR)/gstoraster-gstoraster.Tpo -c -o gstoraster-gstoraster.obj `if test -f 'filter/gstoraster.c'; then $(CYGPATH_W) 'filter/gstoraster.c'; else $(CYGPATH_W) '$(srcdir)/filter/gstoraster.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstoraster-gstoraster.Tpo $(DEPDIR)/gstoraster-gstoraster.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/gstoraster.c' object='gstoraster-gstoraster.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gstoraster_CFLAGS) $(CFLAGS) -c -o gstoraster-gstoraster.obj `if test -f 'filter/gstoraster.c'; then $(CYGPATH_W) 'filter/gstoraster.c'; else $(CYGPATH_W) '$(srcdir)/filter/gstoraster.c'; fi`
+
+gstoraster-colord.o: filter/colord.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gstoraster_CFLAGS) $(CFLAGS) -MT gstoraster-colord.o -MD -MP -MF $(DEPDIR)/gstoraster-colord.Tpo -c -o gstoraster-colord.o `test -f 'filter/colord.c' || echo '$(srcdir)/'`filter/colord.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstoraster-colord.Tpo $(DEPDIR)/gstoraster-colord.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/colord.c' object='gstoraster-colord.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gstoraster_CFLAGS) $(CFLAGS) -c -o gstoraster-colord.o `test -f 'filter/colord.c' || echo '$(srcdir)/'`filter/colord.c
+
+gstoraster-colord.obj: filter/colord.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gstoraster_CFLAGS) $(CFLAGS) -MT gstoraster-colord.obj -MD -MP -MF $(DEPDIR)/gstoraster-colord.Tpo -c -o gstoraster-colord.obj `if test -f 'filter/colord.c'; then $(CYGPATH_W) 'filter/colord.c'; else $(CYGPATH_W) '$(srcdir)/filter/colord.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstoraster-colord.Tpo $(DEPDIR)/gstoraster-colord.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter/colord.c' object='gstoraster-colord.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gstoraster_CFLAGS) $(CFLAGS) -c -o gstoraster-colord.obj `if test -f 'filter/colord.c'; then $(CYGPATH_W) 'filter/colord.c'; else $(CYGPATH_W) '$(srcdir)/filter/colord.c'; fi`
+
imagetopdf-common.o: filter/common.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(imagetopdf_CFLAGS) $(CFLAGS) -MT imagetopdf-common.o -MD -MP -MF $(DEPDIR)/imagetopdf-common.Tpo -c -o imagetopdf-common.o `test -f 'filter/common.c' || echo '$(srcdir)/'`filter/common.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/imagetopdf-common.Tpo $(DEPDIR)/imagetopdf-common.Po
@@ -2319,146 +2476,6 @@ pdftoijs-pdftoijs.obj: filter/pdftoijs.cxx
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoijs_CXXFLAGS) $(CXXFLAGS) -c -o pdftoijs-pdftoijs.obj `if test -f 'filter/pdftoijs.cxx'; then $(CYGPATH_W) 'filter/pdftoijs.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoijs.cxx'; fi`
-pdftoopvp-OPRS.o: filter/pdftoopvp/oprs/OPRS.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPRS.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPRS.Tpo -c -o pdftoopvp-OPRS.o `test -f 'filter/pdftoopvp/oprs/OPRS.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPRS.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPRS.Tpo $(DEPDIR)/pdftoopvp-OPRS.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPRS.cxx' object='pdftoopvp-OPRS.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPRS.o `test -f 'filter/pdftoopvp/oprs/OPRS.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPRS.cxx
-
-pdftoopvp-OPRS.obj: filter/pdftoopvp/oprs/OPRS.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPRS.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPRS.Tpo -c -o pdftoopvp-OPRS.obj `if test -f 'filter/pdftoopvp/oprs/OPRS.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPRS.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPRS.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPRS.Tpo $(DEPDIR)/pdftoopvp-OPRS.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPRS.cxx' object='pdftoopvp-OPRS.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPRS.obj `if test -f 'filter/pdftoopvp/oprs/OPRS.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPRS.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPRS.cxx'; fi`
-
-pdftoopvp-OPVPSplashClip.o: filter/pdftoopvp/oprs/OPVPSplashClip.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashClip.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashClip.Tpo -c -o pdftoopvp-OPVPSplashClip.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashClip.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashClip.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashClip.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashClip.cxx' object='pdftoopvp-OPVPSplashClip.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashClip.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashClip.cxx
-
-pdftoopvp-OPVPSplashClip.obj: filter/pdftoopvp/oprs/OPVPSplashClip.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashClip.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashClip.Tpo -c -o pdftoopvp-OPVPSplashClip.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashClip.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashClip.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashClip.cxx' object='pdftoopvp-OPVPSplashClip.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashClip.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashClip.cxx'; fi`
-
-pdftoopvp-OPVPSplash.o: filter/pdftoopvp/oprs/OPVPSplash.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplash.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplash.Tpo -c -o pdftoopvp-OPVPSplash.o `test -f 'filter/pdftoopvp/oprs/OPVPSplash.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplash.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplash.Tpo $(DEPDIR)/pdftoopvp-OPVPSplash.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplash.cxx' object='pdftoopvp-OPVPSplash.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplash.o `test -f 'filter/pdftoopvp/oprs/OPVPSplash.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplash.cxx
-
-pdftoopvp-OPVPSplash.obj: filter/pdftoopvp/oprs/OPVPSplash.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplash.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplash.Tpo -c -o pdftoopvp-OPVPSplash.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplash.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplash.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplash.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplash.Tpo $(DEPDIR)/pdftoopvp-OPVPSplash.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplash.cxx' object='pdftoopvp-OPVPSplash.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplash.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplash.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplash.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplash.cxx'; fi`
-
-pdftoopvp-OPVPSplashPath.o: filter/pdftoopvp/oprs/OPVPSplashPath.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashPath.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashPath.Tpo -c -o pdftoopvp-OPVPSplashPath.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashPath.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashPath.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashPath.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashPath.cxx' object='pdftoopvp-OPVPSplashPath.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashPath.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashPath.cxx
-
-pdftoopvp-OPVPSplashPath.obj: filter/pdftoopvp/oprs/OPVPSplashPath.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashPath.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashPath.Tpo -c -o pdftoopvp-OPVPSplashPath.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashPath.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashPath.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashPath.cxx' object='pdftoopvp-OPVPSplashPath.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashPath.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashPath.cxx'; fi`
-
-pdftoopvp-OPVPSplashState.o: filter/pdftoopvp/oprs/OPVPSplashState.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashState.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashState.Tpo -c -o pdftoopvp-OPVPSplashState.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashState.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashState.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashState.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashState.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashState.cxx' object='pdftoopvp-OPVPSplashState.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashState.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashState.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashState.cxx
-
-pdftoopvp-OPVPSplashState.obj: filter/pdftoopvp/oprs/OPVPSplashState.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashState.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashState.Tpo -c -o pdftoopvp-OPVPSplashState.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashState.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashState.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashState.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashState.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashState.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashState.cxx' object='pdftoopvp-OPVPSplashState.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashState.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashState.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashState.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashState.cxx'; fi`
-
-pdftoopvp-OPVPSplashXPath.o: filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashXPath.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Tpo -c -o pdftoopvp-OPVPSplashXPath.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashXPath.cxx' object='pdftoopvp-OPVPSplashXPath.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashXPath.o `test -f 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
-
-pdftoopvp-OPVPSplashXPath.obj: filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPSplashXPath.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Tpo -c -o pdftoopvp-OPVPSplashXPath.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Tpo $(DEPDIR)/pdftoopvp-OPVPSplashXPath.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPSplashXPath.cxx' object='pdftoopvp-OPVPSplashXPath.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPSplashXPath.obj `if test -f 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx'; fi`
-
-pdftoopvp-OPVPWrapper.o: filter/pdftoopvp/oprs/OPVPWrapper.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPWrapper.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPWrapper.Tpo -c -o pdftoopvp-OPVPWrapper.o `test -f 'filter/pdftoopvp/oprs/OPVPWrapper.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPWrapper.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPWrapper.Tpo $(DEPDIR)/pdftoopvp-OPVPWrapper.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPWrapper.cxx' object='pdftoopvp-OPVPWrapper.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPWrapper.o `test -f 'filter/pdftoopvp/oprs/OPVPWrapper.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPWrapper.cxx
-
-pdftoopvp-OPVPWrapper.obj: filter/pdftoopvp/oprs/OPVPWrapper.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPWrapper.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPWrapper.Tpo -c -o pdftoopvp-OPVPWrapper.obj `if test -f 'filter/pdftoopvp/oprs/OPVPWrapper.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPWrapper.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPWrapper.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPWrapper.Tpo $(DEPDIR)/pdftoopvp-OPVPWrapper.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPWrapper.cxx' object='pdftoopvp-OPVPWrapper.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPWrapper.obj `if test -f 'filter/pdftoopvp/oprs/OPVPWrapper.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPWrapper.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPWrapper.cxx'; fi`
-
-pdftoopvp-OPVPWrapper_0_2.o: filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPWrapper_0_2.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Tpo -c -o pdftoopvp-OPVPWrapper_0_2.o `test -f 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Tpo $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx' object='pdftoopvp-OPVPWrapper_0_2.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPWrapper_0_2.o `test -f 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
-
-pdftoopvp-OPVPWrapper_0_2.obj: filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPWrapper_0_2.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Tpo -c -o pdftoopvp-OPVPWrapper_0_2.obj `if test -f 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Tpo $(DEPDIR)/pdftoopvp-OPVPWrapper_0_2.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx' object='pdftoopvp-OPVPWrapper_0_2.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPWrapper_0_2.obj `if test -f 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx'; fi`
-
-pdftoopvp-OPVPOutputDev.o: filter/pdftoopvp/OPVPOutputDev.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPOutputDev.o -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPOutputDev.Tpo -c -o pdftoopvp-OPVPOutputDev.o `test -f 'filter/pdftoopvp/OPVPOutputDev.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/OPVPOutputDev.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPOutputDev.Tpo $(DEPDIR)/pdftoopvp-OPVPOutputDev.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/OPVPOutputDev.cxx' object='pdftoopvp-OPVPOutputDev.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPOutputDev.o `test -f 'filter/pdftoopvp/OPVPOutputDev.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/OPVPOutputDev.cxx
-
-pdftoopvp-OPVPOutputDev.obj: filter/pdftoopvp/OPVPOutputDev.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-OPVPOutputDev.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-OPVPOutputDev.Tpo -c -o pdftoopvp-OPVPOutputDev.obj `if test -f 'filter/pdftoopvp/OPVPOutputDev.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/OPVPOutputDev.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/OPVPOutputDev.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-OPVPOutputDev.Tpo $(DEPDIR)/pdftoopvp-OPVPOutputDev.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/OPVPOutputDev.cxx' object='pdftoopvp-OPVPOutputDev.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-OPVPOutputDev.obj `if test -f 'filter/pdftoopvp/OPVPOutputDev.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/OPVPOutputDev.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/OPVPOutputDev.cxx'; fi`
-
-pdftoopvp-pdftoopvp.o: filter/pdftoopvp/pdftoopvp.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-pdftoopvp.o -MD -MP -MF $(DEPDIR)/pdftoopvp-pdftoopvp.Tpo -c -o pdftoopvp-pdftoopvp.o `test -f 'filter/pdftoopvp/pdftoopvp.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/pdftoopvp.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-pdftoopvp.Tpo $(DEPDIR)/pdftoopvp-pdftoopvp.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/pdftoopvp.cxx' object='pdftoopvp-pdftoopvp.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-pdftoopvp.o `test -f 'filter/pdftoopvp/pdftoopvp.cxx' || echo '$(srcdir)/'`filter/pdftoopvp/pdftoopvp.cxx
-
-pdftoopvp-pdftoopvp.obj: filter/pdftoopvp/pdftoopvp.cxx
-@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -MT pdftoopvp-pdftoopvp.obj -MD -MP -MF $(DEPDIR)/pdftoopvp-pdftoopvp.Tpo -c -o pdftoopvp-pdftoopvp.obj `if test -f 'filter/pdftoopvp/pdftoopvp.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/pdftoopvp.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/pdftoopvp.cxx'; fi`
-@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftoopvp-pdftoopvp.Tpo $(DEPDIR)/pdftoopvp-pdftoopvp.Po
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='filter/pdftoopvp/pdftoopvp.cxx' object='pdftoopvp-pdftoopvp.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftoopvp_CXXFLAGS) $(CXXFLAGS) -c -o pdftoopvp-pdftoopvp.obj `if test -f 'filter/pdftoopvp/pdftoopvp.cxx'; then $(CYGPATH_W) 'filter/pdftoopvp/pdftoopvp.cxx'; else $(CYGPATH_W) '$(srcdir)/filter/pdftoopvp/pdftoopvp.cxx'; fi`
-
pdftopdf-pdftopdf.o: filter/pdftopdf/pdftopdf.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pdftopdf_CXXFLAGS) $(CXXFLAGS) -MT pdftopdf-pdftopdf.o -MD -MP -MF $(DEPDIR)/pdftopdf-pdftopdf.Tpo -c -o pdftopdf-pdftopdf.o `test -f 'filter/pdftopdf/pdftopdf.cc' || echo '$(srcdir)/'`filter/pdftopdf/pdftopdf.cc
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pdftopdf-pdftopdf.Tpo $(DEPDIR)/pdftopdf-pdftopdf.Po
@@ -2698,7 +2715,6 @@ uninstall-docDATA:
@list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
-
install-pkgconfDATA: $(pkgconf_DATA)
@$(NORMAL_INSTALL)
@list='$(pkgconf_DATA)'; test -n "$(pkgconfdir)" || list=; \
@@ -2720,7 +2736,27 @@ uninstall-pkgconfDATA:
@list='$(pkgconf_DATA)'; test -n "$(pkgconfdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgconfdir)'; $(am__uninstall_files_from_dir)
+install-pkgcupsserverrootDATA: $(pkgcupsserverroot_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgcupsserverroot_DATA)'; test -n "$(pkgcupsserverrootdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgcupsserverrootdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgcupsserverrootdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgcupsserverrootdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgcupsserverrootdir)" || exit $$?; \
+ done
+uninstall-pkgcupsserverrootDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgcupsserverroot_DATA)'; test -n "$(pkgcupsserverrootdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgcupsserverrootdir)'; $(am__uninstall_files_from_dir)
install-pkgfiltersincludeDATA: $(pkgfiltersinclude_DATA)
@$(NORMAL_INSTALL)
@list='$(pkgfiltersinclude_DATA)'; test -n "$(pkgfiltersincludedir)" || list=; \
@@ -3143,7 +3179,7 @@ all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \
install-binPROGRAMS: install-libLTLIBRARIES
installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(phpextensiondir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgbackenddir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfdir)" "$(DESTDIR)$(pkgfiltersincludedir)" "$(DESTDIR)$(pkgfontconfigdir)" "$(DESTDIR)$(pkgfontembedincludedir)" "$(DESTDIR)$(pkgmimedir)" "$(DESTDIR)$(ppddir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(phpextensiondir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgbackenddir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(initrcdir)" "$(DESTDIR)$(pkgfilterdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfdir)" "$(DESTDIR)$(pkgcupsserverrootdir)" "$(DESTDIR)$(pkgfiltersincludedir)" "$(DESTDIR)$(pkgfontconfigdir)" "$(DESTDIR)$(pkgfontembedincludedir)" "$(DESTDIR)$(pkgmimedir)" "$(DESTDIR)$(ppddir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -3181,7 +3217,7 @@ clean: clean-am
clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
clean-libLTLIBRARIES clean-libtool \
clean-phpextensionLTLIBRARIES clean-pkgbackendPROGRAMS \
- clean-pkgfilterPROGRAMS mostlyclean-am
+ clean-pkgfilterPROGRAMS clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
@@ -3202,9 +3238,10 @@ info: info-am
info-am:
-install-data-am: install-docDATA install-phpextensionLTLIBRARIES \
- install-pkgbackendPROGRAMS \
+install-data-am: install-docDATA install-initrcSCRIPTS \
+ install-phpextensionLTLIBRARIES install-pkgbackendPROGRAMS \
install-pkgconfDATA \
+ install-pkgcupsserverrootDATA \
install-pkgfilterPROGRAMS install-pkgfilterSCRIPTS \
install-pkgfiltersincludeDATA install-pkgfontconfigDATA \
install-pkgfontembedincludeDATA install-pkgmimeDATA \
@@ -3215,7 +3252,8 @@ install-dvi: install-dvi-am
install-dvi-am:
-install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES \
+ install-sbinPROGRAMS
install-html: install-html-am
@@ -3258,23 +3296,26 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-docDATA \
- uninstall-libLTLIBRARIES uninstall-phpextensionLTLIBRARIES \
- uninstall-pkgbackendPROGRAMS \
+ uninstall-initrcSCRIPTS uninstall-libLTLIBRARIES \
+ uninstall-phpextensionLTLIBRARIES uninstall-pkgbackendPROGRAMS \
uninstall-pkgconfDATA \
+ uninstall-pkgcupsserverrootDATA \
uninstall-pkgfilterPROGRAMS uninstall-pkgfilterSCRIPTS \
uninstall-pkgfiltersincludeDATA uninstall-pkgfontconfigDATA \
uninstall-pkgfontembedincludeDATA uninstall-pkgmimeDATA \
- uninstall-ppdDATA
-
-.MAKE: all check-am install-am install-data-am install-strip
+ uninstall-ppdDATA uninstall-sbinPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: all check-am install-am install-data-am install-strip \
+ uninstall-am
.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
clean-libLTLIBRARIES clean-libtool \
clean-phpextensionLTLIBRARIES clean-pkgbackendPROGRAMS \
- clean-pkgfilterPROGRAMS ctags dist dist-all dist-bzip2 \
- dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \
- dist-zip distcheck distclean distclean-compile \
+ clean-pkgfilterPROGRAMS clean-sbinPROGRAMS ctags dist dist-all \
+ dist-bzip2 dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ \
+ dist-xz dist-zip distcheck distclean distclean-compile \
distclean-generic distclean-hdr distclean-libtool \
distclean-local distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
@@ -3282,32 +3323,51 @@ uninstall-am: uninstall-binPROGRAMS uninstall-docDATA \
install-data-am install-data-hook install-docDATA install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
- install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-initrcSCRIPTS install-libLTLIBRARIES install-man \
+ install-pdf install-pdf-am \
install-phpextensionLTLIBRARIES install-pkgbackendPROGRAMS \
- \
install-pkgconfDATA \
- install-pkgfilterPROGRAMS \
- install-pkgfilterSCRIPTS install-pkgfiltersincludeDATA \
- install-pkgfontconfigDATA install-pkgfontembedincludeDATA \
- install-pkgmimeDATA install-ppdDATA install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-binPROGRAMS uninstall-docDATA \
- uninstall-libLTLIBRARIES uninstall-phpextensionLTLIBRARIES \
+ install-pkgcupsserverrootDATA \
+ install-pkgfilterPROGRAMS install-pkgfilterSCRIPTS \
+ install-pkgfiltersincludeDATA install-pkgfontconfigDATA \
+ install-pkgfontembedincludeDATA install-pkgmimeDATA \
+ install-ppdDATA install-ps install-ps-am \
+ install-sbinPROGRAMS install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-docDATA uninstall-hook uninstall-initrcSCRIPTS \
+ uninstall-libLTLIBRARIES uninstall-man uninstall-man5 \
+ uninstall-man8 uninstall-phpextensionLTLIBRARIES \
uninstall-pkgbackendPROGRAMS \
uninstall-pkgconfDATA \
- uninstall-pkgfilterPROGRAMS uninstall-pkgfilterSCRIPTS \
- uninstall-pkgfiltersincludeDATA uninstall-pkgfontconfigDATA \
- uninstall-pkgfontembedincludeDATA uninstall-pkgmimeDATA \
- uninstall-ppdDATA
+ uninstall-pkgcupsserverrootDATA \
+ uninstall-pkgfilterPROGRAMS \
+ uninstall-pkgfilterSCRIPTS uninstall-pkgfiltersincludeDATA \
+ uninstall-pkgfontconfigDATA uninstall-pkgfontembedincludeDATA \
+ uninstall-pkgmimeDATA uninstall-ppdDATA \
+ uninstall-sbinPROGRAMS
- $(DLOPEN_LIBS)
distclean-local:
rm -rf *.cache *~
+install-data-hook:
+@RCLINKS_TRUE@ for level in $(RCLEVELS); do \
+@RCLINKS_TRUE@ $(INSTALL) -d -m 755 $(DESTDIR)$(INITDIR)/rc$${level}.d; \
+@RCLINKS_TRUE@ $(LN_S) -f ../init.d/cups-browsed $(DESTDIR)$(INITDIR)/rc$${level}.d/S$(RCSTART)cups-browsed; \
+@RCLINKS_TRUE@ $(LN_S) -f ../init.d/cups-browsed $(DESTDIR)$(INITDIR)/rc$${level}.d/K$(RCSTOP)cups-browsed; \
+@RCLINKS_TRUE@ done; \
+@RCLINKS_TRUE@ $(INSTALL) -d -m 755 $(DESTDIR)$(INITDIR)/rc0.d; \
+@RCLINKS_TRUE@ $(LN_S) -f ../init.d/cups-browsed $(DESTDIR)$(INITDIR)/rc0.d/K$(RCSTOP)cups-browsed;
+
+uninstall-hook:
+@RCLINKS_TRUE@ if test "x$(INITDIR)" != x; then \
+@RCLINKS_TRUE@ $(RM) $(DESTDIR)$(BUILDROOT)$(INITDIR)/rc?.d/[SK]??cups-browsed || :; \
+@RCLINKS_TRUE@ rmdir $(DESTDIR)$(BUILDROOT)$(INITDIR)/rc?.d || :;\
+@RCLINKS_TRUE@ fi
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/NEWS b/NEWS
index dc55700..bb166fa 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,166 @@
-NEWS - OpenPrinting CUPS Filters v1.0.25 - 2012-11-28
+NEWS - OpenPrinting CUPS Filters v1.0.36 - 2013-08-13
-----------------------------------------------------
+CHANGES IN V1.0.36
+
+ - Fixed libdl detection in configure. Thanks to Andreas Huettel and
+ Yuta Satoh (Gentoo bug #478642).
+ - cups-browsed: Allow BrowsePoll operation also access print queues
+ on older CUPS servers. Thanks to David Mohr for the patch.
+ - cups-browsed: Assure that it always applies to the local CUPS
+ daemon and never to a remote one specified via client.conf
+ (Ubuntu bug #1207203).
+ - pdftoopvp, pdftoijs, pdftoraster, bannertopdf: Made code working
+ with Poppler 0.24.x (Bug #1144).
+ - gstoraster: Silenced compiler warnings.
+ - gstoraster, pdftoraster: Added support for PPD-less printing
+ controlled by IPP attributes (CUPS 1.7.x+ only).
+ - gstoraster, gstopxl: Moved these filters from Ghostscript to
+ cups-filters as upstream home.
+ - libcupsfilters: Added new cupsRasterParseIPPOptions() API
+ function for PPD-less printing controlled by IPP attributes
+ (raster.h, CUPS 1.7.x+ only).
+ - pdftopdf: Added support for page labels. "page-label" option and
+ "CLASSIFICATION" environment variable. Thanks to Tim Waugh from
+ Red Hat for the patch.
+ - pdftops: If one or more of the PDF-to-PS renderers (Ghostscript,
+ Poppler pdftops, Poppler pdftocairo, acroread) is not installed
+ at build time, pre-fill the appropriate executable's path with the
+ executable name to allow the use of this renderer when it gets
+ installed later (Debian bug #716842).
+ - cups-browsed: Do not resolve host names of remote printers discovered
+ via CUPS broadcasts (Bug #1141).
+ - Added man pages for cups-browsed and cups-browsed.conf. Thanks to
+ Brian Potkin for the contribution (Debian bug #714460).
+ - Install also escp.h, it is useful for .drv files.
+
+CHANGES IN V1.0.35
+
+ - pdftoraster: Silenced compiler warning (Bug #1092).
+ - bannertopdf: Fixed typo which prevented the host name to be shown
+ (Bug #1115).
+ - README: Fixed info about the PPD keyword cupsManualCopies (Bug
+ #1086).
+ - Modified the cost factors of the filters to avoid unneeded PDF
+ conversion detours when the input data is PostScript. Instead of
+ pstopdf->pdftopdf->pdftops and pstopdf->pdftopdf->gstoraster we
+ get pstops and pstops->gstoraster now (Bug #1138).
+ - pdftops: Added experimental support for pdftocairo as PDF renderer.
+ Note that PostScript level 1 output and PDF input with color
+ spaces other than DeviceRGB, DeviceGray, sRGB or sGray is not
+ supported. PDFs generated by Cairo (for example when printing from
+ evince) uses only supported color spaces. Thanks to James Cloos
+ for the patch (Bug #1139).
+ - cups-browsed: Changed default of browsing protocols fron none to
+ both DNS-SD and CUPS.
+ - pdftops: Let Poppler generally generate PostScript level 3 if the
+ PPD identifies the printer as PS3 printer, make an exception of
+ sending PostScript Level 2 only for HP's laser printers, to not
+ compromise print quality and performance on all PS3 printers only
+ due to some buggy HP models (Debian bug #712949, see also Ubuntu bug
+ #277404).
+ - Install pcl.h, it is needed by cupsfilters.drv. Thanks to Jiri
+ Popelka from Red Hat for the patch (Bug #1133).
+ - Make cups-filters building with automake 1.13. Thanks to Andreas K.
+ Huettel (dilfridge) on IRC.
+ - libcupsfilters, libfontembed, pdftopdf, texttopdf, cups-browsed:
+ Fixed several resource leaks and other problems. Thanks to Jiri
+ Popelka from Red Hat for the patches (Bug #1116).
+
+CHANGES IN V1.0.34
+
+ - cups-browsed: Fixed build with OpenBSD (Bug #1103).
+ - pdftopdf: Enabled hardware copy generation, if available.
+ - pdftopdf: Fixed evenDuplex logic.
+ - cups-browsed: If a queue left over from the last session
+ gets confirmed, fill in the data structure with the Bonjour
+ parameters, also update the Bonjour parameters if a local
+ queue is upgraded from IPP to IPPS.
+
+CHANGES IN V1.0.33
+
+ - cups-browsed: Added NULL check (Bug #1106).
+
+CHANGES IN V1.0.32
+
+ - cups-browsed: Shared algorithm to generate local queues based on
+ browsed remote queue data between Bonjour and CUPS browsing, as the
+ simpler method used for CUPS browsing could overwrite local print
+ queues and had de-duplication problems, for example if the server
+ appears on two IPs in the network (connected by both ethernet and
+ WLAN).
+ - cups-browsed: CUPS broadcasting also broadcasted non-shared,
+ especially cups-browsed-generated printers. Switched to detection
+ of non-shared printers by the appropriate bit in the printer-type
+ bit field IPP attribute.
+ - cups-browsed: Made CUPS broadcasting work also without BrowseAllow
+ lines in cups-browsed.conf. In this case we accept all remote
+ printers (Ubuntu bug #1163764).
+ - README: Updated documentation for cups-browsed.
+ - Added more comments and examples to /etc/cups/cups-browsed.conf.
+ - cups-browsed: Added support for "...:<port>" extensions of
+ BrowsePoll addresses. Thanks to Tim Waugh from Red Hat (Ubuntu
+ bug 1159213).
+
+CHANGES IN V1.0.31
+
+ - cups-browsed: cups-browsed removed valid local queues pointing to
+ remote queues when cups-browsed did not shut down cleanly after
+ the previous session, leaving the user with missing local accessor
+ queues for some of the remote CUPS queues (Ubuntu bug #1131149).
+ - Fixed build system to allow parallel or multilib builds. Thanks to
+ Timo Gurr for the patch (Bug #1104).
+ - pdftopdf: Improved error output.
+ - pdftopdf: getRotation now handles unusual cases more graceful
+ (probably fixes Ubuntu Bug #1154318).
+ - Fixed build system to allow building without Avahi. In this case
+ a cups-browsed with only CUPS broadcasting/browsing will get
+ built. Thanks to Tim Waugh from Red Hat (Bug #1101, Bug #1102).
+
+CHANGES IN V1.0.30
+
+ - cups-browsed: Do not remove a generated local print queue when
+ it was made the system default printer (Ubuntu bug #1146407).
+ - texttopdf: Fixed corrupted pdf when a utf-8 title is given and
+ corresponding crash with 'prettyprint' (Ubuntu Bug #1137438).
+ - cups-browsed: Added CUPS Broadcasting for sharing local printers
+ to remote CUPS clients with CUPS 1.5.x and older. Thanks to Tim
+ Waugh from Red Hat.
+ - cups-browsed: Added sample config-file and build-time default
+ setting options. Thanks to Tim Waugh from Red Hat.
+ - cups-browsed: Added CUPS browsing and BrowsePoll functionality, to
+ be backwards compatible to CUPS 1.5.x and older servers. Thanks
+ to Tim Waugh from Red Hat.
+ - pdftopdf: Fixed incorrect evenDuplex page insertion (Bug #1088).
+ - pdftoopvp: Let it build with Poppler 0.22.x. Thanks to Koji Otani
+ from BBR Inc. (Bug #1089).
+
+CHANGES IN V1.0.29
+
+ - Fixed ./configure option "--with-rcdir=no". Thanks to Jiri
+ Popelka from Red Hat (Bug #1091).
+
+CHANGES IN V1.0.28
+
+ - cups-browsed: Do not create CUPS queues for shared local CUPS
+ printers.
+
+CHANGES IN V1.0.27
+
+ - cups-browsed: The daemon crashed if there is no local CUPS queue
+ at all. Fixed.
+
+CHANGES IN V1.0.26
+
+ - Some fixes in README and INSTALL.
+ - cups-browsed: Added daemon to browse the Bonjour broadcasts of
+ shared remote CUPS printers and automatically add local raw queues
+ pointing to them, to resemble the behavior of the former CUPS
+ broadcasting/browsing which was dropped in CUPS 1.6. Now remote
+ printers appear as local print queues as before, but with the
+ standardized Bonjour broadcasting.
+ - "make dist" got broken in 1.0.25. Fixed.
+
CHANGES IN V1.0.25
- urftopdf: Newly added filter to convert the URF format which (at
diff --git a/README b/README
index 02b84d8..dede3d6 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README - OpenPrinting CUPS Filters v1.0.25 - 2012-11-28
+README - OpenPrinting CUPS Filters v1.0.36 - 2013-08-13
-------------------------------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
@@ -7,28 +7,32 @@ instead...
INTRODUCTION
- CUPS is a standards-based, open source printing system developed by Apple
- Inc. for Mac OS® X and other UNIX®-like operating systems. CUPS uses the
- Internet Printing Protocol ("IPP") and provides System V and Berkeley
- command-line interfaces, a web interface, and a C API to manage printers and
- print jobs.
-
- This distribution contains backends, filters, and other software that was
- once part of the core CUPS distribution but is no longer maintained by
- Apple Inc. In addition it contains additional filters developed
- independently of Apple, especially filters for the PDF-centric printing
- workflow introduced by OpenPrinting.
-
- From CUPS 1.6.0 on, this package will be required for using printer drivers
- with CUPS under Linux. With CUPS 1.5.x and earlier this package can be used
- optionally to switch over to PDF-based printing. In that case some filters
- are provided by both CUPS and this package. Then the filters of this package
- should be used.
-
- For compiling and using this package CUPS, Poppler, libjpeg, libpng,
- libtiff, libijs, freetype, fontconfig, and liblcms (liblcms2 recommended)
- are needed. It is highly recommended, especially if non-PostScript printers
- are used, to have Ghostscript, foomatic-filters, and foomatic-db installed.
+ CUPS is a standards-based, open source printing system developed
+ by Apple Inc. for Mac OS® X and other UNIX®-like operating
+ systems. CUPS uses the Internet Printing Protocol ("IPP") and
+ provides System V and Berkeley command-line interfaces, a web
+ interface, and a C API to manage printers and print jobs.
+
+ This distribution contains backends, filters, and other software
+ that was once part of the core CUPS distribution but is no longer
+ maintained by Apple Inc. In addition it contains additional
+ filters and software developed independently of Apple, especially
+ filters for the PDF-centric printing workflow introduced by
+ OpenPrinting and a daemon to browse Bonjour broadcasts of remote
+ CUPS printers and makes these printers available locally.
+
+ From CUPS 1.6.0 on, this package is required for using printer
+ drivers with CUPS under Linux. With CUPS 1.5.x and earlier this
+ package can be used optionally to switch over to PDF-based
+ printing. In that case some filters are provided by both CUPS and
+ this package. Then the filters of this package should be used.
+
+ For compiling and using this package CUPS, Poppler, libjpeg,
+ libpng, libtiff, libijs, freetype, fontconfig, liblcms (liblcms2
+ recommended), libavahi-common, and libavahi-client are needed. It
+ is highly recommended, especially if non-PostScript printers are
+ used, to have Ghostscript, foomatic-filters, and foomatic-db
+ installed.
CUPS, this package, and Ghostscript contain some rudimentary printer
drivers, see http://www.openprinting.org/drivers/ for a more
@@ -51,7 +55,7 @@ INTRODUCTION
IMAGE PRINTING DEFAULT CHANGED TO "SCALE TO FIT"
Compared to the PostScript-based original CUPS filters there is a
- change of deafults: The imagetopdf and imagetoraster filters print
+ change of defaults: The imagetopdf and imagetoraster filters print
in "scale-to-fit" mode (image is scaled to fill one page but
nothing of the image being cut off) by default.
@@ -88,18 +92,26 @@ POSTSCRIPT PRINTING RENDERER AND RESOLUTION SELECTION
Therefore there are two possibilities to configure pdftops at
runtime:
- 1. Selection of the renderer: Ghostscript, Poppler, or Adobe Reader
+ 1. Selection of the renderer: Ghostscript, Poppler, pdftocairo, or
+ Adobe Reader
Ghostscript has better color management and is generally optimized
more for printing. Poppler produces a PostScript which is
compatible with more buggy built-in PostScript interpreters of
printers and it leads to a somewhat quicker workflow when
graphical structures of the input PDF has to be turned into
- bitmaps. Adobe Reader is the PDF renderer from Adobe, the ones
- who created PDF and PostScript.
+ bitmaps. Adobe Reader is the PDF renderer from Adobe, the ones who
+ created PDF and PostScript. pdftocairo is a good choice for the
+ PDF output of Cairo (for example when printing from evince). It
+ is less resource-consuming when rasterizing graphical elements
+ which cannot be represented in PostScript (like
+ transparency). Note that pdftocairo only supports PDF input using
+ DeviceRGB, DeviceGray, RGB or sGray and is not capable of
+ generating PostScript level 1. So its support is only experimental
+ and distributions should not choose it as default.
The selection is done by the "pdftops-renderer" option, setting it
- to "gs", "pdftops", or "acroread":
+ to "gs", "pdftops", "pdftocairo", or "acroread":
Per-job: lpr -o pdftops-renderer=pdftops ...
Per-queue default: lpadmin -p printer -o pdftops-renderer-default=gs
@@ -164,6 +176,154 @@ POSTSCRIPT PRINTING DEBUG MODE
This option does not change anything if Poppler's pdftops is used
as renderer.
+HELPER DAEMON FOR BROWSING REMOTE CUPS PRINTERS
+
+ From version 1.6.0 on in CUPS the CUPS broadcasting/browsing
+ facility was dropped, in favour of Bonjour-based broadcasting of
+ shared printers. This is done as Bonjour broadcasting of shared
+ printers is a standard, established by the PWG (Printing Working
+ Group, http://www.pwg.org/), and most other network services
+ (shared file systems, shared media files/streams, remote desktop
+ services, ...) are also broadcasted via Bonjour.
+
+ Problem is that CUPS only broadcasts its shared printers but does
+ not browse broadcasts of other CUPS servers to make the shared
+ remote printers available locally without any configuration
+ efforts. This is a regression compared to the old CUPS
+ broadcasting/browsing. The intention of CUPS upstream is that the
+ application's print dialogs browse the Bonjour broadcasts as an
+ AirPrint-capable iPhone does, but it will take its time until all
+ toolkit developers add the needed functionality, and programs
+ using old toolkits or no toolkits at all, or the command line stay
+ uncovered.
+
+ The solution is cups-browsed, a helper daemon running in parallel
+ to the CUPS daemon which listens to Bonjour broadcasts of shared
+ CUPS printers on remote machines in the local network via Avahi,
+ and can also listen for (and send) CUPS Browsing broadcasts. For
+ each reported remote printer it creates a local raw queue pointing
+ to the remote printer so that the printer appears in local print
+ dialogs and is also available for printing via the command
+ line. As with the former CUPS broadcasting/browsing with this
+ queue the driver on the server is used and the local print dialogs
+ give access to all options of the server-side printer driver.
+
+ Note that CUPS broadcasting/browsing is available for legacy
+ support, to let the local CUPS daemon work seamlessly together
+ with remote CUPS daemons of version 1.5.x and older which only
+ support CUPS broadcasting/browsing. In networks with only CUPS
+ 1.6.x servers (or Ubuntu or Fedora/Red Hat servers with CUPS
+ 1.5.x) please use the native Bonjour broadcasting of your servers
+ and cups-browsed, configured for Bonjour browsing only on the
+ clients.
+
+ Also high availability with redundant print servers is
+ supported. If there is more than one server providing a shared
+ print queue with the same name, cups-browsed uses the first queue
+ which appeared and if this queue disappears, cups-browsed
+ seamlessly switches to the queue of another server. Unfortunately,
+ load-balancing (what CUPS did via implicit classes) is not
+ possible with cups-browsed.
+
+ For maximum security cups-browsed uses IPPS (encrypted IPP)
+ whenever possible.
+
+ The configuration file for cups-browsed is
+ /etc/cups/cups-browsed.conf. This file can include limited forms
+ of the original CUPS BrowseRemoteProtocols, BrowseLocalProtocols,
+ BrowsePoll, and BrowseAllow directives.
+
+ Note that cups-browsed does not work with remote CUPS servers
+ specified by a client.conf file. It always connects to the local
+ CUPS daemon by setting the CUPS_SERVER environment variable and so
+ overriding client.conf. If your local CUPS daemon uses a
+ non-standard domain socket as only way of access, you need to
+ specify it via the DomainSocket directive in
+ /etc/cups/cups-browsed.conf.
+
+ The "make install" process installs init scripts which make the
+ daemon automatically started during boot. You can also manually
+ start it with (as root):
+
+ /usr/sbin/cups-browsed &
+
+ or in debug mode with
+
+ /usr/sbin/cups-browsed --debug
+
+ Shut it down by sending signal 2 (SIGINT) or 15 (SIGTERM) to
+ it. The queues which it has created get removed then (except a
+ queue set as system default, to not loose its system default
+ state).
+
+ Here is some info on how cups-browsed works internally (first concept of a
+ daemon which does only Bonjour browsing):
+
+ - Daemon start
+ o Wait for CUPS daemon if it is not running
+ o Read out all CUPS queues created by this daemon (in former sessions)
+ o Mark them unconfirmed and set timeout 10 sec from now
+ - Main loop (use avahi_simple_poll_iterate() to do queue list maintenance
+ regularly)
+ o Event: New printer shows up
+ + Queue for printer is already created by this daemon -> Mark list
+ entry confirmed, if discovered printer is ipps but existing queue ipp,
+ upgrade existing queue by setting URI to ipps. Set status to
+ to-be-created and timeout to now-1 sec to make the CUPS queue be
+ updated.
+ + Queue does not yet exist -> Mark as to-be-created and set
+ timeout to now-1 sec.
+ o Event: A printer disappears
+ + If we have listed a queue for it, mark the entry as disappeared, set
+ timeout to now-1 sec
+ o On any of the above events and every 2 sec
+ + Check through list of our listed queues
+ - If queue is unconfirmed and timeout has passed, mark it as
+ disappeared, set timeout to now-1 sec
+ - If queue is marked disappered and timeout has passed, check whether
+ there are still jobs in it, if yes, set timeout to 10 sec from now,
+ if no, remove the CUPS queue and the queue entry in our list. If
+ removal fails, set timeout to 10 sec.
+ - If queue is to-be-created, create it, if succeeded set to
+ confirmed, if not, set timeout to 10 sec fron now. printer-is-shared
+ must be set to false.
+ - Daemon shutdown
+ o Remove all CUPS queues in our list, as long as they do not have jobs.
+
+ Do not overwrite existing queues which are not created by us If
+ the simple <remote_printer> name is already taken, try to create a
+ <remote_printer>@<server> name, if this is also taken, ignore the
+ remote printer. Do not retry, to avoid polling CUPS all the time.
+
+ Do not remove queues which are not created by us. We do this by
+ listing only our queues and remove only listed queues.
+
+ Queue names: Use the name of the remote queue. If a queue with the
+ same name from another server already exists, mark the new queue
+ as duplicate and when a queue disappears, check whether it has
+ duplicates and change the URI of the disappeared queue to the URI
+ of the first duplicate, mark the queue as to-be-created with
+ timeout now-1 sec (to update the URI of the CUPS queue) and mark
+ the duplicate ddisappeared with timeout now-1 sec. In terms of
+ high availability we replace the old load balancing of the
+ implicit class by a failover solution. Alternatively (not
+ implemented), if queue with same name but from other server
+ appears, create new queue as <original name>@<server name without
+ .local>. When queue with simple name is removed, replace the first
+ of the others by one with simple name (mark old queue disappeared
+ with timeout now-1 sec and create new queue with simple name).
+
+ Fill description of the created CUPS queue with the Bonjour
+ service name (= original description) and location with the server
+ name without .local.
+
+ stderr messages only in debug mode (command line options:
+ "--debug" or "-d" or "-v").
+
+ Queue identified as from this daemon by doing the equivalent of
+ "lpadmin -p printer -o cups-browsed-default", this generates a
+ "cups-browsed" attribute in printers.conf with value "true".
+
CUPS FILTERS FOR PDF AS STANDARD PRINT JOB FORMAT
Here is documentation from the former CUPS add-on tarball with the filters
@@ -183,7 +343,9 @@ CUPS FILTERS FOR PDF AS STANDARD PRINT JOB FORMAT
below) as the ...tops filter calls the ....topdf filter plus
Ghostscript's pdf2ps.
+
IMAGETOPDF
+==========
1. INTRODUCTION
@@ -280,7 +442,7 @@ the followings option settings in a PPD file.
Collate:
If Collate is defined, "imagetopdf" judges the printer supports Collate.
Copies:
- If cupsManualCopies is defined as False, "imagetopdf" judges the printer
+ If cupsManualCopies is defined as True, "imagetopdf" judges the printer
does not support Copies feature.
 
Duplex:
@@ -468,9 +630,11 @@ in the location specified by TMPDIR environment variable. Default location
is "/tmp".
-PDFTOPDF.OLD
+PDFTOPDF (OLD)
+==============
0. DEPRECATION NOTICE
+
This filter is being replaced by a new implementation that does not
depend on poppler. Therefore it has been renamed "pdftopdf.old",
but the references in the following sections have not been updated.
@@ -553,7 +717,7 @@ CUPS option are defined by pairs of key and value, <key>=<value>.
"pdftopdf" accepts the following CUPS standard options;
-fiplot
+fitplot
mirror
PageSize
page-left, page-right, page-bottom, page-top
@@ -626,7 +790,7 @@ the followings option settings in a PPD file.
Collate:
If Collate is defined, "pdftopdf" judges the printer supports Collate.
Copies:
- If cupsManualCopies is defined as False, "pdftopdf" judges the printer
+ If cupsManualCopies is defined as True, "pdftopdf" judges the printer
does not support Copies feature.
Duplex:
If Duplex is defined, "pdftopdf" judges the printer supports Duplex.
@@ -842,6 +1006,7 @@ in the location specified by TMPDIR environment variable. Default location
is "/tmp".
PDFTOPDF -- new implementation
+===============================
A new implementation of the pdftopdf filter is available.
It depends on libqpdf to read/write pdf files.
@@ -863,7 +1028,9 @@ Known issues
- more testing needs to be done
- documentation largely missing
+
TEXTTOPDF
+=========
This implements a texttopdf filter, and is derived from cups' texttops.
@@ -924,6 +1091,7 @@ Please report all bugs to https://bugs.linuxfoundation.org/, product
PDFTORASTER
+===========
1. INTRODUCTION
@@ -990,6 +1158,7 @@ is "/tmp".
PDFTOIJS
+========
1. INTRODUCTION
@@ -1055,6 +1224,7 @@ is "/tmp".
PDFTOOPVP
+=========
1. INTRODUCTION
@@ -1225,6 +1395,7 @@ Solution:
URFTOPDF
+========
"urftopdf" is a filter to convert Apple's proprietary URF raster
format into PDF. URF raster is generated by some iOS applications when
diff --git a/aclocal.m4 b/aclocal.m4
index f67dc41..0b8bf3f 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1338,7 +1338,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
;;
ppc64-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
@@ -1702,7 +1709,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
;;
*)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
- if test -n "$lt_cv_sys_max_cmd_len"; then
+ if test -n "$lt_cv_sys_max_cmd_len" && \
+ test undefined != "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else
@@ -2526,17 +2534,6 @@ freebsd* | dragonfly*)
esac
;;
-gnu*)
- version_type=linux # correct to gnu/linux during the next big refactor
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
-
haiku*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
@@ -2653,7 +2650,7 @@ linux*oldld* | linux*aout* | linux*coff*)
;;
# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
@@ -3269,10 +3266,6 @@ freebsd* | dragonfly*)
fi
;;
-gnu*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
haiku*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -3311,7 +3304,7 @@ irix5* | irix6* | nonstopux*)
;;
# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -4063,7 +4056,7 @@ m4_if([$1], [CXX], [
;;
esac
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
KCC*)
# KAI C++ Compiler
@@ -4362,7 +4355,7 @@ m4_if([$1], [CXX], [
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
# old Intel for x86_64 which still supported -KPIC.
ecc*)
@@ -6251,9 +6244,6 @@ if test "$_lt_caught_CXX_error" != yes; then
_LT_TAGVAR(ld_shlibs, $1)=yes
;;
- gnu*)
- ;;
-
haiku*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -6415,7 +6405,7 @@ if test "$_lt_caught_CXX_error" != yes; then
_LT_TAGVAR(inherit_rpath, $1)=yes
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -9182,18 +9172,6 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 8
-
-# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
-AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
-
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
diff --git a/config.h.in b/config.h.in
index d311916..08a9772 100644
--- a/config.h.in
+++ b/config.h.in
@@ -12,6 +12,9 @@
/* CUPS datadir */
#undef CUPS_DATADIR
+/* "Domain socket of CUPS" */
+#undef CUPS_DEFAULT_DOMAINSOCKET
+
/* Path to CUPS fonts dir */
#undef CUPS_FONTPATH
@@ -24,15 +27,27 @@
/* Define default renderer */
#undef CUPS_PDFTOPS_RENDERER
+/* pdftocairo binary to use. */
+#undef CUPS_POPPLER_PDFTOCAIRO
+
/* pdftops binary to use. */
#undef CUPS_POPPLER_PDFTOPS
/* Path to CUPS binaries dir */
#undef CUPS_SERVERBIN
+/* CUPS serverroot */
+#undef CUPS_SERVERROOT
+
+/* Transient run-time state dir of CUPS */
+#undef CUPS_STATEDIR
+
/* Define that we provide acroread. */
#undef HAVE_ACROREAD
+/* Define if you have the avahi library */
+#undef HAVE_AVAHI
+
/* Define if you have Poppler's "cpp/poppler-version.h" header file. */
#undef HAVE_CPP_POPPLER_VERSION_H
@@ -84,6 +99,9 @@
/* Define to 1 if you have the `open_memstream' function. */
#undef HAVE_OPEN_MEMSTREAM
+/* Define that we provide poppler pdftocairo. */
+#undef HAVE_POPPLER_PDFTOCAIRO
+
/* Define that we provide poppler pdftops. */
#undef HAVE_POPPLER_PDFTOPS
diff --git a/configure b/configure
index 8913f29..e78628c 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for cups-filters 1.0.25.
+# Generated by GNU Autoconf 2.69 for cups-filters 1.0.36.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cups-filters'
PACKAGE_TARNAME='cups-filters'
-PACKAGE_VERSION='1.0.25'
-PACKAGE_STRING='cups-filters 1.0.25'
+PACKAGE_VERSION='1.0.36'
+PACKAGE_STRING='cups-filters 1.0.36'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -632,11 +632,13 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+SED_EXTENDED_REGEX_OPT
PHPDIR
PHPCONFIG
WITH_PHP_FALSE
WITH_PHP_TRUE
CUPS_ACROREAD
+CUPS_PDFTOCAIRO
CUPS_PDFTOPS
CUPS_GHOSTSCRIPT
LARGEFILE
@@ -654,6 +656,23 @@ FREETYPE_LIBS
FREETYPE_CFLAGS
LCMS_LIBS
LCMS_CFLAGS
+RCSTOP
+RCSTART
+RCLEVELS
+INITDDIR
+INITDIR
+RCLINKS_FALSE
+RCLINKS_TRUE
+BROWSEREMOTEPROTOCOLS
+AVAHI_GLIB_LIBS
+AVAHI_GLIB_CFLAGS
+GLIB_LIBS
+GLIB_CFLAGS
+AVAHI_CFLAGS
+AVAHI_LIBS
+ENABLE_AVAHI_FALSE
+ENABLE_AVAHI_TRUE
+PKGCONFIG
LIBTIFF_LIBS
LIBPNG_LIBS
LIBPNG_CFLAGS
@@ -662,10 +681,13 @@ ENABLE_IMAGEFILTERS_FALSE
ENABLE_IMAGEFILTERS_TRUE
STRCASESTR
GETLINE
+CUPS_DEFAULT_DOMAINSOCKET
+CUPS_STATEDIR
DLOPEN_LIBS
BANNERTOPDF_DATADIR
CUPS_SERVERBIN
CUPS_FONTPATH
+CUPS_SERVERROOT
CUPS_DATADIR
CUPS_LIBS
CUPS_CFLAGS
@@ -807,14 +829,25 @@ with_sysroot
enable_libtool_lock
with_fontdir
with_cups_config
+with_rundir
+with_domainsocket
enable_imagefilters
with_jpeg
with_png
with_tiff
+enable_avahi
+with_avahi_libs
+with_avahi_includes
+with_browseremoteprotocols
+with_rcdir
+with_rclevels
+with_rcstart
+with_rcstop
enable_largefile
with_pdftops
with_gs_path
with_pdftops_path
+with_pdftocairo_path
with_acroread_path
with_pdftops_maxres
with_php
@@ -840,6 +873,10 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
LIBPNG_CFLAGS
LIBPNG_LIBS
+GLIB_CFLAGS
+GLIB_LIBS
+AVAHI_GLIB_CFLAGS
+AVAHI_GLIB_LIBS
LCMS_CFLAGS
LCMS_LIBS
FREETYPE_CFLAGS
@@ -1394,7 +1431,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures cups-filters 1.0.25 to adapt to many kinds of systems.
+\`configure' configures cups-filters 1.0.36 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1464,7 +1501,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of cups-filters 1.0.25:";;
+ short | recursive ) echo "Configuration of cups-filters 1.0.36:";;
esac
cat <<\_ACEOF
@@ -1482,6 +1519,7 @@ Optional Features:
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-imagefilters Build the image filters.
+ --disable-avahi Disable DNS Service Discovery support using Avahi.
--disable-largefile omit support for large files
--enable-werror Treat all warnings as errors, useful for
development.
@@ -1494,17 +1532,32 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot=DIR Search for dependent libraries within DIR
(or the compiler's sysroot if not specified).
- --with-fontdir=path Specify path to font config directory ( default:
+ --with-fontdir=path Specify path to font config directory (default:
fonts/conf.d/).
--with-cups-config=path Specify path to cups-config executable.
+ --with-cups-rundir set transient run-time state directory of CUPS
+ --with-cups-domainsocket set unix domain socket name used by CUPS
+
--without-jpeg Disable jpeg support.
--without-png Disable png support.
--without-tiff Disable tiff support.
- --with-pdftops=value Set which pdftops to use (gs,pdftops,acroread).
+ --with-avahi-libs Set directory for Avahi library.
+ --with-avahi-includes Set directory for Avahi includes
+ --with-browseremoteprotocols=value
+ Set which protocols to listen for in cups-browsed
+ (default: dnssd cups)
+ --with-rcdir Set path for rc scripts
+ --with-rclevels Set run levels for rc scripts
+ --with-rcstart Set start number for rc scripts
+ --with-rcstop Set stop number for rc scripts
+ --with-pdftops=value Set which pdftops to use
+ (gs,pdftops,pdftocairo,acroread).
--with-gs-path=value Set path to ghostcript binary (default: system).
--with-pdftops-path=value
Set path to pdftops/ghostscript binary (default:
system).
+ --with-pdftocairo-path=value
+ Set path to pdftocairo binary (default: system).
--with-acroread-path=value
Set path to acroread binary (default: system).
--with-pdftops-maxres=value
@@ -1538,6 +1591,12 @@ Some influential environment variables:
LIBPNG_CFLAGS
C compiler flags for LIBPNG, overriding pkg-config
LIBPNG_LIBS linker flags for LIBPNG, overriding pkg-config
+ GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config
+ GLIB_LIBS linker flags for GLIB, overriding pkg-config
+ AVAHI_GLIB_CFLAGS
+ C compiler flags for AVAHI_GLIB, overriding pkg-config
+ AVAHI_GLIB_LIBS
+ linker flags for AVAHI_GLIB, overriding pkg-config
LCMS_CFLAGS C compiler flags for LCMS, overriding pkg-config
LCMS_LIBS linker flags for LCMS, overriding pkg-config
FREETYPE_CFLAGS
@@ -1627,7 +1686,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-cups-filters configure 1.0.25
+cups-filters configure 1.0.36
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2234,7 +2293,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by cups-filters $as_me 1.0.25, which was
+It was created by cups-filters $as_me 1.0.36, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3137,7 +3196,7 @@ fi
# Define the identity of the package.
PACKAGE='cups-filters'
- VERSION='1.0.25'
+ VERSION='1.0.36'
cat >>confdefs.h <<_ACEOF
@@ -5775,7 +5834,8 @@ else
;;
*)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
- if test -n "$lt_cv_sys_max_cmd_len"; then
+ if test -n "$lt_cv_sys_max_cmd_len" && \
+ test undefined != "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else
@@ -6176,10 +6236,6 @@ freebsd* | dragonfly*)
fi
;;
-gnu*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
haiku*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -6218,7 +6274,7 @@ irix5* | irix6* | nonstopux*)
;;
# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -7317,7 +7373,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
;;
ppc64-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
@@ -9015,7 +9078,7 @@ lt_prog_compiler_static=
lt_prog_compiler_static='-non_shared'
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
# old Intel for x86_64 which still supported -KPIC.
ecc*)
@@ -11185,17 +11248,6 @@ freebsd* | dragonfly*)
esac
;;
-gnu*)
- version_type=linux # correct to gnu/linux during the next big refactor
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
-
haiku*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
@@ -11312,7 +11364,7 @@ linux*oldld* | linux*aout* | linux*coff*)
;;
# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
@@ -13135,9 +13187,6 @@ fi
ld_shlibs_CXX=yes
;;
- gnu*)
- ;;
-
haiku*)
archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
link_all_deplibs_CXX=yes
@@ -13299,7 +13348,7 @@ fi
inherit_rpath_CXX=yes
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -14159,7 +14208,7 @@ lt_prog_compiler_static_CXX=
;;
esac
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
KCC*)
# KAI C++ Compiler
@@ -15031,17 +15080,6 @@ freebsd* | dragonfly*)
esac
;;
-gnu*)
- version_type=linux # correct to gnu/linux during the next big refactor
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
-
haiku*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
@@ -15158,7 +15196,7 @@ linux*oldld* | linux*aout* | linux*coff*)
;;
# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
@@ -15776,6 +15814,14 @@ _ACEOF
+CUPS_SERVERROOT="`$CUPSCONFIG --serverroot`"
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_SERVERROOT "$CUPS_SERVERROOT"
+_ACEOF
+
+
+
CUPS_FONTPATH="$CUPS_DATADIR/fonts"
cat >>confdefs.h <<_ACEOF
@@ -15905,7 +15951,11 @@ $as_echo "$ac_cv_search_dlopen" >&6; }
ac_res=$ac_cv_search_dlopen
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
- DLOPEN_LIBS="-ldl"
+ if test "$ac_cv_search_dlopen" != "none required"; then :
+
+ DLOPEN_LIBS="$ac_cv_search_dlopen"
+
+fi
else
as_fn_error $? "unable to find the dlopen() function" "$LINENO" 5
@@ -15913,6 +15963,68 @@ fi
+# Transient run-time state dir of CUPS
+CUPS_STATEDIR=""
+
+# Check whether --with-rundir was given.
+if test "${with_rundir+set}" = set; then :
+ withval=$with_rundir; CUPS_STATEDIR="$withval"
+else
+
+ case "$uname" in
+ Darwin*)
+ # Darwin (OS X)
+ CUPS_STATEDIR="$CUPS_SERVERROOT"
+ ;;
+ *)
+ # All others
+ CUPS_STATEDIR="$localstatedir/run/cups"
+ ;;
+ esac
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_STATEDIR "$CUPS_STATEDIR"
+_ACEOF
+
+
+
+# Domain socket of CUPS...
+CUPS_DEFAULT_DOMAINSOCKET=""
+
+# Check whether --with-domainsocket was given.
+if test "${with_domainsocket+set}" = set; then :
+ withval=$with_domainsocket; default_domainsocket="$withval"
+else
+ default_domainsocket=""
+fi
+
+
+if test x$enable_domainsocket != xno -a x$default_domainsocket != xno; then
+ if test "x$default_domainsocket" = x; then
+ case "$uname" in
+ Darwin*)
+ # Darwin and MaxOS X do their own thing...
+ CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cu
+psd"
+ ;;
+ *)
+ # All others use FHS standard...
+ CUPS_DEFAULT_DOMAINSOCKET="$CUPS_STATEDIR/cups.sock"
+ ;;
+ esac
+ else
+ CUPS_DEFAULT_DOMAINSOCKET="$default_domainsocket"
+ fi
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_DEFAULT_DOMAINSOCKET "$CUPS_DEFAULT_DOMAINSOCKET"
+_ACEOF
+
+
+
# ======================
# Check system functions
# ======================
@@ -16454,6 +16566,410 @@ fi
fi
+# ==================================
+# Check for modules needed by utils/
+# ==================================
+
+# Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKGCONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKGCONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKGCONFIG=$ac_cv_path_PKGCONFIG
+if test -n "$PKGCONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5
+$as_echo "$PKGCONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+AVAHI_LIBS=""
+AVAHI_CFLAGS=""
+AVAHI_GLIB_CFLAGS=""
+AVAHI_GLIB_LIBS=""
+
+# Check whether --enable-avahi was given.
+if test "${enable_avahi+set}" = set; then :
+ enableval=$enable_avahi; enable_avahi="$enableval"
+else
+ enable_avahi=yes
+
+fi
+
+ if test "x$enable_avahi" != "xno"; then
+ ENABLE_AVAHI_TRUE=
+ ENABLE_AVAHI_FALSE='#'
+else
+ ENABLE_AVAHI_TRUE='#'
+ ENABLE_AVAHI_FALSE=
+fi
+
+
+
+# Check whether --with-avahi-libs was given.
+if test "${with_avahi_libs+set}" = set; then :
+ withval=$with_avahi_libs; AVAHI_LIBS="-L$withval $AVAHI_LIBS"
+fi
+
+
+# Check whether --with-avahi-includes was given.
+if test "${with_avahi_includes+set}" = set; then :
+ withval=$with_avahi_includes; AVAHI_CFLAGS="-I$withval $AVAHI_CFLAGS"
+fi
+
+
+if test "x$PKGCONFIG" != x -a x$enable_avahi != xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Avahi" >&5
+$as_echo_n "checking for Avahi... " >&6; }
+ if $PKGCONFIG --exists avahi-client; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ AVAHI_CFLAGS="$AVAHI_CFLAGS `$PKGCONFIG --cflags avahi-client`"
+ AVAHI_LIBS="$AVAHI_LIBS `$PKGCONFIG --libs avahi-client`"
+
+$as_echo "#define HAVE_AVAHI /**/" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ enable_avahi=no
+ fi
+fi
+
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB" >&5
+$as_echo_n "checking for GLIB... " >&6; }
+
+if test -n "$GLIB_CFLAGS"; then
+ pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.30.2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.30.2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.30.2" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$GLIB_LIBS"; then
+ pkg_cv_GLIB_LIBS="$GLIB_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.30.2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.30.2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.30.2" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.30.2" 2>&1`
+ else
+ GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.30.2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$GLIB_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (glib-2.0 >= 2.30.2) were not met:
+
+$GLIB_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables GLIB_CFLAGS
+and GLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables GLIB_CFLAGS
+and GLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS
+ GLIB_LIBS=$pkg_cv_GLIB_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+
+
+if test "x$PKGCONFIG" != x -a x$enable_avahi != xno; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVAHI_GLIB" >&5
+$as_echo_n "checking for AVAHI_GLIB... " >&6; }
+
+if test -n "$AVAHI_GLIB_CFLAGS"; then
+ pkg_cv_AVAHI_GLIB_CFLAGS="$AVAHI_GLIB_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"avahi-glib\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "avahi-glib") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_AVAHI_GLIB_CFLAGS=`$PKG_CONFIG --cflags "avahi-glib" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$AVAHI_GLIB_LIBS"; then
+ pkg_cv_AVAHI_GLIB_LIBS="$AVAHI_GLIB_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"avahi-glib\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "avahi-glib") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_AVAHI_GLIB_LIBS=`$PKG_CONFIG --libs "avahi-glib" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ AVAHI_GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "avahi-glib" 2>&1`
+ else
+ AVAHI_GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "avahi-glib" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$AVAHI_GLIB_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (avahi-glib) were not met:
+
+$AVAHI_GLIB_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables AVAHI_GLIB_CFLAGS
+and AVAHI_GLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables AVAHI_GLIB_CFLAGS
+and AVAHI_GLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ AVAHI_GLIB_CFLAGS=$pkg_cv_AVAHI_GLIB_CFLAGS
+ AVAHI_GLIB_LIBS=$pkg_cv_AVAHI_GLIB_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+fi
+
+
+
+
+
+# Check whether --with-browseremoteprotocols was given.
+if test "${with_browseremoteprotocols+set}" = set; then :
+ withval=$with_browseremoteprotocols; with_browseremoteprotocols="$withval"
+else
+ with_browseremoteprotocols="dnssd cups"
+
+fi
+
+BROWSEREMOTEPROTOCOLS="$with_browseremoteprotocols"
+
+
+
+# Check whether --with-rcdir was given.
+if test "${with_rcdir+set}" = set; then :
+ withval=$with_rcdir; rcdir="$withval"
+else
+ rcdir=""
+fi
+
+
+# Check whether --with-rclevels was given.
+if test "${with_rclevels+set}" = set; then :
+ withval=$with_rclevels; rclevels="$withval"
+else
+ rclevels="2 3 5"
+fi
+
+
+# Check whether --with-rcstart was given.
+if test "${with_rcstart+set}" = set; then :
+ withval=$with_rcstart; rcstart="$withval"
+else
+ rcstart="99"
+fi
+
+
+# Check whether --with-rcstop was given.
+if test "${with_rcstop+set}" = set; then :
+ withval=$with_rcstop; rcstop="$withval"
+else
+ rcstop="00"
+fi
+
+
+INITDIR=""
+INITDDIR=""
+RCLEVELS="$rclevels"
+RCSTART="$rcstart"
+RCSTOP="$rcstop"
+
+if test x$rcdir = x; then
+ case "`uname`" in
+ FreeBSD* | OpenBSD* | MirBSD* | ekkoBSD*)
+ # FreeBSD and OpenBSD
+ ;;
+
+ Linux | GNU | GNU/k*BSD*)
+ # Linux/HURD seems to choose an init.d directory at random...
+ if test -d /sbin/init.d; then
+ # SuSE
+ INITDIR="/sbin/init.d"
+ else
+ if test -d /etc/init.d; then
+ # Others
+ INITDIR="/etc"
+ else
+ # RedHat
+ INITDIR="/etc/rc.d"
+ fi
+ fi
+ RCSTART="82"
+ RCSTOP="35"
+ ;;
+
+ NetBSD*)
+ # NetBSD
+ INITDDIR="/etc/rc.d"
+ ;;
+
+ *)
+ INITDIR="/etc"
+ ;;
+
+ esac
+elif test "x$rcdir" != xno; then
+ if test "x$rclevels" = x; then
+ INITDDIR="$rcdir"
+ else
+ INITDIR="$rcdir"
+ fi
+fi
+
+ if test "x$INITDIR" != "x"; then
+ RCLINKS_TRUE=
+ RCLINKS_FALSE='#'
+else
+ RCLINKS_TRUE='#'
+ RCLINKS_FALSE=
+fi
+
+
+if test "x${INITDIR}" != "x" -a "x${INITDDIR}" = "x"; then
+ INITDDIR="${INITDIR}/init.d"
+fi
+
+
+
+
+
+
+
# ======================================
# Check for various pdf required modules
# ======================================
@@ -17435,7 +17951,7 @@ else
fi
case x$with_pdftops in #(
- xgs|xpdftops|xacroread) :
+ xgs|xpdftops|xpdftocairo|xacroread) :
;; #(
*) :
as_fn_error $? "Unknown value of with-pdftops provided: $with_pdftops" "$LINENO" 5
@@ -17460,6 +17976,15 @@ else
fi
+# Check whether --with-pdftocairo-path was given.
+if test "${with_pdftocairo_path+set}" = set; then :
+ withval=$with_pdftocairo_path; with_pdftocairo_path="$withval"
+else
+ with_pdftocairo_path=system
+
+fi
+
+
# Check whether --with-acroread-path was given.
if test "${with_acroread_path+set}" = set; then :
withval=$with_acroread_path; with_acroread_path="$withval"
@@ -17566,6 +18091,10 @@ $as_echo "no" >&6; }
fi
+else
+
+ CUPS_GHOSTSCRIPT="gs"
+
fi
if test "x$with_pdftops_path" != "xsystem"; then :
@@ -17663,6 +18192,77 @@ $as_echo "no" >&6; }
fi
+else
+
+ CUPS_PDFTOPS="/usr/bin/pdftops"
+
+fi
+if test "x$with_pdftocairo_path" != "xsystem"; then :
+
+ CUPS_PDFTOPS="$with_pdftocairo_path"
+
+else
+
+ # Extract the first word of "pdftocairo", so it can be a program name with args.
+set dummy pdftocairo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_CUPS_PDFTOCAIRO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $CUPS_PDFTOCAIRO in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CUPS_PDFTOCAIRO="$CUPS_PDFTOCAIRO" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CUPS_PDFTOCAIRO="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_CUPS_PDFTOCAIRO" && ac_cv_path_CUPS_PDFTOCAIRO="as_fn_error $? "Required pdftocairo is missing. Please install Poppler developer packages." "$LINENO" 5"
+ ;;
+esac
+fi
+CUPS_PDFTOCAIRO=$ac_cv_path_CUPS_PDFTOCAIRO
+if test -n "$CUPS_PDFTOCAIRO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_PDFTOCAIRO" >&5
+$as_echo "$CUPS_PDFTOCAIRO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+fi
+if test "x$CUPS_PDFTOCAIRO" != "x"; then :
+
+
+$as_echo "#define HAVE_POPPLER_PDFTOCAIRO /**/" >>confdefs.h
+
+ if test x"$with_pdftops" = xpdftocairo; then :
+
+cat >>confdefs.h <<_ACEOF
+#define CUPS_PDFTOPS_RENDERER PDFTOCAIRO
+_ACEOF
+
+fi
+
+else
+
+ CUPS_PDFTOCAIRO="pdftocairo"
+
fi
if test "x$with_acroread_path" != "xsystem"; then :
@@ -17726,6 +18326,10 @@ _ACEOF
fi
+else
+
+ CUPS_ACROREAD="acroread"
+
fi
@@ -17740,6 +18344,11 @@ _ACEOF
cat >>confdefs.h <<_ACEOF
+#define CUPS_POPPLER_PDFTOCAIRO "$CUPS_PDFTOCAIRO"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
#define CUPS_ACROREAD "$CUPS_ACROREAD"
_ACEOF
@@ -17883,10 +18492,91 @@ fi
CFLAGS="$CFLAGS -D_GNU_SOURCE"
CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
+# =======
+# gstopxl
+# =======
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+SED_EXTENDED_REGEX_OPT=-nre
+sed_variant=`sed --version 2>&1`
+sed_variant=`echo $sed_variant|sed -e 's/ .*//'`
+if test "$sed_variant" != GNU ; then
+SED_EXTENDED_REGEX_OPT=-nEe
+fi
+
+
+
# =====================
# Prepare all .in files
# =====================
-ac_config_files="$ac_config_files libcupsfilters.pc libfontembed.pc Makefile"
+ac_config_files="$ac_config_files libcupsfilters.pc libfontembed.pc Makefile filter/gstopxl utils/cups-browsed utils/cups-browsed.conf"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -18021,6 +18711,14 @@ if test -z "${ENABLE_IMAGEFILTERS_TRUE}" && test -z "${ENABLE_IMAGEFILTERS_FALSE
as_fn_error $? "conditional \"ENABLE_IMAGEFILTERS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_AVAHI_TRUE}" && test -z "${ENABLE_AVAHI_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_AVAHI\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${RCLINKS_TRUE}" && test -z "${RCLINKS_FALSE}"; then
+ as_fn_error $? "conditional \"RCLINKS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${WITH_PHP_TRUE}" && test -z "${WITH_PHP_FALSE}"; then
as_fn_error $? "conditional \"WITH_PHP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -18422,7 +19120,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by cups-filters $as_me 1.0.25, which was
+This file was extended by cups-filters $as_me 1.0.36, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18488,7 +19186,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-cups-filters config.status 1.0.25
+cups-filters config.status 1.0.36
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -18998,6 +19696,9 @@ do
"libcupsfilters.pc") CONFIG_FILES="$CONFIG_FILES libcupsfilters.pc" ;;
"libfontembed.pc") CONFIG_FILES="$CONFIG_FILES libfontembed.pc" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "filter/gstopxl") CONFIG_FILES="$CONFIG_FILES filter/gstopxl" ;;
+ "utils/cups-browsed") CONFIG_FILES="$CONFIG_FILES utils/cups-browsed" ;;
+ "utils/cups-browsed.conf") CONFIG_FILES="$CONFIG_FILES utils/cups-browsed.conf" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -20536,9 +21237,12 @@ Environment settings:
Build configuration:
cups-config: ${with_cups_config}
font directory: ${sysconfdir}/${FONTDIR}
+ init directory: ${INITDDIR}
+ cups dom socket: ${CUPS_DEFAULT_DOMAINSOCKET}
gs-path: ${with_gs_path}
imagefilters: ${enable_imagefilters}
jpeg: ${with_jpeg}
+ pdftocairo-path: ${with_pdftocairo_path}
pdftops: ${with_pdftops}
pdftops-path: ${with_pdftops_path}
png: ${with_png}
@@ -20546,6 +21250,8 @@ Build configuration:
php-config: ${with_php_config}
test-font: ${with_test_font_path}
tiff: ${with_tiff}
+ avahi: ${enable_avahi}
+ browsing: ${with_browseremoteprotocols}
werror: ${enable_werror}
==============================================================================
" >&5
@@ -20558,9 +21264,12 @@ Environment settings:
Build configuration:
cups-config: ${with_cups_config}
font directory: ${sysconfdir}/${FONTDIR}
+ init directory: ${INITDDIR}
+ cups dom socket: ${CUPS_DEFAULT_DOMAINSOCKET}
gs-path: ${with_gs_path}
imagefilters: ${enable_imagefilters}
jpeg: ${with_jpeg}
+ pdftocairo-path: ${with_pdftocairo_path}
pdftops: ${with_pdftops}
pdftops-path: ${with_pdftops_path}
png: ${with_png}
@@ -20568,6 +21277,8 @@ Build configuration:
php-config: ${with_php_config}
test-font: ${with_test_font_path}
tiff: ${with_tiff}
+ avahi: ${enable_avahi}
+ browsing: ${with_browseremoteprotocols}
werror: ${enable_werror}
==============================================================================
" >&6;}
diff --git a/configure.ac b/configure.ac
index 0c37db2..a0ff9c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ AC_PREREQ([2.65])
# ====================
m4_define([cups_filters_version_major],[1])
m4_define([cups_filters_version_minor],[0])
-m4_define([cups_filters_version_micro],[25])
+m4_define([cups_filters_version_micro],[36])
m4_define([cups_filters_version],[cups_filters_version_major.cups_filters_version_minor.cups_filters_version_micro])
# =============
@@ -20,7 +20,7 @@ m4_include([m4/ax_compare_version.m4])
AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2])
AM_SILENT_RULES([yes])
AC_LANG([C++])
-AM_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADERS([config.h])
# Extra defines for the config.h
AH_BOTTOM([
#ifdef HAVE_LONG_LONG
@@ -63,7 +63,7 @@ PKG_PROG_PKG_CONFIG([0.20])
# Specify the fontdir patch if not default
# ========================================
AC_ARG_WITH([fontdir],
- [AS_HELP_STRING([--with-fontdir=path], [Specify path to font config directory ( default: fonts/conf.d/).])],
+ [AS_HELP_STRING([--with-fontdir=path], [Specify path to font config directory (default: fonts/conf.d/).])],
[FONTDIR="$withval"],
[FONTDIR="fonts/conf.d"]
)
@@ -96,6 +96,10 @@ CUPS_DATADIR="`$CUPSCONFIG --datadir`"
AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$CUPS_DATADIR", [CUPS datadir])
AC_SUBST(CUPS_DATADIR)
+CUPS_SERVERROOT="`$CUPSCONFIG --serverroot`"
+AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$CUPS_SERVERROOT", [CUPS serverroot])
+AC_SUBST(CUPS_SERVERROOT)
+
CUPS_FONTPATH="$CUPS_DATADIR/fonts"
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH", [Path to CUPS fonts dir])
AC_SUBST(CUPS_FONTPATH)
@@ -112,11 +116,56 @@ AC_DEFINE_DIR(BANNERTOPDF_DATADIR, "{CUPS_DATADIR}/data", [Directory where banne
AC_SEARCH_LIBS([dlopen],
[dl],
- DLOPEN_LIBS="-ldl",
+ [AS_IF([test "$ac_cv_search_dlopen" != "none required"], [
+ DLOPEN_LIBS="$ac_cv_search_dlopen"
+ ])],
AC_MSG_ERROR([unable to find the dlopen() function])
)
AC_SUBST(DLOPEN_LIBS)
+# Transient run-time state dir of CUPS
+CUPS_STATEDIR=""
+AC_ARG_WITH(rundir, [ --with-cups-rundir set transient run-time state directory of CUPS],CUPS_STATEDIR="$withval",[
+ case "$uname" in
+ Darwin*)
+ # Darwin (OS X)
+ CUPS_STATEDIR="$CUPS_SERVERROOT"
+ ;;
+ *)
+ # All others
+ CUPS_STATEDIR="$localstatedir/run/cups"
+ ;;
+ esac])
+AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR", [Transient run-time state dir of CUPS])
+AC_SUBST(CUPS_STATEDIR)
+
+# Domain socket of CUPS...
+CUPS_DEFAULT_DOMAINSOCKET=""
+AC_ARG_WITH(domainsocket, [ --with-cups-domainsocket set unix domain socket name used by CUPS
+],
+ default_domainsocket="$withval",
+ default_domainsocket="")
+
+if test x$enable_domainsocket != xno -a x$default_domainsocket != xno; then
+ if test "x$default_domainsocket" = x; then
+ case "$uname" in
+ Darwin*)
+ # Darwin and MaxOS X do their own thing...
+ CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cu
+psd"
+ ;;
+ *)
+ # All others use FHS standard...
+ CUPS_DEFAULT_DOMAINSOCKET="$CUPS_STATEDIR/cups.sock"
+ ;;
+ esac
+ else
+ CUPS_DEFAULT_DOMAINSOCKET="$default_domainsocket"
+ fi
+fi
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DOMAINSOCKET, "$CUPS_DEFAULT_DOMAINSOCKET", "Domain socket of CUPS")
+AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
+
# ======================
# Check system functions
# ======================
@@ -193,6 +242,134 @@ AS_IF([test x"$with_tiff" != "xno"], [
AC_SUBST(LIBTIFF_LIBS)
])
+# ==================================
+# Check for modules needed by utils/
+# ==================================
+
+dnl Check for pkg-config, which is used for some other tests later on...
+AC_PATH_PROG(PKGCONFIG, pkg-config)
+
+dnl Avahi for cups-browsed
+AVAHI_LIBS=""
+AVAHI_CFLAGS=""
+AVAHI_GLIB_CFLAGS=""
+AVAHI_GLIB_LIBS=""
+
+AC_ARG_ENABLE([avahi],
+ [AS_HELP_STRING([--disable-avahi], [Disable DNS Service Discovery support using Avahi.])],
+ [enable_avahi="$enableval"],
+ [enable_avahi=yes]
+)
+AM_CONDITIONAL([ENABLE_AVAHI], [test "x$enable_avahi" != "xno"])
+
+AC_ARG_WITH(avahi-libs,
+ [AS_HELP_STRING([--with-avahi-libs], [Set directory for Avahi library.])],
+ AVAHI_LIBS="-L$withval $AVAHI_LIBS",)
+AC_ARG_WITH(avahi-includes,
+ [AS_HELP_STRING([--with-avahi-includes], [Set directory for Avahi includes])],
+ AVAHI_CFLAGS="-I$withval $AVAHI_CFLAGS",)
+
+if test "x$PKGCONFIG" != x -a x$enable_avahi != xno; then
+ AC_MSG_CHECKING(for Avahi)
+ if $PKGCONFIG --exists avahi-client; then
+ AC_MSG_RESULT(yes)
+ AVAHI_CFLAGS="$AVAHI_CFLAGS `$PKGCONFIG --cflags avahi-client`"
+ AVAHI_LIBS="$AVAHI_LIBS `$PKGCONFIG --libs avahi-client`"
+ AC_DEFINE(HAVE_AVAHI, [], [Define if you have the avahi library])
+ else
+ AC_MSG_RESULT(no)
+ enable_avahi=no
+ fi
+fi
+
+AC_SUBST(AVAHI_LIBS)
+AC_SUBST(AVAHI_CFLAGS)
+
+PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.30.2])
+AC_SUBST(GLIB_CFLAGS)
+AC_SUBST(GLIB_LIBS)
+
+if test "x$PKGCONFIG" != x -a x$enable_avahi != xno; then
+ PKG_CHECK_MODULES(AVAHI_GLIB, [avahi-glib])
+fi
+
+AC_SUBST(AVAHI_GLIB_CFLAGS)
+AC_SUBST(AVAHI_GLIB_LIBS)
+
+AC_ARG_WITH([browseremoteprotocols],
+ [AS_HELP_STRING([--with-browseremoteprotocols=value], [Set which protocols to listen for in cups-browsed (default: dnssd cups)])],
+ [with_browseremoteprotocols="$withval"],
+ [with_browseremoteprotocols="dnssd cups"]
+)
+BROWSEREMOTEPROTOCOLS="$with_browseremoteprotocols"
+AC_SUBST(BROWSEREMOTEPROTOCOLS)
+
+dnl Setup init.d locations...
+AC_ARG_WITH(rcdir, [AS_HELP_STRING([--with-rcdir], [Set path for rc scripts])],rcdir="$withval",rcdir="")
+AC_ARG_WITH(rclevels, [AS_HELP_STRING([--with-rclevels], [Set run levels for rc scripts])],rclevels="$withval",rclevels="2 3 5")
+AC_ARG_WITH(rcstart, [AS_HELP_STRING([--with-rcstart], [Set start number for rc scripts])],rcstart="$withval",rcstart="99")
+AC_ARG_WITH(rcstop, [AS_HELP_STRING([--with-rcstop], [Set stop number for rc scripts])],rcstop="$withval",rcstop="00")
+
+INITDIR=""
+INITDDIR=""
+RCLEVELS="$rclevels"
+RCSTART="$rcstart"
+RCSTOP="$rcstop"
+
+if test x$rcdir = x; then
+ case "`uname`" in
+ FreeBSD* | OpenBSD* | MirBSD* | ekkoBSD*)
+ # FreeBSD and OpenBSD
+ ;;
+
+ Linux | GNU | GNU/k*BSD*)
+ # Linux/HURD seems to choose an init.d directory at random...
+ if test -d /sbin/init.d; then
+ # SuSE
+ INITDIR="/sbin/init.d"
+ else
+ if test -d /etc/init.d; then
+ # Others
+ INITDIR="/etc"
+ else
+ # RedHat
+ INITDIR="/etc/rc.d"
+ fi
+ fi
+ RCSTART="82"
+ RCSTOP="35"
+ ;;
+
+ NetBSD*)
+ # NetBSD
+ INITDDIR="/etc/rc.d"
+ ;;
+
+ *)
+ INITDIR="/etc"
+ ;;
+
+ esac
+elif test "x$rcdir" != xno; then
+ if test "x$rclevels" = x; then
+ INITDDIR="$rcdir"
+ else
+ INITDIR="$rcdir"
+ fi
+fi
+
+AM_CONDITIONAL([RCLINKS], [test "x$INITDIR" != "x"])
+
+if test "x${INITDIR}" != "x" -a "x${INITDDIR}" = "x"; then
+ INITDDIR="${INITDIR}/init.d"
+fi
+
+AC_SUBST(INITDIR)
+AC_SUBST(INITDDIR)
+AC_SUBST(RCLEVELS)
+AC_SUBST(RCSTART)
+AC_SUBST(RCSTOP)
+
# ======================================
# Check for various pdf required modules
# ======================================
@@ -235,12 +412,12 @@ AS_IF([test x"$long_long_found" = "xyes"], [
# Check for pdf2ps
# ================
AC_ARG_WITH([pdftops],
- [AS_HELP_STRING([--with-pdftops=value], [Set which pdftops to use (gs,pdftops,acroread).])],
+ [AS_HELP_STRING([--with-pdftops=value], [Set which pdftops to use (gs,pdftops,pdftocairo,acroread).])],
[with_pdftops="$withval"],
[with_pdftops=gs]
)
AS_CASE([x$with_pdftops],
- [xgs|xpdftops|xacroread], [],
+ [xgs|xpdftops|xpdftocairo|xacroread], [],
[AC_MSG_ERROR([Unknown value of with-pdftops provided: $with_pdftops])]
)
AC_ARG_WITH([gs-path],
@@ -253,6 +430,11 @@ AC_ARG_WITH([pdftops-path],
[with_pdftops_path="$withval"],
[with_pdftops_path=system]
)
+AC_ARG_WITH([pdftocairo-path],
+ [AS_HELP_STRING([--with-pdftocairo-path=value], [Set path to pdftocairo binary (default: system).])],
+ [with_pdftocairo_path="$withval"],
+ [with_pdftocairo_path=system]
+)
AC_ARG_WITH([acroread-path],
[AS_HELP_STRING([--with-acroread-path=value], [Set path to acroread binary (default: system).])],
[with_acroread_path="$withval"],
@@ -285,6 +467,8 @@ AS_IF([test "x$CUPS_GHOSTSCRIPT" != "x"], [
], [
AC_MSG_RESULT([no])
])
+], [
+ CUPS_GHOSTSCRIPT="gs"
])
AS_IF([test "x$with_pdftops_path" != "xsystem"], [
@@ -310,6 +494,19 @@ AS_IF([test "x$CUPS_PDFTOPS" != "x"], [
], [
AC_MSG_RESULT([no])
])
+], [
+ CUPS_PDFTOPS="/usr/bin/pdftops"
+])
+AS_IF([test "x$with_pdftocairo_path" != "xsystem"], [
+ CUPS_PDFTOPS="$with_pdftocairo_path"
+], [
+ AC_PATH_PROG(CUPS_PDFTOCAIRO, [pdftocairo], [AC_MSG_ERROR([Required pdftocairo is missing. Please install Poppler developer packages.])])
+])
+AS_IF([test "x$CUPS_PDFTOCAIRO" != "x"], [
+ AC_DEFINE([HAVE_POPPLER_PDFTOCAIRO], [], [Define that we provide poppler pdftocairo.])
+ AS_IF([test x"$with_pdftops" = xpdftocairo], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [PDFTOCAIRO], [Define default renderer])])
+], [
+ CUPS_PDFTOCAIRO="pdftocairo"
])
AS_IF([test "x$with_acroread_path" != "xsystem"], [
CUPS_ACROREAD="$with_acroread_path"
@@ -319,10 +516,13 @@ AS_IF([test "x$with_acroread_path" != "xsystem"], [
AS_IF([test "x$CUPS_ACROREAD" != "x"], [
AC_DEFINE([HAVE_ACROREAD], [], [Define that we provide acroread.])
AS_IF([test x"$with_pdftops" = xacroread], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [ACROREAD], [Define default renderer])])
+], [
+ CUPS_ACROREAD="acroread"
])
AC_DEFINE_UNQUOTED([CUPS_GHOSTSCRIPT], "$CUPS_GHOSTSCRIPT", [gs binary to use])
AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOPS], "$CUPS_PDFTOPS", [pdftops binary to use.])
+AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOCAIRO], "$CUPS_PDFTOCAIRO", [pdftocairo binary to use.])
AC_DEFINE_UNQUOTED([CUPS_ACROREAD], "$CUPS_ACROREAD", [acroread binary to use.])
AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_MAX_RESOLUTION], [$CUPS_PDFTOPS_MAXRES], [max resolution used for pdftops when converting images])
@@ -383,6 +583,21 @@ AS_IF([test x"$GCC" = "xyes"], [
CFLAGS="$CFLAGS -D_GNU_SOURCE"
CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
+# =======
+# gstopxl
+# =======
+AC_PROG_SED
+dnl See if it is GNU sed or else.
+dnl - need more work to tell SED features.
+SED_EXTENDED_REGEX_OPT=-nre
+sed_variant=`sed --version 2>&1`
+sed_variant=`echo $sed_variant|sed -e 's/ .*//'`
+if test "$sed_variant" != GNU ; then
+SED_EXTENDED_REGEX_OPT=-nEe
+fi
+AC_SUBST(SED_EXTENDED_REGEX_OPT)
+AC_SUBST(CUPS_GHOSTSCRIPT)
+
# =====================
# Prepare all .in files
# =====================
@@ -390,6 +605,9 @@ AC_CONFIG_FILES([
libcupsfilters.pc
libfontembed.pc
Makefile
+ filter/gstopxl
+ utils/cups-browsed
+ utils/cups-browsed.conf
])
AC_OUTPUT
@@ -405,9 +623,12 @@ Environment settings:
Build configuration:
cups-config: ${with_cups_config}
font directory: ${sysconfdir}/${FONTDIR}
+ init directory: ${INITDDIR}
+ cups dom socket: ${CUPS_DEFAULT_DOMAINSOCKET}
gs-path: ${with_gs_path}
imagefilters: ${enable_imagefilters}
jpeg: ${with_jpeg}
+ pdftocairo-path: ${with_pdftocairo_path}
pdftops: ${with_pdftops}
pdftops-path: ${with_pdftops_path}
png: ${with_png}
@@ -415,6 +636,8 @@ Build configuration:
php-config: ${with_php_config}
test-font: ${with_test_font_path}
tiff: ${with_tiff}
+ avahi: ${enable_avahi}
+ browsing: ${with_browseremoteprotocols}
werror: ${enable_werror}
==============================================================================
])
diff --git a/cupsfilters/image-tiff.c b/cupsfilters/image-tiff.c
index 3c5c5dd..134587a 100644
--- a/cupsfilters/image-tiff.c
+++ b/cupsfilters/image-tiff.c
@@ -655,7 +655,12 @@ _cupsImageReadTIFF(
case PHOTOMETRIC_PALETTE :
if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &redcmap, &greencmap, &bluecmap))
{
- fputs("DEBUG: No colormap tag in the file!\n", stderr);
+ _TIFFfree(scanline);
+ free(in);
+ free(out);
+
+ TIFFClose(tif);
+ fputs("DEBUG: No colormap tag in the file!\n", stderr);
fclose(fp);
return (-1);
}
diff --git a/cupsfilters/raster.c b/cupsfilters/raster.c
new file mode 100644
index 0000000..f2b9c63
--- /dev/null
+++ b/cupsfilters/raster.c
@@ -0,0 +1,1039 @@
+/*
+ * Function to apply IPP options to a CUPS/PWG Raster header.
+ *
+ * Copyright 2013 by Till Kamppeter.
+ *
+ * Distribution and use rights are outlined in the file "COPYING"
+ * which should have been included with this file.
+ *
+ * Contents:
+ *
+ * cupsRasterParseIPPOptions() - Parse IPP options from the command line
+ * and apply them to the CUPS Raster header.
+ */
+
+#include <cups/cups.h>
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 6)
+#define HAVE_CUPS_1_7 1
+#endif
+
+/*
+ * Include necessary headers.
+ */
+
+#include "driver.h"
+#include <config.h>
+#include <string.h>
+#include <ctype.h>
+#ifdef HAVE_CUPS_1_7
+#include <cups/pwg.h>
+#endif /* HAVE_CUPS_1_7 */
+
+/*
+ * '_strlcpy()' - Safely copy two strings.
+ */
+
+size_t /* O - Length of string */
+_strlcpy(char *dst, /* O - Destination string */
+ const char *src, /* I - Source string */
+ size_t size) /* I - Size of destination string buffer */
+{
+ size_t srclen; /* Length of source string */
+
+
+ /*
+ * Figure out how much room is needed...
+ */
+
+ size --;
+
+ srclen = strlen(src);
+
+ /*
+ * Copy the appropriate amount...
+ */
+
+ if (srclen > size)
+ srclen = size;
+
+ memcpy(dst, src, srclen);
+ dst[srclen] = '\0';
+
+ return (srclen);
+}
+
+/*
+ * 'cupsRasterParseIPPOptions()' - Parse IPP options from the command line
+ * and apply them to the CUPS Raster header.
+ */
+
+int /* O - -1 on error, 0 on success */
+cupsRasterParseIPPOptions(cups_page_header2_t *h, /* I - Raster header */
+ int num_options, /* I - Number of options */
+ cups_option_t *options, /* I - Options */
+ int pwg_raster, /* I - 1 if PWG Raster */
+ int set_defaults) /* I - If 1, se default values
+ for all fields for which
+ we did not get an option */
+{
+#ifdef HAVE_CUPS_1_7
+ int i; /* Looping var */
+ char *ptr, /* Pointer into string */
+ s[255]; /* Temporary string */
+ const char *val, /* Pointer into value */
+ *media, /* media option */
+ *page_size, /* PageSize option */
+ *media_source, /* Media source */
+ *media_type; /* Media type */
+ pwg_media_t *size_found; /* page size found for given name */
+
+ /*
+ * Range check input...
+ */
+
+ if (!h)
+ return (-1);
+
+ /*
+ * Check if the supplied "media" option is a comma-separated list of any
+ * combination of page size ("media"), media source ("media-position"),
+ * and media type ("media-type") and if so, put these list elements into
+ * their dedicated options.
+ */
+
+ page_size = NULL;
+ media_source = NULL;
+ media_type = NULL;
+ if ((media = cupsGetOption("media", num_options, options)) != NULL)
+ {
+ /*
+ * Loop through the option string, separating it at commas and marking each
+ * individual option as long as the corresponding PPD option (PageSize,
+ * InputSlot, etc.) is not also set.
+ *
+ * For PageSize, we also check for an empty option value since some versions
+ * of MacOS X use it to specify auto-selection of the media based solely on
+ * the size.
+ */
+
+ for (val = media; *val;)
+ {
+ /*
+ * Extract the sub-option from the string...
+ */
+
+ for (ptr = s; *val && *val != ',' && (ptr - s) < (sizeof(s) - 1);)
+ *ptr++ = *val++;
+ *ptr++ = '\0';
+
+ if (*val == ',')
+ val ++;
+
+ /*
+ * Identify it...
+ */
+
+ size_found = NULL;
+ if ((size_found = pwgMediaForPWG(s)) == NULL)
+ if ((size_found = pwgMediaForPPD(s)) == NULL)
+ if ((size_found = pwgMediaForPPD(s)) == NULL)
+ {
+ if (strcasestr(s, "tray") ||
+ strcasestr(s, "feed") ||
+ strcasestr(s, "capacity") ||
+ strcasestr(s, "upper") ||
+ strcasestr(s, "top") ||
+ strcasestr(s, "middle") ||
+ strcasestr(s, "lower") ||
+ strcasestr(s, "bottom") ||
+ strcasestr(s, "left") ||
+ strcasestr(s, "right") ||
+ strcasestr(s, "side") ||
+ strcasestr(s, "main"))
+ media_source = strdup(s);
+ else
+ media_type = strdup(s);
+ }
+ if (size_found)
+ page_size = strdup(size_found->pwg);
+ }
+ }
+
+ if (pwg_raster)
+ strcpy(h->MediaClass, "PwgRaster");
+ else if ((val = cupsGetOption("media-class", num_options, options)) != NULL ||
+ (val = cupsGetOption("MediaClass", num_options, options)) != NULL)
+ _strlcpy(h->MediaClass, val, sizeof(h->MediaClass));
+ else if (set_defaults)
+ strcpy(h->MediaClass, "PwgRaster");
+
+ if ((val = cupsGetOption("media-color", num_options, options)) != NULL ||
+ (val = cupsGetOption("MediaColor", num_options, options)) != NULL)
+ _strlcpy(h->MediaColor, val, sizeof(h->MediaColor));
+ else if (set_defaults)
+ h->MediaColor[0] = '\0';
+
+ if ((val = cupsGetOption("media-type", num_options, options)) != NULL ||
+ (val = cupsGetOption("MediaType", num_options, options)) != NULL ||
+ (val = media_type) != NULL)
+ _strlcpy(h->MediaType, val, sizeof(h->MediaType));
+ else if (set_defaults)
+ h->MediaType[0] = '\0';
+
+ if ((val = cupsGetOption("print-content-optimize", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("output-type", num_options, options)) != NULL ||
+ (val = cupsGetOption("OutputType", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "automatic"))
+ _strlcpy(h->OutputType, "Automatic",
+ sizeof(h->OutputType));
+ else if (!strcasecmp(val, "graphics"))
+ _strlcpy(h->OutputType, "Graphics", sizeof(h->OutputType));
+ else if (!strcasecmp(val, "photo"))
+ _strlcpy(h->OutputType, "Photo", sizeof(h->OutputType));
+ else if (!strcasecmp(val, "text"))
+ _strlcpy(h->OutputType, "Text", sizeof(h->OutputType));
+ else if (!strcasecmp(val, "text-and-graphics") ||
+ !strcasecmp(val, "TextAndGraphics"))
+ _strlcpy(h->OutputType, "TextAndGraphics",
+ sizeof(h->OutputType));
+ else if (pwg_raster)
+ fprintf(stderr, "DEBUG: Unsupported print-content-type \"%s\".\n", val);
+ else
+ _strlcpy(h->OutputType, val, sizeof(h->OutputType));
+ }
+ else if (set_defaults)
+ _strlcpy(h->OutputType, "Automatic", sizeof(h->OutputType));
+
+ if (pwg_raster)
+ {
+ /* Set "reserved" fields to 0 */
+ h->AdvanceDistance = 0;
+ h->AdvanceMedia = CUPS_ADVANCE_NONE;
+ h->Collate = CUPS_FALSE;
+ }
+ else
+ {
+ /* TODO - Support for advance distance and advance media */
+ if (set_defaults)
+ {
+ h->AdvanceDistance = 0;
+ h->AdvanceMedia = CUPS_ADVANCE_NONE;
+ }
+ if ((val = cupsGetOption("Collate", num_options, options)) != NULL &&
+ (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes")))
+ h->Collate = CUPS_TRUE;
+ else if ((val = cupsGetOption("Collate", num_options, options)) != NULL &&
+ (!strcasecmp(val, "false") || !strcasecmp(val, "off") ||
+ !strcasecmp(val, "no")))
+ h->Collate = CUPS_FALSE;
+ else if (set_defaults)
+ h->Collate = CUPS_FALSE;
+ }
+
+ if (set_defaults)
+ h->CutMedia = CUPS_CUT_NONE;
+
+ if ((val = cupsGetOption("sides", num_options, options)) != NULL ||
+ (val = cupsGetOption("Duplex", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "None") || !strcasecmp(val, "Off") ||
+ !strcasecmp(val, "False") || !strcasecmp(val, "No") ||
+ !strcasecmp(val, "one-sided") || !strcasecmp(val, "OneSided"))
+ h->Duplex = CUPS_FALSE;
+ else if (!strcasecmp(val, "On") ||
+ !strcasecmp(val, "True") || !strcasecmp(val, "Yes") ||
+ !strncasecmp(val, "two-sided", 9) ||
+ !strncasecmp(val, "TwoSided", 8) ||
+ !strncasecmp(val, "Duplex", 6))
+ h->Duplex = CUPS_TRUE;
+ else if (set_defaults)
+ h->Duplex = CUPS_FALSE;
+ }
+ else if (set_defaults)
+ h->Duplex = CUPS_FALSE;
+
+ if ((val = cupsGetOption("printer-resolution", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("Resolution", num_options, options)) != NULL)
+ {
+ int xres, /* X resolution */
+ yres; /* Y resolution */
+ char *ptr; /* Pointer into value */
+
+ xres = yres = strtol(val, (char **)&ptr, 10);
+ if (ptr > val && xres > 0)
+ {
+ if (*ptr == 'x')
+ yres = strtol(ptr + 1, (char **)&ptr, 10);
+ }
+
+ if (ptr <= val || xres <= 0 || yres <= 0 || !ptr ||
+ (strcasecmp(ptr, "dpi") &&
+ strcasecmp(ptr, "dpc") &&
+ strcasecmp(ptr, "dpcm")))
+ {
+ fprintf(stderr, "DEBUG: Bad resolution value \"%s\".\n", val);
+ if (set_defaults)
+ {
+ h->HWResolution[0] = 600;
+ h->HWResolution[1] = 600;
+ }
+ }
+ else
+ {
+ if (!strcasecmp(ptr, "dpc") ||
+ !strcasecmp(ptr, "dpcm"))
+ {
+ xres = xres * 254 / 100;
+ yres = yres * 254 / 100;
+ }
+ h->HWResolution[0] = xres;
+ h->HWResolution[1] = yres;
+ }
+ }
+ else if (set_defaults)
+ {
+ h->HWResolution[0] = 600;
+ h->HWResolution[1] = 600;
+ }
+
+ if (set_defaults)
+ {
+ /* TODO - Support for insert sheets */
+ h->InsertSheet = CUPS_FALSE;
+ }
+
+ if (set_defaults)
+ {
+ /* TODO - Support for jog */
+ h->Jog = CUPS_JOG_NONE;
+ }
+
+ if ((val = cupsGetOption("feed-orientation", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("feed-direction", num_options, options)) != NULL ||
+ (val = cupsGetOption("LeadingEdge", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "ShortEdgeFirst"))
+ h->LeadingEdge = CUPS_EDGE_TOP;
+ else if (!strcasecmp(val, "LongEdgeFirst"))
+ h->LeadingEdge = CUPS_EDGE_RIGHT;
+ else
+ fprintf(stderr, "DEBUG: Unsupported feed-orientation \"%s\".\n", val);
+ }
+ else if (set_defaults)
+ h->LeadingEdge = CUPS_EDGE_TOP;
+
+ if (pwg_raster || set_defaults)
+ {
+ /* TODO - Support for margins */
+ h->Margins[0] = 0;
+ h->Margins[1] = 0;
+ }
+
+ if (pwg_raster || set_defaults)
+ {
+ /* TODO - Support for manual feed */
+ h->ManualFeed = CUPS_FALSE;
+ }
+
+ if ((val = cupsGetOption("media-position", num_options, options)) != NULL ||
+ (val = cupsGetOption("MediaPosition", num_options, options)) != NULL ||
+ (val = cupsGetOption("media-source", num_options, options)) != NULL ||
+ (val = cupsGetOption("MediaSource", num_options, options)) != NULL ||
+ (val = cupsGetOption("InputSlot", num_options, options)) != NULL ||
+ (val = media_source) != NULL)
+ {
+ if (!strncasecmp(val, "Auto", 4) ||
+ !strncasecmp(val, "Default", 7))
+ h->MediaPosition = 0;
+ else if (!strcasecmp(val, "Main"))
+ h->MediaPosition = 1;
+ else if (!strcasecmp(val, "Alternate"))
+ h->MediaPosition = 2;
+ else if (!strcasecmp(val, "LargeCapacity"))
+ h->MediaPosition = 3;
+ else if (!strcasecmp(val, "Manual"))
+ h->MediaPosition = 4;
+ else if (!strcasecmp(val, "Envelope"))
+ h->MediaPosition = 5;
+ else if (!strcasecmp(val, "Disc"))
+ h->MediaPosition = 6;
+ else if (!strcasecmp(val, "Photo"))
+ h->MediaPosition = 7;
+ else if (!strcasecmp(val, "Hagaki"))
+ h->MediaPosition = 8;
+ else if (!strcasecmp(val, "MainRoll"))
+ h->MediaPosition = 9;
+ else if (!strcasecmp(val, "AlternateRoll"))
+ h->MediaPosition = 10;
+ else if (!strcasecmp(val, "Top"))
+ h->MediaPosition = 11;
+ else if (!strcasecmp(val, "Middle"))
+ h->MediaPosition = 12;
+ else if (!strcasecmp(val, "Bottom"))
+ h->MediaPosition = 13;
+ else if (!strcasecmp(val, "Side"))
+ h->MediaPosition = 14;
+ else if (!strcasecmp(val, "Left"))
+ h->MediaPosition = 15;
+ else if (!strcasecmp(val, "Right"))
+ h->MediaPosition = 16;
+ else if (!strcasecmp(val, "Center"))
+ h->MediaPosition = 17;
+ else if (!strcasecmp(val, "Rear"))
+ h->MediaPosition = 18;
+ else if (!strcasecmp(val, "ByPassTray"))
+ h->MediaPosition = 19;
+ else if (!strcasecmp(val, "Tray1"))
+ h->MediaPosition = 20;
+ else if (!strcasecmp(val, "Tray2"))
+ h->MediaPosition = 21;
+ else if (!strcasecmp(val, "Tray3"))
+ h->MediaPosition = 22;
+ else if (!strcasecmp(val, "Tray4"))
+ h->MediaPosition = 23;
+ else if (!strcasecmp(val, "Tray5"))
+ h->MediaPosition = 24;
+ else if (!strcasecmp(val, "Tray6"))
+ h->MediaPosition = 25;
+ else if (!strcasecmp(val, "Tray7"))
+ h->MediaPosition = 26;
+ else if (!strcasecmp(val, "Tray8"))
+ h->MediaPosition = 27;
+ else if (!strcasecmp(val, "Tray9"))
+ h->MediaPosition = 28;
+ else if (!strcasecmp(val, "Tray10"))
+ h->MediaPosition = 29;
+ else if (!strcasecmp(val, "Tray11"))
+ h->MediaPosition = 30;
+ else if (!strcasecmp(val, "Tray12"))
+ h->MediaPosition = 31;
+ else if (!strcasecmp(val, "Tray13"))
+ h->MediaPosition = 32;
+ else if (!strcasecmp(val, "Tray14"))
+ h->MediaPosition = 33;
+ else if (!strcasecmp(val, "Tray15"))
+ h->MediaPosition = 34;
+ else if (!strcasecmp(val, "Tray16"))
+ h->MediaPosition = 35;
+ else if (!strcasecmp(val, "Tray17"))
+ h->MediaPosition = 36;
+ else if (!strcasecmp(val, "Tray18"))
+ h->MediaPosition = 37;
+ else if (!strcasecmp(val, "Tray19"))
+ h->MediaPosition = 38;
+ else if (!strcasecmp(val, "Tray20"))
+ h->MediaPosition = 39;
+ else if (!strcasecmp(val, "Roll1"))
+ h->MediaPosition = 40;
+ else if (!strcasecmp(val, "Roll2"))
+ h->MediaPosition = 41;
+ else if (!strcasecmp(val, "Roll3"))
+ h->MediaPosition = 42;
+ else if (!strcasecmp(val, "Roll4"))
+ h->MediaPosition = 43;
+ else if (!strcasecmp(val, "Roll5"))
+ h->MediaPosition = 44;
+ else if (!strcasecmp(val, "Roll6"))
+ h->MediaPosition = 45;
+ else if (!strcasecmp(val, "Roll7"))
+ h->MediaPosition = 46;
+ else if (!strcasecmp(val, "Roll8"))
+ h->MediaPosition = 47;
+ else if (!strcasecmp(val, "Roll9"))
+ h->MediaPosition = 48;
+ else if (!strcasecmp(val, "Roll10"))
+ h->MediaPosition = 49;
+ else
+ fprintf(stderr, "DEBUG: Unsupported media source \"%s\".\n", val);
+ }
+ else if (set_defaults)
+ h->MediaPosition = 0; /* Auto */
+
+ if ((val = cupsGetOption("media-weight", num_options, options)) != NULL ||
+ (val = cupsGetOption("MediaWeight", num_options, options)) != NULL ||
+ (val = cupsGetOption("media-weight-metric", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("MediaWeightMetric", num_options, options)) != NULL)
+ h->MediaWeight = atol(val);
+ else if (set_defaults)
+ h->MediaWeight = 0;
+
+ if (pwg_raster)
+ {
+ /* Set "reserved" fields to 0 */
+ h->MirrorPrint = CUPS_FALSE;
+ h->NegativePrint = CUPS_FALSE;
+ }
+ else
+ {
+ if ((val = cupsGetOption("mirror-print", num_options, options)) != NULL ||
+ (val = cupsGetOption("MirrorPrint", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes"))
+ h->MirrorPrint = CUPS_TRUE;
+ else if (!strcasecmp(val, "false") ||
+ !strcasecmp(val, "off") ||
+ !strcasecmp(val, "no"))
+ h->MirrorPrint = CUPS_FALSE;
+ else if (set_defaults)
+ h->MirrorPrint = CUPS_FALSE;
+ }
+ if ((val = cupsGetOption("negative-print", num_options, options)) != NULL ||
+ (val = cupsGetOption("NegativePrint", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes"))
+ h->NegativePrint = CUPS_TRUE;
+ else if (!strcasecmp(val, "false") ||
+ !strcasecmp(val, "off") ||
+ !strcasecmp(val, "no"))
+ h->NegativePrint = CUPS_FALSE;
+ else if (set_defaults)
+ h->NegativePrint = CUPS_FALSE;
+ }
+ }
+
+ if ((val = cupsGetOption("copies", num_options, options)) != NULL ||
+ (val = cupsGetOption("Copies", num_options, options)) != NULL ||
+ (val = cupsGetOption("num-copies", num_options, options)) != NULL ||
+ (val = cupsGetOption("NumCopies", num_options, options)) != NULL)
+ h->NumCopies = atol(val);
+ else if (set_defaults)
+ h->NumCopies = 1; /* 0 = Printer default */
+
+ if ((val = cupsGetOption("orientation-requested", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("OrientationRequested", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("Orientation", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "Portrait") ||
+ !strcasecmp(val, "3"))
+ h->Orientation = CUPS_ORIENT_0;
+ else if (!strcasecmp(val, "Landscape") ||
+ !strcasecmp(val, "4"))
+ h->Orientation = CUPS_ORIENT_90;
+ else if (!strcasecmp(val, "reverse-portrait") ||
+ !strcasecmp(val, "ReversePortrait") ||
+ !strcasecmp(val, "5"))
+ h->Orientation = CUPS_ORIENT_180;
+ else if (!strcasecmp(val, "reverse-landscape") ||
+ !strcasecmp(val, "ReverseLandscape") ||
+ !strcasecmp(val, "6"))
+ h->Orientation = CUPS_ORIENT_270;
+ else
+ fprintf(stderr, "DEBUG: Unsupported Orientation \"%s\".\n", val);
+ }
+ else if (set_defaults)
+ h->Orientation = CUPS_ORIENT_0;
+
+ if (pwg_raster)
+ {
+ /* Set "reserved" fields to 0 */
+ h->OutputFaceUp = CUPS_FALSE;
+ }
+ else
+ {
+ if ((val = cupsGetOption("OutputFaceUp", num_options, options)) != NULL ||
+ (val = cupsGetOption("output-face-up", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes"))
+ h->OutputFaceUp = CUPS_TRUE;
+ else if (!strcasecmp(val, "false") ||
+ !strcasecmp(val, "off") ||
+ !strcasecmp(val, "no"))
+ h->OutputFaceUp = CUPS_FALSE;
+ else if (set_defaults)
+ h->OutputFaceUp = CUPS_FALSE;
+ }
+ }
+
+ if ((val = cupsGetOption("media-size", num_options, options)) != NULL ||
+ (val = cupsGetOption("MediaSize", num_options, options)) != NULL ||
+ (val = cupsGetOption("page-size", num_options, options)) != NULL ||
+ (val = cupsGetOption("PageSize", num_options, options)) != NULL ||
+ (val = page_size) != NULL)
+ {
+ size_found = NULL;
+ if ((size_found = pwgMediaForPWG(val)) == NULL)
+ if ((size_found = pwgMediaForPPD(val)) == NULL)
+ size_found = pwgMediaForLegacy(val);
+ if (size_found != NULL)
+ {
+ h->PageSize[0] = size_found->width * 72 / 2540;
+ h->PageSize[1] = size_found->length * 72 / 2540;
+ _strlcpy(h->cupsPageSizeName, size_found->pwg,
+ sizeof(h->cupsPageSizeName));
+ if (pwg_raster)
+ {
+ h->cupsPageSize[0] = 0.0;
+ h->cupsPageSize[1] = 0.0;
+ }
+ else
+ {
+ h->cupsPageSize[0] = size_found->width * 72.0 / 2540.0;
+ h->cupsPageSize[1] = size_found->length * 72.0 / 2540.0;
+ }
+ }
+ else
+ fprintf(stderr, "DEBUG: Unsupported page size %s.\n", val);
+ }
+ else if (set_defaults)
+ {
+ /* TODO: Automatic A4/Letter, like in scheduler/conf.c in CUPS. */
+ h->PageSize[0] = 612;
+ h->PageSize[1] = 792;
+ _strlcpy(h->cupsPageSizeName, "na_letter_8.5x11in",
+ sizeof(h->cupsPageSizeName));
+ if (pwg_raster)
+ {
+ h->cupsPageSize[0] = 0.0;
+ h->cupsPageSize[1] = 0.0;
+ }
+ }
+ else if (pwg_raster)
+ {
+ h->cupsPageSize[0] = 0.0;
+ h->cupsPageSize[1] = 0.0;
+ }
+
+ if (pwg_raster)
+ {
+ /* Set "reserved" fields to 0 */
+ h->ImagingBoundingBox[0] = 0;
+ h->ImagingBoundingBox[1] = 0;
+ h->ImagingBoundingBox[2] = 0;
+ h->ImagingBoundingBox[3] = 0;
+ h->cupsImagingBBox[0] = 0.0;
+ h->cupsImagingBBox[1] = 0.0;
+ h->cupsImagingBBox[2] = 0.0;
+ h->cupsImagingBBox[3] = 0.0;
+ }
+ else
+ {
+ /* TODO - Support for non-zero margins */
+ h->ImagingBoundingBox[0] = 0;
+ h->ImagingBoundingBox[1] = 0;
+ h->ImagingBoundingBox[2] = h->PageSize[0];
+ h->ImagingBoundingBox[3] = h->PageSize[1];
+ h->cupsImagingBBox[0] = 0.0;
+ h->cupsImagingBBox[1] = 0.0;
+ h->cupsImagingBBox[2] = h->cupsPageSize[0];
+ h->cupsImagingBBox[3] = h->cupsPageSize[1];
+ }
+
+ if (pwg_raster)
+ {
+ /* Set "reserved" fields to 0 */
+ h->Separations = CUPS_FALSE;
+ h->TraySwitch = CUPS_FALSE;
+ }
+ else
+ {
+ if ((val = cupsGetOption("separations", num_options, options)) != NULL ||
+ (val = cupsGetOption("Separations", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes"))
+ h->Separations = CUPS_TRUE;
+ else if (!strcasecmp(val, "false") ||
+ !strcasecmp(val, "off") ||
+ !strcasecmp(val, "no"))
+ h->Separations = CUPS_FALSE;
+ else if (set_defaults)
+ h->Separations = CUPS_FALSE;
+ }
+ if ((val = cupsGetOption("tray-switch", num_options, options)) != NULL ||
+ (val = cupsGetOption("TraySwitch", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "true") || !strcasecmp(val, "on") ||
+ !strcasecmp(val, "yes"))
+ h->TraySwitch = CUPS_TRUE;
+ else if (!strcasecmp(val, "false") ||
+ !strcasecmp(val, "off") ||
+ !strcasecmp(val, "no"))
+ h->TraySwitch = CUPS_FALSE;
+ else if (set_defaults)
+ h->TraySwitch = CUPS_FALSE;
+ }
+ }
+
+ if ((val = cupsGetOption("sides", num_options, options)) != NULL ||
+ (val = cupsGetOption("Tumble", num_options, options)) != NULL)
+ {
+ if (!strcasecmp(val, "None") || !strcasecmp(val, "Off") ||
+ !strcasecmp(val, "False") || !strcasecmp(val, "No") ||
+ !strcasecmp(val, "one-sided") || !strcasecmp(val, "OneSided") ||
+ !strcasecmp(val, "two-sided-long-edge") ||
+ !strcasecmp(val, "TwoSidedLongEdge") ||
+ !strcasecmp(val, "DuplexNoTumble"))
+ h->Tumble = CUPS_FALSE;
+ else if (!strcasecmp(val, "On") ||
+ !strcasecmp(val, "True") || !strcasecmp(val, "Yes") ||
+ !strcasecmp(val, "two-sided-short-edge") ||
+ !strcasecmp(val, "TwoSidedShortEdge") ||
+ !strcasecmp(val, "DuplexTumble"))
+ h->Tumble = CUPS_TRUE;
+ else if (set_defaults)
+ h->Tumble = CUPS_FALSE;
+ }
+ else if (set_defaults)
+ h->Tumble = CUPS_FALSE;
+
+ h->cupsWidth = h->HWResolution[0] * h->PageSize[0] / 72;
+ h->cupsHeight = h->HWResolution[1] * h->PageSize[1] / 72;
+
+ if (pwg_raster || set_defaults)
+ {
+ /* TODO - Support for MediaType number */
+ h->cupsMediaType = 0;
+ }
+
+ if ((val = cupsGetOption("pwg-raster-document-type", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("PwgRasterDocumentType", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("print-color-mode", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("PrintColorMode", num_options, options)) != NULL ||
+ (val = cupsGetOption("color-space", num_options, options)) != NULL ||
+ (val = cupsGetOption("ColorSpace", num_options, options)) != NULL ||
+ (val = cupsGetOption("color-model", num_options, options)) != NULL ||
+ (val = cupsGetOption("ColorModel", num_options, options)) != NULL)
+ {
+ int bitspercolor, /* Bits per color */
+ bitsperpixel, /* Bits per pixel */
+ colorspace, /* CUPS/PWG raster color space */
+ numcolors; /* Number of colorants */
+ const char *ptr; /* Pointer into value */
+
+ ptr = NULL;
+ numcolors = 0;
+ bitspercolor = 8;
+ if (!strncasecmp(val, "AdobeRgb", 8))
+ {
+ if (*(val + 8) == '_')
+ ptr = val + 9;
+ colorspace = 20;
+ numcolors = 3;
+ }
+ else if (!strncasecmp(val, "Black", 5))
+ {
+ if (*(val + 5) == '_')
+ ptr = val + 6;
+ bitspercolor = 1;
+ colorspace = 3;
+ numcolors = 1;
+ }
+ else if (!strncasecmp(val, "Cmyk", 4))
+ {
+ if (*(val + 4) == '_')
+ ptr = val + 5;
+ colorspace = 6;
+ numcolors = 4;
+ }
+ else if (!strncasecmp(val, "Device", 6))
+ {
+ ptr = val + 6;
+ numcolors = strtol(ptr, (char **)&ptr, 10);
+ if (*ptr == '_')
+ {
+ ptr ++;
+ colorspace = 47 + numcolors;
+ }
+ else
+ {
+ numcolors = 0;
+ ptr = NULL;
+ }
+ }
+ else if (!strncasecmp(val, "Rgb", 3))
+ {
+ if (*(val + 3) == '_')
+ ptr = val + 4;
+ colorspace = 1;
+ numcolors = 3;
+ }
+ else if (!strncasecmp(val, "Sgray", 5))
+ {
+ if (*(val + 5) == '_')
+ ptr = val + 6;
+ colorspace = 18;
+ numcolors = 1;
+ }
+ else if (!strncasecmp(val, "Srgb", 4))
+ {
+ if (*(val + 4) == '_')
+ ptr = val + 5;
+ colorspace = 19;
+ numcolors = 3;
+ }
+ if (numcolors > 0)
+ {
+ if (ptr)
+ bitspercolor = strtol(ptr, (char **)&ptr, 10);
+ bitsperpixel = bitspercolor * numcolors;
+ h->cupsBitsPerColor = bitspercolor;
+ h->cupsBitsPerPixel = bitsperpixel;
+ h->cupsColorSpace = colorspace;
+ h->cupsNumColors = numcolors;
+ }
+ else
+ {
+ fprintf(stderr, "DEBUG: Bad color space value \"%s\".\n", val);
+ if (set_defaults)
+ {
+ h->cupsBitsPerColor = 1;
+ h->cupsBitsPerPixel = 1;
+ h->cupsColorSpace = 3;
+ h->cupsNumColors = 1;
+ }
+ }
+ }
+ else if (set_defaults)
+ {
+ h->cupsBitsPerColor = 1;
+ h->cupsBitsPerPixel = 1;
+ h->cupsColorSpace = 3;
+ h->cupsNumColors = 1;
+ }
+
+ h->cupsBytesPerLine = (h->cupsWidth * h->cupsBitsPerPixel + 7) / 8;
+
+ if (pwg_raster || set_defaults)
+ {
+ /* TODO - Support for color orders 1 (banded) and 2 (planar) */
+ h->cupsColorOrder = 0;
+ }
+
+ if (pwg_raster || set_defaults)
+ {
+ /* TODO - Support for these parameters */
+ h->cupsCompression = 0;
+ h->cupsRowCount = 0;
+ h->cupsRowFeed = 0;
+ h->cupsRowStep = 0;
+ }
+
+ if (pwg_raster || set_defaults)
+ {
+ /* TODO - Support for cupsBorderlessScalingFactor */
+ h->cupsBorderlessScalingFactor = 0.0;
+ }
+
+ if (pwg_raster || set_defaults)
+ {
+ /* TODO - Support for custom values in CUPS Raster mode */
+ for (i = 0; i < 16; i ++)
+ {
+ h->cupsInteger[i] = 0;
+ h->cupsReal[i] = 0.0;
+ memset(h->cupsString[i], 0, 64);
+ }
+ }
+
+ if (pwg_raster)
+ {
+
+ if ((val = cupsGetOption("job-impressions", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("JobImpressions", num_options, options)) != NULL ||
+ (val = cupsGetOption("Impressions", num_options, options)) != NULL)
+ {
+ int impressions = atoi(val);
+ if (impressions >= 0)
+ h->cupsInteger[0] = impressions;
+ }
+
+ if ((val = cupsGetOption("pwg-raster-document-sheet-back", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("PwgRasterDocumentSheetBack", num_options,
+ options)) != NULL)
+ {
+ /* Set CrossFeedTransform and FeedTransform */
+ if (h->Duplex == CUPS_FALSE)
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = 1;
+ }
+ else if (h->Duplex == CUPS_TRUE)
+ {
+ if (h->Tumble == CUPS_FALSE)
+ {
+ if (!strcasecmp(val, "Flipped"))
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = -1;
+ }
+ else if (!strncasecmp(val, "Manual", 6))
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = 1;
+ }
+ else if (!strcasecmp(val, "Normal"))
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = 1;
+ }
+ else if (!strcasecmp(val, "Rotated"))
+ {
+ h->cupsInteger[1] = -1;
+ h->cupsInteger[2] = -1;
+ }
+ else
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = 1;
+ }
+ }
+ else
+ {
+ if (!strcasecmp(val, "Flipped"))
+ {
+ h->cupsInteger[1] = -1;
+ h->cupsInteger[2] = 1;
+ }
+ else if (!strncasecmp(val, "Manual", 6))
+ {
+ h->cupsInteger[1] = -1;
+ h->cupsInteger[2] = -1;
+ }
+ else if (!strcasecmp(val, "Normal"))
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = 1;
+ }
+ else if (!strcasecmp(val, "Rotated"))
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = 1;
+ }
+ else
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = 1;
+ }
+ }
+ }
+ else
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = 1;
+ }
+ }
+ else
+ {
+ h->cupsInteger[1] = 1;
+ h->cupsInteger[2] = 1;
+ }
+
+ /* TODO - Support for ImageBoxLeft, ImageBoxTop, ImageBoxRight, and
+ ImageBoxBottom (h->cupsInteger[3..6]), leave on 0 for now */
+
+ if ((val = cupsGetOption("alternate-primary", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("AlternatePrimary", num_options,
+ options)) != NULL)
+ {
+ int alternateprimary = atoi(val); /* SRGB value for black
+ pixels */
+ h->cupsInteger[7] = alternateprimary;
+ }
+
+ if ((val = cupsGetOption("print-quality", num_options, options)) != NULL ||
+ (val = cupsGetOption("PrintQuality", num_options, options)) != NULL ||
+ (val = cupsGetOption("Quality", num_options, options)) != NULL)
+ {
+ int quality = atoi(val); /* print-quality value */
+
+ if (!quality ||
+ (quality >= IPP_QUALITY_DRAFT && quality <= IPP_QUALITY_HIGH))
+ h->cupsInteger[8] = quality;
+ else
+ fprintf(stderr, "DEBUG: Unsupported print-quality %d.\n", quality);
+ }
+
+ /* Leave "reserved" fields (h->cupsInteger[9..13]) on 0 */
+
+ if ((val = cupsGetOption("vendor-identifier", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("VendorIdentifier", num_options,
+ options)) != NULL)
+ {
+ int vendorid = atoi(val); /* USB ID of manufacturer */
+ h->cupsInteger[14] = vendorid;
+ }
+
+ if ((val = cupsGetOption("vendor-length", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("VendorLength", num_options,
+ options)) != NULL)
+ {
+ int vendorlength = atoi(val); /* How many bytes of vendor
+ data? */
+ if (vendorlength <= 1088)
+ {
+ h->cupsInteger[15] = vendorlength;
+ if ((val = cupsGetOption("vendor-data", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("VendorData", num_options,
+ options)) != NULL)
+ /* TODO - How to enter binary data here? */
+ _strlcpy((char *)&(h->cupsReal[0]), val, 1088);
+ }
+ }
+ }
+
+ if (pwg_raster || set_defaults)
+ {
+ /* Set "reserved" fields to 0 */
+ memset(h->cupsMarkerType, 0, 64);
+ }
+
+ if ((val = cupsGetOption("print-rendering-intent", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("PrintRenderingIntent", num_options,
+ options)) != NULL ||
+ (val = cupsGetOption("RenderingIntent", num_options,
+ options)) != NULL)
+ {
+ if (!strcmp(val, "absolute"))
+ _strlcpy(h->cupsRenderingIntent, "Absolute",
+ sizeof(h->cupsRenderingIntent));
+ else if (!strcmp(val, "automatic"))
+ _strlcpy(h->cupsRenderingIntent, "Automatic",
+ sizeof(h->cupsRenderingIntent));
+ else if (!strcmp(val, "perceptual"))
+ _strlcpy(h->cupsRenderingIntent, "Perceptual",
+ sizeof(h->cupsRenderingIntent));
+ else if (!strcmp(val, "relative"))
+ _strlcpy(h->cupsRenderingIntent, "Relative",
+ sizeof(h->cupsRenderingIntent));
+ else if (!strcmp(val, "relative-bpc"))
+ _strlcpy(h->cupsRenderingIntent, "RelativeBpc",
+ sizeof(h->cupsRenderingIntent));
+ else if (!strcmp(val, "saturation"))
+ _strlcpy(h->cupsRenderingIntent, "Saturation",
+ sizeof(h->cupsRenderingIntent));
+ else
+ fprintf(stderr, "DEBUG: Unsupported print-rendering-intent \"%s\".\n",
+ val);
+ }
+ else if (set_defaults)
+ h->cupsRenderingIntent[0] = '\0';
+#endif /* HAVE_CUPS_1_7 */
+
+ return (0);
+}
+
+
+/*
+ * End
+ */
diff --git a/cupsfilters/raster.h b/cupsfilters/raster.h
new file mode 100644
index 0000000..ee890f0
--- /dev/null
+++ b/cupsfilters/raster.h
@@ -0,0 +1,55 @@
+/*
+ * CUPS/PWG Raster utilities header file for CUPS.
+ *
+ * Copyright 2013 by Till Kamppeter.
+ *
+ * Distribution and use rights are outlined in the file "COPYING"
+ * which should have been included with this file.
+ */
+
+#ifndef _CUPSFILTERS_RASTER_H_
+# define _CUPSFILTERS_RASTER_H_
+
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+
+/*
+ * Include necessary headers...
+ */
+
+# include <stdio.h>
+# include <stdlib.h>
+# include <time.h>
+# include <math.h>
+
+# if defined(WIN32) || defined(__EMX__)
+# include <io.h>
+# else
+# include <unistd.h>
+# include <fcntl.h>
+# endif /* WIN32 || __EMX__ */
+
+# include <cups/cups.h>
+# include <cups/raster.h>
+
+/*
+ * Prototypes...
+ */
+
+extern int cupsRasterParseIPPOptions(cups_page_header2_t *h,
+ int num_options,
+ cups_option_t *options,
+ int pwg_raster,
+ int set_defaults);
+
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
+
+#endif /* !_CUPSFILTERS_RASTER_H_ */
+
+/*
+ * End
+ */
+
diff --git a/debian/changelog b/debian/changelog
index da5a3b0..b3d0fce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,59 @@
+cups-filters (1.0.36_3) unstable; urgency=low
+
+ * Fixed PLM issue that it can not print ps file in CLP-775N
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.36_3
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Mon, 21 Oct 2013 20:54:09 +0900
+
+cups-filters (1.0.36_2) unstable; urgency=low
+
+ * Disabled ghostscript use in 1.0.36
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.36_2
+
+ -- Taeksu Shin <taeksu.shin@samsung.com> Sat, 07 Sep 2013 14:09:36 +0900
+
+cups-filters (1.0.36_1) unstable; urgency=low
+
+ * Upgrade to 1.0.36 for poppler upgrade
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.36_1
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Tue, 03 Sep 2013 19:15:33 +0900
+
+cups-filters (1.0.34_4) unstable; urgency=low
+
+ * Added compile flag to reduce binary size
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.34_4
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Mon, 19 Aug 2013 23:07:33 +0900
+
+cups-filters (1.0.34_3) unstable; urgency=low
+
+ * Sync with private and rsa
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.34_3
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Wed, 07 Aug 2013 15:27:12 +0900
+
+cups-filters (1.0.34-2) unstable; urgency=low
+
+ * Changed smack label
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.34-2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Wed, 31 Jul 2013 22:10:34 +0900
+
+cups-filters (1.0.34-1) unstable; urgency=low
+
+ * Upgraded to 1.0.34-1
+ * Git: external/cups-filters
+ * Tag: cups-filters_1.0.34-1
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Wed, 26 Jun 2013 19:17:23 +0900
+
cups-filters (1.0.25-3) unstable; urgency=low
* Fixed pdftoraster,pdftoijs,imagetopdf,texttopdf to ignore SIGPIPE
diff --git a/filter/PDFError.h b/filter/PDFError.h
index 9fb58bc..9bcd4b3 100644
--- a/filter/PDFError.h
+++ b/filter/PDFError.h
@@ -31,14 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <config.h>
#include <stdarg.h>
#include <Error.h>
-#ifdef HAVE_CPP_POPPLER_VERSION_H
-#include "cpp/poppler-version.h"
-#endif
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
#define pdfError(pos,...) error(errInternal,pos,__VA_ARGS__)
-#else
-#define pdfError(pos,...) error(pos,__VA_ARGS__)
-#endif
#endif
diff --git a/filter/colord.c b/filter/colord.c
new file mode 100644
index 0000000..8783874
--- /dev/null
+++ b/filter/colord.c
@@ -0,0 +1,462 @@
+/*
+Copyright (c) 2011, Tim Waugh
+Copyright (c) 2011-2013, Richard Hughes
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+MIT Open Source License - http://www.opensource.org/
+
+*/
+
+
+/* Common routines for accessing the colord CMS framework */
+
+#include <cups/raster.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#ifdef HAVE_DBUS
+ #include <dbus/dbus.h>
+#endif
+
+#include "colord.h"
+
+#define QUAL_COLORSPACE 0
+#define QUAL_MEDIA 1
+#define QUAL_RESOLUTION 2
+#define QUAL_SIZE 3
+
+char **
+colord_get_qualifier_for_ppd (ppd_file_t *ppd)
+{
+ char q_keyword[PPD_MAX_NAME];
+ char **tuple = NULL;
+ const char *q1_choice;
+ const char *q2_choice;
+ const char *q3_choice;
+ ppd_attr_t *attr;
+ ppd_attr_t *q1_attr;
+ ppd_attr_t *q2_attr;
+ ppd_attr_t *q3_attr;
+
+ /* get colorspace */
+ if ((attr = ppdFindAttr (ppd, "cupsICCQualifier1", NULL)) != NULL &&
+ attr->value && attr->value[0])
+ {
+ snprintf (q_keyword, sizeof (q_keyword), "Default%s", attr->value);
+ q1_attr = ppdFindAttr (ppd, q_keyword, NULL);
+ }
+ else if ((q1_attr = ppdFindAttr (ppd, "DefaultColorModel", NULL)) == NULL)
+ q1_attr = ppdFindAttr (ppd, "DefaultColorSpace", NULL);
+
+ if (q1_attr && q1_attr->value && q1_attr->value[0])
+ q1_choice = q1_attr->value;
+ else
+ q1_choice = "";
+
+ /* get media */
+ if ((attr = ppdFindAttr(ppd, "cupsICCQualifier2", NULL)) != NULL &&
+ attr->value && attr->value[0])
+ {
+ snprintf(q_keyword, sizeof(q_keyword), "Default%s", attr->value);
+ q2_attr = ppdFindAttr(ppd, q_keyword, NULL);
+ }
+ else
+ q2_attr = ppdFindAttr(ppd, "DefaultMediaType", NULL);
+
+ if (q2_attr && q2_attr->value && q2_attr->value[0])
+ q2_choice = q2_attr->value;
+ else
+ q2_choice = "";
+
+ /* get resolution */
+ if ((attr = ppdFindAttr(ppd, "cupsICCQualifier3", NULL)) != NULL &&
+ attr->value && attr->value[0])
+ {
+ snprintf(q_keyword, sizeof(q_keyword), "Default%s", attr->value);
+ q3_attr = ppdFindAttr(ppd, q_keyword, NULL);
+ }
+ else
+ q3_attr = ppdFindAttr(ppd, "DefaultResolution", NULL);
+
+ if (q3_attr && q3_attr->value && q3_attr->value[0])
+ q3_choice = q3_attr->value;
+ else
+ q3_choice = "";
+
+ /* return a NULL terminated array so we don't have to break it up later */
+ tuple = calloc(QUAL_SIZE + 1, sizeof(char*));
+ tuple[QUAL_COLORSPACE] = strdup(q1_choice);
+ tuple[QUAL_MEDIA] = strdup(q2_choice);
+ tuple[QUAL_RESOLUTION] = strdup(q3_choice);
+ return tuple;
+}
+
+#ifdef HAVE_DBUS
+
+static char *
+get_filename_for_profile_path (DBusConnection *con,
+ const char *object_path)
+{
+ char *filename = NULL;
+ const char *interface = "org.freedesktop.ColorManager.Profile";
+ const char *property = "Filename";
+ const char *tmp;
+ DBusError error;
+ DBusMessageIter args;
+ DBusMessage *message = NULL;
+ DBusMessage *reply = NULL;
+ DBusMessageIter sub;
+
+ message = dbus_message_new_method_call("org.freedesktop.ColorManager",
+ object_path,
+ "org.freedesktop.DBus.Properties",
+ "Get");
+
+ dbus_message_iter_init_append(message, &args);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &interface);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &property);
+
+ /* send syncronous */
+ dbus_error_init(&error);
+ fprintf(stderr, "DEBUG: Calling %s.Get(%s)\n", interface, property);
+ reply = dbus_connection_send_with_reply_and_block(con,
+ message,
+ -1,
+ &error);
+ if (reply == NULL) {
+ fprintf(stderr, "DEBUG: Failed to send: %s:%s\n",
+ error.name, error.message);
+ dbus_error_free(&error);
+ goto out;
+ }
+
+ /* get reply data */
+ dbus_message_iter_init(reply, &args);
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_VARIANT) {
+ fprintf(stderr, "DEBUG: Incorrect reply type\n");
+ goto out;
+ }
+
+ dbus_message_iter_recurse(&args, &sub);
+ dbus_message_iter_get_basic(&sub, &tmp);
+ filename = strdup(tmp);
+out:
+ if (message != NULL)
+ dbus_message_unref(message);
+ if (reply != NULL)
+ dbus_message_unref(reply);
+ return filename;
+}
+
+static char *
+get_profile_for_device_path (DBusConnection *con,
+ const char *object_path,
+ const char **split)
+{
+ char **key = NULL;
+ char *profile = NULL;
+ char str[256];
+ const char *tmp;
+ DBusError error;
+ DBusMessageIter args;
+ DBusMessageIter entry;
+ DBusMessage *message = NULL;
+ DBusMessage *reply = NULL;
+ int i = 0;
+ const int max_keys = 7;
+
+ message = dbus_message_new_method_call("org.freedesktop.ColorManager",
+ object_path,
+ "org.freedesktop.ColorManager.Device",
+ "GetProfileForQualifiers");
+ dbus_message_iter_init_append(message, &args);
+
+ /* create the fallbacks */
+ key = calloc(max_keys + 1, sizeof(char*));
+
+ /* exact match */
+ i = 0;
+ snprintf(str, sizeof(str), "%s.%s.%s",
+ split[QUAL_COLORSPACE],
+ split[QUAL_MEDIA],
+ split[QUAL_RESOLUTION]);
+ key[i++] = strdup(str);
+ snprintf(str, sizeof(str), "%s.%s.*",
+ split[QUAL_COLORSPACE],
+ split[QUAL_MEDIA]);
+ key[i++] = strdup(str);
+ snprintf(str, sizeof(str), "%s.*.%s",
+ split[QUAL_COLORSPACE],
+ split[QUAL_RESOLUTION]);
+ key[i++] = strdup(str);
+ snprintf(str, sizeof(str), "%s.*.*",
+ split[QUAL_COLORSPACE]);
+ key[i++] = strdup(str);
+ key[i++] = strdup("*");
+ dbus_message_iter_open_container(&args,
+ DBUS_TYPE_ARRAY,
+ "s",
+ &entry);
+ for (i=0; key[i] != NULL; i++) {
+ dbus_message_iter_append_basic(&entry,
+ DBUS_TYPE_STRING,
+ &key[i]);
+ }
+ dbus_message_iter_close_container(&args, &entry);
+
+ /* send syncronous */
+ dbus_error_init(&error);
+ fprintf(stderr, "DEBUG: Calling GetProfileForQualifiers(%s...)\n", key[0]);
+ reply = dbus_connection_send_with_reply_and_block(con,
+ message,
+ -1,
+ &error);
+ if (reply == NULL) {
+ fprintf(stderr, "DEBUG: Failed to send: %s:%s\n",
+ error.name, error.message);
+ dbus_error_free(&error);
+ goto out;
+ }
+
+ /* get reply data */
+ dbus_message_iter_init(reply, &args);
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) {
+ fprintf(stderr, "DEBUG: Incorrect reply type\n");
+ goto out;
+ }
+ dbus_message_iter_get_basic(&args, &tmp);
+ fprintf(stderr, "DEBUG: Found profile %s\n", tmp);
+
+ /* get filename */
+ profile = get_filename_for_profile_path(con, tmp);
+
+out:
+ if (message != NULL)
+ dbus_message_unref(message);
+ if (reply != NULL)
+ dbus_message_unref(reply);
+ if (key != NULL) {
+ for (i=0; i < max_keys; i++)
+ free(key[i]);
+ free(key);
+ }
+ return profile;
+}
+
+static char *
+get_device_path_for_device_id (DBusConnection *con,
+ const char *device_id)
+{
+ char *device_path = NULL;
+ const char *device_path_tmp;
+ DBusError error;
+ DBusMessageIter args;
+ DBusMessage *message = NULL;
+ DBusMessage *reply = NULL;
+
+ message = dbus_message_new_method_call("org.freedesktop.ColorManager",
+ "/org/freedesktop/ColorManager",
+ "org.freedesktop.ColorManager",
+ "FindDeviceById");
+ dbus_message_iter_init_append(message, &args);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &device_id);
+
+ /* send syncronous */
+ dbus_error_init(&error);
+ fprintf(stderr, "DEBUG: Calling FindDeviceById(%s)\n", device_id);
+ reply = dbus_connection_send_with_reply_and_block(con,
+ message,
+ -1,
+ &error);
+ if (reply == NULL) {
+ fprintf(stderr, "DEBUG: Failed to send: %s:%s\n",
+ error.name, error.message);
+ dbus_error_free(&error);
+ goto out;
+ }
+
+ /* get reply data */
+ dbus_message_iter_init(reply, &args);
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) {
+ fprintf(stderr, "DEBUG: Incorrect reply type\n");
+ goto out;
+ }
+ dbus_message_iter_get_basic(&args, &device_path_tmp);
+ fprintf(stderr, "DEBUG: Found device %s\n", device_path_tmp);
+ device_path = strdup(device_path_tmp);
+out:
+ if (message != NULL)
+ dbus_message_unref(message);
+ if (reply != NULL)
+ dbus_message_unref(reply);
+ return device_path;
+}
+
+char *
+colord_get_profile_for_device_id (const char *device_id,
+ const char **qualifier_tuple)
+{
+ DBusConnection *con = NULL;
+ char *device_path = NULL;
+ char *filename = NULL;
+
+ if (device_id == NULL) {
+ fprintf(stderr, "DEBUG: No colord device ID available\n");
+ goto out;
+ }
+
+ /* connect to system bus */
+ con = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (con == NULL) {
+ fprintf(stderr, "ERROR: Failed to connect to system bus\n");
+ goto out;
+ }
+
+ /* find the device */
+ device_path = get_device_path_for_device_id (con, device_id);
+ if (device_path == NULL) {
+ fprintf(stderr, "DEBUG: Failed to get find device %s\n", device_id);
+ goto out;
+ }
+
+ /* get the best profile for the device */
+ filename = get_profile_for_device_path(con, device_path, qualifier_tuple);
+ if (filename == NULL) {
+ fprintf(stderr, "DEBUG: Failed to get profile filename for %s\n", device_id);
+ goto out;
+ }
+ fprintf(stderr, "DEBUG: Use profile filename: '%s'\n", filename);
+out:
+ free(device_path);
+ if (con != NULL)
+ dbus_connection_unref(con);
+ return filename;
+}
+
+int
+get_profile_inhibitors (DBusConnection *con, const char *object_path)
+{
+ char *tmp;
+ const char *interface = "org.freedesktop.ColorManager.Device";
+ const char *property = "ProfilingInhibitors";
+ DBusError error;
+ DBusMessageIter args;
+ DBusMessageIter sub;
+ DBusMessageIter sub2;
+ DBusMessage *message = NULL;
+ DBusMessage *reply = NULL;
+ int inhibitors = 0;
+
+ message = dbus_message_new_method_call("org.freedesktop.ColorManager",
+ object_path,
+ "org.freedesktop.DBus.Properties",
+ "Get");
+
+ dbus_message_iter_init_append(message, &args);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &interface);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &property);
+
+ /* send syncronous */
+ dbus_error_init(&error);
+ fprintf(stderr, "DEBUG: Calling %s.Get(%s)\n", interface, property);
+ reply = dbus_connection_send_with_reply_and_block(con,
+ message,
+ -1,
+ &error);
+ if (reply == NULL) {
+ fprintf(stderr, "DEBUG: Failed to send: %s:%s\n",
+ error.name, error.message);
+ dbus_error_free(&error);
+ goto out;
+ }
+
+ /* get reply data */
+ dbus_message_iter_init(reply, &args);
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_VARIANT) {
+ fprintf(stderr, "DEBUG: Incorrect reply type\n");
+ goto out;
+ }
+
+ /* count the size of the array */
+ dbus_message_iter_recurse(&args, &sub2);
+ dbus_message_iter_recurse(&sub2, &sub);
+ while (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID) {
+ dbus_message_iter_get_basic(&sub, &tmp);
+ fprintf(stderr, "DEBUG: Inhibitor %s exists\n", tmp);
+ dbus_message_iter_next(&sub);
+ inhibitors++;
+ }
+out:
+ if (message != NULL)
+ dbus_message_unref(message);
+ if (reply != NULL)
+ dbus_message_unref(reply);
+ return inhibitors;
+}
+
+int
+colord_get_inhibit_for_device_id (const char *device_id)
+{
+ DBusConnection *con;
+ char *device_path = NULL;
+ int has_inhibitors = FALSE;
+
+ /* connect to system bus */
+ con = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (con == NULL) {
+ fprintf(stderr, "ERROR: Failed to connect to system bus\n");
+ goto out;
+ }
+
+ /* find the device */
+ device_path = get_device_path_for_device_id (con, device_id);
+ if (device_path == NULL) {
+ fprintf(stderr, "DEBUG: Failed to get find device %s\n", device_id);
+ goto out;
+ }
+
+ /* get the best profile for the device */
+ has_inhibitors = get_profile_inhibitors(con, device_path);
+out:
+ free(device_path);
+ if (con != NULL)
+ dbus_connection_unref(con);
+ return has_inhibitors;
+}
+
+#else
+
+char *
+colord_get_profile_for_device_id (const char *device_id,
+ const char **qualifier_tuple)
+{
+ fprintf(stderr, "WARN: not compiled with DBus support\n");
+ return NULL;
+}
+
+int
+colord_get_inhibit_for_device_id (const char *device_id)
+{
+ fprintf(stderr, "WARN: not compiled with DBus support\n");
+ return 0;
+}
+
+#endif
diff --git a/filter/pdftoopvp/OPVPError.h b/filter/colord.h
index 5f1b9a3..8f5c142 100644
--- a/filter/pdftoopvp/OPVPError.h
+++ b/filter/colord.h
@@ -1,6 +1,5 @@
/*
-
-Copyright (c) 2012, BBR Inc. All rights reserved.
+Copyright (c) 2011-2013, Richard Hughes
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -21,24 +20,16 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+MIT Open Source License - http://www.opensource.org/
+
*/
-/*
- OPVPError.h
-*/
-#ifndef _OPVPERROR_H_
-#define _OPVPERROR_H_
-
-#include <config.h>
-#include <stdarg.h>
-#include <Error.h>
-#ifdef HAVE_CPP_POPPLER_VERSION_H
-#include "cpp/poppler-version.h"
-#endif
-
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
-#define opvpError(pos,...) error(errInternal,pos,__VA_ARGS__)
-#else
-#define opvpError(pos,...) error(pos,__VA_ARGS__)
-#endif
-
-#endif
+
+
+/* Common routines for accessing the colord CMS framework */
+
+#include <cups/raster.h>
+
+char **colord_get_qualifier_for_ppd (ppd_file_t *ppd);
+char *colord_get_profile_for_device_id (const char *device_id,
+ const char **qualifier_tuple);
+int colord_get_inhibit_for_device_id (const char *device_id);
diff --git a/filter/gstopxl b/filter/gstopxl
new file mode 100644
index 0000000..ad56b4d
--- /dev/null
+++ b/filter/gstopxl
@@ -0,0 +1,184 @@
+#!/bin/sh
+#
+#
+# CUPS PCL XL/PCL 6 filter script for Ghostscript.
+#
+# Copyright 2001-2005 by Easy Software Products.
+#
+# 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.
+#
+
+# Set the library/font path...
+GS_LIB="${CUPS_FONTPATH:=/usr/share/cups/fonts}"
+export GS_LIB
+
+# Determine the PCL XL/PCL 6 driver to use...
+if test "x$PPD" != x; then
+ colordevice=`grep '^*ColorDevice:' "$PPD" | awk -F: '{print $2}'`
+ case "$colordevice" in
+ *True* | *true*)
+ device="pxlcolor"
+ ;;
+ *)
+ device="pxlmono"
+ ;;
+ esac
+else
+ device="pxlmono"
+fi
+
+# Apply PPD settings.
+
+ps_code=
+ppd_opts=
+
+resolution=
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|[[:space:]])Resolution=([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\2}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed -nre 's/^\*DefaultResolution:[[:space:]]+([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: Resolution: $resolution" >&2
+if test -n "$resolution"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-r$resolution"
+fi
+
+pagesize=
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|[[:space:]])(media|PageSize)=([^[:space:]]+).*/pagesize="${pagesize:-\3}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed -nre 's/^\*DefaultPageSize:[[:space:]]+([^[:space:]]+).*/pagesize="${pagesize:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: Page size: $pagesize" >&2
+width=
+height=
+if test -n "$pagesize" && test -e "$PPD"; then
+ eval "$(sed -nre 's|^\*PaperDimension[[:space:]]+'"$pagesize"'/[^:]+:[[:space:]]+"([^[:space:]]+)[[:space:]]+([^[:space:]]+)".*|width="\1"; height="\2"|p' "$PPD")"
+fi
+echo "DEBUG: Width: $width, height: $height" >&2
+if test -n "$width"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEWIDTHPOINTS=$width"
+fi
+if test -n "$height"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEHEIGHTPOINTS=$height"
+fi
+
+bl_x=
+bl_y=
+tr_x=
+tr_y=
+if test -n "$pagesize" && test -e "$PPD"; then
+ eval "$(sed -nre 's|^\*ImageableArea[[:space:]]+'"$pagesize"'/[^:]+:[[:space:]]+"([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([^[:space:]]+)".*|bl_x="\1"; bl_y="\2"; tr_x="\3"; tr_y="\4"|p' "$PPD")"
+fi
+echo "DEBUG: Absolute margins: $bl_x, $bl_y, $tr_x, $tr_y" >&2
+margin_l=
+margin_b=
+margin_r=
+margin_t=
+if test -n "$width" && test -n "$height" && \
+ test -n "$bl_x" && test -n "$bl_y" && \
+ test -n "$tr_x" && test -n "$tr_y"; then
+ margin_l="$bl_x"
+ margin_b="$bl_y"
+ margin_r="$(printf "scale=8; (%s)-(%s)\n" "$width" "$tr_x" | bc)"
+ margin_t="$(printf "scale=8; (%s)-(%s)\n" "$height" "$tr_y" | bc)"
+fi
+echo "DEBUG: Relative margins: $margin_l, $margin_b, $margin_r, $margin_t" >&2
+if test -n "$margin_l" && test -n "$margin_b" && \
+ test -n "$margin_r" && test -n "$margin_t"; then
+ ps_code="${ps_code:+$ps_code }<</.HWMargins[$margin_l $margin_b $margin_r $margin_t] /Margins[0 0]>>setpagedevice"
+fi
+
+inputslot=
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|[[:space:]])(InputSlot)=([^[:space:]]+).*/inputslot="${inputslot:-\3}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed -nre 's/^\*DefaultInputSlot:[[:space:]]+([^[:space:]]+).*/inputslot="${inputslot:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: InputSlot: $inputslot" >&2
+inputslot_val=
+if test -n "$inputslot" && test -e "$PPD"; then
+ eval "$(sed -nre 's|^\*InputSlot[[:space:]]+'"$inputslot"'/[^:]+:[[:space:]]+"[[:space:]]*<[[:space:]]*<[[:space:]]*/MediaPosition[[:space:]]*([0-9]+)[[:space:]]*>[[:space:]]*>[[:space:]]*setpagedevice[[:space:]]*".*|inputslot_val="\1"|p' "$PPD")"
+fi
+echo "DEBUG: Value for MediaPosition: $inputslot_val" >&2
+if test -n "$inputslot_val"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dMediaPosition=$inputslot_val"
+fi
+
+colormodel=
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|[[:space:]])(ColorModel)=([^[:space:]]+).*/colormodel="${colormodel:-\3}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed -nre 's/^\*DefaultColorModel:[[:space:]]+([^[:space:]]+).*/colormodel="${colormodel:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: ColorModel: $colormodel" >&2
+if test "$colormodel" = "Gray"; then
+ device=pxlmono
+fi
+colormodel_val=
+if test -n "$colormodel" && test -e "$PPD"; then
+ eval "$(sed -nre 's|^\*ColorModel[[:space:]]+'"$colormodel"'/[^:]+:[[:space:]]+"[[:space:]]*<[[:space:]]*<[[:space:]]*/BitsPerPixel[[:space:]]*([0-9]*)[[:space:]]*>[[:space:]]*>[[:space:]]*setpagedevice[[:space:]]*".*|colormodel_val="\1"|p' "$PPD")"
+fi
+echo "DEBUG: Value for BitsPerPixel: $colormodel_val" >&2
+if test -n "$colormodel_val"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dBitsPerPixel=$colormodel_val"
+fi
+
+duplex=
+eval "$(printf "%s" "$5" | sed -nre 's/.*(^|[[:space:]])(Duplex)=([^[:space:]]+).*/duplex="${duplex:-\3}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed -nre 's/^\*DefaultDuplex:[[:space:]]+([^[:space:]]+).*/duplex="${duplex:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: Duplex: $duplex" >&2
+duplex_val=
+tumble_val=
+if test -n "$duplex" && test -e "$PPD"; then
+ eval "$(sed -nre 's|^\*Duplex[[:space:]]+'"$duplex"'/[^:]+:[[:space:]]+"[[:space:]]*<[[:space:]]*<[[:space:]]*/Duplex[[:space:]]*([^[:space:]]*)[[:space:]]*(/Tumble[[:space:]]*([^[:space:]]*)[[:space:]]*)?>[[:space:]]*>[[:space:]]*setpagedevice[[:space:]]*".*|duplex_val="\1"; tumble_val="\3"|p' "$PPD")"
+fi
+echo "DEBUG: Value for Duplex: $duplex_val; Value for Tumble: $tumble_val" >&2
+if test -n "$duplex_val"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDuplex=$duplex_val"
+fi
+if test -n "$tumble_val"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dTumble=$tumble_val"
+fi
+
+
+echo "DEBUG: PPD options: $ppd_opts" >&2
+echo "DEBUG: PostScript code from options: $ps_code" >&2
+
+# Options we use with Ghostscript...
+gsopts="-dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE"
+gsopts="$gsopts -sDEVICE=$device -sstdout=%stderr"
+
+# See if we have a filename on the command-line...
+if [ -n "$6" ]; then
+ exec <"$6"
+fi
+
+# We read the data into a temporary file as Ghostscript needs this to be
+# able to also work with PDF input
+tempfiles=
+trap 'rm -f $tempfiles' 0 1 2 13 15
+
+ifile=$(mktemp -t gstopxl.XXXXXX)
+tempfiles="$tempfiles $ifile"
+
+cat >"$ifile"
+
+echo INFO: Starting GPL Ghostscript `/usr/bin/gs --version`... 1>&2
+echo DEBUG: Running /usr/bin/gs $gsopts $ppd_opts -sOUTPUTFILE="%stdout" -c "$ps_code" -f "$ifile" 1>&2
+
+# Now run Ghostscript...
+/usr/bin/gs $gsopts $ppd_opts -sOUTPUTFILE="%stdout" -c "$ps_code" -f "$ifile"
+
+#
+#
diff --git a/filter/gstopxl.in b/filter/gstopxl.in
new file mode 100755
index 0000000..a817d82
--- /dev/null
+++ b/filter/gstopxl.in
@@ -0,0 +1,184 @@
+#!/bin/sh
+#
+#
+# CUPS PCL XL/PCL 6 filter script for Ghostscript.
+#
+# Copyright 2001-2005 by Easy Software Products.
+#
+# 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.
+#
+
+# Set the library/font path...
+GS_LIB="${CUPS_FONTPATH:=/usr/share/cups/fonts}"
+export GS_LIB
+
+# Determine the PCL XL/PCL 6 driver to use...
+if test "x$PPD" != x; then
+ colordevice=`grep '^*ColorDevice:' "$PPD" | awk -F: '{print $2}'`
+ case "$colordevice" in
+ *True* | *true*)
+ device="pxlcolor"
+ ;;
+ *)
+ device="pxlmono"
+ ;;
+ esac
+else
+ device="pxlmono"
+fi
+
+# Apply PPD settings.
+
+ps_code=
+ppd_opts=
+
+resolution=
+eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 's/.*(^|[[:space:]])Resolution=([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\2}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's/^\*DefaultResolution:[[:space:]]+([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: Resolution: $resolution" >&2
+if test -n "$resolution"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-r$resolution"
+fi
+
+pagesize=
+eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 's/.*(^|[[:space:]])(media|PageSize)=([^[:space:]]+).*/pagesize="${pagesize:-\3}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's/^\*DefaultPageSize:[[:space:]]+([^[:space:]]+).*/pagesize="${pagesize:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: Page size: $pagesize" >&2
+width=
+height=
+if test -n "$pagesize" && test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's|^\*PaperDimension[[:space:]]+'"$pagesize"'/[^:]+:[[:space:]]+"([^[:space:]]+)[[:space:]]+([^[:space:]]+)".*|width="\1"; height="\2"|p' "$PPD")"
+fi
+echo "DEBUG: Width: $width, height: $height" >&2
+if test -n "$width"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEWIDTHPOINTS=$width"
+fi
+if test -n "$height"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEHEIGHTPOINTS=$height"
+fi
+
+bl_x=
+bl_y=
+tr_x=
+tr_y=
+if test -n "$pagesize" && test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's|^\*ImageableArea[[:space:]]+'"$pagesize"'/[^:]+:[[:space:]]+"([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([^[:space:]]+)".*|bl_x="\1"; bl_y="\2"; tr_x="\3"; tr_y="\4"|p' "$PPD")"
+fi
+echo "DEBUG: Absolute margins: $bl_x, $bl_y, $tr_x, $tr_y" >&2
+margin_l=
+margin_b=
+margin_r=
+margin_t=
+if test -n "$width" && test -n "$height" && \
+ test -n "$bl_x" && test -n "$bl_y" && \
+ test -n "$tr_x" && test -n "$tr_y"; then
+ margin_l="$bl_x"
+ margin_b="$bl_y"
+ margin_r="$(printf "scale=8; (%s)-(%s)\n" "$width" "$tr_x" | bc)"
+ margin_t="$(printf "scale=8; (%s)-(%s)\n" "$height" "$tr_y" | bc)"
+fi
+echo "DEBUG: Relative margins: $margin_l, $margin_b, $margin_r, $margin_t" >&2
+if test -n "$margin_l" && test -n "$margin_b" && \
+ test -n "$margin_r" && test -n "$margin_t"; then
+ ps_code="${ps_code:+$ps_code }<</.HWMargins[$margin_l $margin_b $margin_r $margin_t] /Margins[0 0]>>setpagedevice"
+fi
+
+inputslot=
+eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 's/.*(^|[[:space:]])(InputSlot)=([^[:space:]]+).*/inputslot="${inputslot:-\3}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's/^\*DefaultInputSlot:[[:space:]]+([^[:space:]]+).*/inputslot="${inputslot:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: InputSlot: $inputslot" >&2
+inputslot_val=
+if test -n "$inputslot" && test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's|^\*InputSlot[[:space:]]+'"$inputslot"'/[^:]+:[[:space:]]+"[[:space:]]*<[[:space:]]*<[[:space:]]*/MediaPosition[[:space:]]*([0-9]+)[[:space:]]*>[[:space:]]*>[[:space:]]*setpagedevice[[:space:]]*".*|inputslot_val="\1"|p' "$PPD")"
+fi
+echo "DEBUG: Value for MediaPosition: $inputslot_val" >&2
+if test -n "$inputslot_val"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dMediaPosition=$inputslot_val"
+fi
+
+colormodel=
+eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 's/.*(^|[[:space:]])(ColorModel)=([^[:space:]]+).*/colormodel="${colormodel:-\3}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's/^\*DefaultColorModel:[[:space:]]+([^[:space:]]+).*/colormodel="${colormodel:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: ColorModel: $colormodel" >&2
+if test "$colormodel" = "Gray"; then
+ device=pxlmono
+fi
+colormodel_val=
+if test -n "$colormodel" && test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's|^\*ColorModel[[:space:]]+'"$colormodel"'/[^:]+:[[:space:]]+"[[:space:]]*<[[:space:]]*<[[:space:]]*/BitsPerPixel[[:space:]]*([0-9]*)[[:space:]]*>[[:space:]]*>[[:space:]]*setpagedevice[[:space:]]*".*|colormodel_val="\1"|p' "$PPD")"
+fi
+echo "DEBUG: Value for BitsPerPixel: $colormodel_val" >&2
+if test -n "$colormodel_val"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dBitsPerPixel=$colormodel_val"
+fi
+
+duplex=
+eval "$(printf "%s" "$5" | sed @SED_EXTENDED_REGEX_OPT@ 's/.*(^|[[:space:]])(Duplex)=([^[:space:]]+).*/duplex="${duplex:-\3}"/p')"
+if test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's/^\*DefaultDuplex:[[:space:]]+([^[:space:]]+).*/duplex="${duplex:-\1}"/p' "$PPD")"
+fi
+echo "DEBUG: Duplex: $duplex" >&2
+duplex_val=
+tumble_val=
+if test -n "$duplex" && test -e "$PPD"; then
+ eval "$(sed @SED_EXTENDED_REGEX_OPT@ 's|^\*Duplex[[:space:]]+'"$duplex"'/[^:]+:[[:space:]]+"[[:space:]]*<[[:space:]]*<[[:space:]]*/Duplex[[:space:]]*([^[:space:]]*)[[:space:]]*(/Tumble[[:space:]]*([^[:space:]]*)[[:space:]]*)?>[[:space:]]*>[[:space:]]*setpagedevice[[:space:]]*".*|duplex_val="\1"; tumble_val="\3"|p' "$PPD")"
+fi
+echo "DEBUG: Value for Duplex: $duplex_val; Value for Tumble: $tumble_val" >&2
+if test -n "$duplex_val"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dDuplex=$duplex_val"
+fi
+if test -n "$tumble_val"; then
+ ppd_opts="${ppd_opts:+$ppd_opts }-dTumble=$tumble_val"
+fi
+
+
+echo "DEBUG: PPD options: $ppd_opts" >&2
+echo "DEBUG: PostScript code from options: $ps_code" >&2
+
+# Options we use with Ghostscript...
+gsopts="-dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE"
+gsopts="$gsopts -sDEVICE=$device -sstdout=%stderr"
+
+# See if we have a filename on the command-line...
+if [ -n "$6" ]; then
+ exec <"$6"
+fi
+
+# We read the data into a temporary file as Ghostscript needs this to be
+# able to also work with PDF input
+tempfiles=
+trap 'rm -f $tempfiles' 0 1 2 13 15
+
+ifile=$(mktemp -t gstopxl.XXXXXX)
+tempfiles="$tempfiles $ifile"
+
+cat >"$ifile"
+
+echo INFO: Starting GPL Ghostscript `@CUPS_GHOSTSCRIPT@ --version`... 1>&2
+echo DEBUG: Running @CUPS_GHOSTSCRIPT@ $gsopts $ppd_opts -sOUTPUTFILE="%stdout" -c "$ps_code" -f "$ifile" 1>&2
+
+# Now run Ghostscript...
+@CUPS_GHOSTSCRIPT@ $gsopts $ppd_opts -sOUTPUTFILE="%stdout" -c "$ps_code" -f "$ifile"
+
+#
+#
diff --git a/filter/gstoraster.c b/filter/gstoraster.c
new file mode 100644
index 0000000..c1eb11a
--- /dev/null
+++ b/filter/gstoraster.c
@@ -0,0 +1,756 @@
+/*
+
+Copyright (c) 2008-2013, Till Kamppeter
+Copyright (c) 2011, Tim Waugh
+Copyright (c) 2011-2013, Richard Hughes
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+MIT Open Source License - http://www.opensource.org/
+
+*/
+
+
+/* PS/PDF to CUPS Raster filter based on Ghostscript */
+
+#include <cups/cups.h>
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 6)
+#define HAVE_CUPS_1_7 1
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <cups/raster.h>
+#include <cupsfilters/raster.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <errno.h>
+
+#include "colord.h"
+
+#define PDF_MAX_CHECK_COMMENT_LINES 20
+
+#ifndef GS
+#define GS "gs"
+#endif
+#ifndef BINDIR
+#define BINDIR "/usr/bin"
+#endif
+#ifndef CUPS_FONTPATH
+#define CUPS_FONTPATH "/usr/share/cups/fonts"
+#endif
+#ifndef CUPSDATA
+#define CUPSDATA "/usr/share/cups"
+#endif
+
+typedef enum {
+ GS_DOC_TYPE_PDF,
+ GS_DOC_TYPE_PS,
+ GS_DOC_TYPE_UNKNOWN
+} GsDocType;
+
+#ifdef CUPS_RASTER_SYNCv1
+typedef cups_page_header2_t gs_page_header;
+#else
+typedef cups_page_header_t gs_page_header;
+#endif /* CUPS_RASTER_SYNCv1 */
+
+static GsDocType
+parse_doc_type(FILE *fp)
+{
+ char buf[5];
+ GsDocType doc_type;
+ char *rc;
+
+ /* get the first few bytes of the file */
+ doc_type = GS_DOC_TYPE_UNKNOWN;
+ rewind(fp);
+ rc = fgets(buf,sizeof(buf),fp);
+ if (rc == NULL)
+ goto out;
+
+ /* is PDF */
+ if (strncmp(buf,"%PDF",4) == 0) {
+ doc_type = GS_DOC_TYPE_PDF;
+ goto out;
+ }
+
+ /* is PS */
+ if (strncmp(buf,"%!",2) == 0) {
+ doc_type = GS_DOC_TYPE_PS;
+ goto out;
+ }
+out:
+ return doc_type;
+}
+
+static void
+parse_pdf_header_options(FILE *fp, gs_page_header *h)
+{
+ char buf[4096];
+ int i;
+
+ rewind(fp);
+ /* skip until PDF start header */
+ while (fgets(buf,sizeof(buf),fp) != 0) {
+ if (strncmp(buf,"%PDF",4) == 0) {
+ break;
+ }
+ }
+ for (i = 0;i < PDF_MAX_CHECK_COMMENT_LINES;i++) {
+ if (fgets(buf,sizeof(buf),fp) == 0) break;
+ if (strncmp(buf,"%%PDFTOPDFNumCopies",19) == 0) {
+ char *p;
+
+ p = strchr(buf+19,':');
+ h->NumCopies = atoi(p+1);
+ } else if (strncmp(buf,"%%PDFTOPDFCollate",17) == 0) {
+ char *p;
+
+ p = strchr(buf+17,':');
+ while (*p == ' ' || *p == '\t') p++;
+ if (strncasecmp(p,"true",4) == 0) {
+ h->Collate = CUPS_TRUE;
+ } else {
+ h->Collate = CUPS_FALSE;
+ }
+ }
+ }
+}
+
+static void
+add_pdf_header_options(gs_page_header *h, cups_array_t *gs_args)
+{
+ int i;
+ char tmpstr[1024];
+
+ /* Simple boolean, enumerated choice, numerical, and string parameters */
+ if (h->MediaClass[0] |= '\0') {
+ snprintf(tmpstr, sizeof(tmpstr), "-sMediaClass=%s", h->MediaClass);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->MediaColor[0] |= '\0') {
+ snprintf(tmpstr, sizeof(tmpstr), "-sMediaColor=%s", h->MediaColor);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->MediaType[0] |= '\0') {
+ snprintf(tmpstr, sizeof(tmpstr), "-sMediaType=%s", h->MediaType);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->OutputType[0] |= '\0') {
+ snprintf(tmpstr, sizeof(tmpstr), "-sOutputType=%s", h->OutputType);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->AdvanceDistance) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dAdvanceDistance=%d",
+ (unsigned)(h->AdvanceDistance));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->AdvanceMedia) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dAdvanceMedia=%d",
+ (unsigned)(h->AdvanceMedia));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->Collate) {
+ cupsArrayAdd(gs_args, strdup("-dCollate"));
+ }
+ if (h->CutMedia) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dCutMedia=%d",
+ (unsigned)(h->CutMedia));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->Duplex) {
+ cupsArrayAdd(gs_args, strdup("-dDuplex"));
+ }
+ if ((h->HWResolution[0] != 100) || (h->HWResolution[1] != 100))
+ snprintf(tmpstr, sizeof(tmpstr), "-r%dx%d",
+ (unsigned)(h->HWResolution[0]), (unsigned)(h->HWResolution[1]));
+ else
+ snprintf(tmpstr, sizeof(tmpstr), "-r100x100");
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ if (h->InsertSheet) {
+ cupsArrayAdd(gs_args, strdup("-dInsertSheet"));
+ }
+ if (h->Jog) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dJog=%d",
+ (unsigned)(h->Jog));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->LeadingEdge) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dLeadingEdge=%d",
+ (unsigned)(h->LeadingEdge));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->ManualFeed) {
+ cupsArrayAdd(gs_args, strdup("-dManualFeed"));
+ }
+ if (h->MediaPosition) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dMediaPosition=%d",
+ (unsigned)(h->MediaPosition));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->MediaWeight) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dMediaWeight=%d",
+ (unsigned)(h->MediaWeight));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->MirrorPrint) {
+ cupsArrayAdd(gs_args, strdup("-dMirrorPrint"));
+ }
+ if (h->NegativePrint) {
+ cupsArrayAdd(gs_args, strdup("-dNegativePrint"));
+ }
+ if (h->NumCopies != 1) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dNumCopies=%d",
+ (unsigned)(h->NumCopies));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->Orientation) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dOrientation=%d",
+ (unsigned)(h->Orientation));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->OutputFaceUp) {
+ cupsArrayAdd(gs_args, strdup("-dOutputFaceUp"));
+ }
+ if (h->PageSize[0] != 612)
+ snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEWIDTHPOINTS=%d",
+ (unsigned)(h->PageSize[0]));
+ else
+ snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEWIDTHPOINTS=612");
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ if (h->PageSize[1] != 792)
+ snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEHEIGHTPOINTS=%d",
+ (unsigned)(h->PageSize[1]));
+ else
+ snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEHEIGHTPOINTS=792");
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ if (h->Separations) {
+ cupsArrayAdd(gs_args, strdup("-dSeparations"));
+ }
+ if (h->TraySwitch) {
+ cupsArrayAdd(gs_args, strdup("-dTraySwitch"));
+ }
+ if (h->Tumble) {
+ cupsArrayAdd(gs_args, strdup("-dTumble"));
+ }
+ if (h->cupsMediaType) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsMediaType=%d",
+ (unsigned)(h->cupsMediaType));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->cupsBitsPerColor != 1)
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsBitsPerColor=%d",
+ (unsigned)(h->cupsBitsPerColor));
+ else
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsBitsPerColor=1");
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ if (h->cupsColorOrder != CUPS_ORDER_CHUNKED)
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorOrder=%d",
+ (unsigned)(h->cupsColorOrder));
+ else
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorOrder=%d",
+ CUPS_ORDER_CHUNKED);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ if (h->cupsColorSpace != CUPS_CSPACE_K)
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorSpace=%d",
+ (unsigned)(h->cupsColorSpace));
+ else
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsColorSpace=%d",
+ CUPS_CSPACE_K);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ if (h->cupsCompression) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsCompression=%d",
+ (unsigned)(h->cupsCompression));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->cupsRowCount) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsRowCount=%d",
+ (unsigned)(h->cupsRowCount));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->cupsRowFeed) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsRowFeed=%d",
+ (unsigned)(h->cupsRowFeed));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->cupsRowStep) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsRowStep=%d",
+ (unsigned)(h->cupsRowStep));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+#ifdef CUPS_RASTER_SYNCv1
+ if (h->cupsBorderlessScalingFactor != 1.0f) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsBorderlessScalingFactor=%.4f",
+ h->cupsBorderlessScalingFactor);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ for (i=0; i <= 15; i ++)
+ if (h->cupsInteger[i]) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsInteger%d=%d",
+ i, (unsigned)(h->cupsInteger[i]));
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ for (i=0; i <= 15; i ++)
+ if (h->cupsReal[i]) {
+ snprintf(tmpstr, sizeof(tmpstr), "-dcupsReal%d=%.4f",
+ i, h->cupsReal[i]);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ for (i=0; i <= 15; i ++)
+ if (h->cupsString[i][0] != '\0') {
+ snprintf(tmpstr, sizeof(tmpstr), "-scupsString%d=%s",
+ i, h->cupsString[i]);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->cupsMarkerType[0] != '\0') {
+ snprintf(tmpstr, sizeof(tmpstr), "-scupsMarkerType=%s",
+ h->cupsMarkerType);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->cupsRenderingIntent[0] != '\0') {
+ snprintf(tmpstr, sizeof(tmpstr), "-scupsRenderingIntent=%s",
+ h->cupsRenderingIntent);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+ if (h->cupsPageSizeName[0] != '\0') {
+ snprintf(tmpstr, sizeof(tmpstr), "-scupsPageSizeName=%s",
+ h->cupsPageSizeName);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+#endif /* CUPS_RASTER_SYNCv1 */
+}
+
+static int
+gs_spawn (const char *filename,
+ cups_array_t *gs_args,
+ char **envp,
+ FILE *fp)
+{
+ char *argument;
+ char buf[BUFSIZ];
+ char **gsargv;
+ const char* apos;
+ int fds[2];
+ int i;
+ int n;
+ int numargs;
+ int pid;
+ int status = 1;
+
+ /* Put Ghostscript command line argument into an array for the "exec()"
+ call */
+ numargs = cupsArrayCount(gs_args);
+ gsargv = calloc(numargs + 1, sizeof(char *));
+ for (argument = (char *)cupsArrayFirst(gs_args), i = 0; argument;
+ argument = (char *)cupsArrayNext(gs_args), i++) {
+ gsargv[i] = argument;
+ }
+ gsargv[i] = NULL;
+
+ /* Debug output: Full Ghostscript command line and environment variables */
+ fprintf(stderr, "DEBUG: Ghostscript command line:");
+ for (i = 0; gsargv[i]; i ++) {
+ if ((strchr(gsargv[i],' ')) || (strchr(gsargv[i],'\t')))
+ apos = "'";
+ else
+ apos = "";
+ fprintf(stderr, " %s%s%s", apos, gsargv[i], apos);
+ }
+ fprintf(stderr, "\n");
+
+ for (i = 0; envp[i]; i ++)
+ fprintf(stderr, "DEBUG: envp[%d]=\"%s\"\n", i, envp[i]);
+
+ /* Create a pipe for feeding the job into Ghostscript */
+ if (pipe(fds))
+ {
+ fds[0] = -1;
+ fds[1] = -1;
+ fprintf(stderr, "ERROR: Unable to establish pipe for Ghostscript call\n");
+ goto out;
+ }
+
+ /* Set the "close on exec" flag on each end of the pipe... */
+ if (fcntl(fds[0], F_SETFD, fcntl(fds[0], F_GETFD) | FD_CLOEXEC))
+ {
+ close(fds[0]);
+ close(fds[1]);
+ fds[0] = -1;
+ fds[1] = -1;
+ fprintf(stderr, "ERROR: Unable to set \"close on exec\" flag on read end of the pipe for Ghostscript call\n");
+ goto out;
+ }
+ if (fcntl(fds[1], F_SETFD, fcntl(fds[1], F_GETFD) | FD_CLOEXEC))
+ {
+ close(fds[0]);
+ close(fds[1]);
+ fprintf(stderr, "ERROR: Unable to set \"close on exec\" flag on write end of the pipe for Ghostscript call\n");
+ goto out;
+ }
+
+ if ((pid = fork()) == 0)
+ {
+ /* Couple pipe with STDIN of Ghostscript process */
+ if (fds[0] != 0) {
+ close(0);
+ if (fds[0] > 0) {
+ if (dup(fds[0]) < 0) {
+ fprintf(stderr, "ERROR: Unable to couple pipe with STDIN of Ghostscript process\n");
+ goto out;
+ }
+ } else {
+ fprintf(stderr, "ERROR: Unable to couple pipe with STDIN of Ghostscript process\n");
+ goto out;
+ }
+ }
+
+ /* Execute Ghostscript command line ... */
+ execve(filename, gsargv, envp);
+ perror(filename);
+ goto out;
+ }
+
+ /* Feed job data into Ghostscript */
+ while ((n = fread(buf, 1, BUFSIZ, fp)) > 0) {
+ int count = write(fds[1], buf, n);
+ if (count != n) {
+ if (count == -1)
+ fprintf(stderr, "ERROR: write failed: %s\n", strerror(errno));
+ fprintf(stderr, "ERROR: Can't feed job data into Ghostscript\n");
+ goto out;
+ }
+ }
+ close (fds[1]);
+
+ if (waitpid (pid, &status, 0) == -1) {
+ perror ("gs");
+ goto out;
+ }
+out:
+ free(gsargv);
+ return status;
+}
+
+static char *
+get_ppd_icc_fallback (ppd_file_t *ppd, char **qualifier)
+{
+ char full_path[1024];
+ char *icc_profile = NULL;
+ char qualifer_tmp[1024];
+ const char *profile_key;
+ ppd_attr_t *attr;
+
+ /* get profile attr, falling back to CUPS */
+ profile_key = "APTiogaProfile";
+ attr = ppdFindAttr(ppd, profile_key, NULL);
+ if (attr == NULL) {
+ profile_key = "cupsICCProfile";
+ attr = ppdFindAttr(ppd, profile_key, NULL);
+ }
+
+ /* create a string for a quick comparion */
+ snprintf(qualifer_tmp, sizeof(qualifer_tmp),
+ "%s.%s.%s",
+ qualifier[0],
+ qualifier[1],
+ qualifier[2]);
+
+ /* neither */
+ if (attr == NULL) {
+ fprintf(stderr, "INFO: no profiles specified in PPD\n");
+ goto out;
+ }
+
+ /* try to find a profile that matches the qualifier exactly */
+ for (;attr != NULL; attr = ppdFindNextAttr(ppd, profile_key, NULL)) {
+ fprintf(stderr, "INFO: found profile %s in PPD with qualifier '%s'\n",
+ attr->value, attr->spec);
+
+ /* invalid entry */
+ if (attr->spec == NULL || attr->value == NULL)
+ continue;
+
+ /* expand to a full path if not already specified */
+ if (attr->value[0] != '/')
+ snprintf(full_path, sizeof(full_path),
+ "%s/profiles/%s", CUPSDATA, attr->value);
+ else
+ strncpy(full_path, attr->value, sizeof(full_path));
+
+ /* check the file exists */
+ if (access(full_path, 0)) {
+ fprintf(stderr, "INFO: found profile %s in PPD that does not exist\n",
+ full_path);
+ continue;
+ }
+
+ /* matches the qualifier */
+ if (strcmp(qualifer_tmp, attr->spec) == 0) {
+ icc_profile = strdup(full_path);
+ goto out;
+ }
+ }
+
+ /* no match */
+ if (attr == NULL) {
+ fprintf(stderr, "INFO: no profiles in PPD for qualifier '%s'\n",
+ qualifer_tmp);
+ goto out;
+ }
+
+out:
+ return icc_profile;
+}
+
+static void
+child_reaper (int signum)
+{
+ wait(NULL);
+}
+
+int
+main (int argc, char **argv, char *envp[])
+{
+ char buf[BUFSIZ];
+ char *icc_profile = NULL;
+ char **qualifier = NULL;
+ char *tmp;
+ char tmpstr[1024];
+ const char *t = NULL;
+ cups_array_t *gs_args = NULL;
+ cups_option_t *options = NULL;
+ FILE *fp = NULL;
+ GsDocType doc_type;
+ gs_page_header h;
+ int fd;
+ int device_inhibited;
+ int i;
+ int n;
+ int num_options;
+ int status = 1;
+ ppd_file_t *ppd = NULL;
+ struct sigaction sa;
+
+ if (argc < 6 || argc > 7) {
+ fprintf(stderr, "ERROR: %s job-id user title copies options [file]\n",
+ argv[0]);
+ goto out;
+ }
+
+ memset(&sa, 0, sizeof(sa));
+ /* Ignore SIGPIPE and have write return an error instead */
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &sa, NULL);
+
+ sa.sa_handler = child_reaper;
+ sigaction(SIGCHLD, &sa, NULL);
+
+ num_options = cupsParseOptions(argv[5], 0, &options);
+
+ t = getenv("PPD");
+ if (t && t[0] != '\0')
+ if ((ppd = ppdOpenFile(t)) == NULL) {
+ fprintf(stderr, "ERROR: Failed to open PPD: %s\n", t);
+ }
+
+ if (ppd) {
+ ppdMarkDefaults (ppd);
+ cupsMarkOptions (ppd, num_options, options);
+ }
+
+ if (argc == 6) {
+ /* stdin */
+
+ fd = cupsTempFd(buf,BUFSIZ);
+ if (fd < 0) {
+ fprintf(stderr, "ERROR: Can't create temporary file\n");
+ goto out;
+ }
+ /* remove name */
+ unlink(buf);
+
+ /* copy stdin to the tmp file */
+ while ((n = read(0,buf,BUFSIZ)) > 0) {
+ if (write(fd,buf,n) != n) {
+ fprintf(stderr, "ERROR: Can't copy stdin to temporary file\n");
+ close(fd);
+ goto out;
+ }
+ }
+ if (lseek(fd,0,SEEK_SET) < 0) {
+ fprintf(stderr, "ERROR: Can't rewind temporary file\n");
+ close(fd);
+ goto out;
+ }
+
+ if ((fp = fdopen(fd,"rb")) == 0) {
+ fprintf(stderr, "ERROR: Can't fdopen temporary file\n");
+ close(fd);
+ goto out;
+ }
+ } else {
+ /* argc == 7 filename is specified */
+
+ if ((fp = fopen(argv[6],"rb")) == 0) {
+ fprintf(stderr, "ERROR: Can't open input file %s\n",argv[6]);
+ goto out;
+ }
+ }
+
+ /* find out file type */
+ doc_type = parse_doc_type(fp);
+ if (doc_type == GS_DOC_TYPE_UNKNOWN) {
+ fprintf(stderr, "ERROR: Can't detect file type\n");
+ goto out;
+ }
+
+ /* support colord and the "color-management=off" option */
+ snprintf (tmpstr, sizeof(tmpstr), "cups-%s", getenv("PRINTER"));
+ device_inhibited = colord_get_inhibit_for_device_id (tmpstr);
+ t = cupsGetOption("color-management", num_options, options);
+ if (t != NULL && strcmp(t, "off") == 0)
+ device_inhibited = 1;
+ if (device_inhibited)
+ fprintf(stderr, "DEBUG: Device is inhibited, no CM performed\n");
+ if (ppd)
+ qualifier = colord_get_qualifier_for_ppd (ppd);
+ if (qualifier != NULL) {
+
+ fprintf(stderr, "DEBUG: PPD uses qualifier '%s.%s.%s'\n",
+ qualifier[0], qualifier[1], qualifier[2]);
+
+ snprintf (tmpstr, sizeof(tmpstr), "cups-%s", getenv("PRINTER"));
+ icc_profile = colord_get_profile_for_device_id (tmpstr,
+ (const char**) qualifier);
+
+ /* fall back to the PPD */
+ if (icc_profile == NULL)
+ icc_profile = get_ppd_icc_fallback (ppd, qualifier);
+
+ if(icc_profile != NULL)
+ fprintf(stderr, "DEBUG: Using ICC Profile '%s'\n", icc_profile);
+ }
+
+ /* Ghostscript parameters */
+ gs_args = cupsArrayNew(NULL, NULL);
+ if (!gs_args) {
+ fprintf(stderr, "ERROR: Unable to allocate memory for Ghostscript arguments array\n");
+ exit(1);
+ }
+
+ /* Part of Ghostscript command line which is not dependent on the job and/or
+ the driver */
+ snprintf(tmpstr, sizeof(tmpstr), "%s/%s", BINDIR, GS);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ cupsArrayAdd(gs_args, strdup("-dQUIET"));
+ /*cupsArrayAdd(gs_args, strdup("-dDEBUG"));*/
+ cupsArrayAdd(gs_args, strdup("-dPARANOIDSAFER"));
+ cupsArrayAdd(gs_args, strdup("-dNOPAUSE"));
+ cupsArrayAdd(gs_args, strdup("-dBATCH"));
+ cupsArrayAdd(gs_args, strdup("-dNOINTERPOLATE"));
+ if (doc_type == GS_DOC_TYPE_PS)
+ cupsArrayAdd(gs_args, strdup("-dNOMEDIAATTRS"));
+ if (device_inhibited)
+ cupsArrayAdd(gs_args, strdup("-dUseFastColor"));
+ cupsArrayAdd(gs_args, strdup("-sDEVICE=cups"));
+ cupsArrayAdd(gs_args, strdup("-sstdout=%stderr"));
+ cupsArrayAdd(gs_args, strdup("-sOutputFile=%stdout"));
+
+ if (ppd)
+ cupsRasterInterpretPPD(&h,ppd,num_options,options,0);
+ else
+#ifdef HAVE_CUPS_1_7
+ cupsRasterParseIPPOptions(&h,num_options,options,1,1);
+#else
+ {
+ fprintf(stderr, "ERROR: No PPD file specified.\n");
+ exit(1);
+ }
+#endif /* HAVE_CUPS_1_7 */
+
+ /* setPDF specific options */
+ if (doc_type == GS_DOC_TYPE_PDF) {
+ parse_pdf_header_options(fp, &h);
+ }
+
+ /* fixed other values that pdftopdf handles */
+ h.MirrorPrint = CUPS_FALSE;
+ h.Orientation = CUPS_ORIENT_0;
+
+ /* get all the data from the header and pass it to ghostscript */
+ add_pdf_header_options (&h, gs_args);
+
+ /* CUPS font path */
+ if ((t = getenv("CUPS_FONTPATH")) == NULL)
+ t = CUPS_FONTPATH;
+ snprintf(tmpstr, sizeof(tmpstr), "-I%s", t);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+
+ /* set the device output ICC profile */
+ if(icc_profile != NULL && icc_profile[0] != '\0') {
+ snprintf(tmpstr, sizeof(tmpstr), "-sOutputICCProfile=%s", icc_profile);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+
+ /* Switch to taking PostScript commands on the Ghostscript command line */
+ cupsArrayAdd(gs_args, strdup("-c"));
+
+ if ((t = cupsGetOption("profile", num_options, options)) != NULL) {
+ snprintf(tmpstr, sizeof(tmpstr), "<</cupsProfile(%s)>>setpagedevice", t);
+ cupsArrayAdd(gs_args, strdup(tmpstr));
+ }
+
+ /* Mark the end of PostScript commands supplied on the Ghostscript command
+ line (with the "-c" option), so that we can supply the input file name */
+ cupsArrayAdd(gs_args, strdup("-f"));
+
+ /* Let Ghostscript read from STDIN */
+ cupsArrayAdd(gs_args, strdup("-_"));
+
+ /* Execute Ghostscript command line ... */
+ snprintf(tmpstr, sizeof(tmpstr), "%s/%s", BINDIR, GS);
+
+ /* call Ghostscript */
+ rewind(fp);
+ status = gs_spawn (tmpstr, gs_args, envp, fp);
+out:
+ if (fp)
+ fclose(fp);
+ if (qualifier != NULL) {
+ for (i=0; qualifier[i] != NULL; i++)
+ free(qualifier[i]);
+ free(qualifier);
+ }
+ if (gs_args) {
+ while ((tmp = cupsArrayFirst(gs_args)) != NULL) {
+ cupsArrayRemove(gs_args,tmp);
+ free(tmp);
+ }
+ cupsArrayDelete(gs_args);
+ }
+ free(icc_profile);
+ if (ppd)
+ ppdClose(ppd);
+ return status;
+}
diff --git a/filter/pdftoijs.cxx b/filter/pdftoijs.cxx
index 2f32fb5..003398c 100644
--- a/filter/pdftoijs.cxx
+++ b/filter/pdftoijs.cxx
@@ -69,31 +69,40 @@ namespace {
ppd_file_t *ppd = 0; // holds the memory for the strings
}
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
void CDECL myErrorFun(void *data, ErrorCategory category,
- int pos, char *msg)
+ Goffset pos, char *msg)
+//#else
+//void CDECL myErrorFun(void *data, ErrorCategory category,
+// int pos, char *msg)
+//#endif
{
if (pos >= 0) {
- fprintf(stderr, "ERROR (%d): ", pos);
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
+ fprintf(stderr, "ERROR (%lld): ", pos);
+//#else
+// fprintf(stderr, "ERROR (%d): ", pos);
+//#endif
} else {
fprintf(stderr, "ERROR: ");
}
fprintf(stderr, "%s\n",msg);
fflush(stderr);
}
-#else
-void CDECL myErrorFun(int pos, char *msg, va_list args)
-{
- if (pos >= 0) {
- fprintf(stderr, "ERROR (%d): ", pos);
- } else {
- fprintf(stderr, "ERROR: ");
- }
- vfprintf(stderr, msg, args);
- fprintf(stderr, "\n");
- fflush(stderr);
-}
-#endif
+//#else
+//void CDECL myErrorFun(int pos, char *msg, va_list args)
+//{
+// if (pos >= 0) {
+// fprintf(stderr, "ERROR (%d): ", pos);
+// } else {
+// fprintf(stderr, "ERROR: ");
+// }
+// vfprintf(stderr, msg, args);
+// fprintf(stderr, "\n");
+// fflush(stderr);
+//}
+//#endif
/* parse "300 400" */
void parse_resolution(const char *str)
@@ -286,30 +295,26 @@ int main(int argc, char *argv[]) {
int rowpad;
GBool reverseVideo;
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
setErrorCallback(::myErrorFun,NULL);
-#else
- setErrorFunction(::myErrorFun);
-#endif
+//#else
+// setErrorFunction(::myErrorFun);
+//#endif
globalParams = new GlobalParams();
parseOpts(argc, argv);
if (argc == 6) {
/* stdin */
int fd;
- Object obj;
- BaseStream *str;
- FILE *fp;
+ char name[BUFSIZ];
char buf[BUFSIZ];
int n;
- fd = cupsTempFd(buf,sizeof(buf));
+ fd = cupsTempFd(name,sizeof(name));
if (fd < 0) {
pdfError(-1,"Can't create temporary file");
exit(1);
}
- /* remove name */
- unlink(buf);
/* copy stdin to the tmp file */
while ((n = read(0,buf,BUFSIZ)) > 0) {
@@ -319,23 +324,10 @@ int main(int argc, char *argv[]) {
exit(1);
}
}
- if (lseek(fd,0,SEEK_SET) < 0) {
- pdfError(-1,"Can't rewind temporary file");
- close(fd);
- exit(1);
- }
-
- if ((fp = fdopen(fd,"rb")) == 0) {
- pdfError(-1,"Can't fdopen temporary file");
- close(fd);
- exit(1);
- }
-
- obj.initNull();
-// parsePDFTOPDFComment(fp); // TODO?
- rewind(fp);
- str = new FileStream(fp,0,gFalse,0,&obj);
- doc = new PDFDoc(str);
+ close(fd);
+ doc = new PDFDoc(new GooString(name));
+ /* remove name */
+ unlink(name);
} else {
GooString *fileName = new GooString(argv[6]);
/* argc == 7 filenmae is specified */
@@ -445,11 +437,11 @@ int main(int argc, char *argv[]) {
out = new SplashOutputDev(cmode,rowpad/* row padding */,
reverseVideo,paperColor,gTrue,gFalse);
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
out->startDoc(doc);
-#else
- out->startDoc(doc->getXRef());
-#endif
+//#else
+// out->startDoc(doc->getXRef());
+//#endif
snprintf(tmp,99,"%d",numChan);
ijs_client_set_param(ctx,job_id,"NumChan",tmp,strlen(tmp));
diff --git a/filter/pdftoopvp/99pdftoopvp.conf b/filter/pdftoopvp/99pdftoopvp.conf
deleted file mode 100644
index 2737e17..0000000
--- a/filter/pdftoopvp/99pdftoopvp.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
-<!-- conf.d/pdftoopvp.fconf -->
-<fontconfig>
-<!-- Symbol and ZapfDingbats -->
- <alias>
- <family>ZapfDingbats</family>
- <prefer>
- <family>Dingbats</family>
- </prefer>
- </alias>
- <alias>
- <family>Symbol</family>
- <prefer>
- <family>Standard Symbols L</family>
- </prefer>
- </alias>
-</fontconfig>
diff --git a/filter/pdftoopvp/OPVPOutputDev.cxx b/filter/pdftoopvp/OPVPOutputDev.cxx
deleted file mode 100644
index 2eac3c8..0000000
--- a/filter/pdftoopvp/OPVPOutputDev.cxx
+++ /dev/null
@@ -1,1990 +0,0 @@
-//
-// OPVPOutputDev.cc
-// Based SplashOutputDev.cc : Copyright 2003 Glyph & Cog, LLC
-//
-// Copyright 2005 AXE,Inc.
-//
-// 2007,2008 Modified by BBR Inc.
-//========================================================================
-
-#include <config.h>
-#ifdef HAVE_CPP_POPPLER_VERSION_H
-#include "cpp/poppler-version.h"
-#endif
-
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
-#include <string.h>
-#include <math.h>
-#include "goo/gfile.h"
-#include "GlobalParams.h"
-#include "OPVPError.h"
-#include "Object.h"
-#include "GfxState.h"
-#include "GfxFont.h"
-#include "Link.h"
-#include "CharCodeToUnicode.h"
-#include "FontEncodingTables.h"
-#include "fofi/FoFiTrueType.h"
-#include "splash/SplashMath.h"
-#include "CMap.h"
-#include "splash/SplashBitmap.h"
-#include "splash/SplashGlyphBitmap.h"
-#include "splash/SplashPattern.h"
-#include "splash/SplashScreen.h"
-#include "splash/SplashErrorCodes.h"
-#include "splash/SplashFontEngine.h"
-#include "splash/SplashFont.h"
-#include "splash/SplashFontFile.h"
-#include "splash/SplashFontFileID.h"
-#include "OPVPSplashPath.h"
-#include "OPVPSplashState.h"
-#include "OPRS.h"
-#include "OPVPOutputDev.h"
-
-#define SLICE_FOR_PATTERN 1000
-
-//------------------------------------------------------------------------
-// Font substitutions
-//------------------------------------------------------------------------
-
-struct SplashOutFontSubst {
- char *name;
- double mWidth;
-};
-
-//------------------------------------------------------------------------
-
-#define soutRound(x) ((int)(x + 0.5))
-
-//------------------------------------------------------------------------
-// SplashOutFontFileID
-//------------------------------------------------------------------------
-
-class SplashOutFontFileID: public SplashFontFileID {
-public:
-
- SplashOutFontFileID(Ref *rA) { r = *rA; substIdx = -1; }
-
- ~SplashOutFontFileID() {}
-
- GBool matches(SplashFontFileID *id) {
- return ((SplashOutFontFileID *)id)->r.num == r.num &&
- ((SplashOutFontFileID *)id)->r.gen == r.gen;
- }
-
- void setSubstIdx(int substIdxA) { substIdx = substIdxA; }
- int getSubstIdx() { return substIdx; }
-
-private:
-
- Ref r;
- int substIdx;
-};
-
-//------------------------------------------------------------------------
-// T3FontCache
-//------------------------------------------------------------------------
-
-struct T3FontCacheTag {
- Gushort code;
- Gushort mru; // valid bit (0x8000) and MRU index
-};
-
-class T3FontCache {
-public:
-
- T3FontCache(Ref *fontID, double m11A, double m12A,
- double m21A, double m22A,
- int glyphXA, int glyphYA, int glyphWA, int glyphHA,
- GBool aa);
- ~T3FontCache();
- GBool matches(Ref *idA, double m11A, double m12A,
- double m21A, double m22A)
- { return fontID.num == idA->num && fontID.gen == idA->gen &&
- m11 == m11A && m12 == m12A && m21 == m21A && m22 == m22A; }
-
- Ref fontID; // PDF font ID
- double m11, m12, m21, m22; // transform matrix
- int glyphX, glyphY; // pixel offset of glyph bitmaps
- int glyphW, glyphH; // size of glyph bitmaps, in pixels
- int glyphSize; // size of glyph bitmaps, in bytes
- int cacheSets; // number of sets in cache
- int cacheAssoc; // cache associativity (glyphs per set)
- Guchar *cacheData; // glyph pixmap cache
- T3FontCacheTag *cacheTags; // cache tags, i.e., char codes
-};
-
-T3FontCache::T3FontCache(Ref *fontIDA, double m11A, double m12A,
- double m21A, double m22A,
- int glyphXA, int glyphYA, int glyphWA, int glyphHA,
- GBool aa) {
- int i;
-
- fontID = *fontIDA;
- m11 = m11A;
- m12 = m12A;
- m21 = m21A;
- m22 = m22A;
- glyphX = glyphXA;
- glyphY = glyphYA;
- glyphW = glyphWA;
- glyphH = glyphHA;
- if (aa) {
- glyphSize = glyphW * glyphH;
- } else {
- glyphSize = ((glyphW + 7) >> 3) * glyphH;
- }
- cacheAssoc = 8;
- if (glyphSize <= 256) {
- cacheSets = 8;
- } else if (glyphSize <= 512) {
- cacheSets = 4;
- } else if (glyphSize <= 1024) {
- cacheSets = 2;
- } else {
- cacheSets = 1;
- }
- cacheData = (Guchar *)gmalloc(cacheSets * cacheAssoc * glyphSize);
- cacheTags = (T3FontCacheTag *)gmalloc(cacheSets * cacheAssoc *
- sizeof(T3FontCacheTag));
- for (i = 0; i < cacheSets * cacheAssoc; ++i) {
- cacheTags[i].mru = i & (cacheAssoc - 1);
- }
-}
-
-T3FontCache::~T3FontCache() {
- gfree(cacheData);
- gfree(cacheTags);
-}
-
-struct T3GlyphStack {
- Gushort code; // character code
- double x, y; // position to draw the glyph
-
- //----- cache info
- T3FontCache *cache; // font cache for the current font
- T3FontCacheTag *cacheTag; // pointer to cache tag for the glyph
- Guchar *cacheData; // pointer to cache data for the glyph
-
- //----- saved state
- SplashBitmap *origBitmap;
- OPRS *origOPRS;
- double origCTM4, origCTM5;
-
- T3GlyphStack *next; // next object on stack
-};
-
-//------------------------------------------------------------------------
-// OPVPOutputDev
-//------------------------------------------------------------------------
-
-OPVPOutputDev::OPVPOutputDev()
-{
- xref = 0;
- bitmap = 0;
- fontEngine = 0;
- nT3Fonts = 0;
- t3GlyphStack = 0;
- font = NULL;
- needFontUpdate = gFalse;
- textClipPath = 0;
- underlayCbk = 0;
- underlayCbkData = 0;
- scaleWidth = scaleHeight = -1;
- leftMargin = 0;
- bottomMargin = 0;
- rotate = 0;
- sliceHeight = 0;
- yoffset = 0;
- oprs = 0;
-}
-
-void OPVPOutputDev::setScale(double w, double h,
- double leftMarginA, double bottomMarginA, int rotateA,
- int yoffsetA, int sliceHeightA)
-{
- scaleWidth = w;
- scaleHeight = h;
- leftMargin = leftMarginA;
- bottomMargin = bottomMarginA;
- rotate = rotateA;
- yoffset = yoffsetA;
- sliceHeight = sliceHeightA;
-}
-
-int OPVPOutputDev::init(SplashColorMode colorModeA,
- GBool colorProfile,
- GBool reverseVideoA,
- SplashColor paperColorA,
- const char *driverName,
- int outputFD,
- const char *printerModel,
- int nOptions,
- const char *optionKeys[],
- const char *optionVals[]) {
- int result;
-
- oprs = new OPRS();
-
- if ((result = oprs->init(driverName, outputFD, printerModel,
- nOptions,optionKeys,optionVals)) < 0) {
- opvpError(-1,"OPRS initialization fail");
- return result;
- }
- colorMode = colorModeA;
- if ((result = oprs->setColorMode(colorMode,colorProfile)) < 0) {
- opvpError(-1,"Can't setColorMode");
- return result;
- }
- reverseVideo = reverseVideoA;
- splashColorCopy(paperColor,paperColorA);
-
- return 0;
-}
-
-OPVPOutputDev::~OPVPOutputDev() {
- int i;
-
- for (i = 0; i < nT3Fonts; ++i) {
- delete t3FontCache[i];
- }
- if (fontEngine) {
- delete fontEngine;
- }
- if (oprs) {
- delete oprs;
- }
- if (bitmap) {
- delete bitmap;
- }
-}
-
-void OPVPOutputDev::startDoc(XRef *xrefA) {
- int i;
-
- xref = xrefA;
- if (fontEngine) {
- delete fontEngine;
- }
- fontEngine = new SplashFontEngine(
-#if HAVE_T1LIB_H
- globalParams->getEnableT1lib(),
-#endif
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
- globalParams->getEnableFreeType(),
- gFalse,
- gFalse,
-#endif
- globalParams->getAntialias());
- for (i = 0; i < nT3Fonts; ++i) {
- delete t3FontCache[i];
- }
- nT3Fonts = 0;
-}
-
-void OPVPOutputDev::startPage(int pageNum, GfxState *state) {
- int w, h;
-
- if (state) {
- if (scaleWidth > 0 && scaleHeight > 0) {
- double *ctm = state->getCTM();
-
- switch (rotate) {
- case 90:
- state->setCTM(0,ctm[1],ctm[2],0,leftMargin,bottomMargin-yoffset);
- break;
- case 180:
- state->setCTM(ctm[0],0,0,ctm[3],paperWidth-leftMargin,
- bottomMargin-yoffset);
- break;
- case 270:
- state->setCTM(0,ctm[1],ctm[2],0,paperWidth-leftMargin,
- -bottomMargin+paperHeight-yoffset);
- break;
- default:
- state->setCTM(ctm[0],0,0,ctm[3],leftMargin,
- -bottomMargin+paperHeight-yoffset);
- break;
- }
- state->concatCTM(scaleWidth,0.0,0.0,scaleHeight,0,0);
- }
- w = (int)(state->getPageWidth()+0.5);
- h = (int)(state->getPageHeight()+0.5);
- } else {
- w = h = 1;
- }
- oprs->initGS(colorMode,w,h,paperColor);
-
- if (underlayCbk) {
- (*underlayCbk)(underlayCbkData);
- }
-}
-
-void OPVPOutputDev::endPage() {
- oprs->endPage();
-}
-
-void OPVPOutputDev::saveState(GfxState *state) {
- oprs->saveState();
-}
-
-void OPVPOutputDev::restoreState(GfxState *state) {
- oprs->restoreState();
- needFontUpdate = gTrue;
-}
-
-void OPVPOutputDev::updateAll(GfxState *state) {
- updateLineDash(state);
- updateLineJoin(state);
- updateLineCap(state);
- updateLineWidth(state);
- updateFlatness(state);
- updateMiterLimit(state);
- updateFillColor(state);
- updateStrokeColor(state);
- needFontUpdate = gTrue;
-}
-
-void OPVPOutputDev::updateCTM(GfxState *state, double m11, double m12,
- double m21, double m22,
- double m31, double m32) {
- updateLineDash(state);
- updateLineJoin(state);
- updateLineCap(state);
- updateLineWidth(state);
-}
-
-void OPVPOutputDev::transLineDash(GfxState *state, SplashCoord **adash,
- int *adashLength, SplashCoord *aphase) {
- double *dashPattern;
- double dashStart;
- static SplashCoord dash[20];
- int i;
-
- state->getLineDash(&dashPattern, adashLength, &dashStart);
- if (*adashLength > 20) {
- *adashLength = 20;
- }
- for (i = 0; i < *adashLength; ++i) {
- dash[i] = (SplashCoord)state->transformWidth(dashPattern[i]);
- if (dash[i] < 1) {
- dash[i] = 1;
- }
- }
- *adash = dash;
- *aphase = (SplashCoord)state->transformWidth(dashStart);
-}
-
-void OPVPOutputDev::updateSplashLineDash(GfxState *state, Splash *splash) {
- int dashLength;
- SplashCoord *dash;
- SplashCoord phase;
-
- transLineDash(state, &dash, &dashLength, &phase);
- splash->setLineDash(dash, dashLength, phase);
-}
-
-void OPVPOutputDev::updateLineDash(GfxState *state) {
- int dashLength;
- SplashCoord *dash;
- SplashCoord phase;
-
- transLineDash(state, &dash, &dashLength, &phase);
- oprs->setLineDash(dash, dashLength, phase);
-}
-
-void OPVPOutputDev::updateFlatness(GfxState *state) {
- oprs->setFlatness(state->getFlatness());
-}
-
-void OPVPOutputDev::updateLineJoin(GfxState *state) {
- oprs->setLineJoin(state->getLineJoin());
-}
-
-void OPVPOutputDev::updateLineCap(GfxState *state) {
- oprs->setLineCap(state->getLineCap());
-}
-
-void OPVPOutputDev::updateMiterLimit(GfxState *state) {
- oprs->setMiterLimit(state->getMiterLimit());
-}
-
-void OPVPOutputDev::updateLineWidth(GfxState *state) {
- oprs->setLineWidth(state->getTransformedLineWidth());
-}
-
-void OPVPOutputDev::updateFillColor(GfxState *state) {
- GfxGray gray;
- GfxRGB rgb;
-
- state->getFillGray(&gray);
- state->getFillRGB(&rgb);
- oprs->setFillPattern(getColor(gray, &rgb));
-}
-
-void OPVPOutputDev::updateStrokeColor(GfxState *state) {
- GfxGray gray;
- GfxRGB rgb;
-
- state->getStrokeGray(&gray);
- state->getStrokeRGB(&rgb);
- oprs->setStrokePattern(getColor(gray, &rgb));
-}
-
-#ifdef SPLASH_CMYK
-SplashPattern *OPVPOutputDev::getColor(double gray, GfxRGB *rgb,
- GfxCMYK *cmyk) {
-#else
-SplashPattern *OPVPOutputDev::getColor(GfxGray gray, GfxRGB *rgb) {
-#endif
- SplashPattern *pattern;
- SplashColor color1;
- GfxColorComp r, g, b;
-
- if (reverseVideo) {
- gray = gfxColorComp1 - gray;
- r = gfxColorComp1 - rgb->r;
- g = gfxColorComp1 - rgb->g;
- b = gfxColorComp1 - rgb->b;
- } else {
- r = rgb->r;
- g = rgb->g;
- b = rgb->b;
- }
-
- pattern = NULL; // make gcc happy
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- color1[0] = colToByte(gray);
- pattern = new SplashSolidColor(color1);
- break;
- case splashModeRGB8:
- color1[0] = colToByte(r);
- color1[1] = colToByte(g);
- color1[2] = colToByte(b);
- pattern = new SplashSolidColor(color1);
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- color[0] = colToByte(cmyk->c);
- color[1] = colToByte(cmyk->m);
- color[2] = colToByte(cmyk->y);
- color[3] = colToByte(cmyk->k);
- pattern = new SplashSolidColor(color);
- break;
-#endif
- default:
- opvpError(-1, "no supported color mode");
- break;
- }
-
- return pattern;
-}
-
-void OPVPOutputDev::updateFont(GfxState *state) {
- needFontUpdate = gTrue;
-}
-
-void OPVPOutputDev::doUpdateFont(GfxState *state) {
- GfxFont *gfxFont;
- GfxFontType fontType;
- SplashOutFontFileID *id;
- SplashFontFile *fontFile;
- SplashFontSrc *fontsrc = NULL;
- FoFiTrueType *ff;
- Ref embRef;
- Object refObj, strObj;
- GooString *fileName;
- char *tmpBuf;
- int tmpBufLen;
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- int *codeToGID;
-#else
- Gushort *codeToGID;
-#endif
- double m11, m12, m21, m22;
- int substIdx, n;
- int faceIndex = 0;
- GBool recreateFont = gFalse;
-
- needFontUpdate = gFalse;
- font = NULL;
- fileName = NULL;
- tmpBuf = NULL;
- substIdx = -1;
-
- if (!(gfxFont = state->getFont())) {
- goto err1;
- }
- fontType = gfxFont->getType();
- if (fontType == fontType3) {
- goto err1;
- }
-
- // check the font file cache
- id = new SplashOutFontFileID(gfxFont->getID());
- if ((fontFile = fontEngine->getFontFile(id))) {
- delete id;
-
- } else {
-
- // if there is an embedded font, write it to disk
- if (gfxFont->getEmbeddedFontID(&embRef)) {
- tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
- if (! tmpBuf)
- goto err2;
-
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- } else {
- SysFontType sftype;
- fileName = globalParams->findSystemFontFile(gfxFont,&sftype,
- &faceIndex, NULL);
- if (fileName == 0) {
- opvpError(-1, "Couldn't find a font for '%s'",
- gfxFont->getName() ? gfxFont->getName()->getCString()
- : "(unnamed)");
- goto err2;
- }
- switch (sftype) {
- case sysFontPFA:
- case sysFontPFB:
- fontType = gfxFont->isCIDFont() ? fontCIDType0 : fontType1;
- break;
- case sysFontTTF:
- case sysFontTTC:
- fontType = gfxFont->isCIDFont() ? fontCIDType2 : fontTrueType;
- break;
- }
- }
-#else
- // if there is an external font file, use it
- } else if (!(fileName = gfxFont->getExtFontFile())) {
- DisplayFontParam *dfp;
- // look for a display font mapping or a substitute font
- dfp = NULL;
- if (gfxFont->getName()) {
- dfp = globalParams->getDisplayFont(gfxFont);
- }
- if (!dfp) {
- opvpError(-1, "Couldn't find a font for '%s'",
- gfxFont->getName() ? gfxFont->getName()->getCString()
- : "(unnamed)");
- goto err2;
- }
- switch (dfp->kind) {
- case displayFontT1:
- fileName = dfp->t1.fileName;
- fontType = gfxFont->isCIDFont() ? fontCIDType0 : fontType1;
- break;
- case displayFontTT:
- fileName = dfp->tt.fileName;
- fontType = gfxFont->isCIDFont() ? fontCIDType2 : fontTrueType;
- faceIndex = dfp->tt.faceIndex;
- break;
- }
- }
-#endif
-
- fontsrc = new SplashFontSrc;
- if (fileName)
- fontsrc->setFile(fileName, gFalse);
- else
- fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);
-
- // load the font file
- switch (fontType) {
- case fontType1:
- if (!(fontFile = fontEngine->loadType1Font(
- id,
- fontsrc,
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- (const char **)
-#endif
- ((Gfx8BitFont *)gfxFont)->getEncoding()))) {
- opvpError(-1, "Couldn't create a font for '%s'",
- gfxFont->getName() ? gfxFont->getName()->getCString()
- : "(unnamed)");
- goto err2;
- }
- break;
- case fontType1C:
- if (!(fontFile = fontEngine->loadType1CFont(
- id,
- fontsrc,
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- (const char **)
-#endif
- ((Gfx8BitFont *)gfxFont)->getEncoding()))) {
- opvpError(-1, "Couldn't create a font for '%s'",
- gfxFont->getName() ? gfxFont->getName()->getCString()
- : "(unnamed)");
- goto err2;
- }
- break;
- case fontType1COT:
- if (!(fontFile = fontEngine->loadOpenTypeT1CFont(
- id,
- fontsrc,
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- (const char **)
-#endif
- ((Gfx8BitFont *)gfxFont)->getEncoding()))) {
- opvpError(-1, "Couldn't create a font for '%s'",
- gfxFont->getName() ? gfxFont->getName()->getCString()
- : "(unnamed)");
- goto err2;
- }
- break;
- case fontTrueTypeOT:
- case fontTrueType:
- if (fileName)
- ff = FoFiTrueType::load(fileName->getCString());
- else
- ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
- if (ff) {
- codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);
- n = 256;
- delete ff;
- } else {
- codeToGID = NULL;
- n = 0;
- }
- if (!(fontFile = fontEngine->loadTrueTypeFont(
- id,
- fontsrc,
- codeToGID, n))) {
- opvpError(-1, "Couldn't create a font for '%s'",
- gfxFont->getName() ? gfxFont->getName()->getCString()
- : "(unnamed)");
- goto err2;
- }
- break;
- case fontCIDType0:
- case fontCIDType0C:
- if (!(fontFile = fontEngine->loadCIDFont(
- id,
- fontsrc))) {
- opvpError(-1, "Couldn't create a font for '%s'",
- gfxFont->getName() ? gfxFont->getName()->getCString()
- : "(unnamed)");
- goto err2;
- }
- break;
- case fontCIDType0COT:
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
- if (n) {
- codeToGID = (int *)gmallocn(n, sizeof(int));
- memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
- n * sizeof(int));
- } else {
- codeToGID = NULL;
- }
- if (!(fontFile = fontEngine->loadOpenTypeCFFFont(
- id,
- fontsrc,codeToGID,n))) {
-#else
- if (!(fontFile = fontEngine->loadOpenTypeCFFFont(
- id,
- fontsrc))) {
-#endif
- opvpError(-1, "Couldn't create a font for '%s'",
- gfxFont->getName() ? gfxFont->getName()->getCString()
- : "(unnamed)");
- goto err2;
- }
- break;
- case fontCIDType2OT:
- case fontCIDType2:
- codeToGID = NULL;
- n = 0;
- if (((GfxCIDFont *)gfxFont)->getCIDToGID()) {
- n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
- if (n) {
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- codeToGID = (int *)gmallocn(n, sizeof(int));
- memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
- n * sizeof(int));
-#else
- codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort));
- memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
- n * sizeof(Gushort));
-#endif
- }
- } else {
- if (fileName)
- ff = FoFiTrueType::load(fileName->getCString());
- else
- ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
- if (! ff)
- goto err2;
- codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
- delete ff;
- }
- if (!(fontFile = fontEngine->loadTrueTypeFont(
- id,
- fontsrc,
- codeToGID, n, faceIndex))) {
- opvpError(-1, "Couldn't create a font for '%s'",
- gfxFont->getName() ? gfxFont->getName()->getCString()
- : "(unnamed)");
- goto err2;
- }
- break;
- default:
- // this shouldn't happen
- goto err2;
- }
- fontFile->doAdjustMatrix = gTrue;
- }
-
- // get the font matrix
- state->getFontTransMat(&m11, &m12, &m21, &m22);
- m11 *= state->getHorizScaling();
- m12 *= state->getHorizScaling();
-
- // create the scaled font
- fontMat[0] = m11; fontMat[1] = m12;
- fontMat[2] = m21; fontMat[3] = m22;
- font = fontEngine->getFont(fontFile, fontMat, oprs->getMatrix());
-
- // for substituted fonts: adjust the font matrix -- compare the
- // width of 'm' in the original font and the substituted font
- if (fontFile->doAdjustMatrix && !gfxFont->isCIDFont()) {
- double w1, w2;
- CharCode code;
- char *name;
- for (code = 0; code < 256; ++code) {
- if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) &&
- name[0] == 'm' && name[1] == '\0') {
- break;
- }
- }
- if (code < 256) {
- w1 = ((Gfx8BitFont *)gfxFont)->getWidth(code);
- w2 = font->getGlyphAdvance(code);
- if (!gfxFont->isSymbolic() && w2 > 0) {
- // if real font is substantially narrower than substituted
- // font, reduce the font size accordingly
- if (w1 > 0.01 && w1 < 0.9 * w2) {
- w1 /= w2;
- m11 *= w1;
- m21 *= w1;
- recreateFont = gTrue;
- }
- }
- }
- }
-
- if (recreateFont)
- {
- fontMat[0] = m11; fontMat[1] = m12;
- fontMat[2] = m21; fontMat[3] = m22;
- font = fontEngine->getFont(fontFile, fontMat, oprs->getMatrix());
- }
-
- if (fontsrc && !fontsrc->isFile)
- fontsrc->unref();
- return;
-
- err2:
- delete id;
- err1:
- if (fontsrc && !fontsrc->isFile)
- fontsrc->unref();
- return;
-}
-
-void OPVPOutputDev::stroke(GfxState *state) {
- OPVPSplashPath *path;
- GfxColorSpace *cs;
-
- /* check None separate color */
- if ((cs = state->getStrokeColorSpace()) == NULL) return;
- if (cs->getMode() == csSeparation) {
- GooString *name;
-
- name = (dynamic_cast<GfxSeparationColorSpace *>(cs))->getName();
- if (name == NULL) return;
- if (name->cmp("None") == 0) return;
- }
-
- path = convertPath(state, state->getPath());
- oprs->stroke(path);
- delete path;
-}
-
-void OPVPOutputDev::fill(GfxState *state) {
- OPVPSplashPath *path;
- GfxColorSpace *cs;
-
- /* check None separate color */
- if ((cs = state->getFillColorSpace()) == NULL) return;
- if (cs->getMode() == csSeparation) {
- GooString *name;
-
- name = (dynamic_cast<GfxSeparationColorSpace *>(cs))->getName();
- if (name == NULL) return;
- if (name->cmp("None") == 0) return;
- }
-
- path = convertPath(state, state->getPath());
- oprs->fill(path, gFalse);
- delete path;
-}
-
-void OPVPOutputDev::eoFill(GfxState *state) {
- OPVPSplashPath *path;
- GfxColorSpace *cs;
-
- /* check None separate color */
- if ((cs = state->getFillColorSpace()) == NULL) return;
- if (cs->getMode() == csSeparation) {
- GooString *name;
-
- name = (dynamic_cast<GfxSeparationColorSpace *>(cs))->getName();
- if (name == NULL) return;
- if (name->cmp("None") == 0) return;
- }
-
- path = convertPath(state, state->getPath());
- oprs->fill(path, gTrue);
- delete path;
-}
-
-void OPVPOutputDev::clip(GfxState *state) {
- OPVPSplashPath *path;
-
- path = convertPath(state, state->getPath());
- oprs->clipToPath(path, gFalse);
- delete path;
-}
-
-void OPVPOutputDev::eoClip(GfxState *state) {
- OPVPSplashPath *path;
-
- path = convertPath(state, state->getPath());
- oprs->clipToPath(path, gTrue);
- delete path;
-}
-
-OPVPSplashPath *OPVPOutputDev::bitmapToPath(SplashBitmap *bitmapA,
- int width, int height)
-{
- int x,y;
- OPVPSplashPath *path;
- int x1, x2;
- SplashColor pix;
-
- path = new OPVPSplashPath();
-
- for (y = 0;y < height;y++) {
- for (x = 0;x < width;x++) {
- bitmapA->getPixel(x,y,pix);
- if (pix[0] == 0) {
- /* start */
- x1 = x;
- for (x++;x < width;x++) {
- bitmapA->getPixel(x,y,pix);
- if (pix[0] != 0) {
- /* end */
- break;
- }
- }
- x2 = x-1;
- path->moveTo(x1,y);
- path->lineTo(x2,y);
- path->lineTo(x2,(y+1));
- path->lineTo(x1,(y+1));
- path->close();
- }
- }
- }
- return path;
-}
-
-void OPVPOutputDev::clipToStrokePath(GfxState *state) {
- SplashBitmap *tbitmap;
- Splash *tsplash;
- SplashPath *spath;
- OPVPSplashPath *path, *path2;
-
- // use splash for makeStrokePath
- // create dummy bitmap for creating splash
- tbitmap = new SplashBitmap(1, 1, 1, splashModeMono1, gFalse);
- tsplash = new Splash(tbitmap, gFalse);
- // set line parameters
- // except colors
- updateSplashLineDash(state, tsplash);
- tsplash->setLineJoin(state->getLineJoin());
- tsplash->setLineCap(state->getLineCap());
- tsplash->setMiterLimit(state->getMiterLimit());
- tsplash->setLineWidth(state->getTransformedLineWidth());
-
- path = convertPath(state, state->getPath());
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- spath = tsplash->makeStrokePath(path,0);
-#else
- spath = tsplash->makeStrokePath(path);
-#endif
- path2 = new OPVPSplashPath(spath);
- delete spath;
- delete path;
- delete tsplash;
- delete tbitmap;
- oprs->clipToPath(path2, gFalse);
- delete path2;
-}
-
-OPVPSplashPath *OPVPOutputDev::convertPath(GfxState *state, GfxPath *path) {
- OPVPSplashPath *sPath;
- GfxSubpath *subpath;
- double x1, y1, x2, y2, x3, y3;
- int i, j;
-
- sPath = new OPVPSplashPath();
- for (i = 0; i < path->getNumSubpaths(); ++i) {
- subpath = path->getSubpath(i);
- if (subpath->getNumPoints() > 0) {
- state->transform(subpath->getX(0), subpath->getY(0), &x1, &y1);
- sPath->moveTo((SplashCoord)x1, (SplashCoord)y1);
- j = 1;
- while (j < subpath->getNumPoints()) {
- if (subpath->getCurve(j)) {
- state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1);
- state->transform(subpath->getX(j+1), subpath->getY(j+1), &x2, &y2);
- state->transform(subpath->getX(j+2), subpath->getY(j+2), &x3, &y3);
- sPath->curveTo((SplashCoord)x1, (SplashCoord)y1,
- (SplashCoord)x2, (SplashCoord)y2,
- (SplashCoord)x3, (SplashCoord)y3);
- j += 3;
- } else {
- state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1);
- sPath->lineTo((SplashCoord)x1, (SplashCoord)y1);
- ++j;
- }
- }
- if (subpath->isClosed()) {
- sPath->close();
- }
- }
- }
- return sPath;
-}
-
-void OPVPOutputDev::drawChar(GfxState *state, double x, double y,
- double dx, double dy,
- double originX, double originY,
- CharCode code, int nBytes,
- Unicode *u, int uLen) {
- double x1, y1;
- SplashPath *spath;
- OPVPSplashPath *path;
- int render;
-
- // check for invisible text -- this is used by Acrobat Capture
- render = state->getRender();
- if (render == 3) {
- return;
- }
-
- if (needFontUpdate) {
- doUpdateFont(state);
- }
- if (!font) {
- return;
- }
-
- x -= originX;
- y -= originY;
- state->transform(x,y,&x1,&y1);
-
- // fill
- if (!(render & 1)) {
- oprs->fillChar((SplashCoord)x1, (SplashCoord)y1, code, font, u, fontMat);
- }
-
- // stroke
- if ((render & 3) == 1 || (render & 3) == 2) {
- if ((spath = font->getGlyphPath(code))) {
- path = new OPVPSplashPath(spath);
- delete spath;
- path->closeAllSubPath();
- path->offset((SplashCoord)x1, (SplashCoord)y1);
- oprs->stroke(path);
- delete path;
- } else {
- opvpError(-1,"No glyph outline infomation");
- }
- }
-
- // clip
- if (render & 4) {
- if ((spath = font->getGlyphPath(code)) != NULL) {
- path = new OPVPSplashPath(spath);
- delete spath;
- path->offset((SplashCoord)x1, (SplashCoord)y1);
- if (textClipPath) {
- textClipPath->append(path);
- delete path;
- } else {
- textClipPath = path;
- }
- } else {
- opvpError(-1,"No glyph outline infomation");
- }
- }
-}
-
-GBool OPVPOutputDev::beginType3Char(GfxState *state, double x, double y,
- double dx, double dy,
- CharCode code, Unicode *u, int uLen) {
- /* In a vector mode, cache is not needed */
- return gFalse;
-}
-
-void OPVPOutputDev::endType3Char(GfxState *state) {
- /* In a vector mode, cache is not needed */
- /* do nothing */
-}
-
-void OPVPOutputDev::type3D0(GfxState *state, double wx, double wy) {
- /* In a vector mode, cache is not needed */
- /* do nothing */
-}
-
-void OPVPOutputDev::type3D1(GfxState *state, double wx, double wy,
- double llx, double lly, double urx, double ury) {
-}
-
-void OPVPOutputDev::drawType3Glyph(T3FontCache *t3Font,
- T3FontCacheTag *tag, Guchar *data,
- double x, double y) {
- SplashGlyphBitmap glyph;
-
- glyph.x = -t3Font->glyphX;
- glyph.y = -t3Font->glyphY;
- glyph.w = t3Font->glyphW;
- glyph.h = t3Font->glyphH;
- glyph.aa = colorMode != splashModeMono1;
- glyph.data = data;
- glyph.freeData = gFalse;
- oprs->fillGlyph((SplashCoord)x, (SplashCoord)y, &glyph);
-}
-
-void OPVPOutputDev::endTextObject(GfxState *state) {
- if (textClipPath) {
- oprs->clipToPath(textClipPath, gFalse);
- delete textClipPath;
- textClipPath = NULL;
- }
-}
-
-struct SplashOutImageMaskData {
- ImageStream *imgStr;
- GBool invert;
- int width, height, y;
-};
-
-GBool OPVPOutputDev::imageMaskSrc(void *data, SplashColorPtr line) {
- SplashOutImageMaskData *imgMaskData = (SplashOutImageMaskData *)data;
- Guchar *p;
- SplashColorPtr q;
- int x;
-
- if (imgMaskData->y == imgMaskData->height) {
- return gFalse;
- }
- for (x = 0, p = imgMaskData->imgStr->getLine(), q = line;
- x < imgMaskData->width;
- ++x) {
- *q++ = *p++ ^ imgMaskData->invert;
- }
- ++imgMaskData->y;
- return gTrue;
-}
-
-void OPVPOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
- int width, int height, GBool invert,
- GBool interpolate,
- GBool inlineImg) {
- double *ctm;
- SplashCoord mat[6];
- SplashOutImageMaskData imgMaskData;
-
- ctm = state->getCTM();
- mat[0] = ctm[0];
- mat[1] = ctm[1];
- mat[2] = -ctm[2];
- mat[3] = -ctm[3];
- mat[4] = ctm[2] + ctm[4];
- mat[5] = ctm[3] + ctm[5];
-
- imgMaskData.imgStr = new ImageStream(str, width, 1, 1);
- imgMaskData.imgStr->reset();
- imgMaskData.invert = invert ? 0 : 1;
- imgMaskData.width = width;
- imgMaskData.height = height;
- imgMaskData.y = 0;
-
- oprs->fillImageMask(&imageMaskSrc, &imgMaskData, width, height, mat,
- t3GlyphStack != NULL);
- if (inlineImg) {
- while (imgMaskData.y < height) {
- imgMaskData.imgStr->getLine();
- ++imgMaskData.y;
- }
- }
-
- delete imgMaskData.imgStr;
-}
-
-struct SplashOutImageData {
- ImageStream *imgStr;
- GfxImageColorMap *colorMap;
- SplashColorPtr lookup;
- int *maskColors;
- SplashColorMode colorMode;
- int width, height, y;
-};
-
-GBool OPVPOutputDev::imageSrc(void *data, SplashColorPtr line,
- Guchar *alphaLine)
-{
- SplashOutImageData *imgData = (SplashOutImageData *)data;
- Guchar *p;
- SplashColorPtr q, col;
- GfxRGB rgb;
- GfxGray gray;
-#if SPLASH_CMYK
- GfxCMYK cmyk;
-#endif
- int nComps, x;
-
- if (imgData->y == imgData->height) {
- return gFalse;
- }
-
- nComps = imgData->colorMap->getNumPixelComps();
-
- if (imgData->lookup) {
- switch (imgData->colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- for (x = 0, p = imgData->imgStr->getLine(), q = line;
- x < imgData->width;
- ++x, ++p) {
- *q++ = imgData->lookup[*p];
- }
- break;
- case splashModeRGB8:
- case splashModeBGR8:
- for (x = 0, p = imgData->imgStr->getLine(), q = line;
- x < imgData->width;
- ++x, ++p) {
- col = &imgData->lookup[3 * *p];
- *q++ = col[0];
- *q++ = col[1];
- *q++ = col[2];
- }
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- for (x = 0, p = imgData->imgStr->getLine(), q = line;
- x < imgData->width;
- ++x, ++p) {
- col = &imgData->lookup[4 * *p];
- *q++ = col[0];
- *q++ = col[1];
- *q++ = col[2];
- *q++ = col[3];
- }
- break;
-#endif
- default:
- //~ unimplemented
- break;
- }
- } else {
- switch (imgData->colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- for (x = 0, p = imgData->imgStr->getLine(), q = line;
- x < imgData->width;
- ++x, p += nComps) {
- imgData->colorMap->getGray(p, &gray);
- *q++ = colToByte(gray);
- }
- break;
- case splashModeRGB8:
- for (x = 0, p = imgData->imgStr->getLine(), q = line;
- x < imgData->width;
- ++x, p += nComps) {
- imgData->colorMap->getRGB(p, &rgb);
- *q++ = colToByte(rgb.r);
- *q++ = colToByte(rgb.g);
- *q++ = colToByte(rgb.b);
- }
- break;
- case splashModeBGR8:
- for (x = 0, p = imgData->imgStr->getLine(), q = line;
- x < imgData->width;
- ++x, p += nComps) {
- imgData->colorMap->getRGB(p, &rgb);
- *q++ = colToByte(rgb.b);
- *q++ = colToByte(rgb.g);
- *q++ = colToByte(rgb.r);
- }
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- for (x = 0, p = imgData->imgStr->getLine(), q = line;
- x < imgData->width;
- ++x, p += nComps) {
- imgData->colorMap->getCMYK(p, &cmyk);
- *q++ = colToByte(cmyk.c);
- *q++ = colToByte(cmyk.m);
- *q++ = colToByte(cmyk.y);
- *q++ = colToByte(cmyk.k);
- }
- break;
-#endif
- default:
- //~ unimplemented
- break;
- }
- }
-
- ++imgData->y;
- return gTrue;
-}
-
-GBool OPVPOutputDev::alphaImageSrc(void *data, SplashColorPtr line,
- Guchar *alphaLine) {
- SplashOutImageData *imgData = (SplashOutImageData *)data;
- Guchar *p;
- SplashColorPtr q, col;
- GfxRGB rgb;
- GfxGray gray;
-#if SPLASH_CMYK
- GfxCMYK cmyk;
-#endif
- Guchar alpha;
- int nComps, x, i;
-
- if (imgData->y == imgData->height) {
- return gFalse;
- }
-
- nComps = imgData->colorMap->getNumPixelComps();
-
- for (x = 0, p = imgData->imgStr->getLine(), q = line;
- x < imgData->width;
- ++x, p += nComps) {
- alpha = 0;
- for (i = 0; i < nComps; ++i) {
- if (p[i] < imgData->maskColors[2*i] ||
- p[i] > imgData->maskColors[2*i+1]) {
- alpha = 0xff;
- break;
- }
- }
- if (imgData->lookup) {
- switch (imgData->colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- *q++ = alpha;
- *q++ = imgData->lookup[*p];
- break;
- case splashModeRGB8:
- *q++ = alpha;
- col = &imgData->lookup[3 * *p];
- *q++ = col[0];
- *q++ = col[1];
- *q++ = col[2];
- break;
- case splashModeBGR8:
- col = &imgData->lookup[3 * *p];
- *q++ = col[0];
- *q++ = col[1];
- *q++ = col[2];
- *q++ = alpha;
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- *q++ = alpha;
- col = &imgData->lookup[4 * *p];
- *q++ = col[0];
- *q++ = col[1];
- *q++ = col[2];
- *q++ = col[3];
- break;
-#endif
- default:
- //~ unimplemented
- break;
- }
- } else {
- switch (imgData->colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- imgData->colorMap->getGray(p, &gray);
- *q++ = alpha;
- *q++ = colToByte(gray);
- break;
- case splashModeRGB8:
- imgData->colorMap->getRGB(p, &rgb);
- *q++ = alpha;
- *q++ = colToByte(rgb.r);
- *q++ = colToByte(rgb.g);
- *q++ = colToByte(rgb.b);
- break;
- case splashModeBGR8:
- imgData->colorMap->getRGB(p, &rgb);
- *q++ = colToByte(rgb.b);
- *q++ = colToByte(rgb.g);
- *q++ = colToByte(rgb.r);
- *q++ = alpha;
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- imgData->colorMap->getCMYK(p, &cmyk);
- *q++ = alpha;
- *q++ = colToByte(cmyk.c);
- *q++ = colToByte(cmyk.m);
- *q++ = colToByte(cmyk.y);
- *q++ = colToByte(cmyk.k);
- break;
-#endif
- default:
- //~ unimplemented
- break;
- }
- }
- }
-
- ++imgData->y;
- return gTrue;
-}
-
-void OPVPOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
- int width, int height,
- GfxImageColorMap *colorMap,
- GBool interpolate,
- int *maskColors, GBool inlineImg) {
- double *ctm;
- SplashCoord mat[6];
- SplashOutImageData imgData;
- SplashColorMode srcMode;
- SplashImageSource src;
- GfxGray gray;
- GfxRGB rgb;
-#if SPLASH_CMYK
- GfxCMYK cmyk;
-#endif
- Guchar pix;
- int n, i;
-
- ctm = state->getCTM();
- mat[0] = ctm[0];
- mat[1] = ctm[1];
- mat[2] = -ctm[2];
- mat[3] = -ctm[3];
- mat[4] = ctm[2] + ctm[4];
- mat[5] = ctm[3] + ctm[5];
-
- imgData.imgStr = new ImageStream(str, width,
- colorMap->getNumPixelComps(),
- colorMap->getBits());
- imgData.imgStr->reset();
- imgData.colorMap = colorMap;
- imgData.maskColors = maskColors;
- imgData.colorMode = colorMode;
- imgData.width = width;
- imgData.height = height;
- imgData.y = 0;
-
- // special case for one-channel (monochrome/gray/separation) images:
- // build a lookup table here
- imgData.lookup = NULL;
- if (colorMap->getNumPixelComps() == 1) {
- n = 1 << colorMap->getBits();
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- imgData.lookup = (SplashColorPtr)gmalloc(n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getGray(&pix, &gray);
- imgData.lookup[i] = colToByte(gray);
- }
- break;
- case splashModeRGB8:
- imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getRGB(&pix, &rgb);
- imgData.lookup[3*i] = colToByte(rgb.r);
- imgData.lookup[3*i+1] = colToByte(rgb.g);
- imgData.lookup[3*i+2] = colToByte(rgb.b);
- }
- break;
- case splashModeBGR8:
- imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getRGB(&pix, &rgb);
- imgData.lookup[3*i] = colToByte(rgb.b);
- imgData.lookup[3*i+1] = colToByte(rgb.g);
- imgData.lookup[3*i+2] = colToByte(rgb.r);
- }
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- imgData.lookup = (SplashColorPtr)gmalloc(4 * n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getCMYK(&pix, &cmyk);
- imgData.lookup[4*i] = colToByte(cmyk.c);
- imgData.lookup[4*i+1] = colToByte(cmyk.m);
- imgData.lookup[4*i+2] = colToByte(cmyk.y);
- imgData.lookup[4*i+3] = colToByte(cmyk.k);
- }
- break;
-#endif
- default:
- //~ unimplemented
- break;
- }
- }
-
- if (colorMode == splashModeMono1) {
- srcMode = splashModeMono8;
- } else {
- srcMode = colorMode;
- }
- src = maskColors ? &alphaImageSrc : &imageSrc;
- oprs->drawImage(src, &imgData, srcMode, maskColors ? gTrue : gFalse,
- width, height, mat);
- if (inlineImg) {
- while (imgData.y < height) {
- imgData.imgStr->getLine();
- ++imgData.y;
- }
- }
-
- gfree(imgData.lookup);
- delete imgData.imgStr;
- str->close();
-}
-
-struct SplashOutMaskedImageData {
- ImageStream *imgStr;
- GfxImageColorMap *colorMap;
- SplashBitmap *mask;
- SplashColorPtr lookup;
- SplashColorMode colorMode;
- int width, height, y;
-};
-
-GBool OPVPOutputDev::maskedImageSrc(void *data, SplashColorPtr line,
- Guchar *alphaLine) {
- SplashOutMaskedImageData *imgData = (SplashOutMaskedImageData *)data;
- Guchar *p;
- SplashColor maskColor;
- SplashColorPtr q, col;
- GfxRGB rgb;
- GfxGray gray;
-#if SPLASH_CMYK
- GfxCMYK cmyk;
-#endif
- Guchar alpha;
- int nComps, x;
-
- if (imgData->y == imgData->height) {
- return gFalse;
- }
-
- nComps = imgData->colorMap->getNumPixelComps();
-
- for (x = 0, p = imgData->imgStr->getLine(), q = line;
- x < imgData->width;
- ++x, p += nComps) {
- imgData->mask->getPixel(x, imgData->y, maskColor);
- alpha = maskColor[0] ? 0xff : 0x00;
- if (imgData->lookup) {
- switch (imgData->colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- *q++ = alpha;
- *q++ = imgData->lookup[*p];
- break;
- case splashModeRGB8:
- *q++ = alpha;
- col = &imgData->lookup[3 * *p];
- *q++ = col[0];
- *q++ = col[1];
- *q++ = col[2];
- break;
- case splashModeBGR8:
- col = &imgData->lookup[3 * *p];
- *q++ = col[0];
- *q++ = col[1];
- *q++ = col[2];
- *q++ = alpha;
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- *q++ = alpha;
- col = &imgData->lookup[4 * *p];
- *q++ = col[0];
- *q++ = col[1];
- *q++ = col[2];
- *q++ = col[3];
- break;
-#endif
- default:
- //~ unimplemented
- break;
- }
- } else {
- switch (imgData->colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- imgData->colorMap->getGray(p, &gray);
- *q++ = alpha;
- *q++ = colToByte(gray);
- break;
- case splashModeRGB8:
- imgData->colorMap->getRGB(p, &rgb);
- *q++ = alpha;
- *q++ = colToByte(rgb.r);
- *q++ = colToByte(rgb.g);
- *q++ = colToByte(rgb.b);
- break;
- case splashModeBGR8:
- imgData->colorMap->getRGB(p, &rgb);
- *q++ = colToByte(rgb.b);
- *q++ = colToByte(rgb.g);
- *q++ = colToByte(rgb.r);
- *q++ = alpha;
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- imgData->colorMap->getCMYK(p, &cmyk);
- *q++ = alpha;
- *q++ = colToByte(cmyk.c);
- *q++ = colToByte(cmyk.m);
- *q++ = colToByte(cmyk.y);
- *q++ = colToByte(cmyk.k);
- break;
-#endif
- default:
- //~ unimplemented
- break;
- }
- }
- }
-
- ++imgData->y;
- return gTrue;
-}
-
-void OPVPOutputDev::drawMaskedImage(GfxState *state, Object *ref,
- Stream *str, int width, int height,
- GfxImageColorMap *colorMap,
- GBool interpolate,
- Stream *maskStr, int maskWidth,
- int maskHeight, GBool maskInvert,
- GBool maskInterpolate) {
- double *ctm;
- SplashCoord mat[6];
- SplashOutMaskedImageData imgData;
- SplashOutImageMaskData imgMaskData;
- SplashColorMode srcMode;
- SplashBitmap *maskBitmap;
- Splash *maskSplash;
- SplashColor maskColor;
- GfxGray gray;
- GfxRGB rgb;
-#if SPLASH_CMYK
- GfxCMYK cmyk;
-#endif
- Guchar pix;
- int n, i;
-
- //----- scale the mask image to the same size as the source image
-
- mat[0] = (SplashCoord)width;
- mat[1] = 0;
- mat[2] = 0;
- mat[3] = (SplashCoord)height;
- mat[4] = 0;
- mat[5] = 0;
- imgMaskData.imgStr = new ImageStream(maskStr, maskWidth, 1, 1);
- imgMaskData.imgStr->reset();
- imgMaskData.invert = maskInvert ? 0 : 1;
- imgMaskData.width = maskWidth;
- imgMaskData.height = maskHeight;
- imgMaskData.y = 0;
- maskBitmap = new SplashBitmap(width, height, 1, splashModeMono1, gFalse);
- maskSplash = new Splash(maskBitmap, gFalse);
- maskColor[0] = 0;
- maskSplash->clear(maskColor);
- maskColor[0] = 1;
- maskSplash->setFillPattern(new SplashSolidColor(maskColor));
- maskSplash->fillImageMask(&imageMaskSrc, &imgMaskData,
- maskWidth, maskHeight, mat, gFalse);
- delete imgMaskData.imgStr;
- maskStr->close();
- delete maskSplash;
-
- //----- draw the source image
-
- ctm = state->getCTM();
- mat[0] = ctm[0];
- mat[1] = ctm[1];
- mat[2] = -ctm[2];
- mat[3] = -ctm[3];
- mat[4] = ctm[2] + ctm[4];
- mat[5] = ctm[3] + ctm[5];
-
- imgData.imgStr = new ImageStream(str, width,
- colorMap->getNumPixelComps(),
- colorMap->getBits());
- imgData.imgStr->reset();
- imgData.colorMap = colorMap;
- imgData.mask = maskBitmap;
- imgData.colorMode = colorMode;
- imgData.width = width;
- imgData.height = height;
- imgData.y = 0;
-
- // special case for one-channel (monochrome/gray/separation) images:
- // build a lookup table here
- imgData.lookup = NULL;
- if (colorMap->getNumPixelComps() == 1) {
- n = 1 << colorMap->getBits();
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- imgData.lookup = (SplashColorPtr)gmalloc(n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getGray(&pix, &gray);
- imgData.lookup[i] = colToByte(gray);
- }
- break;
- case splashModeRGB8:
- imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getRGB(&pix, &rgb);
- imgData.lookup[3*i] = colToByte(rgb.r);
- imgData.lookup[3*i+1] = colToByte(rgb.g);
- imgData.lookup[3*i+2] = colToByte(rgb.b);
- }
- break;
- case splashModeBGR8:
- imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getRGB(&pix, &rgb);
- imgData.lookup[3*i] = colToByte(rgb.b);
- imgData.lookup[3*i+1] = colToByte(rgb.g);
- imgData.lookup[3*i+2] = colToByte(rgb.r);
- }
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- imgData.lookup = (SplashColorPtr)gmalloc(4 * n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getCMYK(&pix, &cmyk);
- imgData.lookup[4*i] = colToByte(cmyk.c);
- imgData.lookup[4*i+1] = colToByte(cmyk.m);
- imgData.lookup[4*i+2] = colToByte(cmyk.y);
- imgData.lookup[4*i+3] = colToByte(cmyk.k);
- }
- break;
-#endif
- default:
- //~ unimplemented
- break;
- }
- }
-
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- srcMode = splashModeMono8;
- break;
- case splashModeRGB8:
- srcMode = splashModeRGB8;
- break;
- case splashModeBGR8:
- srcMode = splashModeBGR8;
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- srcMode = splashModeCMYK8;
- break;
-#endif
- default:
- //~ unimplemented
- srcMode = splashModeRGB8;
- break;
- }
- oprs->drawImage(&maskedImageSrc, &imgData, srcMode, gTrue,
- width, height, mat);
-
- delete maskBitmap;
- gfree(imgData.lookup);
- delete imgData.imgStr;
- str->close();
-}
-
-void OPVPOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
- Stream *str, int width, int height,
- GfxImageColorMap *colorMap,
- GBool interpolate,
- Stream *maskStr,
- int maskWidth, int maskHeight,
- GfxImageColorMap *maskColorMap,
- GBool maskInterpolate) {
- double *ctm;
- SplashCoord mat[6];
- SplashOutImageData imgData;
- SplashOutImageData imgMaskData;
- SplashColorMode srcMode;
- SplashBitmap *maskBitmap;
- Splash *maskSplash;
- SplashColor maskColor;
- GfxGray gray;
- GfxRGB rgb;
-#if SPLASH_CMYK
- GfxCMYK cmyk;
-#endif
- Guchar pix;
- int n, i;
-
- ctm = state->getCTM();
- mat[0] = ctm[0];
- mat[1] = ctm[1];
- mat[2] = -ctm[2];
- mat[3] = -ctm[3];
- mat[4] = ctm[2] + ctm[4];
- mat[5] = ctm[3] + ctm[5];
-
- //----- set up the soft mask
-
- imgMaskData.imgStr = new ImageStream(maskStr, maskWidth,
- maskColorMap->getNumPixelComps(),
- maskColorMap->getBits());
- imgMaskData.imgStr->reset();
- imgMaskData.colorMap = maskColorMap;
- imgMaskData.maskColors = NULL;
- imgMaskData.colorMode = splashModeMono8;
- imgMaskData.width = maskWidth;
- imgMaskData.height = maskHeight;
- imgMaskData.y = 0;
- n = 1 << maskColorMap->getBits();
- imgMaskData.lookup = (SplashColorPtr)gmalloc(n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- maskColorMap->getGray(&pix, &gray);
- imgMaskData.lookup[i] = colToByte(gray);
- }
- maskBitmap = new SplashBitmap(maskWidth,maskHeight,
- 1, splashModeMono8, gFalse);
- maskSplash = new Splash(maskBitmap, gFalse);
- maskColor[0] = 0;
- maskSplash->clear(maskColor);
- maskSplash->drawImage(&imageSrc, &imgMaskData,
- splashModeMono8, gFalse, maskWidth, maskHeight, mat);
- delete imgMaskData.imgStr;
- maskStr->close();
- gfree(imgMaskData.lookup);
- delete maskSplash;
- oprs->setSoftMask(maskBitmap);
-
- //----- draw the source image
-
- imgData.imgStr = new ImageStream(str, width,
- colorMap->getNumPixelComps(),
- colorMap->getBits());
- imgData.imgStr->reset();
- imgData.colorMap = colorMap;
- imgData.maskColors = NULL;
- imgData.colorMode = colorMode;
- imgData.width = width;
- imgData.height = height;
- imgData.y = 0;
-
- // special case for one-channel (monochrome/gray/separation) images:
- // build a lookup table here
- imgData.lookup = NULL;
- if (colorMap->getNumPixelComps() == 1) {
- n = 1 << colorMap->getBits();
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- imgData.lookup = (SplashColorPtr)gmalloc(n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getGray(&pix, &gray);
- imgData.lookup[i] = colToByte(gray);
- }
- break;
- case splashModeRGB8:
- imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getRGB(&pix, &rgb);
- imgData.lookup[3*i] = colToByte(rgb.r);
- imgData.lookup[3*i+1] = colToByte(rgb.g);
- imgData.lookup[3*i+2] = colToByte(rgb.b);
- }
- break;
- case splashModeBGR8:
- imgData.lookup = (SplashColorPtr)gmalloc(3 * n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getRGB(&pix, &rgb);
- imgData.lookup[3*i] = colToByte(rgb.b);
- imgData.lookup[3*i+1] = colToByte(rgb.g);
- imgData.lookup[3*i+2] = colToByte(rgb.r);
- }
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- imgData.lookup = (SplashColorPtr)gmalloc(4 * n);
- for (i = 0; i < n; ++i) {
- pix = (Guchar)i;
- colorMap->getCMYK(&pix, &cmyk);
- imgData.lookup[4*i] = colToByte(cmyk.c);
- imgData.lookup[4*i+1] = colToByte(cmyk.m);
- imgData.lookup[4*i+2] = colToByte(cmyk.y);
- imgData.lookup[4*i+3] = colToByte(cmyk.k);
- }
- break;
-#endif
- default:
- //~ unimplemented
- break;
- }
- }
-
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- srcMode = splashModeMono8;
- break;
- case splashModeRGB8:
- srcMode = splashModeRGB8;
- break;
- case splashModeBGR8:
- srcMode = splashModeBGR8;
- break;
-#if SPLASH_CMYK
- case splashModeCMYK8:
- srcMode = splashModeCMYK8;
- break;
-#endif
- default:
- //~ unimplemented
- srcMode = splashModeRGB8;
- break;
- }
- oprs->drawImage(&imageSrc, &imgData, srcMode, gFalse, width, height, mat);
-
- oprs->setSoftMask(NULL);
- gfree(imgData.lookup);
- delete imgData.imgStr;
- str->close();
-}
-
-int OPVPOutputDev::getBitmapWidth() {
- return bitmap->getWidth();
-}
-
-int OPVPOutputDev::getBitmapHeight() {
- return bitmap->getHeight();
-}
-
-void OPVPOutputDev::xorRectangle(int x0, int y0, int x1, int y1,
- SplashPattern *pattern) {
- /* no need in printing */
-}
-
-void OPVPOutputDev::setFillColor(int r, int g, int b) {
- GfxRGB rgb;
- GfxGray gray;
-#if SPLASH_CMYK
- GfxCMYK cmyk;
-#endif
-
- rgb.r = byteToCol(r);
- rgb.g = byteToCol(g);
- rgb.b = byteToCol(b);
- gray = (GfxColorComp)(0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.g + 0.5);
- if (gray > gfxColorComp1) {
- gray = gfxColorComp1;
- }
-#if SPLASH_CMYK
- cmyk.c = gfxColorComp1 - rgb.r;
- cmyk.m = gfxColorComp1 - rgb.g;
- cmyk.y = gfxColorComp1 - rgb.b;
- cmyk.k = 0;
- oprs->setFillPattern(getColor(gray, &rgb, &cmyk));
-#else
- oprs->setFillPattern(getColor(gray, &rgb));
-#endif
-}
-
-int OPVPOutputDev::OPVPStartJob(char *jobInfo)
-{
- return oprs->OPVPStartJob(jobInfo);
-}
-
-int OPVPOutputDev::OPVPEndJob()
-{
- return oprs->OPVPEndJob();
-}
-
-int OPVPOutputDev::OPVPStartDoc(char *docInfo)
-{
- return oprs->OPVPStartDoc(docInfo);
-}
-
-int OPVPOutputDev::OPVPEndDoc()
-{
- return oprs->OPVPEndDoc();
-}
-
-int OPVPOutputDev::OPVPStartPage(char *pageInfo,
- int rasterWidth, int rasterHeight)
-{
- paperWidth = rasterWidth;
- paperHeight = rasterHeight;
- return oprs->OPVPStartPage(pageInfo,rasterWidth);
-}
-
-int OPVPOutputDev::OPVPEndPage()
-{
- return oprs->OPVPEndPage();
-}
-
-int OPVPOutputDev::outSlice()
-{
- return oprs->outSlice();
-}
-
-void OPVPOutputDev::psXObject(Stream *psStream, Stream *level1Stream)
-{
- opvpError(-1,"psXObject is found, but it is not supported");
-}
diff --git a/filter/pdftoopvp/OPVPOutputDev.h b/filter/pdftoopvp/OPVPOutputDev.h
deleted file mode 100644
index c2af86e..0000000
--- a/filter/pdftoopvp/OPVPOutputDev.h
+++ /dev/null
@@ -1,250 +0,0 @@
-//========================================================================
-//
-// OPVPOutputDev.h
-//
-// Copyright 2005 AXE,Inc.
-//
-//========================================================================
-
-#ifndef OPVPOUTPUTDEV_H
-#define OPVPOUTPUTDEV_H
-
-#include <config.h>
-
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
-#include "goo/gtypes.h"
-#include "splash/SplashTypes.h"
-#include "config.h"
-#include "OutputDev.h"
-#include "GfxState.h"
-#include "GfxFont.h"
-
-class GfxState;
-class GfxPath;
-class Gfx8BitFont;
-class SplashBitmap;
-class OPRS;
-class OPVPSplashPath;
-class SplashPattern;
-class SplashFontEngine;
-class SplashFont;
-class T3FontCache;
-struct T3FontCacheTag;
-struct T3GlyphStack;
-struct GfxRGB;
-
-//------------------------------------------------------------------------
-
-// number of Type 3 fonts to cache
-#define splashOutT3FontCacheSize 8
-
-//------------------------------------------------------------------------
-// OPVPOutputDev
-//------------------------------------------------------------------------
-
-class OPVPOutputDev: public OutputDev {
-public:
-
- // Constructor.
- OPVPOutputDev();
-
- // Second Constructor
- int init(SplashColorMode colorModeA, GBool colorProfile, GBool reverseVideoA,
- SplashColor paperColorA,
- const char *driverName, int outputFD,
- const char *printerModel,
- int nOptions,
- const char *optionKeys[], const char *optionVals[]);
-
- // Destructor.
- virtual ~OPVPOutputDev();
-
- //----- get info about output device
-
- // Does this device use upside-down coordinates?
- // (Upside-down means (0,0) is the top left corner of the page.)
- virtual GBool upsideDown() { return gTrue; }
-
- // Does this device use drawChar() or drawString()?
- virtual GBool useDrawChar() { return gTrue; }
-
- // Does this device use beginType3Char/endType3Char? Otherwise,
- // text in Type 3 fonts will be drawn with drawChar/drawString.
- virtual GBool interpretType3Chars() { return gTrue; }
-
- //----- initialization and control
-
- // Start a page.
- virtual void startPage(int pageNum, GfxState *state);
-
- // End a page.
- virtual void endPage();
-
- //----- save/restore graphics state
- virtual void saveState(GfxState *state);
- virtual void restoreState(GfxState *state);
-
- //----- update graphics state
- virtual void updateAll(GfxState *state);
- virtual void updateCTM(GfxState *state, double m11, double m12,
- double m21, double m22, double m31, double m32);
- virtual void updateLineDash(GfxState *state);
- virtual void updateFlatness(GfxState *state);
- virtual void updateLineJoin(GfxState *state);
- virtual void updateLineCap(GfxState *state);
- virtual void updateMiterLimit(GfxState *state);
- virtual void updateLineWidth(GfxState *state);
- virtual void updateFillColor(GfxState *state);
- virtual void updateStrokeColor(GfxState *state);
-
- //----- update text state
- virtual void updateFont(GfxState *state);
-
- //----- path painting
- virtual void stroke(GfxState *state);
- virtual void fill(GfxState *state);
- virtual void eoFill(GfxState *state);
-
- //----- path clipping
- virtual void clip(GfxState *state);
- virtual void eoClip(GfxState *state);
- virtual void clipToStrokePath(GfxState *state);
-
- //----- text drawing
- virtual void drawChar(GfxState *state, double x, double y,
- double dx, double dy,
- double originX, double originY,
- CharCode code, int nBytes, Unicode *u, int uLen);
- virtual GBool beginType3Char(GfxState *state, double x, double y,
- double dx, double dy,
- CharCode code, Unicode *u, int uLen);
- virtual void endType3Char(GfxState *state);
- virtual void endTextObject(GfxState *state);
-
- //----- image drawing
- virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
- int width, int height, GBool invert,
- GBool interpolate,
- GBool inlineImg);
- virtual void drawImage(GfxState *state, Object *ref, Stream *str,
- int width, int height, GfxImageColorMap *colorMap,
- GBool interpolate,
- int *maskColors, GBool inlineImg);
- virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
- int width, int height,
- GfxImageColorMap *colorMap,
- GBool interpolate,
- Stream *maskStr, int maskWidth, int maskHeight,
- GBool maskInvert, GBool maskeInterpolate);
- virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
- int width, int height,
- GfxImageColorMap *colorMap,
- GBool interpolate,
- Stream *maskStr,
- int maskWidth, int maskHeight,
- GfxImageColorMap *maskColorMap,
- GBool maskInterpolate);
-
- //----- Type 3 font operators
- virtual void type3D0(GfxState *state, double wx, double wy);
- virtual void type3D1(GfxState *state, double wx, double wy,
- double llx, double lly, double urx, double ury);
-
- //----- special access
-
- // Called to indicate that a new PDF document has been loaded.
- void startDoc(XRef *xrefA);
-
- GBool isReverseVideo() { return reverseVideo; }
-
- // Get the bitmap and its size.
- SplashBitmap *getBitmap() { return bitmap; }
- int getBitmapWidth();
- int getBitmapHeight();
-
- // Get the Splash object.
- OPRS *getOPRS() { return oprs; }
-
- // XOR a rectangular region in the bitmap with <pattern>. <pattern>
- // is passed to Splash::setFillPattern, so it should not be used
- // after calling this function.
- void xorRectangle(int x0, int y0, int x1, int y1, SplashPattern *pattern);
-
- // Set the Splash fill color.
- void setFillColor(int r, int g, int b);
-
- void setUnderlayCbk(void (*cbk)(void *data), void *data)
- { underlayCbk = cbk; underlayCbkData = data; }
-
- int OPVPStartJob(char *jobInfo);
- int OPVPEndJob();
- int OPVPStartDoc(char *docInfo);
- int OPVPEndDoc();
- int OPVPStartPage(char *pageInfo, int rasterWidth, int rasterHeight);
- int OPVPEndPage();
- int outSlice();
- virtual void psXObject(Stream *psStream, Stream *level1Stream);
- void setScale(double w, double h, double leftMarginA, double bottomMarginA,
- int rotateA, int yoffsetA, int sliceHeightA);
-
-private:
-
- SplashPattern *getColor(GfxGray gray, GfxRGB *rgb);
- OPVPSplashPath *convertPath(GfxState *state, GfxPath *path);
- void drawType3Glyph(T3FontCache *t3Font,
- T3FontCacheTag *tag, Guchar *data,
- double x, double y);
- void patternFillChar(GfxState *state,
- double x, double y, CharCode code);
-
- static GBool imageMaskSrc(void *data, SplashColorPtr line);
- static GBool imageSrc(void *data, SplashColorPtr line,
- Guchar *alphaLine);
- static GBool alphaImageSrc(void *data, SplashColorPtr line,
- Guchar *alphaLine);
- static GBool maskedImageSrc(void *data, SplashColorPtr line,
- Guchar *alphaLine);
-
- OPVPSplashPath *bitmapToPath(SplashBitmap *bitmapA, int width, int height);
- void closeAllSubPath(OPVPSplashPath *path);
- void patternFillImageMask(GfxState *state,
- SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat);
- void doUpdateFont(GfxState *state);
- void transLineDash(GfxState *state, SplashCoord **adash,
- int *adashLength, SplashCoord *aphase);
- void updateSplashLineDash(GfxState *state, Splash *splash);
-
- SplashColorMode colorMode;
- GBool reverseVideo; // reverse video mode
- SplashColor paperColor; // paper color
-
- XRef *xref; // xref table for current document
-
- SplashBitmap *bitmap;
- OPRS *oprs;
- SplashFontEngine *fontEngine;
-
- T3FontCache * // Type 3 font cache
- t3FontCache[splashOutT3FontCacheSize];
- int nT3Fonts; // number of valid entries in t3FontCache
- T3GlyphStack *t3GlyphStack; // Type 3 glyph context stack
-
- SplashFont *font; // current font
- GBool needFontUpdate; // set when the font needs to be updated
- OPVPSplashPath *textClipPath; // clipping path built with text object
-
- void (*underlayCbk)(void *data);
- void *underlayCbkData;
- double fontMat[4];
- double scaleWidth, scaleHeight;
- int paperWidth, paperHeight;
- double leftMargin, bottomMargin;
- int rotate;
- int yoffset;
- int sliceHeight;
-};
-
-#endif
diff --git a/filter/pdftoopvp/oprs/OPRS.cxx b/filter/pdftoopvp/oprs/OPRS.cxx
deleted file mode 100644
index 56c9a33..0000000
--- a/filter/pdftoopvp/oprs/OPRS.cxx
+++ /dev/null
@@ -1,594 +0,0 @@
-//========================================================================
-//
-// OPRS.cc
-//
-//========================================================================
-
-#include <config.h>
-
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <stdarg.h>
-#if defined __OpenBSD__
-#include <sys/endian.h>
-#if BYTE_ORDER == BIG_ENDIAN
-#define __BYTE_ORDER __BIG_ENDIAN
-#else
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
-#endif
-
-#include "goo/gmem.h"
-#include "splash/SplashErrorCodes.h"
-#include "splash/SplashMath.h"
-#include "splash/SplashBitmap.h"
-#include "splash/SplashState.h"
-#include "splash/SplashXPathScanner.h"
-#include "splash/SplashPattern.h"
-#include "splash/SplashScreen.h"
-#include "splash/SplashFont.h"
-#include "splash/SplashGlyphBitmap.h"
-#include "splash/Splash.h"
-#include "OPVPSplash.h"
-#include "OPVPSplashClip.h"
-#include "OPVPSplashPath.h"
-#include "OPVPSplashXPath.h"
-#include "OPRS.h"
-
-//------------------------------------------------------------------------
-// Splash
-//------------------------------------------------------------------------
-
-#define SPLASH(x) (rasterMode ? (splash->x) : (opvpSplash->x))
-
-OPRS::OPRS()
-{
- opvp = 0;
- splash = 0;
- opvpSplash = 0;
- rasterMode = gFalse;
-}
-
-int OPRS::setBitmap(SplashBitmap *bitmapA) {
- if (splash != 0) {
- delete splash;
- }
- splash = new Splash(bitmapA, gFalse);
- rasterMode = gTrue;
- return 0;
-}
-
-OPRS::~OPRS() {
- if (splash != 0) {
- delete splash;
- splash = 0;
- }
- if (opvpSplash != 0) {
- opvpSplash->restoreAllDriverState();
- delete opvpSplash;
- opvpSplash = 0;
- }
-}
-
-//------------------------------------------------------------------------
-// state read
-//------------------------------------------------------------------------
-
-
-SplashPattern *OPRS::getStrokePattern() {
- return SPLASH(getStrokePattern());
-}
-
-SplashPattern *OPRS::getFillPattern() {
- return SPLASH(getFillPattern());
-}
-
-SplashScreen *OPRS::getScreen() {
- return SPLASH(getScreen());
-}
-
-SplashCoord OPRS::getLineWidth() {
- return SPLASH(getLineWidth());
-}
-
-int OPRS::getLineCap() {
- return SPLASH(getLineCap());
-}
-
-int OPRS::getLineJoin() {
- return SPLASH(getLineJoin());
-}
-
-SplashCoord OPRS::getMiterLimit() {
- return SPLASH(getMiterLimit());
-}
-
-SplashCoord OPRS::getFlatness() {
- return 1;
-}
-
-SplashCoord *OPRS::getLineDash() {
- return SPLASH(getLineDash());
-}
-
-int OPRS::getLineDashLength() {
- return SPLASH(getLineDashLength());
-}
-
-SplashCoord OPRS::getLineDashPhase() {
- return SPLASH(getLineDashPhase());
-}
-
-OPVPSplashClip *OPRS::getClip() {
- if (rasterMode) {
- SplashClip *sclip = splash->getClip();
- OPVPSplashClip *r = new OPVPSplashClip(sclip);
- delete sclip;
- return r;
- } else {
- return opvpSplash->getClip();
- }
-}
-
-//------------------------------------------------------------------------
-// state write
-//------------------------------------------------------------------------
-
-void OPRS::setStrokePattern(SplashPattern *strokePattern) {
- SPLASH(setStrokePattern(strokePattern));
-}
-
-void OPRS::setFillPattern(SplashPattern *fillPattern) {
- SPLASH(setFillPattern(fillPattern));
-}
-
-void OPRS::setScreen(SplashScreen *screen) {
- SPLASH(setScreen(screen));
-}
-
-void OPRS::setLineWidth(SplashCoord lineWidth) {
- SPLASH(setLineWidth(lineWidth));
-}
-
-void OPRS::setMiterLimit(SplashCoord miterLimit) {
- SPLASH(setMiterLimit(miterLimit));
-}
-
-void OPRS::setLineCap(int lineCap) {
- SPLASH(setLineCap(lineCap));
-}
-
-void OPRS::setLineJoin(int lineJoin) {
- SPLASH(setLineJoin(lineJoin));
-}
-
-void OPRS::setFlatness(SplashCoord flatness) {
-/* ignore flatness */
-}
-
-void OPRS::setLineDash(SplashCoord *lineDash, int lineDashLength,
- SplashCoord lineDashPhase) {
- SPLASH(setLineDash(lineDash,lineDashLength,lineDashPhase));
-}
-
-SplashError OPRS::clipToPath(OPVPSplashPath *path, GBool eo) {
- return SPLASH(clipToPath(path,eo));
-}
-
-//------------------------------------------------------------------------
-// state save/restore
-//------------------------------------------------------------------------
-
-void OPRS::saveState() {
- SPLASH(saveState());
-}
-
-SplashError OPRS::restoreState() {
- SPLASH(restoreState());
- return splashOk;
-}
-
-//------------------------------------------------------------------------
-// drawing operations
-//------------------------------------------------------------------------
-
-void OPRS::clear(SplashColor color) {
- SPLASH(clear(color));
-}
-
-SplashError OPRS::stroke(OPVPSplashPath *path) {
- return SPLASH(stroke(path));
-}
-
-SplashError OPRS::fill(OPVPSplashPath *path, GBool eo) {
- return SPLASH(fill(path,eo));
-}
-
-SplashError OPRS::fillChar(SplashCoord x, SplashCoord y,
- int c, SplashFont *font, Unicode *u,
- double *fontMat) {
- if (rasterMode) {
- return splash->fillChar(x,y,c,font);
- } else {
- return opvpSplash->fillChar(x,y,c,font,u,fontMat);
- }
-}
-
-SplashError OPRS::fillGlyph(SplashCoord x, SplashCoord y,
- SplashGlyphBitmap *glyph) {
- SPLASH(fillGlyph(x,y,glyph));
- return splashOk;
-}
-
-SplashError OPRS::fillImageMask(SplashImageMaskSource src, void *srcData,
- int w, int h, SplashCoord *mat, GBool glyphMode) {
- return SPLASH(fillImageMask(src,srcData,w,h,mat,glyphMode));
-}
-
-SplashError OPRS::drawImage(SplashImageSource src, void *srcData,
- SplashColorMode srcMode, GBool srcAlpha,
- int w, int h, SplashCoord *mat) {
- if (rasterMode) {
- return splash->drawImage(src,srcData,srcMode,srcAlpha,w,h,mat);
- } else {
- return opvpSplash->drawImage(src,srcData,srcMode,srcAlpha,w,h,mat);
- }
-}
-
-/*
- * initialize and load vector-driver
- */
-int OPRS::init(const char *driverName, int outputFD,
- const char *printerModel, int nOptions,
- const char *optionKeys[], const char *optionVals[])
-{
- opvp = OPVPWrapper::loadDriver(driverName,outputFD,printerModel);
- if (opvp == 0) return -1;
- rasterMode = gFalse;
- if (!rasterMode) {
- opvpSplash = new OPVPSplash(opvp,nOptions,
- optionKeys, optionVals);
- }
- return 0;
-}
-
-int OPRS::OPVPStartJob(char *jobInfo)
-{
- if (!opvp->supportStartJob) {
- return 0;
- }
- return opvp->StartJob((const opvp_char_t *)jobInfo);
-}
-
-int OPRS::OPVPEndJob()
-{
- if (!opvp->supportEndJob) {
- return 0;
- }
- return opvp->EndJob();
-}
-
-int OPRS::OPVPStartDoc(char *docInfo)
-{
- if (!opvp->supportStartDoc) {
- return 0;
- }
- return opvp->StartDoc((const opvp_char_t *)docInfo);
-}
-
-int OPRS::OPVPEndDoc()
-{
- if (!opvp->supportEndDoc) {
- return 0;
- }
- return opvp->EndDoc();
-}
-
-int OPRS::OPVPStartPage(char *pageInfo, int rasterWidth)
-{
- int r;
-
- if (opvp->supportStartPage) {
- if ((r = opvp->StartPage((const opvp_char_t *)pageInfo)) < 0) {
- return r;
- }
- }
- if (rasterMode) {
- if (!opvp->supportStartRaster) {
- error("No StartRaster error in raster mode\n");
- return -1;
- }
- if (opvp->supportSetCurrentPoint) {
- opvp_fix_t x,y;
-
- OPVP_F2FIX(0.0,x);
- OPVP_F2FIX(0.0,y);
- opvp->SetCurrentPoint(x,y);
- }
- opvp->StartRaster(rasterWidth);
- }
- return 0;
-}
-
-int OPRS::OPVPEndPage()
-{
- int r;
-
- if (rasterMode) {
- if (!opvp->supportEndRaster) {
- error("No EndRaster error in raster mode\n");
- return -1;
- }
- opvp->EndRaster();
- }
- if (opvp->supportEndPage) {
- if ((r = opvp->EndPage()) < 0) {
- return r;
- }
- }
- return splashOk;
-}
-
-unsigned char *OPRS::getScanLineDataMono1(unsigned char *dst,
- unsigned char *bitmap, int rasterWidth)
-{
- int n = (rasterWidth+7)/8;
-
- memcpy(dst,bitmap,n);
- return bitmap+n;
-}
-
-unsigned char *OPRS::getScanLineDataMono8(unsigned char *dst,
- unsigned char *bitmap, int rasterWidth)
-{
- memcpy(dst,bitmap,rasterWidth);
- return bitmap+rasterWidth;
-}
-
-unsigned char *OPRS::getScanLineDataRGB8(unsigned char *dst,
- unsigned char *bitmap, int rasterWidth)
-{
- int i;
-
- for (i = 0;i < rasterWidth;i++) {
-#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
- bitmap++;
- *dst++ = *bitmap++;
- *dst++ = *bitmap++;
- *dst++ = *bitmap++;
-#else
- dst[2] = *bitmap++;
- dst[1] = *bitmap++;
- dst[0] = *bitmap++;
- bitmap++;
- dst += 3;
-#endif
- }
- return bitmap;
-}
-
-unsigned char *OPRS::getScanLineDataBGR8Packed(unsigned char *dst,
- unsigned char *bitmap, int rasterWidth)
-{
- memcpy(dst,bitmap,rasterWidth*3);
- return bitmap+rasterWidth*3;
-}
-
-OPRS::GetScanLineDataFunT OPRS::getGetScanLineDataFun(SplashBitmap *bitmap)
-{
- switch (bitmap->getMode()) {
- case splashModeMono1:
- return getScanLineDataMono1;
- case splashModeMono8:
- return getScanLineDataMono8;
- case splashModeRGB8:
- return getScanLineDataRGB8;
- default:
- OPRS::error("Unknown bitmap mode\n");
- break;
- }
- return getScanLineDataMono8;
-}
-
-int OPRS::getRasterSize(SplashBitmap *bitmap)
-{
- int rw = bitmap->getWidth();
-
- switch (bitmap->getMode()) {
- case splashModeMono1:
- return (rw+7)/8;
- case splashModeMono8:
- return rw;
- case splashModeRGB8:
- return rw*3;
- default:
- OPRS::error("Unknown bitmap mode\n");
- break;
- }
- return 0;
-}
-
-GBool OPRS::checkAll1(unsigned char *bp, int n, int width, int mode)
-{
- int lastbytemask = 0xff;
- int i;
-
- if (mode == splashModeMono1) {
- lastbytemask <<= (width & 0x7);
- lastbytemask &= 0xff;
- }
- for (i = 0;i < n-1;i++) {
- if (*bp++ != 0xff) return gFalse;
- }
- return (*bp & lastbytemask) == lastbytemask;
-}
-
-int OPRS::outSlice()
-{
- if (rasterMode) {
- /* out bitmap */
- int rasterWidth;
- int nScanLines;
- int rasterSize;
- unsigned char *p;
- int i;
- SplashBitmap *bitmap;
- SplashColorPtr cp;
- unsigned char *bp;
- GetScanLineDataFunT fun;
- int mode;
-
- if (!opvp->supportStartRaster || !opvp->supportTransferRasterData
- || !opvp->supportEndRaster) {
- OPRS::error("No raster supporting printer driver\n");
- return -1;
- }
-
- bitmap = splash->getBitmap();
- rasterWidth = bitmap->getWidth();
- nScanLines = bitmap->getHeight();
- rasterSize = getRasterSize(bitmap);
- if ((bp = new unsigned char[rasterSize]) == 0) {
- OPRS::error("Not enough memory\n");
- return -1;
- }
- cp = (bitmap->getDataPtr());
- p = reinterpret_cast<unsigned char *>(cp);
- fun = getGetScanLineDataFun(bitmap);
- mode = bitmap->getMode();
- for (i = 0;i < nScanLines;i++) {
- p = (*fun)(bp,p,rasterWidth);
- if (opvp->supportSkipRaster
- && checkAll1(bp,rasterSize,rasterWidth,mode)) {
- /* all white, skip raster */
- opvp->SkipRaster(1);
- } else {
- opvp->TransferRasterData(rasterSize,bp);
- }
- }
- delete[] bp;
- }
- return 0;
-}
-
-int OPRS::setColorMode(int colorModeA, GBool colorProfile)
-{
- opvp_cspace_t cspace = OPVP_CSPACE_STANDARDRGB;
-
- if (opvp->supportGetColorSpace) opvp->GetColorSpace(&cspace);
- switch (cspace){
- case OPVP_CSPACE_BW:
- if (colorModeA != splashModeMono1) {
- OPRS::error("not mono mode is specified on a monochrome printer\n");
- return -1;
- }
- break;
- case OPVP_CSPACE_DEVICEGRAY:
- if (colorModeA != splashModeMono1 && colorModeA != splashModeMono8) {
- OPRS::error("colorMode is specified on not a color printer\n");
- return -1;
- }
- break;
- case OPVP_CSPACE_DEVICERGB:
- if (colorProfile) break;
- default:
- /* rgb color */
- if (colorProfile) {
- /* try set colorspace to DEVICERGB */
- if (opvp->supportSetColorSpace) opvp->SetColorSpace(
- OPVP_CSPACE_DEVICERGB);
- if (opvp->supportGetColorSpace) opvp->GetColorSpace(&cspace);
- if (cspace == OPVP_CSPACE_DEVICERGB) break;
- /* fail to set, fall through */
- }
- if (opvp->supportSetColorSpace) opvp->SetColorSpace(
- OPVP_CSPACE_STANDARDRGB);
- break;
- }
- if (!rasterMode) {
- opvpSplash->setColorMode(colorModeA);
- }
- return 0;
-}
-
-SplashBitmap *OPRS::getBitmap()
-{
- return SPLASH(getBitmap());
-}
-
-void OPRS::setDebugMode(GBool debugModeA)
-{
- SPLASH(setDebugMode(debugModeA));
-}
-
-void OPRS::initGS(int colorMode, int w, int h, SplashColor paperColor)
-{
- SplashColor color;
-
- if (!rasterMode && opvp->supportInitGS) {
- opvp->InitGS();
- }
- if (opvp->supportSetPaintMode) {
- opvp->SetPaintMode(OPVP_PAINTMODE_TRANSPARENT);
- }
- switch (colorMode) {
- case splashModeMono1: color[0] = 0; break;
- case splashModeMono8: color[0] = 0; break;
- case splashModeRGB8: color[0] = color[1] = color[2] = 0; break;
- }
- if (!rasterMode) {
- opvpSplash->setStateBypass(gTrue);
- }
- SPLASH(setStrokePattern(new SplashSolidColor(color)));
- SPLASH(setFillPattern(new SplashSolidColor(color)));
- SPLASH(setLineCap(splashLineCapButt));
- SPLASH(setLineJoin(splashLineJoinMiter));
- SPLASH(setLineDash(0, 0, 0));
- SPLASH(setLineWidth(0));
- SPLASH(setMiterLimit(10));
- SPLASH(setFlatness(1));
- SPLASH(clipResetToRect(0,0,w-1,h-1));
- SPLASH(clear(paperColor));
- if (!rasterMode) {
- opvpSplash->setStateBypass(gFalse);
- }
-}
-
-void OPRS::error(const char *msg, ...)
-{
- va_list args;
-
- fprintf(stderr,"ERROR:OPRS:");
- va_start(args, msg);
- vfprintf(stderr, msg, args);
- va_end(args);
- fflush(stderr);
-}
-
-void OPRS::endPage()
-{
- /* restore state */
- while (SPLASH(restoreState()) == splashOk);
- if (!rasterMode) {
- opvpSplash->endPage();
- }
-}
-
-void OPRS::setSoftMask(SplashBitmap *softMaskA)
-{
- /* Soft Mask is not supported in vector mode. */
- if (rasterMode) {
- splash->setSoftMask(softMaskA);
- }
-}
-
-SplashCoord *OPRS::getMatrix()
-{
- return SPLASH(getMatrix());
-}
diff --git a/filter/pdftoopvp/oprs/OPRS.h b/filter/pdftoopvp/oprs/OPRS.h
deleted file mode 100644
index d72dd15..0000000
--- a/filter/pdftoopvp/oprs/OPRS.h
+++ /dev/null
@@ -1,188 +0,0 @@
-//========================================================================
-//
-// OPRS.h
-//
-//========================================================================
-
-#ifndef OPRS_H
-#define OPRS_H
-
-#include <config.h>
-
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
-#include "splash/SplashTypes.h"
-#include "opvp_common.h"
-#include "splash/Splash.h"
-#include "OPVPSplash.h"
-#include "OPVPWrapper.h"
-
-#define OPVP_BUFF_SIZE 256
-
-class SplashBitmap;
-class SplashGlyphBitmap;
-class SplashState;
-class SplashPattern;
-class SplashScreen;
-class OPVPSplashPath;
-class SplashXPath;
-class OPVPSplashClip;
-class SplashFont;
-
-//------------------------------------------------------------------------
-// OPRS
-//------------------------------------------------------------------------
-
-class OPRS {
-public:
-
- static void error(const char *msg, ...);
- OPRS();
- ~OPRS();
-
- int setBitmap(SplashBitmap *bitmapA);
-
- //----- state read
-
- SplashPattern *getStrokePattern();
- SplashPattern *getFillPattern();
- SplashScreen *getScreen();
- SplashCoord getLineWidth();
- int getLineCap();
- int getLineJoin();
- SplashCoord getMiterLimit();
- SplashCoord getFlatness();
- SplashCoord *getLineDash();
- int getLineDashLength();
- SplashCoord getLineDashPhase();
- OPVPSplashClip *getClip();
-
- //----- state write
-
- void setStrokePattern(SplashPattern *strokeColor);
- void setFillPattern(SplashPattern *fillColor);
- void setScreen(SplashScreen *screen);
- void setLineWidth(SplashCoord lineWidth);
- void setMiterLimit(SplashCoord miterLimit);
- void setLineCap(int lineCap);
- void setLineJoin(int lineJoin);
- void setFlatness(SplashCoord flatness);
- // the <lineDash> array will be copied
- void setLineDash(SplashCoord *lineDash, int lineDashLength,
- SplashCoord lineDashPhase);
- SplashError clipToPath(OPVPSplashPath *path, GBool eo);
-
- //----- state save/restore
-
- void saveState();
- SplashError restoreState();
-
- void setSoftMask(SplashBitmap *softMaskA);
-
- //----- drawing operations
-
- // Fill the bitmap with <color>. This is not subject to clipping.
- void clear(SplashColor color);
-
- // Stroke a path using the current stroke pattern.
- SplashError stroke(OPVPSplashPath *path);
-
- // Fill a path using the current fill pattern.
- SplashError fill(OPVPSplashPath *path, GBool eo);
-
- // Draw a character, using the current fill pattern.
- SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font,
- Unicode *u, double *fontMat);
-
- // Draw a glyph, using the current fill pattern. This function does
- // not free any data, i.e., it ignores glyph->freeData.
- SplashError fillGlyph(SplashCoord x, SplashCoord y,
- SplashGlyphBitmap *glyph);
-
- // Draws an image mask using the fill color. This will read <w>*<h>
- // pixels from <src>, in raster order, starting with the top line.
- // "1" pixels will be drawn with the current fill color; "0" pixels
- // are transparent. The matrix:
- // [ mat[0] mat[1] 0 ]
- // [ mat[2] mat[3] 0 ]
- // [ mat[4] mat[5] 1 ]
- // maps a unit square to the desired destination for the image, in
- // PostScript style:
- // [x' y' 1] = [x y 1] * mat
- // Note that the Splash y axis points downward, and the image source
- // is assumed to produce pixels in raster order, starting from the
- // top line.
- SplashError fillImageMask(SplashImageMaskSource src, void *srcData,
- int w, int h, SplashCoord *mat, GBool glyphMode);
-
- // Draw an image. This will read <w>*<h> pixels from <src>, in
- // raster order, starting with the top line. These pixels are
- // assumed to be in the source mode, <srcMode>. The following
- // combinations of source and target modes are supported:
- // source target
- // ------ ------
- // Mono1 Mono1
- // Mono8 Mono1 -- with dithering
- // Mono8 Mono8
- // RGB8 RGB8
- // BGR8packed BGR8Packed
- // The matrix behaves as for fillImageMask.
- SplashError drawImage(SplashImageSource src, void *srcData,
- SplashColorMode srcMode, GBool srcAlpha,
- int w, int h, SplashCoord *mat);
-
- //~ drawMaskedImage
-
- //----- misc
-
- // Return the associated bitmap.
- SplashBitmap *getBitmap();
-
- // Toggle debug mode on or off.
- void setDebugMode(GBool debugModeA);
-
- int init(const char *driverName, int outputFD,
- const char *printerModel, int nOptions,
- const char *optionKeys[], const char *optionVals[]);
- void initGS(int colorMode, int w, int h, SplashColor paperColor);
- int setColorMode(int colorModeA, GBool colorProfile);
- int unloadVectorDriver();
-
- int OPVPStartJob(char *jobInfo);
- int OPVPEndJob();
- int OPVPStartDoc(char *docInfo);
- int OPVPEndDoc();
- int OPVPStartPage(char *pageInfo, int rasterWidth);
- int OPVPEndPage();
- int outSlice();
- Splash *getSplash() { return splash; }
- int getRasterMode() { return rasterMode; }
- void endPage();
- SplashCoord *getMatrix();
-
-private:
- int rasterMode;
- OPVPSplash *opvpSplash;
- Splash *splash;
- OPVPWrapper *opvp;
- int getRasterSize(SplashBitmap *bitmap);
-
- typedef unsigned char *(*GetScanLineDataFunT)(unsigned char *dst,
- unsigned char *bitmap, int rasterWidth);
-
- static unsigned char *getScanLineDataMono1(unsigned char *dst,
- unsigned char *bitmap, int rasterWidth);
- static unsigned char *getScanLineDataMono8(unsigned char *dst,
- unsigned char *bitmap, int rasterWidth);
- static unsigned char *getScanLineDataRGB8(unsigned char *dst,
- unsigned char *bitmap, int rasterWidth);
- static unsigned char *getScanLineDataBGR8Packed(unsigned char *dst,
- unsigned char *bitmap, int rasterWidth);
-
- GetScanLineDataFunT getGetScanLineDataFun(SplashBitmap *bitmap);
- GBool checkAll1(unsigned char *bp, int n, int width, int mode);
-};
-
-#endif
diff --git a/filter/pdftoopvp/oprs/OPVPSplash.cxx b/filter/pdftoopvp/oprs/OPVPSplash.cxx
deleted file mode 100644
index 49f46c7..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplash.cxx
+++ /dev/null
@@ -1,2336 +0,0 @@
-//========================================================================
-//
-// OPVPSplash.cc
-//
-//========================================================================
-
-#include <config.h>
-#ifdef HAVE_CPP_POPPLER_VERSION_H
-#include "cpp/poppler-version.h"
-#endif
-
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <limits.h>
-#include "goo/gmem.h"
-#include "splash/SplashErrorCodes.h"
-#include "splash/SplashMath.h"
-#include "splash/SplashBitmap.h"
-#include "splash/SplashXPathScanner.h"
-#include "splash/SplashPattern.h"
-#include "splash/SplashScreen.h"
-#include "splash/SplashFont.h"
-#include "splash/SplashGlyphBitmap.h"
-#include "splash/Splash.h"
-#include "OPRS.h"
-#include "OPVPSplashState.h"
-#include "OPVPSplash.h"
-#include "OPVPSplashPath.h"
-#include "OPVPSplashXPath.h"
-#include "OPVPSplashClip.h"
-
-//------------------------------------------------------------------------
-// OPVPSplash
-//------------------------------------------------------------------------
-
-inline void OPVPSplash::transform(SplashCoord *matrix,
- SplashCoord xi, SplashCoord yi,
- SplashCoord *xo, SplashCoord *yo) {
- // [ m[0] m[1] 0 ]
- // [xo yo 1] = [xi yi 1] * [ m[2] m[3] 0 ]
- // [ m[4] m[5] 1 ]
- *xo = xi * matrix[0] + yi * matrix[2] + matrix[4];
- *yo = xi * matrix[1] + yi * matrix[3] + matrix[5];
-}
-
-OPVPSplash::OPVPSplash(OPVPWrapper *opvpA,
- int nOptions, const char *optionKeys[], const char *optionVals[])
-{
- const char *opv;
-
- opvp = opvpA;
- // with default screen params
- state = new OPVPSplashState(0,0,gFalse,(SplashScreenParams *)NULL);
- debugMode = gFalse;
- stateBypass = gFalse;
- clipPath = 0;
- if (getOption("OPVP_OLDLIPSDRIVER",nOptions,
- optionKeys,optionVals) != NULL) {
- oldLipsDriver = gTrue;
- } else {
- oldLipsDriver = gFalse;
- }
- if (getOption("OPVP_CLIPPATHNOTSAVED",nOptions,
- optionKeys,optionVals) != NULL) {
- clipPathNotSaved = gTrue;
- } else {
- clipPathNotSaved = gFalse;
- }
- if (getOption("OPVP_NOSHEARIMAGE",nOptions,
- optionKeys,optionVals) != NULL) {
- noShearImage = gTrue;
- } else {
- noShearImage = gFalse;
- }
- if (getOption("OPVP_NOLINESTYLE",nOptions,
- optionKeys,optionVals) != NULL) {
- noLineStyle = gTrue;
- } else {
- noLineStyle = gFalse;
- }
- if (!opvpA->supportSetLineStyle || !opvpA->supportSetLineDash
- || !opvpA->supportSetLineDashOffset) {
- noLineStyle = gTrue;
- }
- if (getOption("OPVP_NOCLIPPATH",nOptions,
- optionKeys,optionVals) != NULL) {
- noClipPath = gTrue;
- } else {
- noClipPath = gFalse;
- }
- if (getOption("OPVP_IGNOREMITERLIMIT",nOptions,
- optionKeys,optionVals) != NULL) {
- ignoreMiterLimit = gTrue;
- } else {
- ignoreMiterLimit = gFalse;
- }
- if (getOption("OPVP_NOMITERLIMIT",nOptions,
- optionKeys,optionVals) != NULL) {
- noMiterLimit = gTrue;
- } else {
- noMiterLimit = gFalse;
- }
- if (!opvpA->supportSetMiterLimit) {
- noMiterLimit = gTrue;
- }
- if ((opv = getOption("OPVP_BITMAPCHARTHRESHOLD",nOptions,
- optionKeys,optionVals)) != NULL) {
- bitmapCharThreshold = atoi(opv);
- } else {
- bitmapCharThreshold = OPVP_BITMAPCHAR_THRESHOLD;
- }
- if ((opv = getOption("OPVP_MAXCLIPPATHLENGTH",nOptions,
- optionKeys,optionVals)) != NULL) {
- maxClipPathLength = atoi(opv);
- } else {
- maxClipPathLength = OPVP_MAX_CLIPPATH_LENGTH;
- }
- if ((opv = getOption("OPVP_MAXFILLPATHLENGTH",nOptions,
- optionKeys,optionVals)) != NULL) {
- maxFillPathLength = atoi(opv);
- } else {
- maxFillPathLength = OPVP_MAX_FILLPATH_LENGTH;
- }
- if (getOption("OPVP_NOIMAGEMASK",nOptions,
- optionKeys,optionVals) != NULL) {
- noImageMask = gTrue;
- } else {
- noImageMask = gFalse;
- }
- if (getOption("OPVP_NOBITMAPCHAR",nOptions,
- optionKeys,optionVals) != NULL) {
- bitmapCharThreshold = 0;
- }
- if (!opvpA->supportSetClipPath) {
- noClipPath = gTrue;
- }
- savedNoClipPath = noClipPath;
- saveDriverStateCount = 0;
- if (noImageMask) {
- /* We draw bitmapChar with imageMask feature.
- So, when noImageMask, noBitmapChar */
- bitmapCharThreshold = 0;
- }
-#ifdef OPTION_DEBUG
-fprintf(stderr,"noClipPath=%d\n",noClipPath);
-fprintf(stderr,"oldLipsDriver=%d\n",oldLipsDriver);
-fprintf(stderr,"noLineStyle=%d\n",noLineStyle);
-fprintf(stderr,"noMiterLimit=%d\n",noMiterLimit);
-fprintf(stderr,"ignoreMiterLimit=%d\n",ignoreMiterLimit);
-fprintf(stderr,"noShearImage=%d\n",noShearImage);
-fprintf(stderr,"clipPathNotSaved=%d\n",clipPathNotSaved);
-fprintf(stderr,"bitmapCharThreshold=%d\n",bitmapCharThreshold);
-fprintf(stderr,"maxClipPathLength=%d\n",maxClipPathLength);
-#endif
-}
-
-OPVPSplash::~OPVPSplash()
-{
- while (state->next) {
- restoreState();
- }
- delete state;
- if (opvp->supportClosePrinter) {
- opvp->ClosePrinter();
- }
- delete opvp;
-}
-
-//------------------------------------------------------------------------
-// state read
-//------------------------------------------------------------------------
-
-
-SplashPattern *OPVPSplash::getStrokePattern() {
- return state->strokePattern;
-}
-
-SplashPattern *OPVPSplash::getFillPattern() {
- return state->fillPattern;
-}
-
-SplashScreen *OPVPSplash::getScreen() {
- return state->screen;
-}
-
-SplashCoord OPVPSplash::getLineWidth() {
- return state->lineWidth;
-}
-
-int OPVPSplash::getLineCap() {
- return state->lineCap;
-}
-
-int OPVPSplash::getLineJoin() {
- return state->lineJoin;
-}
-
-SplashCoord OPVPSplash::getMiterLimit() {
- return state->miterLimit;
-}
-
-SplashCoord OPVPSplash::getFlatness() {
- return state->flatness;
-}
-
-SplashCoord *OPVPSplash::getLineDash() {
- return state->lineDash;
-}
-
-int OPVPSplash::getLineDashLength() {
- return state->lineDashLength;
-}
-
-SplashCoord OPVPSplash::getLineDashPhase() {
- return state->lineDashPhase;
-}
-
-OPVPSplashClip *OPVPSplash::getClip() {
- return state->clip;
-}
-
-//------------------------------------------------------------------------
-// state write
-//------------------------------------------------------------------------
-
-opvp_cspace_t OPVPSplash::getOPVPColorSpace()
-{
- switch (colorMode) {
- case splashModeMono1:
- return OPVP_CSPACE_BW;
- break;
- case splashModeMono8:
- return OPVP_CSPACE_DEVICEGRAY;
- break;
- case splashModeRGB8:
- default:
- break;
- }
- return OPVP_CSPACE_STANDARDRGB;
-}
-
-void OPVPSplash::makeBrush(SplashPattern *pattern, opvp_brush_t *brush)
-{
- brush->colorSpace = getOPVPColorSpace();
- brush->pbrush = NULL;
- brush->color[3] = -1;
- brush->xorg = brush->yorg = 0;
- if (pattern == NULL) {
- /* set default black color */
- brush->color[2] = 0;
- brush->color[1] = 0;
- brush->color[0] = 0;
- } else if (typeid(*pattern) == typeid(SplashSolidColor)) {
- /* solid color */
- SplashColor color;
-
- pattern->getColor(0,0,color);
- switch (colorMode) {
- case splashModeMono1:
- brush->color[2] = color[0];
- brush->color[1] = 0;
- brush->color[0] = 0;
- break;
- case splashModeMono8:
- brush->color[2] = color[0];
- brush->color[1] = 0;
- brush->color[0] = 0;
- break;
- case splashModeRGB8:
- brush->color[2] = splashRGB8R(color);
- brush->color[1] = splashRGB8G(color);
- brush->color[0] = splashRGB8B(color);
- break;
- default:
- OPRS::error("Unknown color mode\n");
- brush->color[2] = splashRGB8R(color);
- brush->color[1] = splashRGB8G(color);
- brush->color[0] = splashRGB8B(color);
- break;
- }
- } else {
- /* error */
- return;
- }
-}
-
-GBool OPVPSplash::equalPattern(SplashPattern *pat1, SplashPattern *pat2)
-{
- SplashColor c1, c2;
- if (pat1 == NULL || pat2 == NULL) {
- return pat1 == pat2;
- }
- if (typeid(*pat1) != typeid(*pat2)) return gFalse;
-
- pat1->getColor(0,0,c1);
- pat2->getColor(0,0,c2);
- switch (colorMode) {
- case splashModeMono1:
- return c1[0] == c2[0];
- break;
- case splashModeMono8:
- return c1[0] == c2[0];
- break;
- case splashModeRGB8:
- return c1[0] == c2[0] && c1[1] == c2[1] && c1[2] == c2[2];
- break;
- default:
- break;
- }
- return gTrue;
-}
-
-void OPVPSplash::setStrokePattern(SplashPattern *strokePattern) {
- opvp_brush_t brush;
-
- if (!stateBypass && equalPattern(strokePattern,state->strokePattern)) {
- delete strokePattern;
- return;
- }
- state->setStrokePattern(strokePattern);
- makeBrush(strokePattern,&brush);
- if (opvp->SetStrokeColor(&brush) != 0) {
- OPRS::error("SetStrokeColor error\n");
- return;
- }
-}
-
-void OPVPSplash::setFillPattern(SplashPattern *fillPattern) {
- opvp_brush_t brush;
-
- if (!stateBypass && equalPattern(fillPattern,state->fillPattern)) {
- delete fillPattern;
- return;
- }
- state->setFillPattern(fillPattern);
- makeBrush(fillPattern,&brush);
- if (opvp->SetFillColor(&brush) != 0) {
- OPRS::error("SetFillColor error\n");
- return;
- }
-}
-
-void OPVPSplash::setScreen(SplashScreen *screen) {
- state->setScreen(screen);
-}
-
-void OPVPSplash::setLineWidth(SplashCoord lineWidth) {
- if (stateBypass || state->lineWidth != lineWidth) {
- opvp_fix_t width;
-
- state->lineWidth = lineWidth;
- OPVP_F2FIX(lineWidth,width);
- if (opvp->SetLineWidth(width) < 0) {
- OPRS::error("SetLineWidth error\n");
- return;
- }
- }
-}
-
-void OPVPSplash::setLineCap(int lineCap) {
- if (stateBypass || state->lineCap != lineCap) {
- opvp_linecap_t cap;
-
- state->lineCap = lineCap;
- switch (lineCap) {
- case splashLineCapButt:
- cap = OPVP_LINECAP_BUTT;
- break;
- case splashLineCapRound:
- cap = OPVP_LINECAP_ROUND;
- break;
- case splashLineCapProjecting:
- cap = OPVP_LINECAP_SQUARE;
- break;
- default:
- /* error */
- cap = OPVP_LINECAP_BUTT;
- break;
- }
- if (opvp->SetLineCap(cap) < 0) {
- OPRS::error("SetLineCap error\n");
- return;
- }
- }
-}
-
-void OPVPSplash::setLineJoin(int lineJoin) {
- if (stateBypass || state->lineJoin != lineJoin) {
- opvp_linejoin_t join;
-
- state->lineJoin = lineJoin;
- switch (lineJoin) {
- case splashLineJoinMiter:
- join = OPVP_LINEJOIN_MITER;
- break;
- case splashLineJoinRound:
- join = OPVP_LINEJOIN_ROUND;
- break;
- case splashLineJoinBevel:
- join = OPVP_LINEJOIN_BEVEL;
- break;
- default:
- /* error */
- join = OPVP_LINEJOIN_MITER;
- break;
- }
- if (opvp->SetLineJoin(join) < 0) {
- OPRS::error("SetLineJoin error\n");
- return;
- }
- }
-}
-
-void OPVPSplash::setMiterLimit(SplashCoord miterLimit) {
- if (stateBypass || state->miterLimit != miterLimit) {
- opvp_fix_t limit;
-
- state->miterLimit = miterLimit;
- if (noMiterLimit) return;
- if (oldLipsDriver) {
- /* for old driver for lips */
- /* miterLimit is length/2 */
- miterLimit = miterLimit*state->lineWidth*0.5;
- }
- OPVP_F2FIX(miterLimit,limit);
- if (opvp->SetMiterLimit(limit) < 0) {
- OPRS::error("SetMiterLimit error\n");
- return;
- }
- }
-}
-
-void OPVPSplash::setFlatness(SplashCoord flatness) {
- if (flatness < 1) {
- state->flatness = 1;
- } else {
- state->flatness = flatness;
- }
-}
-
-void OPVPSplash::setLineDash(SplashCoord *lineDash, int lineDashLength,
- SplashCoord lineDashPhase) {
- int i;
- opvp_fix_t *pdash;
- GBool equal;
-
- if (stateBypass || lineDash != state->lineDash) {
- if (lineDash == NULL || lineDashLength == 0) {
- if (!noLineStyle
- && opvp->SetLineStyle(OPVP_LINESTYLE_SOLID) < 0) {
- OPRS::error("SetLineStyle error\n");
- return;
- }
- state->setLineDash(lineDash, lineDashLength, lineDashPhase);
- return;
- } else if (stateBypass || state->lineDash == NULL) {
- if (!noLineStyle
- && opvp->SetLineStyle(OPVP_LINESTYLE_DASH) < 0) {
- OPRS::error("SetLineStyle error\n");
- return;
- }
- }
- }
- if (lineDash == NULL || lineDashLength == 0) return;
- if (!noLineStyle) {
- equal = (state->lineDash != NULL);
- pdash = new opvp_fix_t[lineDashLength];
- for (i = 0;i < lineDashLength;i++) {
- if (equal && lineDash[i] != state->lineDash[i]) equal = gFalse;
- OPVP_F2FIX(lineDash[i],pdash[i]);
- }
- if (!equal && opvp->SetLineDash(lineDashLength,pdash) < 0) {
- OPRS::error("SetLineDash error\n");
- goto err;
- }
- if (stateBypass || lineDashPhase != state->lineDashPhase) {
- opvp_fix_t offset;
-
- OPVP_F2FIX(lineDashPhase,offset);
- if (opvp->SetLineDashOffset(offset) < 0) {
- OPRS::error("SetLineDashOffset error\n");
- goto err;
- }
- }
-err:
- delete[] pdash;
- }
- state->setLineDash(lineDash, lineDashLength, lineDashPhase);
-}
-
-SplashError OPVPSplash::doClipPath(OPVPSplashPath *path, GBool eo,
- OPVPClipPath *prevClip)
-{
- SplashError result;
-
- if (path->getLength() > maxClipPathLength) {
- if (!noClipPath) {
- if (prevClip != 0 &&
- prevClip->getPath()->getLength() <= maxClipPathLength) {
- /* previous clipping is printer clipping */
- if (opvp->ResetClipPath() != 0) {
- OPRS::error("ResetClipPath error\n");
- return splashErrOPVP;
- }
- }
- noClipPath = gTrue;
- }
- } else {
- noClipPath = savedNoClipPath;
- }
- if (!noClipPath && path->getLength() > 0) {
- /* when path->length == 0, no drawable arae, and no output
- so, it isn't need to set ClipPath */
- if ((result = path->makePath(opvp)) != splashOk) {
- return result;
- }
- if (opvp->SetClipPath(
- eo ? OPVP_CLIPRULE_EVENODD : OPVP_CLIPRULE_WINDING) < 0) {
- OPRS::error("SetClipPath error\n");
- return splashErrOPVP;
- }
- }
- return splashOk;
-}
-
-SplashError OPVPSplash::makeRectanglePath(SplashCoord x0,
- SplashCoord y0, SplashCoord x1, SplashCoord y1, OPVPSplashPath **p)
-{
- SplashError result;
-
- *p = new OPVPSplashPath();
- if ((result = (*p)->moveTo(x0,y0)) != splashOk) return result;
- if ((result = (*p)->lineTo(x1,y0)) != splashOk) return result;
- if ((result = (*p)->lineTo(x1,y1)) != splashOk) return result;
- if ((result = (*p)->lineTo(x0,y1)) != splashOk) return result;
- if ((result = (*p)->close()) != splashOk) return result;
- return splashOk;
-}
-
-void OPVPSplash::clipResetToRect(SplashCoord x0, SplashCoord y0,
- SplashCoord x1, SplashCoord y1) {
- OPVPSplashPath *p;
- OPVPClipPath *cp;
-
- while ((cp = OPVPClipPath::pop()) != NULL) delete cp;
- if (clipPath != 0) {
- delete clipPath;
- clipPath = 0;
- }
-
- if (makeRectanglePath(x0,y0,x1,y1,&p) != splashOk) return;
-
- if (doClipPath(p,gTrue,clipPath) != splashOk) return;
- clipPath = new OPVPClipPath(p,gTrue);
- state->clip->resetToRect(x0, y0, x1, y1);
-}
-
-SplashError OPVPSplash::clipToPath(OPVPSplashPath *path, GBool eo) {
- SplashError result;
- SplashCoord x0, y0, x1, y1;
- SplashCoord x2, y2, x3, y3;
- SplashClipResult clipResult;
- int xMin, yMin, xMax, yMax;
-
- if (path == 0) return splashErrBogusPath;
- if (path->getLength() == 0) return splashOk;
- if (clipPath == 0) {
- /* no clip region exist */
- if ((result = state->clip->clipToPath(path, state->matrix,
- state->flatness, eo)) != splashOk) {
- return result;
- }
- path = path->copy();
- } else {
- OPVPSplashPath *oldPath = clipPath->getPath();
- if (path->isRectanglePath(&x0,&y0,&x1,&y1)) {
- if ((clipResult = state->clip->testRect(
- splashRound(x0), splashRound(y0), splashRound(x1), splashRound(y1)))
- == splashClipAllOutside) {
- /* no drawable area */
- if ((result = state->clip->clipToPath(path, state->matrix,
- state->flatness, eo)) != splashOk) {
- return result;
- }
- path = new OPVPSplashPath();
- } else if (clipResult == splashClipPartial) {
- if (oldPath->isRectanglePath(&x2,&y2,&x3,&y3)) {
- if ((result = state->clip->clipToPath(path, state->matrix,
- state->flatness, eo)) != splashOk) {
- return result;
- }
- /* both rectangle */
- if (x0 < x2) x0 = x2;
- if (y0 < y2) y0 = y2;
- if (x1 > x3) x1 = x3;
- if (y1 > y3) y1 = y3;
- if ((result = makeRectanglePath(x0,y0,x1,y1,&path)) != splashOk) {
- return result;
- }
- } else {
- state->clip->getBBox(&xMin,&yMin,&xMax,&yMax);
- if (splashRound(x0) <= xMin && splashRound(y0) <= yMin
- && splashRound(x1) >= xMax && splashRound(y1)) {
- /* The old path is all inside the new path */
- /* We may ignore the new path */
- return splashOk;
- }
- if ((result = state->clip->clipToPath(path, state->matrix,
- state->flatness, eo)) != splashOk) {
- return result;
- }
- if (state->clip->getNumPaths() > 0) {
- path = state->clip->makePath();
- } else {
- path = new OPVPSplashPath();
- }
- }
- } else {
- /* splashClipAllInside */
- /* We may ignore the previous region. */
- if ((result = state->clip->clipToPath(path, state->matrix,
- state->flatness, eo)) != splashOk) {
- return result;
- }
- path = path->copy();
- }
- } else {
- /* non rectangle path */
-
- OPVPSplashXPath *xpath = new OPVPSplashXPath(path, state->matrix,
- state->flatness, gFalse);
-
- xpath->sort();
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- SplashXPathScanner *scanner = new SplashXPathScanner(xpath,eo,
- INT_MIN,INT_MAX);
-#else
- SplashXPathScanner *scanner = new SplashXPathScanner(xpath,eo);
-#endif
- scanner->getBBox(&xMin,&yMin,&xMax,&yMax);
- delete scanner;
- delete xpath;
- if ((clipResult = state->clip->testRect(xMin,yMin,xMax,yMax))
- == splashClipAllOutside) {
- /* no efect */
- /* no drawable area */
- if ((result = state->clip->clipToPath(path, state->matrix,
- state->flatness, eo)) != splashOk) {
- return result;
- }
- path = new OPVPSplashPath();
- } else if (clipResult == splashClipPartial) {
- OPVPSplashClip *nclip = new OPVPSplashClip(xMin,yMin,xMax,yMax,gFalse);
- nclip->clipToPath(path,state->matrix,state->flatness,eo);
- state->clip->getBBox(&xMin,&yMin,&xMax,&yMax);
- if ((clipResult = nclip->testRect(xMin,yMin,xMax,yMax))
- == splashClipAllOutside) {
- /* no drawable area */
- delete nclip;
- if ((result = state->clip->clipToPath(path, state->matrix,
- state->flatness, eo)) != splashOk) {
- return result;
- }
- path = new OPVPSplashPath();
- } else {
- delete nclip;
- if (clipResult == splashClipAllInside) {
- /* The old path is all inside the new path */
- /* We may ignore the new path */
- return splashOk;
- }
- if ((result = state->clip->clipToPath(path, state->matrix,
- state->flatness, eo)) != splashOk) {
- return result;
- }
- if (state->clip->getNumPaths() > 0) {
- path = state->clip->makePath();
- } else {
- path = new OPVPSplashPath();
- }
- }
- } else {
- /* splashClipAllInside */
- /* We may ignore the previous region. */
- if ((result = state->clip->clipToPath(path, state->matrix,
- state->flatness, eo)) != splashOk) {
- return result;
- }
- path = path->copy();
- }
- }
- }
- if ((result = doClipPath(path,eo,clipPath)) != splashOk) {
- delete path;
- return result;
- }
- if (clipPath != 0) delete clipPath;
- clipPath = new OPVPClipPath(path,eo);
-
- return splashOk;
-}
-
-//------------------------------------------------------------------------
-// state save/restore
-//------------------------------------------------------------------------
-
-void OPVPSplash::saveState() {
- OPVPSplashState *newState;
-
- newState = state->copy();
- newState->next = state;
- state = newState;
- if (clipPath != 0) clipPath->push();
- if (opvp->SaveGS() != 0) {
- OPRS::error("SaveGS error\n");
- return;
- }
- saveDriverStateCount++;
-}
-
-SplashError OPVPSplash::restoreState() {
- OPVPSplashState *oldState;
- OPVPClipPath *oldClip;
- OPVPSplashPath *path;
- GBool saved = gFalse;
-
- if (!state->next) {
- return splashErrNoSave;
- }
- oldState = state;
- state = state->next;
- delete oldState;
- if (saveDriverStateCount > 0 && opvp->RestoreGS() != 0) {
- OPRS::error("RestoreGS error\n");
- return splashErrOPVP;
- }
- saveDriverStateCount--;
- oldClip = clipPath;
- if (clipPath != 0) {
- saved = clipPath->getSaved();
- delete clipPath;
- clipPath = 0;
- }
- clipPath = OPVPClipPath::pop();
- if (clipPath != 0) {
- path = clipPath->getPath();
- if (path->getLength() > maxClipPathLength) {
- if (clipPathNotSaved && !noClipPath) {
- if (opvp->ResetClipPath() != 0) {
- OPRS::error("ResetClipPath error\n");
- return splashErrOPVP;
- }
- noClipPath = gTrue;
- }
- } else {
- noClipPath = savedNoClipPath;
- }
- } else {
- noClipPath = savedNoClipPath;
- }
- if (clipPathNotSaved && !noClipPath) {
- if (clipPath != 0) {
- if (!saved) {
- SplashError result;
-
- if ((result = doClipPath(clipPath->getPath(),clipPath->getEo(),
- oldClip))
- != splashOk) return result;
- }
- } else if (oldClip != 0) {
- if (opvp->ResetClipPath() != 0) {
- OPRS::error("ResetClipPath error\n");
- return splashErrOPVP;
- }
- }
- }
- return splashOk;
-}
-
-//------------------------------------------------------------------------
-// drawing operations
-//------------------------------------------------------------------------
-
-void OPVPSplash::clear(SplashColor color)
-{
- opvp_brush_t brush;
-
- brush.colorSpace = getOPVPColorSpace();
- brush.pbrush = NULL;
- brush.color[3] = -1;
- brush.xorg = brush.yorg = 0;
- switch (colorMode) {
- case splashModeMono1:
- brush.color[2] = color[0];
- brush.color[1] = 0;
- brush.color[0] = 0;
- break;
- case splashModeMono8:
- brush.color[2] = color[0];
- brush.color[1] = 0;
- brush.color[0] = 0;
- break;
- case splashModeRGB8:
- brush.color[2] = splashRGB8R(color);
- brush.color[1] = splashRGB8G(color);
- brush.color[0] = splashRGB8B(color);
- break;
- default:
- OPRS::error("Unknown color mode\n");
- brush.color[2] = splashRGB8R(color);
- brush.color[1] = splashRGB8G(color);
- brush.color[0] = splashRGB8B(color);
- break;
- }
- opvp->SetBgColor(&brush);
-}
-
-/*
- Translate arc to Bezier Curve
-
- input start point (x0,y0) , center (cx, cy) and end point (x3, y3)
- return Bezier curve control points (rx1,ry1 and rx2, ry2)
-
- an angle should be less than eqaul 90 degree
-
-*/
-void OPVPSplash::arcToCurve(SplashCoord x0, SplashCoord y0,
- SplashCoord x3, SplashCoord y3,
- SplashCoord cx, SplashCoord cy, SplashCoord *rx1, SplashCoord *ry1,
- SplashCoord *rx2, SplashCoord *ry2)
-{
-#define ROTX(x,y) (x*rotcos-y*rotsin)*r+cx
-#define ROTY(x,y) (x*rotsin+y*rotcos)*r+cy
-
- SplashCoord x1,y1,x2,y2;
- SplashCoord r;
- SplashCoord rotcos, rotsin;
- SplashCoord ox,oy,hx,hy,d;
-
- hx = (x0+x3)/2;
- hy = (y0+y3)/2;
- r = splashDist(x0,y0,cx,cy);
- d = splashDist(x0,y0,hx,hy);
- rotcos = (hx-cx)/d;
- rotsin = (hy-cy)/d;
- oy = (splashDist(x0,y0,x3,y3)/2)/r;
- ox = splashDist(hx,hy,cx,cy)/r;
- x1 = ((4-ox)/3);
- y1 = ((1-ox)*(3-ox)/(3*oy));
- x2 = x1;
- y2 = -y1;
- *rx1 = ROTX(x1,y1);
- *ry1 = ROTY(x1,y1);
- *rx2 = ROTX(x2,y2);
- *ry2 = ROTY(x2,y2);
-#undef ROTX
-#undef ROTY
-}
-
-SplashError OPVPSplash::strokeByMyself(OPVPSplashPath *path)
-{
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- SplashPath *dPath;
- OPVPSplashPath *oPath;
- Splash *osplash;
- SplashPattern *savedPattern;
-
- /* draw dashed line by myself */
- if (path->getLength() == 0) {
- return splashOk;
- }
-
- osplash = new Splash(new SplashBitmap(1,1,4,splashModeMono1,gFalse),gFalse);
- state->setState(osplash);
- dPath = osplash->makeStrokePath(path,state->lineWidth);
- oPath = new OPVPSplashPath(dPath);
- delete dPath;
-
- if (state->lineWidth <= 1) {
- OPVPSplashXPath *xPath;
- xPath = new OPVPSplashXPath(oPath, state->matrix, state->flatness, gFalse);
- xPath->strokeNarrow(this,state);
- delete xPath;
- } else {
- /* change fill pattern temprarily */
- savedPattern = state->fillPattern->copy();
- setFillPattern(state->strokePattern->copy());
-
- fillByMyself(oPath,gFalse);
-
- /* restore fill pattern */
- setFillPattern(savedPattern);
- }
- delete osplash;
- return splashOk;
-#else
- OPVPSplashXPath *xPath, *xPath2;
- SplashPattern *savedPattern;
-
- /* draw dashed line by myself */
- if (path->getLength() == 0) {
- return splashOk;
- }
- xPath = new OPVPSplashXPath(path, state->matrix, state->flatness, gFalse);
- if (state->lineDash != NULL && state->lineDashLength > 0) {
- xPath2 = xPath->makeDashedPath(state);
- delete xPath;
- xPath = xPath2;
- }
-
- if (state->lineWidth <= 1) {
- xPath->strokeNarrow(this,state);
- } else {
- /* change fill pattern temprarily */
- savedPattern = state->fillPattern->copy();
- setFillPattern(state->strokePattern->copy());
-
- xPath->strokeWide(this,state);
-
- /* restore fill pattern */
- setFillPattern(savedPattern);
- }
-
- delete xPath;
- return splashOk;
-#endif
-}
-
-SplashError OPVPSplash::stroke(OPVPSplashPath *path) {
- SplashError result;
-
- if (clipPath != 0 && clipPath->getPath()->getLength() == 0) {
- return splashOk;
- }
- if ((state->lineDash != NULL
- && state->lineDashLength > 0 && noLineStyle)) {
- return strokeByMyself(path);
- }
- if (noMiterLimit && (!ignoreMiterLimit) && state->lineWidth != 0
- && state->lineJoin == splashLineJoinMiter) {
- return strokeByMyself(path);
- }
- if (noClipPath) {
- int xMin, yMin, xMax, yMax;
- SplashClipResult clipResult;
- int fatOffset = splashCeil(state->lineWidth/2);
- int miterLimit = splashCeil(state->miterLimit/2);
-
- if (fatOffset < miterLimit) fatOffset = miterLimit;
- path->getBBox(&xMin,&yMin,&xMax,&yMax);
- xMin -= fatOffset;
- yMin -= fatOffset;
- xMax += fatOffset;
- yMax += fatOffset;
- clipResult = state->clip->testRect(xMin,yMin,xMax,yMax);
- if (clipResult == splashClipAllOutside) {
- /* not need to draw */
- return splashOk;
- } else if (clipResult == splashClipPartial) {
- return strokeByMyself(path);
- }
- /* splashClipAllInside */
- /* fall through */
- }
- if ((result = path->makePath(opvp)) != 0) return result;
- if (opvp->StrokePath() < 0) {
- OPRS::error("StrokePath error\n");
- return splashErrOPVP;
- }
- return splashOk;
-}
-
-SplashError OPVPSplash::fillByMyself(OPVPSplashPath *path, GBool eo)
-{
- OPVPSplashXPath *xPath;
- SplashXPathScanner *scanner;
- int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
- SplashClipResult clipRes, clipRes2;
-
- if (path->getLength() == 0) {
- return splashOk;
- }
- xPath = new OPVPSplashXPath(path, state->matrix, state->flatness, gTrue);
- xPath->sort();
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- scanner = new SplashXPathScanner(xPath, eo, INT_MIN, INT_MAX);
-#else
- scanner = new SplashXPathScanner(xPath, eo);
-#endif
-
- // get the min and max x and y values
- scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
-
- // check clipping
- if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI))
- != splashClipAllOutside) {
- SplashPattern *savedPattern;
-
- /* change stroke pattern temporarily */
- savedPattern = state->strokePattern->copy();
- setStrokePattern(state->fillPattern->copy());
-
- for (y = yMinI; y < yMaxI; ++y) {
- while (scanner->getNextSpan(y, &x0, &x1)) {
- if (x0 == x1) continue;
- if (clipRes == splashClipAllInside) {
- drawSpan(x0, x1-1, y, gTrue);
- } else {
- clipRes2 = state->clip->testSpan(x0, x1, y);
- drawSpan(x0, x1-1, y, clipRes2 == splashClipAllInside);
- }
- }
- }
- /* restore stroke pattern */
- setStrokePattern(savedPattern);
- }
-
- delete scanner;
- delete xPath;
- return splashOk;
-}
-
-SplashError OPVPSplash::fill(OPVPSplashPath *path, GBool eo) {
- SplashError result;
- opvp_fillmode_t mode;
-
- if (path->getLength() <= 1) return splashOk;
- if (clipPath != 0 && clipPath->getPath()->getLength() == 0) {
- return splashOk;
- }
- if (path->getLength() > maxFillPathLength) {
- return fillByMyself(path,eo);
- }
- if (noClipPath) {
- int xMin, yMin, xMax, yMax;
- SplashClipResult clipResult;
-
- path->getBBox(&xMin,&yMin,&xMax,&yMax);
- clipResult = state->clip->testRect(xMin,yMin,xMax,yMax);
- if (clipResult == splashClipAllOutside) {
- /* not need to draw */
- return splashOk;
- } else if (clipResult == splashClipPartial) {
- return fillByMyself(path,eo);
- }
- /* splashClipAllInside */
- /* fall through */
- }
- if ((result = path->makePath(opvp)) != 0) return result;
- mode = eo ? OPVP_FILLMODE_EVENODD : OPVP_FILLMODE_WINDING;
- if (opvp->SetFillMode(mode) < 0) {
- OPRS::error("SetFillMode error\n");
- return splashErrOPVP;
- }
- if (opvp->FillPath() < 0) {
- OPRS::error("FillPath error\n");
- return splashErrOPVP;
- }
- return splashOk;
-}
-
-void OPVPSplash::fillGlyph(SplashCoord x, SplashCoord y,
- SplashGlyphBitmap *glyph)
-{
- opvp_fix_t opvpx,opvpy;
- int opvpbytes;
- int x0, y0;
- Guchar *bp;
- SplashClipResult clipRes;
- SplashCoord xt, yt;
-
- transform(state->matrix,x,y,&xt,&yt);
- x0 = splashFloor(xt)-glyph->x;
- y0 = splashFloor(yt)-glyph->y;
- clipRes = state->clip->testRect(x0,y0,
- x0 + glyph->w - 1,
- y0 + glyph->h - 1);
- if (clipRes == splashClipAllOutside) return;
- OPVP_i2Fix((x0),(opvpx));
- OPVP_i2Fix((y0),(opvpy));
- if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
- OPRS::error("SetCurrentPoint error\n");
- }
-
- if (oldLipsDriver && (((glyph->w+7)/8) & 3) != 0) {
- /* not 4bytes aligned, so make aligned */
- int i;
- int m = (glyph->w+7)/8;
-
- opvpbytes = (m+3)/4;
- opvpbytes *= 4;
- bp = (Guchar *)gmalloc(opvpbytes*glyph->h);
- for (i = 0;i < glyph->h;i++) {
- memcpy(bp+i*opvpbytes,glyph->data+i*m,m);
- }
- } else {
- bp = glyph->data;
- opvpbytes = (glyph->w+7)/8;
- }
- if ((!noClipPath || clipRes != splashClipPartial) && !noImageMask) {
- if (opvp->DrawImage(glyph->w,glyph->h,opvpbytes,OPVP_IFORMAT_MASK,
- glyph->w,glyph->h,(void *)bp) < 0) {
- OPRS::error("DrawImage error\n");
- }
- } else {
- int tx,ty;
- int sx = 0;
- SplashPattern *savedPattern;
- SplashCoord *savedLineDash = 0;
- int savedLineDashLength;
- SplashCoord savedLineDashPhase;
- SplashCoord savedLineWidth;
-
- /* change stroke pattern temprarily */
- savedPattern = state->strokePattern->copy();
- setStrokePattern(state->fillPattern->copy());
- /* change lins style temporarily */
- savedLineDashLength = state->lineDashLength;
- savedLineDashPhase = state->lineDashPhase;
- if (savedLineDashLength > 0 && state->lineDash != 0) {
- savedLineDash = new SplashCoord[savedLineDashLength];
- memcpy(savedLineDash, state->lineDash,
- savedLineDashLength*sizeof(SplashCoord));
- }
- setLineDash(0,0,0);
- savedLineWidth = state->lineWidth;
- setLineWidth(0.0);
-
-
- for (ty = 0;ty < glyph->h;ty++) {
- GBool dmode = gFalse;
- for (tx = 0;tx < glyph->w;tx++) {
- GBool on = (bp[opvpbytes*ty+(tx/8)] & (0x80 >> (tx & 7))) != 0;
-
- if (on && !dmode) {
- sx = tx;
- dmode = gTrue;
- } else if (!on && dmode) {
- drawSpan(x0+sx,x0+tx-1,y0+ty,gTrue);
- dmode = gFalse;
- }
- }
- if (dmode) {
- drawSpan(x0+sx,x0+tx-1,y0+ty,gTrue);
- }
- }
- /* restore stroke pattern */
- setStrokePattern(savedPattern);
- /* restore line style */
- setLineDash(savedLineDash,savedLineDashLength,
- savedLineDashPhase);
- if (savedLineDash != 0) {
- delete[] savedLineDash;
- }
- setLineWidth(savedLineWidth);
- }
- if (bp != glyph->data) gfree(bp);
-}
-
-SplashError OPVPSplash::fillChar(SplashCoord x, SplashCoord y,
- int c, SplashFont *font,
- Unicode *u, double *fontMat) {
- SplashError err = splashOk;
- SplashPath *spath;
- OPVPSplashPath *path;
- SplashCoord xt, yt;
- double mx,my;
-
- transform(state->matrix, x, y, &xt, &yt);
- if ((spath = font->getGlyphPath(c)) == 0) return splashOk;
- path = new OPVPSplashPath(spath);
- delete spath;
- if (bitmapCharThreshold > 0) {
- mx = splashAbs(fontMat[0]);
- if (mx < splashAbs(fontMat[1])) {
- mx = splashAbs(fontMat[1]);
- }
- my = splashAbs(fontMat[3]);
- if (my < splashAbs(fontMat[2])) {
- my = splashAbs(fontMat[2]);
- }
- if (path == 0 || (mx*my < bitmapCharThreshold)) {
- /* if a char is enough small, then out a char as a bitmask */
- SplashGlyphBitmap glyph;
- int x0, y0, xFrac, yFrac;
- SplashClipResult clipRes;
-
- x0 = splashFloor(xt);
- xFrac = splashFloor((xt - x0) * splashFontFraction);
- y0 = splashFloor(yt);
- yFrac = splashFloor((yt - y0) * splashFontFraction);
- if (font->getGlyph(c, xFrac, yFrac, &glyph, x0, y0, state->clip,
- &clipRes)) {
- if (path != 0) delete path;
- if (glyph.w == 0 || glyph.h == 0) {
- /* empty glyph */
- return splashOk;
- }
- if (clipRes != splashClipAllOutside) {
- fillGlyph(xt, yt, &glyph);
- }
- if (glyph.freeData) {
- gfree(glyph.data);
- }
- return err;
- }
- }
- /* fall through and out a char as a path */
- }
- if (path == 0) {
- //OPRS::error("FillPath error\n");
- err = splashErrOPVP;
- goto err0;
- }
- path->offset(xt,yt);
- err = fill(path,gFalse);
-err0:
- if (path != 0) delete path;
- return err;
-}
-
-SplashError OPVPSplash::fillImageMaskFastWithCTM(SplashImageMaskSource src,
- void *srcData, int w, int h, int tx, int ty,SplashCoord *mat) {
- int i, j;
- opvp_fix_t opvpx,opvpy;
- int opvpbytes;
- opvp_ctm_t opvpctm;
- Guchar *buf = 0, *bp;
- SplashError result = splashOk;
- SplashColorPtr lineBuf;
-
- opvpbytes = (w+7)/8;
- /* align 4 */
- opvpbytes = (opvpbytes+3)/4;
- opvpbytes *= 4;
- buf = (Guchar *)gmalloc(opvpbytes*h);
- lineBuf = (SplashColorPtr)gmalloc(opvpbytes*8);
-
- for (i = 0;i < h;i++) {
- int k;
-
- bp = buf+opvpbytes*i;
- (*src)(srcData, lineBuf);
- for (j = 0;j < w;j += k) {
- Guchar d;
-
- d = 0;
- for (k = 0;k < 8 && j+k < w;k++) {
- d <<= 1;
- if (lineBuf[j+k] != 0) d |= 1;
- }
- d <<= 8-k;
- *bp++ = d;
- }
- }
- free(lineBuf);
- opvpctm.a = mat[0];
- opvpctm.b = mat[1];
- opvpctm.c = mat[2];
- opvpctm.d = mat[3];
- opvpctm.e = mat[4];
- opvpctm.f = mat[5];
- OPVP_i2Fix((tx),(opvpx));
- OPVP_i2Fix((ty),(opvpy));
- if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
- OPRS::error("SetCurrentPoint error\n");
- }
-
- if (opvp->SetCTM(&opvpctm) < 0) {
- OPRS::error("SetCTM error\n");
- }
- if (opvp->DrawImage(w,h,opvpbytes,OPVP_IFORMAT_MASK,1,1,(void *)(buf)) < 0) {
- OPRS::error("DrawImage error\n");
- result = splashErrOPVP;
- }
- /* reset CTM */
- opvpctm.a = 1.0;
- opvpctm.b = 0.0;
- opvpctm.c = 0.0;
- opvpctm.d = 1.0;
- opvpctm.e = 0.0;
- opvpctm.f = 0.0;
- if (opvp->SetCTM(&opvpctm) < 0) {
- OPRS::error("SetCTM error\n");
- }
-
- if (buf != 0) gfree(buf);
- return result;
-}
-
-SplashError OPVPSplash::fillImageMask(SplashImageMaskSource src, void *srcData,
- int w, int h, SplashCoord *mat, GBool glyphMode) {
- GBool rot;
- SplashCoord xScale, yScale, xShear, yShear;
- int tx, ty, scaledWidth, scaledHeight, xSign, ySign;
- int ulx, uly, llx, lly, urx, ury, lrx, lry;
- int ulx1, uly1, llx1, lly1, urx1, ury1, lrx1, lry1;
- int xMin, xMax, yMin, yMax;
- SplashClipResult clipRes;
- SplashColorPtr pixBuf;
- SplashColorPtr p;
- int x, y;
- int i;
- SplashPattern *savedPattern;
- SplashCoord *savedLineDash = 0;
- int savedLineDashLength;
- SplashCoord savedLineDashPhase;
- SplashCoord savedLineWidth;
-
- if (debugMode) {
- printf("fillImageMask: w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n",
- w, h, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
- }
-
- // check for singular matrix
- if (splashAbs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.000001) {
- return splashErrSingularMatrix;
- }
-
- // compute scale, shear, rotation, translation parameters
- rot = splashAbs(mat[1]) > splashAbs(mat[0]);
- if (rot) {
- xScale = -mat[1];
- yScale = mat[2] - (mat[0] * mat[3]) / mat[1];
- xShear = -mat[3] / yScale;
- yShear = -mat[0] / mat[1];
- } else {
- xScale = mat[0];
- yScale = mat[3] - (mat[1] * mat[2]) / mat[0];
- xShear = mat[2] / yScale;
- yShear = mat[1] / mat[0];
- }
- tx = splashRound(mat[4]);
- ty = splashRound(mat[5]);
- scaledWidth = abs(splashRound(mat[4] + xScale) - tx) + 1;
- scaledHeight = abs(splashRound(mat[5] + yScale) - ty) + 1;
- xSign = (xScale < 0) ? -1 : 1;
- ySign = (yScale < 0) ? -1 : 1;
-
- // clipping
- ulx1 = 0;
- uly1 = 0;
- urx1 = xSign * (scaledWidth - 1);
- ury1 = splashRound(yShear * urx1);
- llx1 = splashRound(xShear * ySign * (scaledHeight - 1));
- lly1 = ySign * (scaledHeight - 1) + splashRound(yShear * llx1);
- lrx1 = xSign * (scaledWidth - 1) +
- splashRound(xShear * ySign * (scaledHeight - 1));
- lry1 = ySign * (scaledHeight - 1) + splashRound(yShear * lrx1);
- if (rot) {
- ulx = tx + uly1; uly = ty - ulx1;
- urx = tx + ury1; ury = ty - urx1;
- llx = tx + lly1; lly = ty - llx1;
- lrx = tx + lry1; lry = ty - lrx1;
- } else {
- ulx = tx + ulx1; uly = ty + uly1;
- urx = tx + urx1; ury = ty + ury1;
- llx = tx + llx1; lly = ty + lly1;
- lrx = tx + lrx1; lry = ty + lry1;
- }
- xMin = (ulx < urx) ? (ulx < llx) ? (ulx < lrx) ? ulx : lrx
- : (llx < lrx) ? llx : lrx
- : (urx < llx) ? (urx < lrx) ? urx : lrx
- : (llx < lrx) ? llx : lrx;
- xMax = (ulx > urx) ? (ulx > llx) ? (ulx > lrx) ? ulx : lrx
- : (llx > lrx) ? llx : lrx
- : (urx > llx) ? (urx > lrx) ? urx : lrx
- : (llx > lrx) ? llx : lrx;
- yMin = (uly < ury) ? (uly < lly) ? (uly < lry) ? uly : lry
- : (lly < lry) ? lly : lry
- : (ury < lly) ? (ury < lry) ? ury : lry
- : (lly < lry) ? lly : lry;
- yMax = (uly > ury) ? (uly > lly) ? (uly > lry) ? uly : lry
- : (lly > lry) ? lly : lry
- : (ury > lly) ? (ury > lry) ? ury : lry
- : (lly > lry) ? lly : lry;
- clipRes = state->clip->testRect(xMin, yMin, xMax, yMax);
- if (clipRes == splashClipAllOutside) return splashOk;
-
- if (!noClipPath || clipRes == splashClipAllInside) {
- if (!noShearImage && !noImageMask) {
- if (fillImageMaskFastWithCTM(src,srcData,w,h,tx,ty,mat)
- == splashOk) {
- return splashOk;
- }
- }
- }
-
- SplashError result = splashOk;
- /* change stroke pattern temprarily */
- savedPattern = state->strokePattern->copy();
- setStrokePattern(state->fillPattern->copy());
-
- /* change lins style temporarily */
- savedLineDashLength = state->lineDashLength;
- savedLineDashPhase = state->lineDashPhase;
- if (savedLineDashLength > 0 && state->lineDash != 0) {
- savedLineDash = new SplashCoord[savedLineDashLength];
- memcpy(savedLineDash, state->lineDash,
- savedLineDashLength*sizeof(SplashCoord));
- }
- setLineDash(0,0,0);
- savedLineWidth = state->lineWidth;
- setLineWidth(0.0);
-
- /* calculate inverse matrix */
- SplashCoord imat[4];
- double det = mat[0] * mat[3] - mat[1] * mat[2];
- imat[0] = mat[3]/det;
- imat[1] = -mat[1]/det;
- imat[2] = -mat[2]/det;
- imat[3] = mat[0]/det;
-
- /* read source image */
- pixBuf = (SplashColorPtr)gmalloc(h * w);
-
- p = pixBuf;
- for (i = 0; i < h; ++i) {
- (*src)(srcData, p);
- p += w;
- }
- int width = xMax-xMin+1;
- int height = yMax-yMin+1;
- OPVPSplashClip *clip = state->clip->copy();
-
- if (w < scaledWidth || h < scaledHeight) {
- OPVPSplashPath cpath;
-
- cpath.moveTo(tx,ty);
- cpath.lineTo(mat[0]+tx,mat[1]+ty);
- cpath.lineTo(mat[0]+mat[2]+tx,mat[1]+mat[3]+ty);
- cpath.lineTo(mat[2]+tx,mat[3]+ty);
- clip->clipToPath(&cpath,state->matrix,1.0,gFalse);
- }
- for (y = 0;y < height;y++) {
- int dy = y+yMin-ty;
- int sx = 0;
- GBool dmode = gFalse;
-
- for (x = 0;x < width;x++) {
- if (!clip->test(x+xMin,y+yMin)) {
- if (dmode) {
- drawSpan(xMin+sx,xMin+x-1,yMin+y,gTrue);
- dmode = gFalse;
- }
- continue;
- }
- int ox,oy;
- /* calculate original coordinate */
- int dx = x+xMin-tx;
- ox = (int)trunc((imat[0]*dx+imat[2]*dy)*w);
- oy = (int)trunc((imat[1]*dx+imat[3]*dy)*h);
- if (ox >= 0 && ox < w && oy >= 0 && oy < h) {
- GBool on = pixBuf[oy*w+ox] != 0;
-
- if (on && !dmode) {
- dmode = gTrue;
- sx = x;
- } else if (!on && dmode) {
- drawSpan(xMin+sx,xMin+x-1,yMin+y,gTrue);
- dmode = gFalse;
- }
- } else if (dmode) {
- drawSpan(xMin+sx,xMin+x-1,yMin+y,gTrue);
- dmode = gFalse;
- }
- }
- if (dmode) {
- drawSpan(xMin+sx,xMin+x-1,yMin+y,gTrue);
- }
- }
- delete clip;
- gfree(pixBuf);
-
- /* restore stroke pattern */
- setStrokePattern(savedPattern);
- /* restore line style */
- setLineDash(savedLineDash,savedLineDashLength,
- savedLineDashPhase);
- if (savedLineDash != 0) {
- delete[] savedLineDash;
- }
- setLineWidth(savedLineWidth);
-
- return result;
-}
-
-SplashError OPVPSplash::drawImageNotShear(SplashImageSource src,
- void *srcData,
- int w, int h,
- int tx, int ty,
- int scaledWidth, int scaledHeight,
- int xSign, int ySign, GBool rot) {
- int i, j;
- opvp_fix_t opvpx,opvpy;
- int opvpbytes, linesize;
- opvp_ctm_t opvpctm;
- SplashError result = splashOk;
- Guchar *buf = 0, *bp;
- SplashColorPtr lineBuf = 0, color;
- float e,f;
- int hs,he, hstep;
- int ow = w;
- int lineBufSize;
-
- if (rot) {
- int t = h;
-
- h = w;
- w = t;
- t = scaledHeight;
- scaledHeight = scaledWidth;
- scaledWidth = t;
- if (xSign != ySign) {
- xSign = xSign >= 0 ? -1 : 1;
- } else {
- ySign = ySign >= 0 ? -1 : 1;
- }
- }
-
- if (xSign > 0) {
- OPVP_i2Fix((tx),(opvpx));
- e = tx;
- } else {
- OPVP_i2Fix((tx-scaledWidth),(opvpx));
- e = tx-scaledWidth;
- }
- if (ySign > 0) {
- OPVP_i2Fix((ty),(opvpy));
- f = ty;
- } else {
- OPVP_i2Fix((ty-scaledHeight),(opvpy));
- f = ty-scaledHeight;
- }
- if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
- OPRS::error("SetCurrentPoint error\n");
- return splashErrOPVP;
- }
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- linesize = w;
- opvpbytes = (w+3)/4;
- opvpbytes *= 4;
- lineBufSize = (ow+3)/4;
- lineBufSize *= 4;
- break;
- case splashModeRGB8:
- linesize = w*3;;
- opvpbytes = (w*3+3)/4;
- opvpbytes *= 4;
- lineBufSize = (ow*3+3)/4;
- lineBufSize *= 4;
- break;
- default:
- OPRS::error("Image: no supported color mode\n");
- return splashErrOPVP;
- break;
- }
- if (ySign >= 0) {
- hstep = 1;
- hs = 0;
- he = h;
- } else {
- hstep = -1;
- hs = h-1;
- he = -1;
- }
- buf = (Guchar *)gmalloc(opvpbytes*h);
- lineBuf = (SplashColorPtr)gmalloc(lineBufSize);
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- if (rot) {
- if (xSign >= 0) {
- for (i = 0;i < w;i++) {
- (*src)(srcData, lineBuf, NULL);
- color = lineBuf;
- for (j = hs;j != he;j += hstep) {
- bp = buf+i+j*opvpbytes;
- *bp = *color++;
- }
- }
- } else {
- for (i = 0;i < w;i++) {
- (*src)(srcData, lineBuf, NULL);
- color = lineBuf;
- for (j = hs;j != he;j += hstep) {
- bp = buf+linesize-1-i+j*opvpbytes;
- *bp = *color++;
- }
- }
- }
- } else {
- if (xSign >= 0) {
- for (i = hs;i != he;i += hstep) {
- bp = buf+opvpbytes*i;
- (*src)(srcData, lineBuf, NULL);
- color = lineBuf;
- for (j = 0;j < w;j++) {
- *bp++ = *color++;
- }
- }
- } else {
- for (i = hs;i != he;i += hstep) {
- bp = buf+opvpbytes*i+linesize-1;
- (*src)(srcData, lineBuf, NULL);
- color = lineBuf;
- for (j = 0;j < w;j++) {
- *bp-- = *color++;
- }
- }
- }
- }
- break;
- case splashModeRGB8:
- if (rot) {
- if (xSign >= 0) {
- for (i = 0;i < w;i++) {
- (*src)(srcData, lineBuf, NULL);
- color = lineBuf;
- for (j = hs;j != he;j += hstep) {
- bp = buf+i*3+j*opvpbytes;
- bp[0] = *color++;
- bp[1] = *color++;
- bp[2] = *color++;
- }
- }
- } else {
- for (i = 0;i < w;i++) {
- (*src)(srcData, lineBuf, NULL);
- color = lineBuf;
- for (j = hs;j != he;j += hstep) {
- bp = buf+linesize-3-i*3+j*opvpbytes;
- bp[0] = *color++;
- bp[1] = *color++;
- bp[2] = *color++;
- }
- }
- }
- } else {
- if (xSign >= 0) {
- for (i = hs;i != he;i += hstep) {
- bp = buf+opvpbytes*i;
- (*src)(srcData, lineBuf, NULL);
- color = lineBuf;
- for (j = 0;j < w;j++) {
- *bp++ = *color++;
- *bp++ = *color++;
- *bp++ = *color++;
- }
- }
- } else {
- for (i = hs;i != he;i += hstep) {
- bp = buf+opvpbytes*i+linesize-1;
- (*src)(srcData, lineBuf, NULL);
- color = lineBuf;
- for (j = 0;j < w;j++) {
- *bp-- = color[2];
- *bp-- = color[1];
- *bp-- = color[0];
- color += 3;
- }
- }
- }
- }
- break;
- default:
- OPRS::error("Image: no supported color mode\n");
- result = splashErrOPVP;
- goto err1;
- break;
- }
- if (lineBuf != 0) gfree(lineBuf);
-
- /* canonlisp driver use CTM only, ignores currentPoint */
- /* So, set start point to CTM */
- opvpctm.a = 1.0;
- opvpctm.b = 0.0;
- opvpctm.c = 0.0;
- opvpctm.d = 1.0;
- opvpctm.e = e;
- opvpctm.f = f;
- if (opvp->SetCTM(&opvpctm) < 0) {
- OPRS::error("SetCTM error\n");
- }
-
- if (opvp->DrawImage(w,h,opvpbytes,OPVP_IFORMAT_RAW,
- scaledWidth,scaledHeight,(void *)(buf)) < 0) {
- OPRS::error("DrawImage error\n");
- result = splashErrOPVP;
- goto err1;
- }
-err1:
- /* reset CTM */
- opvpctm.e = 0.0;
- opvpctm.f = 0.0;
- if (opvp->SetCTM(&opvpctm) < 0) {
- OPRS::error("SetCTM error\n");
- }
-
- if (buf != 0) gfree(buf);
- return result;
-}
-
-SplashError OPVPSplash::drawImageFastWithCTM(SplashImageSource src,
- void *srcData,
- int w, int h, int tx, int ty,
- SplashCoord *mat) {
- int i;
- opvp_fix_t opvpx,opvpy;
- int opvpbytes;
- opvp_ctm_t opvpctm;
- SplashError result = splashOk;
- Guchar *buf = 0, *bp;
-
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- opvpbytes = (w+3)/4;
- opvpbytes *= 4;
- break;
- case splashModeRGB8:
- opvpbytes = (w*3+3)/4;
- opvpbytes *= 4;
- break;
- default:
- OPRS::error("Image: no supported color mode\n");
- return splashErrOPVP;
- break;
- }
- buf = (Guchar *)gmalloc(opvpbytes*h);
-
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- for (i = 0;i < h;i++) {
- bp = buf+opvpbytes*i;
- (*src)(srcData, (SplashColorPtr)bp, NULL);
- }
- break;
- case splashModeRGB8:
- for (i = 0;i < h;i++) {
- bp = buf+opvpbytes*i;
- (*src)(srcData, (SplashColorPtr)bp, NULL);
- }
- break;
- default:
- OPRS::error("Image: no supported color mode\n");
- result = splashErrOPVP;
- goto err0;
- break;
- }
-
- opvpctm.a = mat[0];
- opvpctm.b = mat[1];
- opvpctm.c = mat[2];
- opvpctm.d = mat[3];
- opvpctm.e = mat[4];
- opvpctm.f = mat[5];
- OPVP_i2Fix((tx),(opvpx));
- OPVP_i2Fix((ty),(opvpy));
- if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
- OPRS::error("SetCurrentPoint error\n");
- }
-
- if (opvp->SetCTM(&opvpctm) < 0) {
- OPRS::error("SetCTM error\n");
- }
- if (opvp->DrawImage(w,h,opvpbytes,OPVP_IFORMAT_RAW,1,1,(void *)(buf)) < 0) {
- OPRS::error("DrawImage error\n");
- result = splashErrOPVP;
- }
-err0:
- /* reset CTM */
- opvpctm.a = 1.0;
- opvpctm.b = 0.0;
- opvpctm.c = 0.0;
- opvpctm.d = 1.0;
- opvpctm.e = 0.0;
- opvpctm.f = 0.0;
- if (opvp->SetCTM(&opvpctm) < 0) {
- OPRS::error("SetCTM error\n");
- }
-
- if (buf != 0) gfree(buf);
- return splashOk;
-}
-
-SplashError OPVPSplash::drawImage(SplashImageSource src, void *srcData,
- SplashColorMode srcMode, GBool srcAlpha,
- int w, int h, SplashCoord *mat) {
- GBool ok, rot, halftone;
- SplashCoord xScale, yScale, xShear, yShear;
- int tx, ty, scaledWidth, scaledHeight, xSign, ySign;
- int ulx, uly, llx, lly, urx, ury, lrx, lry;
- int ulx1, uly1, llx1, lly1, urx1, ury1, lrx1, lry1;
- int xMin, xMax, yMin, yMax;
- SplashClipResult clipRes;
- SplashColorPtr pixBuf, p;
- int x, y;
- int i;
-
- if (debugMode) {
- printf("drawImage: srcMode=%d w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n",
- srcMode, w, h, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
- }
-
- // check color modes
- ok = gFalse; // make gcc happy
- switch (colorMode) {
- case splashModeMono1:
- ok = srcMode == splashModeMono1 || srcMode == splashModeMono8;
- break;
- case splashModeMono8:
- ok = srcMode == splashModeMono8;
- break;
- case splashModeRGB8:
- ok = srcMode == splashModeRGB8;
- break;
- }
- if (!ok) {
- OPRS::error("Image Mode mismatch\n");
- return splashErrModeMismatch;
- }
- halftone = colorMode == splashModeMono1 && srcMode == splashModeMono8;
-
- // check for singular matrix
- if (splashAbs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.000001) {
- OPRS::error("Image Not Singular Matrix\n");
- return splashErrSingularMatrix;
- }
-
- // compute scale, shear, rotation, translation parameters
- rot = splashAbs(mat[1]) > splashAbs(mat[0]);
- if (rot) {
- xScale = -mat[1];
- yScale = mat[2] - (mat[0] * mat[3]) / mat[1];
- xShear = -mat[3] / yScale;
- yShear = -mat[0] / mat[1];
- } else {
- xScale = mat[0];
- yScale = mat[3] - (mat[1] * mat[2]) / mat[0];
- xShear = mat[2] / yScale;
- yShear = mat[1] / mat[0];
- }
- tx = splashRound(mat[4]);
- ty = splashRound(mat[5]);
- scaledWidth = abs(splashRound(mat[4] + xScale) - tx) + 1;
- scaledHeight = abs(splashRound(mat[5] + yScale) - ty) + 1;
- xSign = (xScale < 0) ? -1 : 1;
- ySign = (yScale < 0) ? -1 : 1;
-
- // clipping
- ulx1 = 0;
- uly1 = 0;
- urx1 = xSign * (scaledWidth - 1);
- ury1 = splashRound(yShear * urx1);
- llx1 = splashRound(xShear * ySign * (scaledHeight - 1));
- lly1 = ySign * (scaledHeight - 1) + splashRound(yShear * llx1);
- lrx1 = xSign * (scaledWidth - 1) +
- splashRound(xShear * ySign * (scaledHeight - 1));
- lry1 = ySign * (scaledHeight - 1) + splashRound(yShear * lrx1);
- if (rot) {
- ulx = tx + uly1; uly = ty - ulx1;
- urx = tx + ury1; ury = ty - urx1;
- llx = tx + lly1; lly = ty - llx1;
- lrx = tx + lry1; lry = ty - lrx1;
- } else {
- ulx = tx + ulx1; uly = ty + uly1;
- urx = tx + urx1; ury = ty + ury1;
- llx = tx + llx1; lly = ty + lly1;
- lrx = tx + lrx1; lry = ty + lry1;
- }
- xMin = (ulx < urx) ? (ulx < llx) ? (ulx < lrx) ? ulx : lrx
- : (llx < lrx) ? llx : lrx
- : (urx < llx) ? (urx < lrx) ? urx : lrx
- : (llx < lrx) ? llx : lrx;
- xMax = (ulx > urx) ? (ulx > llx) ? (ulx > lrx) ? ulx : lrx
- : (llx > lrx) ? llx : lrx
- : (urx > llx) ? (urx > lrx) ? urx : lrx
- : (llx > lrx) ? llx : lrx;
- yMin = (uly < ury) ? (uly < lly) ? (uly < lry) ? uly : lry
- : (lly < lry) ? lly : lry
- : (ury < lly) ? (ury < lry) ? ury : lry
- : (lly < lry) ? lly : lry;
- yMax = (uly > ury) ? (uly > lly) ? (uly > lry) ? uly : lry
- : (lly > lry) ? lly : lry
- : (ury > lly) ? (ury > lry) ? ury : lry
- : (lly > lry) ? lly : lry;
- if ((clipRes = state->clip->testRect(xMin, yMin, xMax, yMax))
- == splashClipAllOutside) {
- return splashOk;
- }
-
- if (!noClipPath || clipRes == splashClipAllInside) {
- if (!srcAlpha && !noShearImage) {
- if (drawImageFastWithCTM(src,srcData,w,h,tx,ty,mat) == splashOk) {
- return splashOk;
- }
- }
- if (!srcAlpha && splashRound(xShear) == 0 && splashRound(yShear) == 0) {
- /* no sheared case */
- if (drawImageNotShear(src,srcData,w,h,tx,ty,
- scaledWidth, scaledHeight,xSign,ySign,rot) == splashOk) {
- return splashOk;
- }
- }
- }
-
- /* shear case */
- SplashError result = splashOk;
-
- /* calculate inverse matrix */
- SplashCoord imat[4];
- double det = mat[0] * mat[3] - mat[1] * mat[2];
- imat[0] = mat[3]/det;
- imat[1] = -mat[1]/det;
- imat[2] = -mat[2]/det;
- imat[3] = mat[0]/det;
-
- opvp_fix_t opvpx,opvpy;
- int opvpbytes, linesize;
- OPVP_Rectangle opvprect;
- int width = xMax-xMin+1;
- int height = yMax-yMin+1;
- opvp_ctm_t opvpctm;
-
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- if (srcAlpha) {
- /* alpha data exists */
- linesize = w*2;
- } else {
- linesize = w;
- }
- opvpbytes = (width+3)/4;
- opvpbytes *= 4;
- break;
- case splashModeRGB8:
- if (srcAlpha) {
- /* alpha data exists */
- linesize = w*4;
- } else {
- linesize = w*3;
- }
- opvpbytes = (width*3+3)/4;
- opvpbytes *= 4;
- break;
- default:
- OPRS::error("Image: no supported color mode\n");
- return splashErrOPVP;
- break;
- }
-
- /* read source image */
- pixBuf = (SplashColorPtr)gmalloc(h * linesize);
-
- p = pixBuf;
- for (i = 0; i < h; ++i) {
- (*src)(srcData, p, NULL);
- p += linesize;
- }
- /* allocate line buffer */
- Guchar *lineBuf = (Guchar *)gmalloc(opvpbytes);
- Guchar *onBuf = (Guchar *)gmalloc(width);
- OPVPSplashClip *clip;
- opvpctm.a = 1.0;
- opvpctm.b = 0.0;
- opvpctm.c = 0.0;
- opvpctm.d = 1.0;
- OPVP_i2Fix(0,opvprect.p0.x);
- OPVP_i2Fix(0,opvprect.p0.y);
-
- clip = state->clip->copy();
- if (w < scaledWidth || h < scaledHeight) {
- OPVPSplashPath cpath;
-
- cpath.moveTo(tx,ty);
- cpath.lineTo(mat[0]+tx,mat[1]+ty);
- cpath.lineTo(mat[0]+mat[2]+tx,mat[1]+mat[3]+ty);
- cpath.lineTo(mat[2]+tx,mat[3]+ty);
- clip->clipToPath(&cpath,state->matrix,1.0,gFalse);
- }
- for (y = 0;y < height;y++) {
- int dy = y+yMin-ty;
- memset(onBuf,0,width);
- if (srcAlpha) {
- /* with alpha data */
- for (x = 0;x < width;x++) {
- if (!clip->test(x+xMin,y+yMin)) continue;
- int ox,oy;
- /* calculate original coordinate */
- int dx = x+xMin-tx;
- ox = (int)trunc((imat[0]*dx+imat[2]*dy)*w);
- oy = (int)trunc((imat[1]*dx+imat[3]*dy)*h);
- if (ox >= 0 && ox < w && oy >= 0 && oy < h) {
- /* in the image */
-
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- onBuf[x] = pixBuf[oy*linesize+ox] != 0;
- lineBuf[x] = pixBuf[oy*linesize+ox+1];
- break;
- case splashModeRGB8:
- p = pixBuf+oy*linesize+ox*4;
- onBuf[x] = (*p++) != 0;
- lineBuf[x*3] = *p++;
- lineBuf[x*3+1] = *p++;
- lineBuf[x*3+2] = *p;
- break;
- default:
- OPRS::error("Image: no supported color mode\n");
- result = splashErrOPVP;
- goto err1;
- break;
- }
- }
- }
- } else {
- for (x = 0;x < width;x++) {
- if (!clip->test(x+xMin,y+yMin)) continue;
- int ox,oy;
- /* calculate original coordinate */
- int dx = x+xMin-tx;
- ox = (int)trunc((imat[0]*dx+imat[2]*dy)*w);
- oy = (int)trunc((imat[1]*dx+imat[3]*dy)*h);
- if (ox >= 0 && ox < w && oy >= 0 && oy < h) {
- /* in the image */
-
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- lineBuf[x] = pixBuf[oy*linesize+ox];
- break;
- case splashModeRGB8:
- p = pixBuf+oy*linesize+ox*3;
- lineBuf[x*3] = *p++;
- lineBuf[x*3+1] = *p++;
- lineBuf[x*3+2] = *p;
- break;
- default:
- OPRS::error("Image: no supported color mode\n");
- result = splashErrOPVP;
- goto err1;
- break;
- }
- onBuf[x] = 1;
- }
- }
- }
- /* out pixel */
- int sx = 0;
- int ex;
- while (sx < width) {
- /* find start pixel */
- for (;onBuf[sx] == 0 && sx < width;sx++);
- if (sx >= width) break;
- /* find end pixel */
- for (ex = sx+1;onBuf[ex] != 0 && ex < width;ex++);
- int n = ex-sx;
- Guchar *bp;
- int ns;
-
- switch (colorMode) {
- case splashModeMono1:
- case splashModeMono8:
- bp = lineBuf+sx;
- ns = n;
- break;
- case splashModeRGB8:
- bp = lineBuf+sx*3;
- ns = n*3;
- break;
- default:
- OPRS::error("Image: no supported color mode\n");
- result = splashErrOPVP;
- goto err1;
- break;
- }
- ns = (ns+3)/4;
- ns *= 4;
-
- OPVP_i2Fix(xMin+sx,(opvpx));
- OPVP_i2Fix(yMin+y,(opvpy));
- if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
- OPRS::error("SetCurrentPoint error\n");
- result = splashErrOPVP;
- goto err1;
- }
- OPVP_i2Fix(n,opvprect.p1.x);
- OPVP_i2Fix(1,opvprect.p1.y);
- /* canonlisp driver use CTM only, ignores currentPoint */
- /* So, set start point to CTM */
- opvpctm.e = xMin+sx;
- opvpctm.f = yMin+y;
- if (opvp->SetCTM(&opvpctm) < 0) {
- OPRS::error("SetCTM error\n");
- }
-
- if (opvp->DrawImage(n,1,ns,OPVP_IFORMAT_RAW,
- n,1,(void *)(bp)) < 0) {
- OPRS::error("DrawImage error\n");
- result = splashErrOPVP;
- goto err1;
- }
-
- /* reset CTM */
- opvpctm.e = 0.0;
- opvpctm.f = 0.0;
- if (opvp->SetCTM(&opvpctm) < 0) {
- OPRS::error("SetCTM error\n");
- }
-
- sx = ex+1;
- }
- }
-
-
-err1:
- delete clip;
- gfree(pixBuf);
- gfree(lineBuf);
- gfree(onBuf);
- return result;
-}
-
-void OPVPSplash::setColorMode(int colorModeA)
-{
- colorMode = colorModeA;
-}
-
-void OPVPSplash::drawSpan(int x0, int x1, int y, GBool noClip)
-{
- int s,e;
- opvp_point_t points[1];
- opvp_fix_t opvpx, opvpy;
- SplashCoord *savedLineDash = 0;
- int savedLineDashLength;
- SplashCoord savedLineDashPhase;
- SplashCoord savedLineWidth;
- GBool noSpan;
-
-
- if (opvp->NewPath() < 0) {
- OPRS::error("NewPath error\n");
- return;
- }
- if (noClip) {
- noSpan = gFalse;
- OPVP_i2Fix(x0,opvpx);
- OPVP_i2Fix(y,opvpy);
- if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
- OPRS::error("SetCurrentPoint error\n");
- return;
- }
- OPVP_i2Fix(x1+1,points[0].x);
- OPVP_i2Fix(y,points[0].y);
- if (opvp->LinePath(OPVP_PATHOPEN,1,points) < 0) {
- OPRS::error("LinePath error\n");
- return;
- }
- } else {
- noSpan = gTrue;
- s = x0;
- while (s < x1) {
- /* find start point */
- for (;s < x1;s++) {
- if (state->clip->test(s, y)) break;
- }
- if (s < x1) {
- /* start point was found */
- /* then find end point */
- for (e = s+1;e < x1;e++) {
- if (!state->clip->test(e, y)) break;
- }
- /* do make span */
- noSpan = gFalse;
- OPVP_i2Fix(s,opvpx);
- OPVP_i2Fix(y,opvpy);
- if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
- OPRS::error("SetCurrentPoint error\n");
- return;
- }
- OPVP_i2Fix(e,points[0].x);
- OPVP_i2Fix(y,points[0].y);
- if (opvp->LinePath(OPVP_PATHOPEN,1,points) < 0) {
- OPRS::error("LinePath error\n");
- return;
- }
- s = e;
- }
- }
- }
- if (opvp->EndPath() < 0) {
- OPRS::error("EndPath error\n");
- return;
- }
- if (noSpan) return;
- /* change lins style temporarily */
- savedLineDashLength = state->lineDashLength;
- savedLineDashPhase = state->lineDashPhase;
- if (savedLineDashLength > 0 && state->lineDash != 0) {
- savedLineDash = new SplashCoord[savedLineDashLength];
- memcpy(savedLineDash, state->lineDash,
- savedLineDashLength*sizeof(SplashCoord));
- }
- setLineDash(0,0,0);
- savedLineWidth = state->lineWidth;
- setLineWidth(0.0);
-
- if (opvp->StrokePath() < 0) {
- OPRS::error("StrokePath error\n");
- return;
- }
-
- /* restore line style */
- setLineDash(savedLineDash,savedLineDashLength,
- savedLineDashPhase);
- if (savedLineDash != 0) {
- delete[] savedLineDash;
- }
- setLineWidth(savedLineWidth);
-}
-
-/*
- draw pixel with StrokePath
- color is stroke color
-*/
-void OPVPSplash::drawPixel(int x, int y, GBool noClip)
-{
- opvp_point_t points[1];
- opvp_fix_t opvpx, opvpy;
-
- if (noClip || state->clip->test(x, y)) {
- if (opvp->NewPath() < 0) {
- OPRS::error("NewPath error\n");
- return;
- }
- OPVP_i2Fix(x,opvpx);
- OPVP_i2Fix(y,opvpy);
- if (opvp->SetCurrentPoint(opvpx,opvpy) < 0) {
- OPRS::error("NewPath error\n");
- return;
- }
- OPVP_i2Fix(x+1,points[0].x);
- OPVP_i2Fix(y,points[0].y);
- if (opvp->LinePath(OPVP_PATHOPEN,1,points) < 0) {
- OPRS::error("LinePath error\n");
- return;
- }
- if (opvp->EndPath() < 0) {
- OPRS::error("EndPath error\n");
- return;
- }
- if (opvp->StrokePath() < 0) {
- OPRS::error("StrokePath error\n");
- return;
- }
- }
-}
-
-const char *OPVPSplash::getOption(const char *key, int nOptions,
- const char *optionKeys[], const char *optionVals[])
-{
- int i;
-
- for (i = 0;i < nOptions;i++) {
- if (strcmp(key,optionKeys[i]) == 0) {
- return optionVals[i];
- }
- }
- return 0;
-}
-
-void OPVPSplash::endPage()
-{
- if (clipPath != 0) {
- delete clipPath;
- clipPath = 0;
- }
-}
-
-void OPVPSplash::restoreAllDriverState()
-{
- for (;saveDriverStateCount > 0;saveDriverStateCount--) {
- opvp->RestoreGS();
- }
-}
-
-SplashCoord *OPVPSplash::getMatrix()
-{
- return state->matrix;
-}
-
-OPVPClipPath *OPVPClipPath::stackTop = 0;
-
-OPVPClipPath::OPVPClipPath(OPVPSplashPath *pathA, GBool eoA)
-{
- path = pathA;
- eo = eoA;
- next = 0;
- saved = gFalse;
-}
-
-void OPVPClipPath::push()
-{
- OPVPClipPath *p;
-
- p = stackTop;
- stackTop = copy();
- stackTop->next = p;
- saved = gTrue;
-}
-
-OPVPClipPath *OPVPClipPath::pop() {
- OPVPClipPath *p = stackTop;
- if (stackTop != 0) stackTop = stackTop->next;
- return p;
-}
-
-OPVPClipPath *OPVPClipPath::copy()
-{
- OPVPClipPath *p;
-
- p = new OPVPClipPath(path->copy(),eo);
- p->saved = saved;
- return p;
-}
diff --git a/filter/pdftoopvp/oprs/OPVPSplash.h b/filter/pdftoopvp/oprs/OPVPSplash.h
deleted file mode 100644
index 525d3c3..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplash.h
+++ /dev/null
@@ -1,244 +0,0 @@
-//========================================================================
-//
-// OPVPSplash.h
-//
-//========================================================================
-
-#ifndef OPVPSPLASH_H
-#define OPVPSPLASH_H
-
-#include <config.h>
-
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
-#include <typeinfo>
-#include "splash/SplashTypes.h"
-#include "splash/SplashPattern.h"
-#include "splash/SplashErrorCodes.h"
-#include "OPVPSplashPath.h"
-#include "OPVPWrapper.h"
-#include "CharTypes.h"
-
-/* extra error code */
-#define splashErrOPVP 100
-
-#define OPVP_MAX_CLIPPATH_LENGTH 2000
-#define OPVP_MAX_FILLPATH_LENGTH 4000
-#define OPVP_BITMAPCHAR_THRESHOLD 2000
-#define OPVP_ROP_SRCCOPY 0xCC
-#define OPVP_ROP_S 0xCC
-#define OPVP_ROP_P 0xF0
-#define OPVP_ROP_PSDPxax 0xB8
-#define OPVP_ROP_DSPDxax 0xE2
-
-class SplashBitmap;
-class SplashGlyphBitmap;
-class OPVPSplashState;
-class SplashPattern;
-class SplashScreen;
-class OPVPSplashPath;
-class OPVPSplashXPath;
-class OPVPSplashClip;
-class SplashFont;
-
-class OPVPClipPath {
-public:
- OPVPClipPath(OPVPSplashPath *pathA, GBool eoA);
- void push();
- static OPVPClipPath *pop();
- ~OPVPClipPath() { delete path; }
- OPVPSplashPath *getPath() { return path; }
- GBool getEo() { return eo; }
- GBool getSaved() { return saved; }
-private:
- OPVPClipPath *copy();
- OPVPClipPath *next;
- OPVPSplashPath *path;
- GBool eo;
- GBool saved;
- static OPVPClipPath *stackTop;
-};
-
-//------------------------------------------------------------------------
-// Splash
-//------------------------------------------------------------------------
-
-class OPVPSplash {
-public:
-
- // Create a new rasterizer object.
- OPVPSplash(OPVPWrapper *opvpA,
- int nOptions, const char *optionKeys[], const char *optionVals[]);
-
- virtual ~OPVPSplash();
-
- //----- state read
-
- SplashPattern *getStrokePattern();
- SplashPattern *getFillPattern();
- SplashScreen *getScreen();
- SplashCoord getLineWidth();
- int getLineCap();
- int getLineJoin();
- SplashCoord getMiterLimit();
- SplashCoord getFlatness();
- SplashCoord *getLineDash();
- int getLineDashLength();
- SplashCoord getLineDashPhase();
- OPVPSplashClip *getClip();
-
- //----- state write
-
- void setStrokePattern(SplashPattern *strokeColor);
- void setFillPattern(SplashPattern *fillColor);
- void setScreen(SplashScreen *screen);
- void setLineWidth(SplashCoord lineWidth);
- void setLineCap(int lineCap);
- void setLineJoin(int lineJoin);
- void setMiterLimit(SplashCoord miterLimit);
- void setFlatness(SplashCoord flatness);
- // the <lineDash> array will be copied
- void setLineDash(SplashCoord *lineDash, int lineDashLength,
- SplashCoord lineDashPhase);
- void clipResetToRect(SplashCoord x0, SplashCoord y0,
- SplashCoord x1, SplashCoord y1);
- SplashError clipToPath(OPVPSplashPath *path, GBool eo);
-
- //----- state save/restore
-
- void saveState();
- SplashError restoreState();
- void restoreAllDriverState();
-
- //----- drawing operations
-
- // Fill the bitmap with <color>. This is not subject to clipping.
- void clear(SplashColor color);
-
- // Stroke a path using the current stroke pattern.
- SplashError stroke(OPVPSplashPath *path);
-
- // Fill a path using the current fill pattern.
- SplashError fill(OPVPSplashPath *path, GBool eo);
-
- // Draw a character, using the current fill pattern.
- SplashError fillChar(SplashCoord x, SplashCoord y, int c,
- SplashFont *font, Unicode *u, double *fontMat);
-
- // Draw a glyph, using the current fill pattern. This function does
- // not free any data, i.e., it ignores glyph->freeData.
- // not used in vector mode
- void fillGlyph(SplashCoord x, SplashCoord y,
- SplashGlyphBitmap *glyph);
-
- // Draws an image mask using the fill color. This will read <w>*<h>
- // pixels from <src>, in raster order, starting with the top line.
- // "1" pixels will be drawn with the current fill color; "0" pixels
- // are transparent. The matrix:
- // [ mat[0] mat[1] 0 ]
- // [ mat[2] mat[3] 0 ]
- // [ mat[4] mat[5] 1 ]
- // maps a unit square to the desired destination for the image, in
- // PostScript style:
- // [x' y' 1] = [x y 1] * mat
- // Note that the Splash y axis points downward, and the image source
- // is assumed to produce pixels in raster order, starting from the
- // top line.
- SplashError fillImageMask(SplashImageMaskSource src, void *srcData,
- int w, int h, SplashCoord *mat, GBool glyphMode);
-
- // Draw an image. This will read <w>*<h> pixels from <src>, in
- // raster order, starting with the top line. These pixels are
- // assumed to be in the source mode, <srcMode>. The following
- // combinations of source and target modes are supported:
- // source target
- // ------ ------
- // Mono1 Mono1
- // Mono8 Mono1 -- with dithering
- // Mono8 Mono8
- // RGB8 RGB8
- // BGR8packed BGR8Packed
- // The matrix behaves as for fillImageMask.
- SplashError drawImage(SplashImageSource src, void *srcData,
- SplashColorMode srcMode, GBool srcAlpha,
- int w, int h, SplashCoord *mat);
-
- //~ drawMaskedImage
-
- //----- misc
-
- // Return the associated bitmap.
- SplashBitmap *getBitmap() { return 0; }
-
- // Toggle debug mode on or off.
- void setDebugMode(GBool debugModeA) { debugMode = debugModeA; }
-
- void setColorMode(int colorModeA);
- void setStateBypass(GBool bypass) {stateBypass = bypass;}
- void endPage();
- SplashCoord *getMatrix();
- void drawSpan(int x0, int x1, int y, GBool noClip);
-#ifdef OLD_DRAW_IMAGE
- void drawPixel(int x, int y, SplashColor *color, GBool noClip);
-#endif
- void drawPixel(int x, int y, GBool noClip);
- void arcToCurve(SplashCoord x0, SplashCoord y0,
- SplashCoord x3, SplashCoord y3,
- SplashCoord cx, SplashCoord cy, SplashCoord *rx1, SplashCoord *ry1,
- SplashCoord *rx2, SplashCoord *ry2);
-
-private:
- void makeBrush(SplashPattern *pattern, opvp_brush_t *brush);
- SplashError doClipPath(OPVPSplashPath *path, GBool eo,
- OPVPClipPath *prevClip);
- opvp_cspace_t getOPVPColorSpace();
- GBool equalPattern(SplashPattern *pt1, SplashPattern *pt2);
- SplashError makeRectanglePath(SplashCoord x0, SplashCoord y0,
- SplashCoord x1, SplashCoord y1, OPVPSplashPath **p);
- SplashError drawImageFastWithCTM(SplashImageSource src, void *srcData,
- int w, int h, int tx, int ty,
- SplashCoord *mat);
- SplashError drawImageNotShear(SplashImageSource src,
- void *srcData,
- int w, int h,
- int tx, int ty,
- int scaledWidth, int scaledHeight,
- int xSign, int ySign, GBool rot);
- SplashError fillImageMaskFastWithCTM(SplashImageMaskSource src,
- void *srcData, int w, int h, int tx, int ty,SplashCoord *mat);
- SplashError strokeByMyself(OPVPSplashPath *path);
- SplashError fillByMyself(OPVPSplashPath *path, GBool eo);
- OPVPSplashXPath *makeDashedPath(OPVPSplashXPath *xPath);
- void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi,
- SplashCoord *xo, SplashCoord *yo);
-
- const char *getOption(const char *key, int nOptions, const char *optionKeys[],
- const char *optionVals[]);
-
- OPVPWrapper *opvp;
- int printerContext;
-
- OPVPSplashState *state;
- GBool debugMode;
- int colorMode;
- GBool stateBypass;
- OPVPClipPath *clipPath;
-
- GBool oldLipsDriver;
- GBool clipPathNotSaved;
- GBool noShearImage;
- GBool noLineStyle;
- GBool noClipPath;
- GBool noMiterLimit;
- GBool ignoreMiterLimit;
- GBool savedNoClipPath;
- GBool noImageMask;
- int bitmapCharThreshold;
- int maxClipPathLength;
- int maxFillPathLength;
- int saveDriverStateCount;
-};
-
-#endif
diff --git a/filter/pdftoopvp/oprs/OPVPSplashClip.cxx b/filter/pdftoopvp/oprs/OPVPSplashClip.cxx
deleted file mode 100644
index c9d2e83..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplashClip.cxx
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <config.h>
-#include "splash/SplashXPathScanner.h"
-#include "OPVPSplashClip.h"
-
-void OPVPSplashClip::getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA)
-{
- int i;
- int cxMin = splashRound(xMin), cyMin = splashRound(yMin);
- int cxMax = splashRound(xMax), cyMax = splashRound(yMax);
- int txMin, tyMin, txMax, tyMax;
-
- for (i = 0; i < length; ++i) {
- scanners[i]->getBBox(&txMin,&tyMin,&txMax,&tyMax);
- if (txMin > cxMin) cxMin = txMin;
- if (tyMin > cyMin) cyMin = tyMin;
- if (txMax < cxMax) cxMax = txMax;
- if (tyMax < cyMax) cyMax = tyMax;
- }
- *xMinA = cxMin;
- *yMinA = cyMin;
- *xMaxA = cxMax;
- *yMaxA = cyMax;
-}
-
-OPVPSplashPath *OPVPSplashClip::makePath()
-{
- int i,j;
- int y, x0, x1;
- int txMin, tyMin, txMax, tyMax;
- int tsxMin, tsyMin, tsxMax, tsyMax;
- Guchar *cbuf,*tbuf;
- int blen;
- OPVPSplashPath *p = new OPVPSplashPath();
-
- getBBox(&txMin,&tyMin,&txMax,&tyMax);
- if (txMin > txMax || tyMin > tyMax) return p;
- blen = txMax-txMin+1;
- cbuf = new Guchar[blen];
- tbuf = new Guchar[blen];
-
- /* dummy call to clear state */
- scanners[0]->getBBox(&tsxMin,&tsyMin,&tsxMax,&tsyMax);
- scanners[0]->getNextSpan(tsyMin-2,&x0,&x1);
-
- for (y = tyMin;y <= tyMax;y++) {
- /* clear buffer */
- for (i = 0;i < blen;i++) {
- cbuf[i] = 0;
- }
- while (scanners[0]->getNextSpan(y,&x0,&x1)) {
- if (x0 < txMin) x0 = txMin;
- if (x1 > txMax) x1 = txMax;
- for (i = x0;i < x1;i++) {
- cbuf[i-txMin] = 1;
- }
- }
- for (j = 1; j < length; ++j) {
- /* clear buffer */
- for (i = 0;i < blen;i++) {
- tbuf[i] = 0;
- }
- while (scanners[j]->getNextSpan(y,&x0,&x1)) {
- if (x0 < txMin) x0 = txMin;
- if (x1 > txMax) x1 = txMax;
- for (i = x0;i < x1;i++) {
- tbuf[i-txMin] = 1;
- }
- }
- /* and buffer */
- for (i = 0;i < blen;i++) {
- cbuf[i] &= tbuf[i];
- }
- }
- /* scan buffer and add path */
- for (i = 0;i < blen;i = j) {
- if (cbuf[i] != 0) {
- p->moveTo(i+txMin,y);
- for (j = i+1;j < blen && cbuf[j] != 0;j++);
- p->lineTo(j-1+txMin,y);
- p->lineTo(j-1+txMin,y+1);
- p->lineTo(i+txMin,y+1);
- p->close();
- } else {
- j = i+1;
- }
- }
- }
- delete[] cbuf;
- delete[] tbuf;
- return p;
-}
diff --git a/filter/pdftoopvp/oprs/OPVPSplashClip.h b/filter/pdftoopvp/oprs/OPVPSplashClip.h
deleted file mode 100644
index d531fca..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplashClip.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef OPVPSPLASHCLIP_H
-#define OPVPSPLASHCLIP_H
-
-#include "splash/SplashClip.h"
-#include "OPVPSplashPath.h"
-
-class OPVPSplashClip : public SplashClip {
-public:
-
- OPVPSplashClip(SplashCoord x0, SplashCoord y0,
- SplashCoord x1, SplashCoord y1,
- GBool antialiasA) :
- SplashClip(x0,y0,x1,y1,antialiasA) {
- }
-
- OPVPSplashClip(SplashClip *sclip) : SplashClip(sclip) {
- }
-
- OPVPSplashClip *copy() { return new OPVPSplashClip(this); }
-
- ~OPVPSplashClip() {}
-
- void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA);
- OPVPSplashPath *makePath();
-private:
- OPVPSplashClip(OPVPSplashClip *clip) : SplashClip(clip) {
- }
-};
-
-#endif
diff --git a/filter/pdftoopvp/oprs/OPVPSplashPath.cxx b/filter/pdftoopvp/oprs/OPVPSplashPath.cxx
deleted file mode 100644
index 5779dce..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplashPath.cxx
+++ /dev/null
@@ -1,185 +0,0 @@
-#include <config.h>
-#include <stdio.h>
-#include "splash/SplashMath.h"
-#include "OPVPSplashPath.h"
-#include "OPVPWrapper.h"
-#include "OPRS.h"
-
-void OPVPSplashPath::getBBox(int *xMinA, int *yMinA, int *xMaxA,
- int *yMaxA)
-{
- int i;
- SplashCoord xMin, yMin, xMax, yMax;
-
- if (length <= 0) {
- /* return far away point */
- *xMinA = *yMinA = *xMaxA = *yMaxA = 0xC0000000;
- return;
- }
- xMin = xMax = pts[0].x;
- yMin = yMax = pts[0].y;
- for (i = 1;i < length;i++) {
- if (pts[i].x > xMax) {
- xMax = pts[i].x;
- } else if (pts[i].x < xMin) {
- xMin = pts[i].x;
- }
- if (pts[i].y > yMax) {
- yMax = pts[i].y;
- } else if (pts[i].y < yMin) {
- yMin = pts[i].y;
- }
- }
- *xMinA = splashRound(xMin);
- *xMaxA = splashRound(xMax);
- *yMinA = splashRound(yMin);
- *yMaxA = splashRound(yMax);
-}
-
-GBool OPVPSplashPath::isRectanglePath(
- SplashCoord *xMin, SplashCoord *yMin, SplashCoord *xMax, SplashCoord *yMax)
-{
- if (length != 5
- || pts[0].x != pts[4].x
- || pts[0].y != pts[4].y
- || flags[0] != (splashPathFirst | splashPathClosed)
- || flags[1] != 0
- || flags[2] != 0
- || flags[3] != 0
- || flags[4] != (splashPathLast | splashPathClosed)) {
- return gFalse;
- }
- if (splashRound(pts[0].x) == splashRound(pts[1].x)) {
- if (splashRound(pts[1].y) != splashRound(pts[2].y)
- || splashRound(pts[2].x) != splashRound(pts[3].x)
- || splashRound(pts[3].y) != splashRound(pts[4].y)) {
- return gFalse;
- }
- } else if (splashRound(pts[0].y) == splashRound(pts[1].y)) {
- if (splashRound(pts[1].x) != splashRound(pts[2].x)
- || splashRound(pts[2].y) != splashRound(pts[3].y)
- || splashRound(pts[3].x) != splashRound(pts[4].x)) {
- return gFalse;
- }
- } else {
- return gFalse;
- }
- *xMin = pts[0].x;
- *yMin = pts[0].y;
- *xMax = pts[2].x;
- *yMax = pts[2].y;
- if (*xMin > *xMax) {
- SplashCoord t = *xMin;
-
- *xMin = *xMax;
- *xMax = t;
- }
- if (*yMin > *yMax) {
- SplashCoord t = *yMin;
-
- *yMin = *yMax;
- *yMax = t;
- }
- return gTrue;
-}
-
-SplashError OPVPSplashPath::makePath(OPVPWrapper *opvp)
-{
- int i,j;
- opvp_fix_t x,y;
-
- if (opvp->NewPath() < 0) {
- OPRS::error("NewPath error\n");
- return splashErrOPVP;
- }
- for (i = 0;i < length;i = j) {
- int curve = 0;
- int n;
- opvp_point_t *points;
- int k;
-
- if ((flags[i] & splashPathFirst) != 0) {
- /* first point of a subpath */
- if ((flags[i] & splashPathLast) == 0
- || (flags[i] & splashPathClosed) != 0) {
- OPVP_F2FIX((pts[i].x),(x));
- OPVP_F2FIX((pts[i].y),(y));
- if (opvp->SetCurrentPoint(x,y) < 0) {
- OPRS::error("SetCurrentPoint error\n");
- return splashErrOPVP;
- }
- }
- j = i+1;
- continue;
- }
- if (i+2 < length && flags[i] == splashPathCurve) {
- /* curve */
- curve = 1;
- for (j = i;j+2 < length
- && flags[j] == splashPathCurve;j += 3);
- } else {
- curve = 0;
- for (j = i;j < length
- && (flags[j] & splashPathCurve) == 0
- && (flags[j] & splashPathFirst) == 0;j++);
- }
-
- n = j-i;
- points = new opvp_point_t[n];
- /* copy points */
- for (k = i; k < j;k++) {
- OPVP_F2FIX((pts[k].x),(points[k-i].x));
- OPVP_F2FIX((pts[k].y),(points[k-i].y));
- }
-
- if (curve) {
- /* curve */
- if (opvp->BezierPath(n,points) < 0) {
- OPRS::error("BezierPath error\n");
- return splashErrOPVP;
- }
- } else {
- /* line */
- GBool closed = (flags[j-1] & splashPathClosed) != 0;
-
- if (closed) {
- if (opvp->LinePath(OPVP_PATHCLOSE,
- n,points) < 0) {
- OPRS::error("LinePath error\n");
- return splashErrOPVP;
- }
- } else {
- if (opvp->LinePath(OPVP_PATHOPEN,
- n,points) < 0) {
- OPRS::error("LinePath error\n");
- return splashErrOPVP;
- }
- }
- }
- delete[] points;
- }
- if (opvp->EndPath() < 0) {
- OPRS::error("EndPath error\n");
- return splashErrOPVP;
- }
- return splashOk;
-}
-
-void OPVPSplashPath::closeAllSubPath()
-{
- int i;
- int f = 0;
-
- for (i = 0;i < length;i++) {
- if ((flags[i] & splashPathFirst) != 0) {
- f = i;
- }
- if ((flags[i] & splashPathLast) != 0) {
- if (pts[f].x == pts[i].x
- && pts[f].y == pts[i].y) {
- flags[f] |= splashPathClosed;
- flags[i] |= splashPathClosed;
- }
- }
- }
-}
diff --git a/filter/pdftoopvp/oprs/OPVPSplashPath.h b/filter/pdftoopvp/oprs/OPVPSplashPath.h
deleted file mode 100644
index d8a3b23..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplashPath.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef OPVPSPLASHPATH_H
-#define OPVPSPLASHPATH_H
-
-#include "splash/SplashPath.h"
-#include "OPVPWrapper.h"
-
-class OPVPSplashPath : public SplashPath {
-public:
-
- OPVPSplashPath() {};
-
- OPVPSplashPath(SplashPath *spath) : SplashPath(spath) {
- }
-
- // Copy a path.
- OPVPSplashPath *copy() { return new OPVPSplashPath(this); }
-
- void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA);
- GBool isRectanglePath(SplashCoord *xMin, SplashCoord *yMin,
- SplashCoord *xMax, SplashCoord *yMax);
- SplashError makePath(OPVPWrapper *opvp);
- void closeAllSubPath();
-private:
- OPVPSplashPath(OPVPSplashPath *path) : SplashPath(path) {
- }
-};
-
-#endif
diff --git a/filter/pdftoopvp/oprs/OPVPSplashState.cxx b/filter/pdftoopvp/oprs/OPVPSplashState.cxx
deleted file mode 100644
index 99d8150..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplashState.cxx
+++ /dev/null
@@ -1,183 +0,0 @@
-//========================================================================
-//
-// SplashState.cc
-//
-//========================================================================
-
-#include <config.h>
-
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
-#include <string.h>
-#ifdef HAVE_CPP_POPPLER_VERSION_H
-#include "cpp/poppler-version.h"
-#endif
-#include "goo/gmem.h"
-#include "splash/SplashPattern.h"
-#include "splash/SplashScreen.h"
-#include "splash/SplashBitmap.h"
-#include "splash/SplashState.h"
-#include "OPVPSplashState.h"
-#include "OPVPSplashClip.h"
-
-//------------------------------------------------------------------------
-// SplashState
-//------------------------------------------------------------------------
-
-// number of components in each color mode
-static int opvpSplashColorModeNComps[] = {
- 1, 1, 3, 3, 4
-};
-
-OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
- SplashScreenParams *screenParams) {
- SplashColor color;
-
- matrix[0] = 1; matrix[1] = 0;
- matrix[2] = 0; matrix[3] = 1;
- matrix[4] = 0; matrix[5] = 0;
- memset(&color, 0, sizeof(SplashColor));
- strokePattern = new SplashSolidColor(color);
- fillPattern = new SplashSolidColor(color);
- screen = new SplashScreen(screenParams);
- blendFunc = NULL;
- strokeAlpha = 1;
- fillAlpha = 1;
- lineWidth = 0;
- lineCap = splashLineCapButt;
- lineJoin = splashLineJoinMiter;
- miterLimit = 10;
- flatness = 1;
- lineDash = NULL;
- lineDashLength = 0;
- lineDashPhase = 0;
- strokeAdjust = gFalse;
- clip = new OPVPSplashClip(0, 0, width - 0.001,
- height - 0.001, vectorAntialias);
- softMask = NULL;
- deleteSoftMask = gFalse;
- inNonIsolatedGroup = gFalse;
- next = NULL;
-}
-
-OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
- SplashScreen *screenA) {
- SplashColor color;
-
- matrix[0] = 1; matrix[1] = 0;
- matrix[2] = 0; matrix[3] = 1;
- matrix[4] = 0; matrix[5] = 0;
- memset(&color, 0, sizeof(SplashColor));
- strokePattern = new SplashSolidColor(color);
- fillPattern = new SplashSolidColor(color);
- screen = screenA->copy();
- blendFunc = NULL;
- strokeAlpha = 1;
- fillAlpha = 1;
- lineWidth = 0;
- lineCap = splashLineCapButt;
- lineJoin = splashLineJoinMiter;
- miterLimit = 10;
- flatness = 1;
- lineDash = NULL;
- lineDashLength = 0;
- lineDashPhase = 0;
- strokeAdjust = gFalse;
- clip = new OPVPSplashClip(0, 0, width - 0.001,
- height - 0.001, vectorAntialias);
- softMask = NULL;
- deleteSoftMask = gFalse;
- inNonIsolatedGroup = gFalse;
- next = NULL;
-}
-
-OPVPSplashState::OPVPSplashState(OPVPSplashState *state) {
- memcpy(matrix, state->matrix, 6 * sizeof(SplashCoord));
- strokePattern = state->strokePattern->copy();
- fillPattern = state->fillPattern->copy();
- screen = state->screen->copy();
- blendFunc = state->blendFunc;
- strokeAlpha = state->strokeAlpha;
- fillAlpha = state->fillAlpha;
- lineWidth = state->lineWidth;
- lineCap = state->lineCap;
- lineJoin = state->lineJoin;
- miterLimit = state->miterLimit;
- flatness = state->flatness;
- if (state->lineDash) {
- lineDashLength = state->lineDashLength;
- lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
- memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord));
- } else {
- lineDash = NULL;
- lineDashLength = 0;
- }
- lineDashPhase = state->lineDashPhase;
- strokeAdjust = state->strokeAdjust;
- clip = state->clip->copy();
- softMask = state->softMask;
- deleteSoftMask = gFalse;
- inNonIsolatedGroup = state->inNonIsolatedGroup;
- next = NULL;
-}
-
-OPVPSplashState::~OPVPSplashState() {
- delete strokePattern;
- delete fillPattern;
- delete screen;
- gfree(lineDash);
- delete clip;
- if (deleteSoftMask && softMask) {
- delete softMask;
- }
-}
-
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
-void OPVPSplashState::setState(Splash *osplash) {
- osplash->setMatrix(matrix);
- osplash->setFlatness(flatness);
- osplash->setLineDash(lineDash,lineDashLength,lineDashPhase);
- osplash->setLineCap(lineCap);
- osplash->setStrokeAdjust(strokeAdjust);
- osplash->setMiterLimit(miterLimit);
- osplash->setLineJoin(lineJoin);
-}
-#endif
-
-void OPVPSplashState::setStrokePattern(SplashPattern *strokePatternA) {
- delete strokePattern;
- strokePattern = strokePatternA;
-}
-
-void OPVPSplashState::setFillPattern(SplashPattern *fillPatternA) {
- delete fillPattern;
- fillPattern = fillPatternA;
-}
-
-void OPVPSplashState::setScreen(SplashScreen *screenA) {
- delete screen;
- screen = screenA;
-}
-
-void OPVPSplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
- SplashCoord lineDashPhaseA) {
- gfree(lineDash);
- lineDashLength = lineDashLengthA;
- if (lineDashLength > 0) {
- lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
- memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord));
- } else {
- lineDash = NULL;
- }
- lineDashPhase = lineDashPhaseA;
-}
-
-void OPVPSplashState::setSoftMask(SplashBitmap *softMaskA) {
- if (deleteSoftMask) {
- delete softMask;
- }
- softMask = softMaskA;
- deleteSoftMask = gTrue;
-}
diff --git a/filter/pdftoopvp/oprs/OPVPSplashState.h b/filter/pdftoopvp/oprs/OPVPSplashState.h
deleted file mode 100644
index 9cb16db..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplashState.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//========================================================================
-//
-// OPVPSplashState.h
-//
-//========================================================================
-
-#ifndef OPVPSPLASHSTATE_H
-#define OPVPSPLASHSTATE_H
-
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
-#ifdef HAVE_CPP_POPPLER_VERSION_H
-#include "cpp/poppler-version.h"
-#endif
-#include "splash/SplashTypes.h"
-#include "splash/SplashState.h"
-#include "splash/Splash.h"
-
-class SplashPattern;
-class SplashScreen;
-class OPVPSplashClip;
-class SplashBitmap;
-
-//------------------------------------------------------------------------
-// SplashState
-//------------------------------------------------------------------------
-
-class OPVPSplashState {
-public:
-
- // Create a new state object, initialized with default settings.
- OPVPSplashState(int width, int height, GBool vectorAntialias,
- SplashScreenParams *screenParams);
- OPVPSplashState(int width, int height, GBool vectorAntialias,
- SplashScreen *screenA);
-
- // Copy a state object.
- OPVPSplashState *copy() { return new OPVPSplashState(this); }
-
- ~OPVPSplashState();
-
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- void setState(Splash *osplash);
-#endif
-
- // Set the stroke pattern. This does not copy <strokePatternA>.
- void setStrokePattern(SplashPattern *strokePatternA);
-
- // Set the fill pattern. This does not copy <fillPatternA>.
- void setFillPattern(SplashPattern *fillPatternA);
-
- // Set the screen. This does not copy <screenA>.
- void setScreen(SplashScreen *screenA);
-
- // Set the line dash pattern. This copies the <lineDashA> array.
- void setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
- SplashCoord lineDashPhaseA);
-
- // Set the soft mask bitmap.
- void setSoftMask(SplashBitmap *softMaskA);
-
-private:
-
- OPVPSplashState(OPVPSplashState *state);
-
- SplashCoord matrix[6];
- SplashPattern *strokePattern;
- SplashPattern *fillPattern;
- SplashScreen *screen;
- SplashBlendFunc blendFunc;
- SplashCoord strokeAlpha;
- SplashCoord fillAlpha;
- SplashCoord lineWidth;
- int lineCap;
- int lineJoin;
- SplashCoord miterLimit;
- SplashCoord flatness;
- SplashCoord *lineDash;
- int lineDashLength;
- SplashCoord lineDashPhase;
- GBool strokeAdjust;
- OPVPSplashClip *clip;
- SplashBitmap *softMask;
- GBool deleteSoftMask;
- GBool inNonIsolatedGroup;
-
- OPVPSplashState *next; // used by OPVPSplash class
-
- friend class OPVPSplash;
- friend class OPVPSplashXPath;
-};
-
-#endif
diff --git a/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx b/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
deleted file mode 100644
index 7a6f429..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx
+++ /dev/null
@@ -1,426 +0,0 @@
-#include <config.h>
-#include <stdio.h>
-#ifdef HAVE_CPP_POPPLER_VERSION_H
-#include "cpp/poppler-version.h"
-#endif
-#include "splash/Splash.h"
-#include "splash/SplashMath.h"
-#include "OPVPSplashClip.h"
-#include "OPVPSplashXPath.h"
-#include "OPVPWrapper.h"
-#include "OPVPSplash.h"
-
-#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 19
-OPVPSplashXPath *OPVPSplashXPath::makeDashedPath(OPVPSplashState *state)
-{
- OPVPSplashXPath *dPath;
- GBool lineDashStartOn, lineDashOn;
- GBool atSegStart, atSegEnd, atDashStart, atDashEnd;
- int lineDashStartIdx, lineDashIdx, subpathStart;
- SplashCoord lineDashTotal, lineDashStartPhase, lineDashDist;
- int segIdx;
- SplashXPathSeg *seg;
- SplashCoord sx0, sy0, sx1, sy1, ax0, ay0, ax1, ay1, dist;
- int i;
-
- dPath = new OPVPSplashXPath();
-
- lineDashTotal = 0;
- for (i = 0; i < state->lineDashLength; ++i) {
- lineDashTotal += state->lineDash[i];
- }
- lineDashStartPhase = state->lineDashPhase;
- i = splashFloor(lineDashStartPhase / lineDashTotal);
- lineDashStartPhase -= i * lineDashTotal;
- lineDashStartOn = gTrue;
- lineDashStartIdx = 0;
- while (lineDashStartPhase >= state->lineDash[lineDashStartIdx]) {
- lineDashStartOn = !lineDashStartOn;
- lineDashStartPhase -= state->lineDash[lineDashStartIdx];
- ++lineDashStartIdx;
- }
-
- segIdx = 0;
- seg = segs;
- sx0 = seg->x0;
- sy0 = seg->y0;
- sx1 = seg->x1;
- sy1 = seg->y1;
- dist = splashDist(sx0, sy0, sx1, sy1);
- lineDashOn = lineDashStartOn;
- lineDashIdx = lineDashStartIdx;
- lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase;
- atSegStart = gTrue;
- atDashStart = gTrue;
- subpathStart = dPath->length;
-
- while (segIdx < length) {
-
- ax0 = sx0;
- ay0 = sy0;
- if (dist <= lineDashDist) {
- ax1 = sx1;
- ay1 = sy1;
- lineDashDist -= dist;
- dist = 0;
- atSegEnd = gTrue;
- atDashEnd = lineDashDist == 0 || (seg->flags & splashXPathLast);
- } else {
- ax1 = sx0 + (lineDashDist / dist) * (sx1 - sx0);
- ay1 = sy0 + (lineDashDist / dist) * (sy1 - sy0);
- sx0 = ax1;
- sy0 = ay1;
- dist -= lineDashDist;
- lineDashDist = 0;
- atSegEnd = gFalse;
- atDashEnd = gTrue;
- }
-
- if (lineDashOn) {
- dPath->addSegment(ax0, ay0, ax1, ay1,
- atDashStart, atDashEnd,
- atDashStart, atDashEnd);
- // end of closed subpath
- if (atSegEnd &&
- (seg->flags & splashXPathLast) &&
- !(seg->flags & splashXPathEnd1)) {
- dPath->segs[subpathStart].flags &= ~splashXPathEnd0;
- dPath->segs[dPath->length - 1].flags &= ~splashXPathEnd1;
- }
- }
-
- if (atDashEnd) {
- lineDashOn = !lineDashOn;
- if (++lineDashIdx == state->lineDashLength) {
- lineDashIdx = 0;
- }
- lineDashDist = state->lineDash[lineDashIdx];
- atDashStart = gTrue;
- } else {
- atDashStart = gFalse;
- }
- if (atSegEnd) {
- if (++segIdx < length) {
- ++seg;
- sx0 = seg->x0;
- sy0 = seg->y0;
- sx1 = seg->x1;
- sy1 = seg->y1;
- dist = splashDist(sx0, sy0, sx1, sy1);
- if (seg->flags & splashXPathFirst) {
- lineDashOn = lineDashStartOn;
- lineDashIdx = lineDashStartIdx;
- lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase;
- atDashStart = gTrue;
- subpathStart = dPath->length;
- }
- }
- atSegStart = gTrue;
- } else {
- atSegStart = gFalse;
- }
- }
-
- return dPath;
-}
-
-void OPVPSplashXPath::strokeWide(OPVPSplash *splash, OPVPSplashState *state)
-{
- SplashXPathSeg *seg, *seg2;
- OPVPSplashPath *widePath;
- SplashCoord d, dx, dy, wdx, wdy, dxPrev, dyPrev, wdxPrev, wdyPrev;
- SplashCoord dotprod, miter;
- SplashCoord x0,y0,x1,y1,x2,y2,x3,y3;
- int i, j;
-
- dx = dy = wdx = wdy = 0; // make gcc happy
- dxPrev = dyPrev = wdxPrev = wdyPrev = 0; // make gcc happy
-
- for (i = 0, seg = segs; i < length; ++i, ++seg) {
-
- // save the deltas for the previous segment; if this is the first
- // segment on a subpath, compute the deltas for the last segment
- // on the subpath (which may be used to draw a line join)
- if (seg->flags & splashXPathFirst) {
- for (j = i + 1, seg2 = &segs[j];
- j < length; ++j, ++seg2) {
- if (seg2->flags & splashXPathLast) {
- d = splashDist(seg2->x0, seg2->y0, seg2->x1, seg2->y1);
- if (d == 0) {
- //~ not clear what the behavior should be for joins with d==0
- dxPrev = 0;
- dyPrev = 1;
- } else {
- d = 1 / d;
- dxPrev = d * (seg2->x1 - seg2->x0);
- dyPrev = d * (seg2->y1 - seg2->y0);
- }
- wdxPrev = 0.5 * state->lineWidth * dxPrev;
- wdyPrev = 0.5 * state->lineWidth * dyPrev;
- break;
- }
- }
- } else {
- dxPrev = dx;
- dyPrev = dy;
- wdxPrev = wdx;
- wdyPrev = wdy;
- }
-
- // compute deltas for this line segment
- d = splashDist(seg->x0, seg->y0, seg->x1, seg->y1);
- if (d == 0) {
- // we need to draw end caps on zero-length lines
- //~ not clear what the behavior should be for splashLineCapButt with d==0
- dx = 0;
- dy = 1;
- } else {
- d = 1 / d;
- dx = d * (seg->x1 - seg->x0);
- dy = d * (seg->y1 - seg->y0);
- }
- wdx = 0.5 * state->lineWidth * dx;
- wdy = 0.5 * state->lineWidth * dy;
-
- // initialize the path (which will be filled)
- widePath = new OPVPSplashPath();
- widePath->moveTo(seg->x0 - wdy, seg->y0 + wdx);
-
- // draw the start cap
- if (seg->flags & splashXPathEnd0) {
- switch (state->lineCap) {
- case splashLineCapButt:
- widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
- break;
- case splashLineCapRound:
- x0 = seg->x0 - wdy;
- y0 = seg->y0 + wdx;
- x3 = seg->x0 - wdx;
- y3 = seg->y0 - wdy;
- splash->arcToCurve(x0, y0, x3, y3,
- seg->x0, seg->y0, &x1,&y1,&x2,&y2);
- widePath->curveTo(x2,y2,x1,y1,x3,y3);
- x0 = x3;
- y0 = y3;
- x3 = seg->x0 + wdy;
- y3 = seg->y0 - wdx;
- splash->arcToCurve(x0,y0,x3,y3,
- seg->x0, seg->y0, &x1,&y1,&x2,&y2);
- widePath->curveTo(x2,y2,x1,y1,x3,y3);
- break;
- case splashLineCapProjecting:
- widePath->lineTo(seg->x0 - wdx - wdy, seg->y0 + wdx - wdy);
- widePath->lineTo(seg->x0 - wdx + wdy, seg->y0 - wdx - wdy);
- widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
- break;
- }
- } else {
- widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
- }
-
- // draw the left side of the segment
- widePath->lineTo(seg->x1 + wdy, seg->y1 - wdx);
-
- // draw the end cap
- if (seg->flags & splashXPathEnd1) {
- switch (state->lineCap) {
- case splashLineCapButt:
- widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx);
- break;
- case splashLineCapRound:
- x0 = seg->x1 + wdy;
- y0 = seg->y1 - wdx;
- x3 = seg->x1 + wdx;
- y3 = seg->y1 + wdy;
- splash->arcToCurve(x0, y0, x3, y3,
- seg->x1, seg->y1, &x1,&y1,&x2,&y2);
- widePath->curveTo(x2,y2,x1,y1,x3,y3);
- x0 = x3;
- y0 = y3;
- x3 = seg->x1 - wdy;
- y3 = seg->y1 + wdx;
- splash->arcToCurve(x0,y0,x3,y3,
- seg->x1, seg->y1, &x1,&y1,&x2,&y2);
- widePath->curveTo(x2,y2,x1,y1,x3,y3);
- break;
- case splashLineCapProjecting:
- widePath->lineTo(seg->x1 + wdx + wdy, seg->y1 - wdx + wdy);
- widePath->lineTo(seg->x1 + wdx - wdy, seg->y1 + wdx + wdy);
- widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx);
- break;
- }
- } else {
- widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx);
- }
-
- // draw the right side of the segment
- widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx);
-
- // fill the segment
- splash->fill(widePath, gTrue);
- delete widePath;
-
- // draw the line join
- if (!(seg->flags & splashXPathEnd0)) {
- widePath = NULL;
- switch (state->lineJoin) {
- case splashLineJoinMiter:
- dotprod = -(dx * dxPrev + dy * dyPrev);
- if (dotprod != 1) {
- widePath = new OPVPSplashPath();
- widePath->moveTo(seg->x0, seg->y0);
- miter = 2 / (1 - dotprod);
- if (splashSqrt(miter) <= state->miterLimit) {
- miter = splashSqrt(miter - 1);
- if (dy * dxPrev > dx * dyPrev) {
- widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev);
- widePath->lineTo(seg->x0 + wdy - miter * wdx,
- seg->y0 - wdx - miter * wdy);
- widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
- } else {
- widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev);
- widePath->lineTo(seg->x0 - wdy - miter * wdx,
- seg->y0 + wdx - miter * wdy);
- widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx);
- }
- } else {
- if (dy * dxPrev > dx * dyPrev) {
- widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev);
- widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
- } else {
- widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev);
- widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx);
- }
- }
- }
- break;
- case splashLineJoinRound:
- widePath = new OPVPSplashPath();
- /* draw circle */
- widePath->moveTo(seg->x0 + wdy, seg->y0 - wdx);
- x0 = seg->x0 + wdy;
- y0 = seg->y0 - wdx;
- x3 = seg->x0 - wdx;
- y3 = seg->y0 - wdy;
- splash->arcToCurve(x0, y0, x3, y3,
- seg->x0, seg->y0, &x1,&y1,&x2,&y2);
- widePath->curveTo(x1,y1,x2,y2,x3,y3);
- x0 = x3;
- y0 = y3;
- x3 = seg->x0 - wdy;
- y3 = seg->y0 + wdx;
- splash->arcToCurve(x0, y0, x3, y3,
- seg->x0, seg->y0, &x1,&y1,&x2,&y2);
- widePath->curveTo(x1,y1,x2,y2,x3,y3);
- x0 = x3;
- y0 = y3;
- x3 = seg->x0 + wdx;
- y3 = seg->y0 + wdy;
- splash->arcToCurve(x0, y0, x3, y3,
- seg->x0, seg->y0, &x1,&y1,&x2,&y2);
- widePath->curveTo(x1,y1,x2,y2,x3,y3);
- x0 = x3;
- y0 = y3;
- x3 = seg->x0 + wdy;
- y3 = seg->y0 - wdx;
- splash->arcToCurve(x0, y0, x3, y3,
- seg->x0, seg->y0, &x1,&y1,&x2,&y2);
- widePath->curveTo(x1,y1,x2,y2,x3,y3);
- break;
- case splashLineJoinBevel:
- widePath = new OPVPSplashPath();
- widePath->moveTo(seg->x0, seg->y0);
- if (dy * dxPrev > dx * dyPrev) {
- widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev);
- widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx);
- } else {
- widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev);
- widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx);
- }
- break;
- }
- if (widePath) {
- splash->fill(widePath, gTrue);
- delete widePath;
- }
- }
- }
-}
-#endif
-
-void OPVPSplashXPath::strokeNarrow(OPVPSplash *splash, OPVPSplashState *state)
-{
- SplashXPathSeg *seg;
- int x0, x1, x2, x3, y0, y1, x, y, t;
- SplashCoord dx, dy, dxdy;
- SplashClipResult clipRes;
- int i;
-
- for (i = 0, seg = segs; i < length; ++i, ++seg) {
-
- x0 = splashFloor(seg->x0);
- x1 = splashFloor(seg->x1);
- y0 = splashFloor(seg->y0);
- y1 = splashFloor(seg->y1);
-
- // horizontal segment
- if (y0 == y1) {
- if (x0 > x1) {
- t = x0; x0 = x1; x1 = t;
- }
- if ((clipRes = state->clip->testSpan(x0, x1, y0))
- != splashClipAllOutside) {
- splash->drawSpan(x0, x1, y0, clipRes == splashClipAllInside);
- }
-
- // segment with |dx| > |dy|
- } else if (splashAbs(seg->dxdy) > 1) {
- dx = seg->x1 - seg->x0;
- dy = seg->y1 - seg->y0;
- dxdy = seg->dxdy;
- if (y0 > y1) {
- t = y0; y0 = y1; y1 = t;
- t = x0; x0 = x1; x1 = t;
- dx = -dx;
- dy = -dy;
- }
- if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0,
- x0 <= x1 ? x1 : x0, y1))
- != splashClipAllOutside) {
- if (dx > 0) {
- x2 = x0;
- for (y = y0; y < y1; ++y) {
- x3 = splashFloor(seg->x0 + (y + 1 - seg->y0) * dxdy);
- splash->drawSpan(x2, x3 - 1, y, clipRes == splashClipAllInside);
- x2 = x3;
- }
- splash->drawSpan(x2, x1, y, clipRes == splashClipAllInside);
- } else {
- x2 = x0;
- for (y = y0; y < y1; ++y) {
- x3 = splashFloor(seg->x0 + (y + 1 - seg->y0) * dxdy);
- splash->drawSpan(x3 + 1, x2, y, clipRes == splashClipAllInside);
- x2 = x3;
- }
- splash->drawSpan(x1, x2, y, clipRes == splashClipAllInside);
- }
- }
-
- // segment with |dy| > |dx|
- } else {
- dxdy = seg->dxdy;
- if (y0 > y1) {
- t = y0; y0 = y1; y1 = t;
- }
- if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0,
- x0 <= x1 ? x1 : x0, y1))
- != splashClipAllOutside) {
- for (y = y0; y <= y1; ++y) {
- x = splashFloor(seg->x0 + (y - seg->y0) * dxdy);
- splash->drawPixel(x, y, clipRes == splashClipAllInside);
- }
- }
- }
- }
-}
-
diff --git a/filter/pdftoopvp/oprs/OPVPSplashXPath.h b/filter/pdftoopvp/oprs/OPVPSplashXPath.h
deleted file mode 100644
index f51b868..0000000
--- a/filter/pdftoopvp/oprs/OPVPSplashXPath.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef OPVPSPLASHXPATH_H
-#define OPVPSPLASHXPATH_H
-
-#include <config.h>
-#ifdef HAVE_CPP_POPPLER_VERSION_H
-#include "cpp/poppler-version.h"
-#endif
-#include "splash/SplashXPath.h"
-#include "OPVPSplashPath.h"
-#include "OPVPSplashState.h"
-
-class OPVPSplash;
-
-class OPVPSplashXPath : public SplashXPath {
-public:
- OPVPSplashXPath(OPVPSplashPath *path, SplashCoord *matrix,
- SplashCoord flatness, GBool closeSubpaths) :
- SplashXPath(path,matrix,flatness,closeSubpaths) {
- }
-
- // Copy an expanded path.
- OPVPSplashXPath *copy() { return new OPVPSplashXPath(this); }
-
- OPVPSplashXPath *makeDashedPath(OPVPSplashState *state);
- void strokeNarrow(OPVPSplash *splash, OPVPSplashState *state);
-#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 19
- void strokeWide(OPVPSplash *splash, OPVPSplashState *state);
-#endif
-private:
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- OPVPSplashXPath() : SplashXPath(new SplashPath(), 0, 0, gFalse) {};
-#else
- OPVPSplashXPath() {};
-#endif
- OPVPSplashXPath(OPVPSplashXPath *xPath) : SplashXPath(xPath) {
- }
-};
-
-#endif
diff --git a/filter/pdftoopvp/oprs/OPVPWrapper.cxx b/filter/pdftoopvp/oprs/OPVPWrapper.cxx
deleted file mode 100644
index baae6ce..0000000
--- a/filter/pdftoopvp/oprs/OPVPWrapper.cxx
+++ /dev/null
@@ -1,904 +0,0 @@
-/*
- OPVPWrapper.cc
-*/
-
-
-#include <config.h>
-#include <stdio.h>
-#include "OPRS.h"
-#include "OPVPWrapper.h"
-#include "OPVPWrapper_0_2.h"
-#include <string.h>
-#include <dlfcn.h>
-
-OPVPWrapper::OPVPWrapper(void *opvpHandleA, opvp_int_t *opvpErrorNoA,
- opvp_api_procs_t *procsA, opvp_dc_t printerContextA)
-{
- procs = procsA;
- opvpHandle = opvpHandleA;
- opvpErrorNo = opvpErrorNoA;
- printerContext = printerContextA;
- version[0] = 1;
- version[1] = 0;
- supportClosePrinter = (procs->opvpClosePrinter != 0);
- supportStartJob = (procs->opvpStartJob != 0);
- supportEndJob = (procs->opvpEndJob != 0);
- supportAbortJob = (procs->opvpAbortJob != 0);
- supportStartDoc = (procs->opvpStartDoc != 0);
- supportEndDoc = (procs->opvpEndDoc != 0);
- supportStartPage = (procs->opvpStartPage != 0);
- supportEndPage = (procs->opvpEndPage != 0);
- supportResetCTM = (procs->opvpResetCTM != 0);
- supportSetCTM = (procs->opvpSetCTM != 0);
- supportGetCTM = (procs->opvpGetCTM != 0);
- supportInitGS = (procs->opvpInitGS != 0);
- supportSaveGS = (procs->opvpSaveGS != 0);
- supportRestoreGS = (procs->opvpRestoreGS != 0);
- supportQueryColorSpace = (procs->opvpQueryColorSpace != 0);
- supportSetColorSpace = (procs->opvpSetColorSpace != 0);
- supportGetColorSpace = (procs->opvpGetColorSpace != 0);
- supportSetFillMode = (procs->opvpSetFillMode != 0);
- supportGetFillMode = (procs->opvpGetFillMode != 0);
- supportSetAlphaConstant = (procs->opvpSetAlphaConstant != 0);
- supportGetAlphaConstant = (procs->opvpGetAlphaConstant != 0);
- supportSetLineWidth = (procs->opvpSetLineWidth != 0);
- supportGetLineWidth = (procs->opvpGetLineWidth != 0);
- supportSetLineDash = (procs->opvpSetLineDash != 0);
- supportGetLineDash = (procs->opvpGetLineDash != 0);
- supportSetLineDashOffset = (procs->opvpSetLineDashOffset != 0);
- supportGetLineDashOffset = (procs->opvpGetLineDashOffset != 0);
- supportSetLineStyle = (procs->opvpSetLineStyle != 0);
- supportGetLineStyle = (procs->opvpGetLineStyle != 0);
- supportSetLineCap = (procs->opvpSetLineCap != 0);
- supportGetLineCap = (procs->opvpGetLineCap != 0);
- supportSetLineJoin = (procs->opvpSetLineJoin != 0);
- supportGetLineJoin = (procs->opvpGetLineJoin != 0);
- supportSetMiterLimit = (procs->opvpSetMiterLimit != 0);
- supportGetMiterLimit = (procs->opvpGetMiterLimit != 0);
- supportSetPaintMode = (procs->opvpSetPaintMode != 0);
- supportGetPaintMode = (procs->opvpGetPaintMode != 0);
- supportSetStrokeColor = (procs->opvpSetStrokeColor != 0);
- supportSetFillColor = (procs->opvpSetFillColor != 0);
- supportSetBgColor = (procs->opvpSetBgColor != 0);
- supportNewPath = (procs->opvpNewPath != 0);
- supportEndPath = (procs->opvpEndPath != 0);
- supportStrokePath = (procs->opvpStrokePath != 0);
- supportFillPath = (procs->opvpFillPath != 0);
- supportStrokeFillPath = (procs->opvpStrokeFillPath != 0);
- supportSetClipPath = (procs->opvpSetClipPath != 0);
- supportSetCurrentPoint = (procs->opvpSetCurrentPoint != 0);
- supportLinePath = (procs->opvpLinePath != 0);
- supportPolygonPath = (procs->opvpPolygonPath != 0);
- supportRectanglePath = (procs->opvpRectanglePath != 0);
- supportRoundRectanglePath = (procs->opvpRoundRectanglePath != 0);
- supportBezierPath = (procs->opvpBezierPath != 0);
- supportArcPath = (procs->opvpArcPath != 0);
- supportDrawImage = (procs->opvpDrawImage != 0);
- supportStartDrawImage = (procs->opvpStartDrawImage != 0);
- supportTransferDrawImage = (procs->opvpTransferDrawImage != 0);
- supportEndDrawImage = (procs->opvpEndDrawImage != 0);
- supportStartScanline = (procs->opvpStartScanline != 0);
- supportScanline = (procs->opvpScanline != 0);
- supportEndScanline = (procs->opvpEndScanline != 0);
- supportStartRaster = (procs->opvpStartRaster != 0);
- supportTransferRasterData = (procs->opvpTransferRasterData != 0);
- supportSkipRaster = (procs->opvpSkipRaster != 0);
- supportEndRaster = (procs->opvpEndRaster != 0);
- supportStartStream = (procs->opvpStartStream != 0);
- supportTransferStreamData = (procs->opvpTransferStreamData != 0);
- supportEndStream = (procs->opvpEndStream != 0);
- supportQueryDeviceCapability = (procs->opvpQueryDeviceCapability != 0);
- supportQueryDeviceInfo = (procs->opvpQueryDeviceInfo != 0);
- supportResetClipPath = (procs->opvpResetClipPath != 0);
-}
-
-OPVPWrapper::~OPVPWrapper()
-{
- unloadDriver(opvpHandle);
- opvpHandle = 0;
-}
-
-opvp_result_t OPVPWrapper::ClosePrinter()
-{
- if (!supportClosePrinter) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpClosePrinter(printerContext);
-}
-
-opvp_result_t OPVPWrapper::StartJob(const opvp_char_t *jobInfo)
-{
- if (!supportStartJob) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpStartJob(printerContext,jobInfo);
-}
-
-opvp_result_t OPVPWrapper::EndJob()
-{
- if (!supportEndJob) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpEndJob(printerContext);
-}
-
-opvp_result_t OPVPWrapper::AbortJob()
-{
- if (!supportAbortJob) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpAbortJob(printerContext);
-}
-
-opvp_result_t OPVPWrapper::StartDoc(const opvp_char_t *docInfo)
-{
- if (!supportStartDoc) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpStartDoc(printerContext,docInfo);
-}
-
-opvp_result_t OPVPWrapper::EndDoc()
-{
- if (!supportEndDoc) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpEndDoc(printerContext);
-}
-
-opvp_result_t OPVPWrapper::StartPage(const opvp_char_t *pageInfo)
-{
- if (!supportStartPage) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpStartPage(printerContext,pageInfo);
-}
-
-opvp_result_t OPVPWrapper::EndPage()
-{
- if (!supportEndPage) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpEndPage(printerContext);
-}
-
-opvp_result_t OPVPWrapper::QueryDeviceCapability(opvp_flag_t queryflag,
- opvp_int_t *buflen, opvp_byte_t *infoBuf)
-{
- if (!supportQueryDeviceCapability) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpQueryDeviceCapability(printerContext,queryflag,
- buflen,infoBuf);
-}
-
-opvp_result_t OPVPWrapper::QueryDeviceInfo(opvp_flag_t queryflag,
- opvp_int_t *buflen, opvp_byte_t *infoBuf)
-{
- if (!supportQueryDeviceInfo) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpQueryDeviceInfo(printerContext,queryflag,
- buflen,infoBuf);
-}
-
-opvp_result_t OPVPWrapper::ResetCTM()
-{
- if (!supportResetCTM) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpResetCTM(printerContext);
-}
-
-opvp_result_t OPVPWrapper::SetCTM(const opvp_ctm_t *pCTM)
-{
- if (!supportSetCTM) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetCTM(printerContext,pCTM);
-}
-
-opvp_result_t OPVPWrapper::GetCTM(opvp_ctm_t *pCTM)
-{
- if (!supportGetCTM) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetCTM(printerContext,pCTM);
-}
-
-opvp_result_t OPVPWrapper::InitGS()
-{
- if (!supportInitGS) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpInitGS(printerContext);
-}
-
-opvp_result_t OPVPWrapper::SaveGS()
-{
- if (!supportSaveGS) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSaveGS(printerContext);
-}
-
-opvp_result_t OPVPWrapper::RestoreGS()
-{
- if (!supportRestoreGS) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpRestoreGS(printerContext);
-}
-
-opvp_result_t OPVPWrapper::QueryColorSpace(opvp_int_t *pnum,
- opvp_cspace_t *pcspace)
-{
- if (!supportQueryColorSpace) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpQueryColorSpace(printerContext,pnum,pcspace);
-}
-
-opvp_result_t OPVPWrapper::SetColorSpace(opvp_cspace_t cspace)
-{
- if (!supportSetColorSpace) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetColorSpace(printerContext,cspace);
-}
-
-opvp_result_t OPVPWrapper::GetColorSpace(opvp_cspace_t *pcspace)
-{
- if (!supportGetColorSpace) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetColorSpace(printerContext,pcspace);
-}
-
-opvp_result_t OPVPWrapper::SetFillMode(opvp_fillmode_t fillmode)
-{
- if (!supportSetFillMode) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetFillMode(printerContext,fillmode);
-}
-
-opvp_result_t OPVPWrapper::GetFillMode(opvp_fillmode_t *pfillmode)
-{
- if (!supportGetFillMode) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetFillMode(printerContext,pfillmode);
-}
-
-opvp_result_t OPVPWrapper::SetAlphaConstant(opvp_float_t alpha)
-{
- if (!supportSetAlphaConstant) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetAlphaConstant(printerContext,alpha);
-}
-
-opvp_result_t OPVPWrapper::GetAlphaConstant(opvp_float_t *palpha)
-{
- if (!supportGetAlphaConstant) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetAlphaConstant(printerContext,palpha);
-}
-
-opvp_result_t OPVPWrapper::SetLineWidth(opvp_fix_t width)
-{
- if (!supportSetLineWidth) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetLineWidth(printerContext,width);
-}
-
-opvp_result_t OPVPWrapper::GetLineWidth(opvp_fix_t *pwidth)
-{
- if (!supportGetLineWidth) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetLineWidth(printerContext,pwidth);
-}
-
-opvp_result_t OPVPWrapper::SetLineDash(opvp_int_t num,
- const opvp_fix_t *pdash)
-{
- if (!supportSetLineDash) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetLineDash(printerContext,num,pdash);
-}
-
-opvp_result_t OPVPWrapper::GetLineDash(opvp_int_t *pnum, opvp_fix_t *pdash)
-{
- if (!supportGetLineDash) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetLineDash(printerContext,pnum,pdash);
-}
-
-opvp_result_t OPVPWrapper::SetLineDashOffset(opvp_fix_t offset)
-{
- if (!supportSetLineDashOffset) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetLineDashOffset(printerContext,offset);
-}
-
-opvp_result_t OPVPWrapper::GetLineDashOffset(opvp_fix_t *poffset)
-{
- if (!supportGetLineDashOffset) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetLineDashOffset(printerContext,poffset);
-}
-
-opvp_result_t OPVPWrapper::SetLineStyle(opvp_linestyle_t linestyle)
-{
- if (!supportSetLineStyle) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetLineStyle(printerContext,linestyle);
-}
-
-opvp_result_t OPVPWrapper::GetLineStyle(opvp_linestyle_t *plinestyle)
-{
- if (!supportGetLineStyle) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetLineStyle(printerContext,plinestyle);
-}
-
-opvp_result_t OPVPWrapper::SetLineCap(opvp_linecap_t linecap)
-{
- if (!supportSetLineCap) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetLineCap(printerContext,linecap);
-}
-
-opvp_result_t OPVPWrapper::GetLineCap(opvp_linecap_t *plinecap)
-{
- if (!supportGetLineCap) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetLineCap(printerContext,plinecap);
-}
-
-opvp_result_t OPVPWrapper::SetLineJoin(opvp_linejoin_t linejoin)
-{
- if (!supportSetLineJoin) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetLineJoin(printerContext,linejoin);
-}
-
-opvp_result_t OPVPWrapper::GetLineJoin(opvp_linejoin_t *plinejoin)
-{
- if (!supportGetLineJoin) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetLineJoin(printerContext,plinejoin);
-}
-
-opvp_result_t OPVPWrapper::SetMiterLimit(opvp_fix_t miterlimit)
-{
- if (!supportSetMiterLimit) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetMiterLimit(printerContext,miterlimit);
-}
-
-opvp_result_t OPVPWrapper::GetMiterLimit(opvp_fix_t *pmiterlimit)
-{
- if (!supportGetMiterLimit) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetMiterLimit(printerContext,pmiterlimit);
-}
-
-opvp_result_t OPVPWrapper::SetPaintMode(opvp_paintmode_t paintmode)
-{
- if (!supportSetPaintMode) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetPaintMode(printerContext,paintmode);
-}
-
-opvp_result_t OPVPWrapper::GetPaintMode(opvp_paintmode_t *ppaintmode)
-{
- if (!supportGetPaintMode) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpGetPaintMode(printerContext,ppaintmode);
-}
-
-opvp_result_t OPVPWrapper::SetStrokeColor(const opvp_brush_t *brush)
-{
- if (!supportSetStrokeColor) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetStrokeColor(printerContext,brush);
-}
-
-opvp_result_t OPVPWrapper::SetFillColor(const opvp_brush_t *brush)
-{
- if (!supportSetFillColor) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetFillColor(printerContext,brush);
-}
-
-opvp_result_t OPVPWrapper::SetBgColor(const opvp_brush_t *brush)
-{
- if (!supportSetBgColor) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetBgColor(printerContext,brush);
-}
-
-opvp_result_t OPVPWrapper::NewPath()
-{
- if (!supportNewPath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpNewPath(printerContext);
-}
-
-opvp_result_t OPVPWrapper::EndPath()
-{
- if (!supportEndPath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpEndPath(printerContext);
-}
-
-opvp_result_t OPVPWrapper::StrokePath()
-{
- if (!supportStrokePath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpStrokePath(printerContext);
-}
-
-opvp_result_t OPVPWrapper::FillPath()
-{
- if (!supportFillPath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpFillPath(printerContext);
-}
-
-opvp_result_t OPVPWrapper::StrokeFillPath()
-{
- if (!supportStrokeFillPath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpStrokeFillPath(printerContext);
-}
-
-opvp_result_t OPVPWrapper::SetClipPath(opvp_cliprule_t clipRule)
-{
- if (!supportSetClipPath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetClipPath(printerContext,clipRule);
-}
-
-opvp_result_t OPVPWrapper::SetCurrentPoint(opvp_fix_t x, opvp_fix_t y)
-{
- if (!supportSetCurrentPoint) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSetCurrentPoint(printerContext,x,y);
-}
-
-opvp_result_t OPVPWrapper::LinePath(opvp_pathmode_t flag,
- opvp_int_t npoints, const opvp_point_t *points)
-{
- if (!supportLinePath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpLinePath(printerContext,flag,npoints,points);
-}
-
-opvp_result_t OPVPWrapper::PolygonPath(opvp_int_t npolygons,
- const opvp_int_t *nvertexes, const opvp_point_t *points)
-{
- if (!supportPolygonPath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpPolygonPath(printerContext,npolygons,nvertexes,points);
-}
-
-opvp_result_t OPVPWrapper::RectanglePath(opvp_int_t nrectangles,
- const opvp_rectangle_t *rectangles)
-{
- if (!supportRectanglePath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpRectanglePath(printerContext,nrectangles,rectangles);
-}
-
-opvp_result_t OPVPWrapper::RoundRectanglePath(opvp_int_t nrectangles,
- const opvp_roundrectangle_t *rectangles)
-{
- if (!supportRoundRectanglePath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpRoundRectanglePath(printerContext,nrectangles,rectangles);
-}
-
-opvp_result_t OPVPWrapper::BezierPath(opvp_int_t npoints,
- const opvp_point_t *points)
-{
- if (!supportBezierPath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpBezierPath(printerContext,npoints,points);
-}
-
-opvp_result_t OPVPWrapper::ArcPath(opvp_arcmode_t kind,
- opvp_arcdir_t dir, opvp_fix_t bbx0,
- opvp_fix_t bby0, opvp_fix_t bbx1, opvp_fix_t bby1, opvp_fix_t x0,
- opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1)
-{
- if (!supportArcPath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpArcPath(printerContext,kind,dir,bbx0,bby0,
- bbx1,bby1,x0,y0,x1,y1);
-}
-
-opvp_result_t OPVPWrapper::DrawImage(
- opvp_int_t sourceWidth, opvp_int_t sourceHeight, opvp_int_t sourcePitch,
- opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
- opvp_int_t destinationHeight, const void *imagedata)
-{
- if (!supportDrawImage) {
- int result;
-
- if ((result = StartDrawImage(sourceWidth,sourceHeight,sourcePitch,
- imageFormat,destinationWidth,destinationHeight)) < 0) {
- return result;
- }
- if ((result = TransferDrawImage(sourcePitch*sourceHeight,
- imagedata)) < 0) {
- return result;
- }
- return EndDrawImage();
- }
- return procs->opvpDrawImage(printerContext,sourceWidth, sourceHeight,
- sourcePitch, imageFormat, destinationWidth, destinationHeight,
- imagedata);
-}
-
-opvp_result_t OPVPWrapper::StartDrawImage(
- opvp_int_t sourceWidth, opvp_int_t sourceHeight, opvp_int_t sourcePitch,
- opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
- opvp_int_t destinationHeight)
-{
- if (!supportStartDrawImage) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpStartDrawImage(printerContext,sourceWidth,
- sourceHeight,sourcePitch,imageFormat,
- destinationWidth,destinationHeight);
-}
-
-opvp_result_t OPVPWrapper::TransferDrawImage(opvp_int_t count,
- const void *imagedata)
-{
- if (!supportTransferDrawImage) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpTransferDrawImage(printerContext,count,imagedata);
-}
-
-opvp_result_t OPVPWrapper::EndDrawImage()
-{
- if (!supportEndDrawImage) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpEndDrawImage(printerContext);
-}
-
-opvp_result_t OPVPWrapper::StartScanline(opvp_int_t yposition)
-{
- if (!supportStartScanline) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpStartScanline(printerContext,yposition);
-}
-
-opvp_result_t OPVPWrapper::Scanline(opvp_int_t nscanpairs,
- const opvp_int_t *scanpairs)
-{
- if (!supportScanline) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpScanline(printerContext,nscanpairs,scanpairs);
-}
-
-opvp_result_t OPVPWrapper::EndScanline()
-{
- if (!supportEndScanline) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpEndScanline(printerContext);
-}
-
-opvp_result_t OPVPWrapper::StartRaster(
- opvp_int_t rasterWidth)
-{
- if (!supportStartRaster) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpStartRaster(printerContext,rasterWidth);
-}
-
-opvp_result_t OPVPWrapper::TransferRasterData(opvp_int_t count,
- const opvp_byte_t *data)
-{
- if (!supportTransferRasterData) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpTransferRasterData(printerContext,count,
- data);
-}
-
-opvp_result_t OPVPWrapper::SkipRaster(opvp_int_t count)
-{
- if (!supportSkipRaster) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpSkipRaster(printerContext,count);
-}
-
-opvp_result_t OPVPWrapper::EndRaster()
-{
- if (!supportEndRaster) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpEndRaster(printerContext);
-}
-
-opvp_result_t OPVPWrapper::StartStream()
-{
- if (!supportStartStream) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpStartStream(printerContext);
-}
-
-opvp_result_t OPVPWrapper::TransferStreamData(opvp_int_t count,
- const void *data)
-{
- if (!supportTransferStreamData) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpTransferStreamData(printerContext,count,data);
-}
-
-opvp_result_t OPVPWrapper::EndStream()
-{
- if (!supportEndStream) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpEndStream(printerContext);
-}
-
-opvp_result_t OPVPWrapper::ResetClipPath()
-{
- if (!supportResetClipPath) {
- *opvpErrorNo = OPVP_NOTSUPPORTED;
- return -1;
- }
- return procs->opvpResetClipPath(printerContext);
-}
-
-char *OPVPWrapper::allocString(char **destin, unsigned int size)
-{
- if (!destin) return 0;
-
- if (*destin != 0) delete[] *destin;
- if (size > 0) {
- *destin = new char[size];
- }
-
- return *destin;
-}
-
-char **OPVPWrapper::genDynamicLibName(const char *name)
-{
- static char *buff[5] = {0,0,0,0,0};
-
- allocString(&(buff[0]), strlen(name)+1);
- strcpy(buff[0], name);
- allocString(&(buff[1]), strlen(name)+3+1);
- strcpy(buff[1], name);
- strcat(buff[1], ".so");
- allocString(&(buff[2]), strlen(name)+4+1);
- strcpy(buff[2], name);
- strcat(buff[2], ".dll");
- allocString(&(buff[3]), strlen(name)+6+1);
- strcpy(buff[3], "lib");
- strcat(buff[3], name);
- strcat(buff[3], ".so");
- buff[4] = 0;
-
- return buff;
-}
-
-OPVPWrapper *OPVPWrapper::loadDriver(const char *driverName,
- int outputFD, const char *printerModel)
-{
- char **list = 0;
- int i;
- void *h;
- int nApiEntry;
- int (*opvpOpenPrinter)(opvp_int_t outputFD,
- const opvp_char_t * printerModel, const opvp_int_t version[2],
- opvp_api_procs_t **apiEntry) = 0;
- int (*opvpOpenPrinter_0_2)(int outputFD, char* printerModel,
- int *nApiEntry, OPVP_api_procs **apiEntry) = 0;
- opvp_api_procs_t *opvpProcs;
- OPVP_api_procs *opvpProcs_0_2;
- opvp_dc_t opvpContext;
- int opvpContext_0_2 = 0;
- opvp_int_t *opvpErrorNo = 0;
- int *opvpErrorNo_0_2 = 0;
- void *handle = 0;
- OPVPWrapper *opvp = 0;
-
- list = genDynamicLibName(driverName);
-
- if (list) {
- i = 0;
- while (list[i]) {
- if ((h = dlopen(list[i],RTLD_NOW))) {
- opvpOpenPrinter = (int (*)(opvp_int_t,
- const opvp_char_t *, const opvp_int_t[2],
- opvp_api_procs_t **))dlsym(h,"opvpOpenPrinter");
- opvpErrorNo = (opvp_int_t *)dlsym(h,"opvpErrorNo");
- if (opvpOpenPrinter && opvpErrorNo) {
- handle = h;
- break;
- }
- opvpOpenPrinter = 0;
- opvpErrorNo = 0;
- /* try version 0.2 driver */
- opvpOpenPrinter_0_2 = (int (*)(int, char*, int *,
- OPVP_api_procs **))dlsym(h,"OpenPrinter");
- opvpErrorNo_0_2 = (int *)dlsym(h,"errorno");
- if (opvpOpenPrinter_0_2 && opvpErrorNo_0_2) {
- handle = h;
- break;
- }
- opvpOpenPrinter_0_2 = 0;
- opvpErrorNo_0_2 = 0;
- }
- i++;
- }
- for (i = 0;list[i] != 0;i++) {
- delete[] (list[i]);
- list[i] = 0;
- }
- }
- if (handle == 0) {
- OPRS::error("Loading vector printer driver (%s) fail\n",driverName);
- return 0;
- }
- if (opvpOpenPrinter != 0) {
- opvp_int_t apiVersion[2];
-
- /* require version 1.0 */
- apiVersion[0] = 1;
- apiVersion[1] = 0;
- if ((opvpContext = (*opvpOpenPrinter)(outputFD,
- (const opvp_char_t *)printerModel,apiVersion,&opvpProcs)) < 0) {
- OPRS::error("OpenPrinter fail\n",driverName);
- unloadDriver(handle);
- return 0;
- }
- opvp = new OPVPWrapper(handle, opvpErrorNo, opvpProcs, opvpContext);
- } else if (opvpOpenPrinter_0_2) {
- if ((opvpContext_0_2 = (*opvpOpenPrinter_0_2)(outputFD,
- (char *)printerModel,&nApiEntry,&opvpProcs_0_2)) < 0) {
- OPRS::error("OpenPrinter fail\n",driverName);
- unloadDriver(handle);
- return 0;
- }
- opvp = (OPVPWrapper *)new OPVPWrapper_0_2(handle, opvpErrorNo_0_2,
- opvpProcs_0_2, opvpContext_0_2);
- }
- return opvp;
-}
-
-/*
- * unload vector-driver
- */
-int OPVPWrapper::unloadDriver(void *opvpHandleA)
-{
- if (opvpHandleA != 0) {
- dlclose(opvpHandleA);
- }
- return 0;
-}
-
-opvp_int_t OPVPWrapper::getErrorNo()
-{
- return *opvpErrorNo;
-}
-
diff --git a/filter/pdftoopvp/oprs/OPVPWrapper.h b/filter/pdftoopvp/oprs/OPVPWrapper.h
deleted file mode 100644
index 1dfcba3..0000000
--- a/filter/pdftoopvp/oprs/OPVPWrapper.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- OPVPWrapper.h
-*/
-
-#ifndef OPVPWRAPPER_H
-#define OPVPWRAPPER_H
-
-#include "opvp_common.h"
-
-class OPVPWrapper {
-public:
- static OPVPWrapper *loadDriver(const char *driverName, int outputFD,
- const char *printerModel);
- static int unloadDriver(void *opvpHandleA);
-private:
- static char *allocString(char **destin, unsigned int size);
- static char **genDynamicLibName(const char *name);
-public:
- OPVPWrapper() {};
- OPVPWrapper(void *opvpHandleA, opvp_int_t *opvpErrorNoA,
- opvp_api_procs_t *procsA, opvp_dc_t printerContextA);
- virtual ~OPVPWrapper();
-
- virtual opvp_int_t getErrorNo();
-
- void getVersion(opvp_int_t versionA[2])
- {
- versionA[0] = version[0];
- versionA[1] = version[1];
- }
-
- virtual opvp_result_t ClosePrinter();
- virtual opvp_result_t StartJob(const opvp_char_t *jobInfo);
- virtual opvp_result_t EndJob();
- virtual opvp_result_t AbortJob();
- virtual opvp_result_t StartDoc(const opvp_char_t *docInfo);
- virtual opvp_result_t EndDoc();
- virtual opvp_result_t StartPage(const opvp_char_t *pageInfo);
- virtual opvp_result_t EndPage();
- virtual opvp_result_t QueryDeviceCapability(opvp_flag_t queryflag,
- opvp_int_t *buflen, opvp_byte_t *infoBuf);
- virtual opvp_result_t QueryDeviceInfo(opvp_flag_t queryflag,
- opvp_int_t *buflen, opvp_byte_t *infoBuf);
- virtual opvp_result_t ResetCTM();
- virtual opvp_result_t SetCTM(const opvp_ctm_t *pCTM);
- virtual opvp_result_t GetCTM(opvp_ctm_t *pCTM);
- virtual opvp_result_t InitGS();
- virtual opvp_result_t SaveGS();
- virtual opvp_result_t RestoreGS();
- virtual opvp_result_t QueryColorSpace(opvp_int_t *pnum,
- opvp_cspace_t *pcspace);
- virtual opvp_result_t SetColorSpace(opvp_cspace_t cspace);
- virtual opvp_result_t GetColorSpace(opvp_cspace_t *pcspace);
- virtual opvp_result_t SetFillMode(opvp_fillmode_t fillmode);
- virtual opvp_result_t GetFillMode(opvp_fillmode_t *pfillmode);
- virtual opvp_result_t SetAlphaConstant(opvp_float_t alpha);
- virtual opvp_result_t GetAlphaConstant(opvp_float_t *palpha);
- virtual opvp_result_t SetLineWidth(opvp_fix_t width);
- virtual opvp_result_t GetLineWidth(opvp_fix_t *pwidth);
- virtual opvp_result_t SetLineDash(opvp_int_t num, const opvp_fix_t *pdash);
- virtual opvp_result_t GetLineDash(opvp_int_t *pnum, opvp_fix_t *pdash);
- virtual opvp_result_t SetLineDashOffset(opvp_fix_t offset);
- virtual opvp_result_t GetLineDashOffset(opvp_fix_t *poffset);
- virtual opvp_result_t SetLineStyle(opvp_linestyle_t linestyle);
- virtual opvp_result_t GetLineStyle(opvp_linestyle_t *plinestyle);
- virtual opvp_result_t SetLineCap(opvp_linecap_t linecap);
- virtual opvp_result_t GetLineCap(opvp_linecap_t *plinecap);
- virtual opvp_result_t SetLineJoin(opvp_linejoin_t linejoin);
- virtual opvp_result_t GetLineJoin(opvp_linejoin_t *plinejoin);
- virtual opvp_result_t SetMiterLimit(opvp_fix_t miterlimit);
- virtual opvp_result_t GetMiterLimit(opvp_fix_t *pmiterlimit);
- virtual opvp_result_t SetPaintMode(opvp_paintmode_t paintmode);
- virtual opvp_result_t GetPaintMode(opvp_paintmode_t *ppaintmode);
- virtual opvp_result_t SetStrokeColor(const opvp_brush_t *brush);
- virtual opvp_result_t SetFillColor(const opvp_brush_t *brush);
- virtual opvp_result_t SetBgColor(const opvp_brush_t *brush);
- virtual opvp_result_t NewPath();
- virtual opvp_result_t EndPath();
- virtual opvp_result_t StrokePath();
- virtual opvp_result_t FillPath();
- virtual opvp_result_t StrokeFillPath();
- virtual opvp_result_t SetClipPath(opvp_cliprule_t clipRule);
- virtual opvp_result_t SetCurrentPoint(opvp_fix_t x, opvp_fix_t y);
- virtual opvp_result_t LinePath(opvp_pathmode_t flag,
- opvp_int_t npoints, const opvp_point_t *points);
- virtual opvp_result_t PolygonPath(opvp_int_t npolygons,
- const opvp_int_t *nvertexes, const opvp_point_t *points);
- virtual opvp_result_t RectanglePath(opvp_int_t nrectangles,
- const opvp_rectangle_t *reclangles);
- virtual opvp_result_t RoundRectanglePath(opvp_int_t nrectangles,
- const opvp_roundrectangle_t *reclangles);
- virtual opvp_result_t BezierPath(opvp_int_t npoints,
- const opvp_point_t *points);
- virtual opvp_result_t ArcPath(opvp_arcmode_t kind,
- opvp_arcdir_t dir, opvp_fix_t bbx0, opvp_fix_t bby0,
- opvp_fix_t bbx1, opvp_fix_t bby1, opvp_fix_t x0,
- opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1);
- virtual opvp_result_t DrawImage(opvp_int_t sourceWidth,
- opvp_int_t sourceHeight, opvp_int_t sourcePitch,
- opvp_imageformat_t imageFormat,
- opvp_int_t destinationWidth, opvp_int_t destinationHeight,
- const void *imageData);
- virtual opvp_result_t StartDrawImage(opvp_int_t sourceWidth,
- opvp_int_t sourceHeight, opvp_int_t sourcePitch,
- opvp_imageformat_t imageFormat,
- opvp_int_t destinationWidth, opvp_int_t destinationHeight);
- virtual opvp_result_t TransferDrawImage(opvp_int_t count,
- const void *imageData);
- virtual opvp_result_t EndDrawImage();
- virtual opvp_result_t StartScanline(opvp_int_t yposition);
- virtual opvp_result_t Scanline(opvp_int_t nscanpairs,
- const opvp_int_t *scanpairs);
- virtual opvp_result_t EndScanline();
- virtual opvp_result_t StartRaster(opvp_int_t rasterWidth);
- virtual opvp_result_t TransferRasterData(opvp_int_t count,
- const opvp_byte_t *data);
- virtual opvp_result_t SkipRaster(opvp_int_t count);
- virtual opvp_result_t EndRaster();
- virtual opvp_result_t StartStream();
- virtual opvp_result_t TransferStreamData(opvp_int_t count,
- const void *data);
- virtual opvp_result_t EndStream();
- virtual opvp_result_t ResetClipPath();
-
- bool supportClosePrinter;
- bool supportStartJob;
- bool supportEndJob;
- bool supportAbortJob;
- bool supportStartDoc;
- bool supportEndDoc;
- bool supportStartPage;
- bool supportEndPage;
- bool supportResetCTM;
- bool supportSetCTM;
- bool supportGetCTM;
- bool supportInitGS;
- bool supportSaveGS;
- bool supportRestoreGS;
- bool supportQueryColorSpace;
- bool supportSetColorSpace;
- bool supportGetColorSpace;
- bool supportSetFillMode;
- bool supportGetFillMode;
- bool supportSetAlphaConstant;
- bool supportGetAlphaConstant;
- bool supportSetLineWidth;
- bool supportGetLineWidth;
- bool supportSetLineDash;
- bool supportGetLineDash;
- bool supportSetLineDashOffset;
- bool supportGetLineDashOffset;
- bool supportSetLineStyle;
- bool supportGetLineStyle;
- bool supportSetLineCap;
- bool supportGetLineCap;
- bool supportSetLineJoin;
- bool supportGetLineJoin;
- bool supportSetMiterLimit;
- bool supportGetMiterLimit;
- bool supportSetPaintMode;
- bool supportGetPaintMode;
- bool supportSetStrokeColor;
- bool supportSetFillColor;
- bool supportSetBgColor;
- bool supportNewPath;
- bool supportEndPath;
- bool supportStrokePath;
- bool supportFillPath;
- bool supportStrokeFillPath;
- bool supportSetClipPath;
- bool supportSetCurrentPoint;
- bool supportLinePath;
- bool supportPolygonPath;
- bool supportRectanglePath;
- bool supportRoundRectanglePath;
- bool supportBezierPath;
- bool supportArcPath;
- bool supportDrawImage;
- bool supportStartDrawImage;
- bool supportTransferDrawImage;
- bool supportEndDrawImage;
- bool supportStartScanline;
- bool supportScanline;
- bool supportEndScanline;
- bool supportStartRaster;
- bool supportTransferRasterData;
- bool supportSkipRaster;
- bool supportEndRaster;
- bool supportStartStream;
- bool supportTransferStreamData;
- bool supportEndStream;
- bool supportQueryDeviceCapability;
- bool supportQueryDeviceInfo;
- bool supportResetClipPath;
-
-protected:
- void *opvpHandle;
- opvp_int_t version[2];
-private:
- opvp_api_procs_t *procs;
- opvp_int_t *opvpErrorNo;
- opvp_dc_t printerContext;
-};
-
-#endif
diff --git a/filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx b/filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
deleted file mode 100644
index 112580e..0000000
--- a/filter/pdftoopvp/oprs/OPVPWrapper_0_2.cxx
+++ /dev/null
@@ -1,1172 +0,0 @@
-/*
- OPVPWrapper_0_2.cc
-*/
-
-
-#include <config.h>
-#include "OPVPWrapper_0_2.h"
-#include <string.h>
-
-/* color space mapping 0.2 to 1.0 */
-opvp_cspace_t OPVPWrapper_0_2::cspace_0_2_to_1_0[] = {
- OPVP_CSPACE_BW,
- OPVP_CSPACE_DEVICEGRAY,
- OPVP_CSPACE_DEVICECMY,
- OPVP_CSPACE_DEVICECMYK,
- OPVP_CSPACE_DEVICERGB,
- OPVP_CSPACE_STANDARDRGB,
- OPVP_CSPACE_STANDARDRGB64
-};
-
-/* color space mapping 1.0 to 0.2 */
-OPVP_ColorSpace OPVPWrapper_0_2::cspace_1_0_to_0_2[] = {
- OPVP_cspaceBW,
- OPVP_cspaceDeviceGray,
- OPVP_cspaceDeviceCMY,
- OPVP_cspaceDeviceCMYK,
- OPVP_cspaceDeviceRGB,
- (OPVP_ColorSpace)0, /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
- OPVP_cspaceStandardRGB,
- OPVP_cspaceStandardRGB64,
-};
-
-/* image format mapping 1.0 to 0.2 */
-OPVP_ImageFormat OPVPWrapper_0_2::iformat_1_0_to_0_2[] = {
- OPVP_iformatRaw,
- /* OPVP_IFORMAT_MASK use iformat raw in 0.2 */
- OPVP_iformatRaw,
- OPVP_iformatRLE,
- OPVP_iformatJPEG,
- OPVP_iformatPNG,
-};
-
-/* image colorDepth needed in 0.2 */
-int OPVPWrapper_0_2::colorDepth_0_2[] = {
- 1, /* OPVP_CSPACE_BW */
- 8, /* OPVP_CSPACE_DEVICEGRAY */
- 24, /* OPVP_CSPACE_DEVICECMY */
- 32, /* OPVP_CSPACE_DEVICECMYK */
- 24, /* OPVP_CSPACE_DEVICERGB */
- 32, /* OPVP_CSPACE_DEVICEKRGB */
- 24, /* OPVP_CSPACE_STANDARDRGB */
- 64, /* OPVP_CSPACE_STANDARDRGB64 */
-};
-
-OPVPWrapper_0_2::OPVPWrapper_0_2(void *opvpHandleA, int *opvpErrorNoA,
- OPVP_api_procs *procsA, int printerContextA)
-{
- procs_0_2 = procsA;
- opvpHandle = opvpHandleA;
- opvpErrorNo_0_2 = opvpErrorNoA;
- printerContext_0_2 = printerContextA;
- version[0] = 0;
- version[1] = 2;
- supportClosePrinter = (procs_0_2->ClosePrinter != 0);
- supportStartJob = (procs_0_2->StartJob != 0);
- supportEndJob = (procs_0_2->EndJob != 0);
- supportAbortJob = false;
- supportStartDoc = (procs_0_2->StartDoc != 0);
- supportEndDoc = (procs_0_2->EndDoc != 0);
- supportStartPage = (procs_0_2->StartPage != 0);
- supportEndPage = (procs_0_2->EndPage != 0);
- supportResetCTM = (procs_0_2->ResetCTM != 0);
- supportSetCTM = (procs_0_2->SetCTM != 0);
- supportGetCTM = (procs_0_2->GetCTM != 0);
- supportInitGS = (procs_0_2->InitGS != 0);
- supportSaveGS = (procs_0_2->SaveGS != 0);
- supportRestoreGS = (procs_0_2->RestoreGS != 0);
- supportQueryColorSpace = (procs_0_2->QueryColorSpace != 0);
- supportSetColorSpace = (procs_0_2->SetColorSpace != 0);
- supportGetColorSpace = (procs_0_2->GetColorSpace != 0);
- supportSetFillMode = (procs_0_2->SetFillMode != 0);
- supportGetFillMode = (procs_0_2->GetFillMode != 0);
- supportSetAlphaConstant = (procs_0_2->SetAlphaConstant != 0);
- supportGetAlphaConstant = (procs_0_2->GetAlphaConstant != 0);
- supportSetLineWidth = (procs_0_2->SetLineWidth != 0);
- supportGetLineWidth = (procs_0_2->GetLineWidth != 0);
- supportSetLineDash = (procs_0_2->SetLineDash != 0);
- supportGetLineDash = (procs_0_2->GetLineDash != 0);
- supportSetLineDashOffset = (procs_0_2->SetLineDashOffset != 0);
- supportGetLineDashOffset = (procs_0_2->GetLineDashOffset != 0);
- supportSetLineStyle = (procs_0_2->SetLineStyle != 0);
- supportGetLineStyle = (procs_0_2->GetLineStyle != 0);
- supportSetLineCap = (procs_0_2->SetLineCap != 0);
- supportGetLineCap = (procs_0_2->GetLineCap != 0);
- supportSetLineJoin = (procs_0_2->SetLineJoin != 0);
- supportGetLineJoin = (procs_0_2->GetLineJoin != 0);
- supportSetMiterLimit = (procs_0_2->SetMiterLimit != 0);
- supportGetMiterLimit = (procs_0_2->GetMiterLimit != 0);
- supportSetPaintMode = (procs_0_2->SetPaintMode != 0);
- supportGetPaintMode = (procs_0_2->GetPaintMode != 0);
- supportSetStrokeColor = (procs_0_2->SetStrokeColor != 0);
- supportSetFillColor = (procs_0_2->SetFillColor != 0);
- supportSetBgColor = (procs_0_2->SetBgColor != 0);
- supportNewPath = (procs_0_2->NewPath != 0);
- supportEndPath = (procs_0_2->EndPath != 0);
- supportStrokePath = (procs_0_2->StrokePath != 0);
- supportFillPath = (procs_0_2->FillPath != 0);
- supportStrokeFillPath = (procs_0_2->StrokeFillPath != 0);
- supportSetClipPath = (procs_0_2->SetClipPath != 0);
- supportSetCurrentPoint = (procs_0_2->SetCurrentPoint != 0);
- supportLinePath = (procs_0_2->LinePath != 0);
- supportPolygonPath = (procs_0_2->PolygonPath != 0);
- supportRectanglePath = (procs_0_2->RectanglePath != 0);
- supportRoundRectanglePath = (procs_0_2->RoundRectanglePath != 0);
- supportBezierPath = (procs_0_2->BezierPath != 0);
- supportArcPath = (procs_0_2->ArcPath != 0);
- supportDrawImage = (procs_0_2->DrawImage != 0);
- supportStartDrawImage = (procs_0_2->StartDrawImage != 0);
- supportTransferDrawImage = (procs_0_2->TransferDrawImage != 0);
- supportEndDrawImage = (procs_0_2->EndDrawImage != 0);
- supportStartScanline = (procs_0_2->StartScanline != 0);
- supportScanline = (procs_0_2->Scanline != 0);
- supportEndScanline = (procs_0_2->EndScanline != 0);
- supportStartRaster = (procs_0_2->StartRaster != 0);
- supportTransferRasterData = (procs_0_2->TransferRasterData != 0);
- supportSkipRaster = (procs_0_2->SkipRaster != 0);
- supportEndRaster = (procs_0_2->EndRaster != 0);
- supportStartStream = (procs_0_2->StartStream != 0);
- supportTransferStreamData = (procs_0_2->TransferStreamData != 0);
- supportEndStream = (procs_0_2->EndStream != 0);
- supportQueryDeviceCapability = (procs_0_2->QueryDeviceCapability != 0);
- supportQueryDeviceInfo = (procs_0_2->QueryDeviceInfo != 0);
- supportResetClipPath = (procs_0_2->ResetClipPath != 0);
- colorSpace = OPVP_CSPACE_STANDARDRGB;
- if (supportGetColorSpace) {
- if (GetColorSpace(&colorSpace) != OPVP_OK) {
- colorSpace = OPVP_CSPACE_STANDARDRGB;
- }
- }
-}
-
-OPVPWrapper_0_2::~OPVPWrapper_0_2()
-{
-}
-
-opvp_result_t OPVPWrapper_0_2::ClosePrinter()
-{
- if (!supportClosePrinter) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->ClosePrinter(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::StartJob(
- const opvp_char_t *jobInfo)
-{
- if (!supportStartJob) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->StartJob(printerContext_0_2,
- (char *)jobInfo);
-}
-
-opvp_result_t OPVPWrapper_0_2::EndJob()
-{
- if (!supportEndJob) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->EndJob(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::AbortJob()
-{
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
-}
-
-opvp_result_t OPVPWrapper_0_2::StartDoc(
- const opvp_char_t *docInfo)
-{
- if (!supportStartDoc) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->StartDoc(printerContext_0_2,
- (char *)docInfo);
-}
-
-opvp_result_t OPVPWrapper_0_2::EndDoc()
-{
- if (!supportEndDoc) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->EndDoc(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::StartPage(
- const opvp_char_t *pageInfo)
-{
- int r;
-
- if (!supportStartPage) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if ((r = procs_0_2->StartPage(printerContext_0_2,
- /* discard const */(char *)pageInfo)) != OPVP_OK) {
- /* error */
- return (opvp_result_t)r;
- }
- /* initialize ROP */
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,
- OPVP_0_2_ROP_P);
- }
- return OPVP_OK;
-}
-
-opvp_result_t OPVPWrapper_0_2::EndPage()
-{
- if (!supportEndPage) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->EndPage(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::QueryDeviceCapability(
- opvp_flag_t queryflag, opvp_int_t *buflen, opvp_byte_t *infoBuf)
-{
- if (!supportQueryDeviceCapability) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->
- QueryDeviceCapability(printerContext_0_2,queryflag,*buflen,
- (char *)infoBuf);
-}
-
-opvp_result_t OPVPWrapper_0_2::QueryDeviceInfo(
- opvp_flag_t queryflag, opvp_int_t *buflen, opvp_byte_t *infoBuf)
-{
- if (!supportQueryDeviceInfo) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if (queryflag & OPVP_QF_MEDIACOPY) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if (queryflag & OPVP_QF_PRINTREGION) {
- queryflag &= ~OPVP_QF_PRINTREGION;
- queryflag |= 0x0020000;
- }
- return (opvp_result_t)procs_0_2->QueryDeviceInfo(printerContext_0_2,
- queryflag,*buflen,(char *)infoBuf);
-}
-
-opvp_result_t OPVPWrapper_0_2::ResetCTM()
-{
- if (!supportResetCTM) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->ResetCTM(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetCTM(const opvp_ctm_t *pCTM)
-{
- if (!supportSetCTM) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->SetCTM(printerContext_0_2,
- (OPVP_CTM *)pCTM);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetCTM(opvp_ctm_t *pCTM)
-{
- if (!supportGetCTM) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->GetCTM(printerContext_0_2,
- (OPVP_CTM *)pCTM);
-}
-
-opvp_result_t OPVPWrapper_0_2::InitGS()
-{
- int r;
-
- if (!supportInitGS) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if ((r = procs_0_2->InitGS(printerContext_0_2)) != OPVP_OK) {
- /* error */
- return (opvp_result_t)r;
- }
- /* initialize ROP */
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,
- OPVP_0_2_ROP_P);
- }
- return OPVP_OK;
-}
-
-opvp_result_t OPVPWrapper_0_2::SaveGS()
-{
- if (!supportSaveGS) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->SaveGS(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::RestoreGS()
-{
- if (!supportRestoreGS) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->RestoreGS(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::QueryColorSpace(
- opvp_int_t *pnum, opvp_cspace_t *pcspace)
-{
- int r;
- int i;
-
- if (!supportQueryColorSpace) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if ((r = procs_0_2->QueryColorSpace(printerContext_0_2,
- (OPVP_ColorSpace *)pcspace,pnum)) != OPVP_OK) {
- /* error */
- return (opvp_result_t)r;
- }
- /* translate cspaces */
- for (i = 0;i < *pnum;i++) {
- if ((unsigned int)pcspace[i]
- > sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
- /* unknown color space */
- /* set DEVICERGB instead */
- pcspace[i] = OPVP_CSPACE_DEVICERGB;
- } else {
- pcspace[i] = cspace_0_2_to_1_0[pcspace[i]];
- }
- }
- return OPVP_OK;
-}
-
-opvp_result_t OPVPWrapper_0_2::SetColorSpace(
- opvp_cspace_t cspace)
-{
- int r;
-
- if (!supportSetColorSpace) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if (cspace == OPVP_CSPACE_DEVICEKRGB) {
- /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if ((unsigned int)cspace
- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
- /* unknown color space */
- *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
- return -1;
- }
- r = procs_0_2->SetColorSpace(printerContext_0_2,
- cspace_1_0_to_0_2[cspace]);
- if (r == OPVP_OK) {
- colorSpace = cspace;
- }
- return (opvp_result_t)r;
-}
-
-opvp_result_t OPVPWrapper_0_2::GetColorSpace(
- opvp_cspace_t *pcspace)
-{
- int r;
-
- if (!supportGetColorSpace) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if ((r = procs_0_2->GetColorSpace(printerContext_0_2,
- (OPVP_ColorSpace *)pcspace)) != OPVP_OK) {
- /* error */
- return (opvp_result_t)r;
- }
- if ((unsigned int)*pcspace
- > sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
- /* unknown color space */
- /* set DEVICERGB instead */
- *pcspace = OPVP_CSPACE_DEVICERGB;
- } else {
- *pcspace = cspace_0_2_to_1_0[*pcspace];
- }
- return (opvp_result_t)r;
-}
-
-opvp_result_t OPVPWrapper_0_2::SetFillMode(
- opvp_fillmode_t fillmode)
-{
- if (!supportSetFillMode) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_FillMode is comaptible with opvp_fillmode_t */
- return (opvp_result_t)procs_0_2->SetFillMode(printerContext_0_2,
- (OPVP_FillMode)fillmode);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetFillMode(
- opvp_fillmode_t *pfillmode)
-{
- if (!supportGetFillMode) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_FillMode is comaptible with opvp_fillmode_t */
- return (opvp_result_t)procs_0_2->GetFillMode(printerContext_0_2,
- (OPVP_FillMode *)pfillmode);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetAlphaConstant(
- opvp_float_t alpha)
-{
- if (!supportSetAlphaConstant) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->SetAlphaConstant(printerContext_0_2,alpha);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetAlphaConstant(
- opvp_float_t *palpha)
-{
- if (!supportGetAlphaConstant) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->GetAlphaConstant(printerContext_0_2,palpha);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetLineWidth(
- opvp_fix_t width)
-{
- if (!supportSetLineWidth) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->SetLineWidth(printerContext_0_2,width);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetLineWidth(
- opvp_fix_t *pwidth)
-{
- if (!supportGetLineWidth) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->GetLineWidth(printerContext_0_2,pwidth);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetLineDash(opvp_int_t num,
- const opvp_fix_t *pdash)
-{
- if (!supportSetLineDash) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->SetLineDash(printerContext_0_2,
- /* remove const */ (OPVP_Fix *)pdash,num);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetLineDash(
- opvp_int_t *pnum, opvp_fix_t *pdash)
-{
- if (!supportGetLineDash) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->GetLineDash(printerContext_0_2,
- pdash,pnum);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetLineDashOffset(
- opvp_fix_t offset)
-{
- if (!supportSetLineDashOffset) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->SetLineDashOffset(printerContext_0_2,offset);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetLineDashOffset(
- opvp_fix_t *poffset)
-{
- if (!supportGetLineDashOffset) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->GetLineDashOffset(printerContext_0_2,poffset);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetLineStyle(
- opvp_linestyle_t linestyle)
-{
- if (!supportSetLineStyle) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_LineStyle is compatible with opvp_linestyle_t */
- return (opvp_result_t)procs_0_2->SetLineStyle(printerContext_0_2,
- (OPVP_LineStyle)linestyle);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetLineStyle(
- opvp_linestyle_t *plinestyle)
-{
- if (!supportGetLineStyle) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_LineStyle is compatible with opvp_linestyle_t */
- return (opvp_result_t)procs_0_2->GetLineStyle(printerContext_0_2,
- (OPVP_LineStyle *)plinestyle);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetLineCap(
- opvp_linecap_t linecap)
-{
- if (!supportSetLineCap) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_LineCap is compatible with opvp_cap_t */
- return (opvp_result_t)procs_0_2->SetLineCap(printerContext_0_2,
- (OPVP_LineCap)linecap);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetLineCap(
- opvp_linecap_t *plinecap)
-{
- if (!supportGetLineCap) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_LineCap is compatible with opvp_cap_t */
- return (opvp_result_t)procs_0_2->GetLineCap(printerContext_0_2,
- (OPVP_LineCap *)plinecap);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetLineJoin(
- opvp_linejoin_t linejoin)
-{
- if (!supportSetLineJoin) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_LineJoin is compatible with opvp_linejoin_t */
- return (opvp_result_t)procs_0_2->SetLineJoin(printerContext_0_2,
- (OPVP_LineJoin)linejoin);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetLineJoin(
- opvp_linejoin_t *plinejoin)
-{
- if (!supportGetLineJoin) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_LineJoin is compatible with opvp_linejoin_t */
- return (opvp_result_t)procs_0_2->GetLineJoin(printerContext_0_2,
- (OPVP_LineJoin *)plinejoin);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetMiterLimit(
- opvp_fix_t miterlimit)
-{
- if (!supportSetMiterLimit) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_Fix is compatible with opvp_fix_t */
- return (opvp_result_t)procs_0_2->SetMiterLimit(printerContext_0_2,
- (OPVP_Fix)miterlimit);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetMiterLimit(
- opvp_fix_t *pmiterlimit)
-{
- if (!supportGetMiterLimit) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_Fix is compatible with opvp_fix_t */
- return (opvp_result_t)procs_0_2->GetMiterLimit(printerContext_0_2,
- (OPVP_Fix *)pmiterlimit);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetPaintMode(
- opvp_paintmode_t paintmode)
-{
- if (!supportSetPaintMode) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_PaintMode is compatible with opvp_paintmode_t */
- return (opvp_result_t)procs_0_2->SetPaintMode(printerContext_0_2,
- (OPVP_PaintMode)paintmode);
-}
-
-opvp_result_t OPVPWrapper_0_2::GetPaintMode(
- opvp_paintmode_t *ppaintmode)
-{
- if (!supportGetPaintMode) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_PaintMode is compatible with opvp_paintmode_t */
- return (opvp_result_t)procs_0_2->GetPaintMode(printerContext_0_2,
- (OPVP_PaintMode *)ppaintmode);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetStrokeColor(
- const opvp_brush_t *brush)
-{
- OPVP_Brush brush_0_2;
-
- if (!supportSetStrokeColor) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if (brush == 0) {
- *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
- return -1;
- }
- if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
- /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if ((unsigned int)brush->colorSpace
- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
- /* unknown color space */
- *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
- return -1;
- }
- brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
- brush_0_2.xorg = brush->xorg;
- brush_0_2.yorg = brush->yorg;
- brush_0_2.pbrush = (OPVP_BrushData *)brush->pbrush;
- memcpy(brush_0_2.color,brush->color,sizeof(brush_0_2.color));
- return (opvp_result_t)procs_0_2->SetStrokeColor(printerContext_0_2,
- &brush_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetFillColor(
- const opvp_brush_t *brush)
-{
- OPVP_Brush brush_0_2;
-
- if (!supportSetFillColor) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if (brush == 0) {
- *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
- return -1;
- }
- if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
- /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if ((unsigned int)brush->colorSpace
- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
- /* unknown color space */
- *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
- return -1;
- }
- brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
- brush_0_2.xorg = brush->xorg;
- brush_0_2.yorg = brush->yorg;
- brush_0_2.pbrush = (OPVP_BrushData *)brush->pbrush;
- memcpy(brush_0_2.color,brush->color,sizeof(brush_0_2.color));
- return (opvp_result_t)procs_0_2->SetFillColor(printerContext_0_2,
- &brush_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetBgColor(
- const opvp_brush_t *brush)
-{
- OPVP_Brush brush_0_2;
-
- if (!supportSetBgColor) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if (brush == 0) {
- *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
- return -1;
- }
- if (brush->colorSpace == OPVP_CSPACE_DEVICEKRGB) {
- /* 0.2 doesn't have OPVP_CSPACE_DEVICEKRGB */
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if ((unsigned int)brush->colorSpace
- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
- /* unknown color space */
- *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
- return -1;
- }
- brush_0_2.colorSpace = cspace_1_0_to_0_2[brush->colorSpace];
- brush_0_2.xorg = brush->xorg;
- brush_0_2.yorg = brush->yorg;
- brush_0_2.pbrush = (OPVP_BrushData *)brush->pbrush;
- memcpy(brush_0_2.color,brush->color,sizeof(brush_0_2.color));
- return (opvp_result_t)procs_0_2->SetBgColor(printerContext_0_2,
- &brush_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::NewPath()
-{
- if (!supportNewPath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->NewPath(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::EndPath()
-{
- if (!supportEndPath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->EndPath(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::StrokePath()
-{
- if (!supportStrokePath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->StrokePath(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::FillPath()
-{
- if (!supportFillPath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->FillPath(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::StrokeFillPath()
-{
- if (!supportStrokeFillPath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->StrokeFillPath(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetClipPath(
- opvp_cliprule_t clipRule)
-{
- if (!supportSetClipPath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_ClipRule is compatible with opvp_cliprule_t */
- return (opvp_result_t)procs_0_2->SetClipPath(printerContext_0_2,
- (OPVP_ClipRule)clipRule);
-}
-
-opvp_result_t OPVPWrapper_0_2::SetCurrentPoint(
- opvp_fix_t x, opvp_fix_t y)
-{
- if (!supportSetCurrentPoint) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->SetCurrentPoint(printerContext_0_2,x,y);
-}
-
-opvp_result_t OPVPWrapper_0_2::LinePath(
- opvp_pathmode_t flag, opvp_int_t npoints, const opvp_point_t *points)
-{
- if (!supportLinePath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_Point is compatible with opvp_point_t */
- return (opvp_result_t)procs_0_2->LinePath(printerContext_0_2,flag,npoints,
- (OPVP_Point *)points);
-}
-
-opvp_result_t OPVPWrapper_0_2::PolygonPath(
- opvp_int_t npolygons, const opvp_int_t *nvertexes,
- const opvp_point_t *points)
-{
- if (!supportPolygonPath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_Point is compatible with opvp_point_t */
- return (opvp_result_t)procs_0_2->PolygonPath(printerContext_0_2,
- (int)npolygons,(int *)nvertexes,(OPVP_Point *)points);
-}
-
-opvp_result_t OPVPWrapper_0_2::RectanglePath(
- opvp_int_t nrectangles, const opvp_rectangle_t *rectangles)
-{
- if (!supportRectanglePath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_Rectangle is compatible with opvp_rectangle_t */
- return (opvp_result_t)procs_0_2->RectanglePath(printerContext_0_2,
- (int)nrectangles,(OPVP_Rectangle *)rectangles);
-}
-
-opvp_result_t OPVPWrapper_0_2::RoundRectanglePath(
- opvp_int_t nrectangles, const opvp_roundrectangle_t *rectangles)
-{
- if (!supportRoundRectanglePath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_RoundRectangle is compatible with opvp_roundrectangle_t */
- return (opvp_result_t)procs_0_2->RoundRectanglePath(printerContext_0_2,
- (int)nrectangles,(OPVP_RoundRectangle *)rectangles);
-}
-
-opvp_result_t OPVPWrapper_0_2::BezierPath(opvp_int_t npoints,
- const opvp_point_t *points)
-{
- if (!supportBezierPath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* OPVP_Point is compatible with opvp_point_t */
- return (opvp_result_t)procs_0_2->BezierPath(printerContext_0_2,(int)npoints,
- (OPVP_Point *)points);
-}
-
-opvp_result_t OPVPWrapper_0_2::ArcPath(opvp_arcmode_t kind, opvp_arcdir_t dir,
- opvp_fix_t bbx0, opvp_fix_t bby0, opvp_fix_t bbx1,
- opvp_fix_t bby1, opvp_fix_t x0, opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1)
-{
- if (!supportArcPath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- /* opvp_arcmode_t is compatible with int */
- /* opvp_arcdir_t is compatible with int */
- return (opvp_result_t)procs_0_2->ArcPath(printerContext_0_2,
- (int)kind,(int)dir,bbx0,bby0,
- bbx1,bby1,x0,y0,x1,y1);
-}
-
-opvp_result_t OPVPWrapper_0_2::DrawImage(opvp_int_t sourceWidth,
- opvp_int_t sourceHeight, opvp_int_t sourcePitch,
- opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
- opvp_int_t destinationHeight, const void *imagedata)
-{
- int r;
- OPVP_Rectangle rect;
- OPVP_ImageFormat iformat_0_2;
- OPVP_PaintMode paintmode_0_2 = OPVP_paintModeTransparent;
- int depth;
-
- if (!supportDrawImage) {
- int result;
-
- if ((result = StartDrawImage(sourceWidth,
- sourceHeight,sourcePitch,imageFormat,destinationWidth,
- destinationHeight)) < 0) {
- return result;
- }
- if ((result = TransferDrawImage(sourcePitch*sourceHeight,
- imagedata)) < 0) {
- return result;
- }
- return EndDrawImage();
- }
-
- if (imageFormat == OPVP_IFORMAT_MASK) {
- if (procs_0_2->GetPaintMode != 0) {
- procs_0_2->GetPaintMode(printerContext_0_2,
- &paintmode_0_2);
- }
- if (paintmode_0_2 != OPVP_paintModeTransparent) {
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,
- OPVP_0_2_ROP_S);
- }
- }
- else {
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,
- OPVP_0_2_ROP_OR);
- }
- }
- depth = 1;
- } else {
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_S);
- }
- depth = colorDepth_0_2[colorSpace];
- }
-
- OPVP_I2FIX(0,rect.p0.x);
- OPVP_I2FIX(0,rect.p0.y);
- OPVP_I2FIX(destinationWidth,rect.p1.x);
- OPVP_I2FIX(destinationHeight,rect.p1.y);
- if ((unsigned int)imageFormat
- > sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
- /* illegal image format */
- *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
- return -1;
- }
- iformat_0_2 = iformat_1_0_to_0_2[imageFormat];
- r = procs_0_2->DrawImage(printerContext_0_2,sourceWidth,sourceHeight,
- depth,iformat_0_2,rect,
- sourcePitch*sourceHeight,
- /* remove const */ (void *)imagedata);
-
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_P);
- }
-
- return (opvp_result_t)r;
-}
-
-opvp_result_t OPVPWrapper_0_2::StartDrawImage(opvp_int_t sourceWidth,
- opvp_int_t sourceHeight, opvp_int_t sourcePitch,
- opvp_imageformat_t imageFormat, opvp_int_t destinationWidth,
- opvp_int_t destinationHeight)
-{
- int r;
- OPVP_Rectangle rect;
- OPVP_ImageFormat iformat_0_2;
- OPVP_PaintMode paintmode_0_2 = OPVP_paintModeTransparent;
- int depth;
-
- if (!supportStartDrawImage) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- if (imageFormat == OPVP_IFORMAT_MASK) {
- if (procs_0_2->GetPaintMode != 0) {
- procs_0_2->GetPaintMode(printerContext_0_2,
- &paintmode_0_2);
- }
- if (paintmode_0_2 != OPVP_paintModeTransparent) {
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_S);
- }
- }
- else {
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_OR);
- }
- }
- depth = 1;
- } else {
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_S);
- }
- depth = colorDepth_0_2[colorSpace];
- }
-
- OPVP_I2FIX(0,rect.p0.x);
- OPVP_I2FIX(0,rect.p0.y);
- OPVP_I2FIX(destinationWidth,rect.p1.x);
- OPVP_I2FIX(destinationHeight,rect.p1.y);
- if ((unsigned int)imageFormat
- > sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
- /* illegal image format */
- *opvpErrorNo_0_2 = OPVP_PARAMERROR_0_2;
- return -1;
- }
- iformat_0_2 = iformat_1_0_to_0_2[imageFormat];
- r = procs_0_2->StartDrawImage(printerContext_0_2,
- sourceWidth,sourceHeight,
- depth,iformat_0_2,rect);
-
- return (opvp_result_t)r;
-}
-
-opvp_result_t OPVPWrapper_0_2::TransferDrawImage(opvp_int_t count,
- const void *imagedata)
-{
- if (!supportTransferDrawImage) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->TransferDrawImage(printerContext_0_2,
- count,(void *)imagedata);
-}
-
-opvp_result_t OPVPWrapper_0_2::EndDrawImage()
-{
- int r;
-
- if (!supportEndDrawImage) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- r = procs_0_2->EndDrawImage(printerContext_0_2);
-
- /* make sure rop is pattern copy */
- if (procs_0_2->SetROP != 0) {
- procs_0_2->SetROP(printerContext_0_2,OPVP_0_2_ROP_P);
- }
-
- return (opvp_result_t)r;
-}
-
-opvp_result_t OPVPWrapper_0_2::StartScanline(opvp_int_t yposition)
-{
- if (!supportStartScanline) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->StartScanline(printerContext_0_2,yposition);
-}
-
-opvp_result_t OPVPWrapper_0_2::Scanline(opvp_int_t nscanpairs,
- const opvp_int_t *scanpairs)
-{
- if (!supportScanline) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->Scanline(printerContext_0_2,
- (int)nscanpairs,(int *)scanpairs);
-}
-
-opvp_result_t OPVPWrapper_0_2::EndScanline()
-{
- if (!supportEndScanline) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->EndScanline(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::StartRaster(opvp_int_t rasterWidth)
-{
- if (!supportStartRaster) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->StartRaster(printerContext_0_2,rasterWidth);
-}
-
-opvp_result_t OPVPWrapper_0_2::TransferRasterData(opvp_int_t count,
- const opvp_byte_t *data)
-{
- if (!supportTransferRasterData) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->TransferRasterData(printerContext_0_2,
- (int)count, (unsigned char *)data);
-}
-
-opvp_result_t OPVPWrapper_0_2::SkipRaster(opvp_int_t count)
-{
- if (!supportSkipRaster) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->SkipRaster(printerContext_0_2,count);
-}
-
-opvp_result_t OPVPWrapper_0_2::EndRaster()
-{
- if (!supportEndRaster) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->EndRaster(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::StartStream()
-{
- if (!supportStartStream) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->StartStream(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::TransferStreamData(opvp_int_t count,
- const void *data)
-{
- if (!supportTransferStreamData) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->TransferStreamData(printerContext_0_2,
- count,(void *)data);
-}
-
-opvp_result_t OPVPWrapper_0_2::EndStream()
-{
- if (!supportEndStream) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->EndStream(printerContext_0_2);
-}
-
-opvp_result_t OPVPWrapper_0_2::ResetClipPath()
-{
- if (!supportResetClipPath) {
- *opvpErrorNo_0_2 = OPVP_NOTSUPPORTED_0_2;
- return -1;
- }
- return (opvp_result_t)procs_0_2->ResetClipPath(printerContext_0_2);
-}
-
-/* translate error code */
-opvp_int_t OPVPWrapper_0_2::getErrorNo()
-{
- switch(*opvpErrorNo_0_2) {
- case OPVP_FATALERROR_0_2:
- return OPVP_FATALERROR;
- break;
- case OPVP_BADREQUEST_0_2:
- return OPVP_BADREQUEST;
- break;
- case OPVP_BADCONTEXT_0_2:
- return OPVP_BADCONTEXT;
- break;
- case OPVP_NOTSUPPORTED_0_2:
- return OPVP_NOTSUPPORTED;
- break;
- case OPVP_JOBCANCELED_0_2:
- return OPVP_JOBCANCELED;
- break;
- case OPVP_PARAMERROR_0_2:
- return OPVP_PARAMERROR;
- break;
- default:
- break;
- }
- /* unknown error no */
- /* return FATALERROR instead */
- return OPVP_FATALERROR;
-}
diff --git a/filter/pdftoopvp/oprs/OPVPWrapper_0_2.h b/filter/pdftoopvp/oprs/OPVPWrapper_0_2.h
deleted file mode 100644
index f670a45..0000000
--- a/filter/pdftoopvp/oprs/OPVPWrapper_0_2.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- OPVPWrapper_0_2.h
-*/
-
-#ifndef OPVPWRAPPER_0_2_H
-#define OPVPWRAPPER_0_2_H
-
-#include "OPVPWrapper.h"
-
-/* ROP */
-#define OPVP_0_2_ROP_S 0xCC
-#define OPVP_0_2_ROP_P 0xF0
-#define OPVP_0_2_ROP_OR 0xB8
-
-class OPVPWrapper_0_2: public OPVPWrapper {
-private:
- static opvp_cspace_t cspace_0_2_to_1_0[];
- static OPVP_ColorSpace cspace_1_0_to_0_2[];
- static OPVP_ImageFormat iformat_1_0_to_0_2[];
- static int colorDepth_0_2[];
-public:
- OPVPWrapper_0_2(void *opvpHandleA, int *opvpErrorNoA,
- OPVP_api_procs *procsA, int printerContextA);
- virtual ~OPVPWrapper_0_2();
- virtual opvp_int_t getErrorNo();
-
- virtual opvp_result_t ClosePrinter();
- virtual opvp_result_t StartJob(const opvp_char_t *jobInfo);
- virtual opvp_result_t EndJob();
- virtual opvp_result_t AbortJob();
- virtual opvp_result_t StartDoc(const opvp_char_t *docInfo);
- virtual opvp_result_t EndDoc();
- virtual opvp_result_t StartPage(const opvp_char_t *pageInfo);
- virtual opvp_result_t EndPage();
- virtual opvp_result_t QueryDeviceCapability(opvp_flag_t queryflag,
- opvp_int_t *buflen, opvp_byte_t *infoBuf);
- virtual opvp_result_t QueryDeviceInfo(opvp_flag_t queryflag,
- opvp_int_t *buflen, opvp_byte_t *infoBuf);
- virtual opvp_result_t ResetCTM();
- virtual opvp_result_t SetCTM(const opvp_ctm_t *pCTM);
- virtual opvp_result_t GetCTM(opvp_ctm_t *pCTM);
- virtual opvp_result_t InitGS();
- virtual opvp_result_t SaveGS();
- virtual opvp_result_t RestoreGS();
- virtual opvp_result_t QueryColorSpace(opvp_int_t *pnum,
- opvp_cspace_t *pcspace);
- virtual opvp_result_t SetColorSpace(opvp_cspace_t cspace);
- virtual opvp_result_t GetColorSpace(opvp_cspace_t *pcspace);
- virtual opvp_result_t SetFillMode(opvp_fillmode_t fillmode);
- virtual opvp_result_t GetFillMode(opvp_fillmode_t *pfillmode);
- virtual opvp_result_t SetAlphaConstant(opvp_float_t alpha);
- virtual opvp_result_t GetAlphaConstant(opvp_float_t *palpha);
- virtual opvp_result_t SetLineWidth(opvp_fix_t width);
- virtual opvp_result_t GetLineWidth(opvp_fix_t *pwidth);
- virtual opvp_result_t SetLineDash(opvp_int_t num, const opvp_fix_t *pdash);
- virtual opvp_result_t GetLineDash(opvp_int_t *pnum, opvp_fix_t *pdash);
- virtual opvp_result_t SetLineDashOffset(opvp_fix_t offset);
- virtual opvp_result_t GetLineDashOffset(opvp_fix_t *poffset);
- virtual opvp_result_t SetLineStyle(opvp_linestyle_t linestyle);
- virtual opvp_result_t GetLineStyle(opvp_linestyle_t *plinestyle);
- virtual opvp_result_t SetLineCap(opvp_linecap_t linecap);
- virtual opvp_result_t GetLineCap(opvp_linecap_t *plinecap);
- virtual opvp_result_t SetLineJoin(opvp_linejoin_t linejoin);
- virtual opvp_result_t GetLineJoin(opvp_linejoin_t *plinejoin);
- virtual opvp_result_t SetMiterLimit(opvp_fix_t miterlimit);
- virtual opvp_result_t GetMiterLimit(opvp_fix_t *pmiterlimit);
- virtual opvp_result_t SetPaintMode(opvp_paintmode_t paintmode);
- virtual opvp_result_t GetPaintMode(opvp_paintmode_t *ppaintmode);
- virtual opvp_result_t SetStrokeColor(const opvp_brush_t *brush);
- virtual opvp_result_t SetFillColor(const opvp_brush_t *brush);
- virtual opvp_result_t SetBgColor(const opvp_brush_t *brush);
- virtual opvp_result_t NewPath();
- virtual opvp_result_t EndPath();
- virtual opvp_result_t StrokePath();
- virtual opvp_result_t FillPath();
- virtual opvp_result_t StrokeFillPath();
- virtual opvp_result_t SetClipPath(opvp_cliprule_t clipRule);
- virtual opvp_result_t SetCurrentPoint(opvp_fix_t x, opvp_fix_t y);
- virtual opvp_result_t LinePath(opvp_pathmode_t flag,
- opvp_int_t npoints, const opvp_point_t *points);
- virtual opvp_result_t PolygonPath(opvp_int_t npolygons,
- const opvp_int_t *nvertexes, const opvp_point_t *points);
- virtual opvp_result_t RectanglePath(opvp_int_t nrectangles,
- const opvp_rectangle_t *reclangles);
- virtual opvp_result_t RoundRectanglePath(opvp_int_t nrectangles,
- const opvp_roundrectangle_t *reclangles);
- virtual opvp_result_t BezierPath(opvp_int_t npoints,
- const opvp_point_t *points);
- virtual opvp_result_t ArcPath(opvp_arcmode_t kind,
- opvp_arcdir_t dir, opvp_fix_t bbx0, opvp_fix_t bby0,
- opvp_fix_t bbx1, opvp_fix_t bby1, opvp_fix_t x0,
- opvp_fix_t y0, opvp_fix_t x1, opvp_fix_t y1);
- virtual opvp_result_t DrawImage(opvp_int_t sourceWidth,
- opvp_int_t sourceHeight, opvp_int_t sourcePitch,
- opvp_imageformat_t imageFormat,
- opvp_int_t destinationWidth, opvp_int_t destinationHeight,
- const void *imageData);
- virtual opvp_result_t StartDrawImage(opvp_int_t sourceWidth,
- opvp_int_t sourceHeight, opvp_int_t sourcePitch,
- opvp_imageformat_t imageFormat,
- opvp_int_t destinationWidth, opvp_int_t destinationHeight);
- virtual opvp_result_t TransferDrawImage(opvp_int_t count,
- const void *imageData);
- virtual opvp_result_t EndDrawImage();
- virtual opvp_result_t StartScanline(opvp_int_t yposition);
- virtual opvp_result_t Scanline(opvp_int_t nscanpairs,
- const opvp_int_t *scanpairs);
- virtual opvp_result_t EndScanline();
- virtual opvp_result_t StartRaster(opvp_int_t rasterWidth);
- virtual opvp_result_t TransferRasterData(opvp_int_t count,
- const opvp_byte_t *data);
- virtual opvp_result_t SkipRaster(opvp_int_t count);
- virtual opvp_result_t EndRaster();
- virtual opvp_result_t StartStream();
- virtual opvp_result_t TransferStreamData(opvp_int_t count,
- const void *data);
- virtual opvp_result_t EndStream();
- virtual opvp_result_t ResetClipPath();
-
-private:
- OPVP_api_procs *procs_0_2;
- int *opvpErrorNo_0_2;
- int printerContext_0_2;
- opvp_cspace_t colorSpace;
-};
-
-#endif
diff --git a/filter/pdftoopvp/opvp/opvp.h b/filter/pdftoopvp/opvp/opvp.h
deleted file mode 100644
index 41ade3a..0000000
--- a/filter/pdftoopvp/opvp/opvp.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * OpenPrinting Vector Printer Driver API Definitions [opvp.h]
- *
- * Copyright (c) 2006 Free Standards Group
- * Copyright (c) 2006 Fuji Xerox Printing Systems Co., Ltd.
- * Copyright (c) 2006 Canon Inc.
- * Copyright (c) 2003-2006 AXE Inc.
- *
- * All Rights Reserverd.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation.
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
- /*
- 2007 Modified for OPVP 1.0 by BBR Inc.
- */
-
-#ifndef _OPVP_H_
-#define _OPVP_H_
-
-/* Return Values and Error Codes */
-#define OPVP_OK 0 /* -1 for errors */
-#define OPVP_FATALERROR -1 /* error: cannot be recovered */
-#define OPVP_BADREQUEST -2 /* error: called where it should
- not be called */
-#define OPVP_BADCONTEXT -3 /* error: invalid printer context */
-#define OPVP_NOTSUPPORTED -4 /* error: combination of
- parameters are set
- which cannot be handled
- by driver or printer */
-#define OPVP_JOBCANCELED -5 /* error: job has been canceled
- by some cause */
-#define OPVP_PARAMERROR -6 /* error: invalid parameter */
-#define OPVP_VERSIONERROR -7 /* error: invalid API version */
-
-/* Basic Types */
-typedef int opvp_dc_t; /* driver/device context */
-typedef int opvp_result_t; /* return value */
-typedef unsigned char opvp_byte_t; /* BYTE */
-typedef unsigned char opvp_char_t; /* character (string) */
-typedef int opvp_int_t; /* integer */
-typedef int opvp_fix_t; /* fixed integer */
-typedef float opvp_float_t; /* float */
-typedef unsigned int opvp_flag_t; /* flags */
-typedef unsigned int opvp_rop_t; /* raster operation */
-
-/* for opvp_fix_t */
-#define OPVP_FIX_FRACT_WIDTH 8
-#define OPVP_FIX_FRACT_DENOM (1<<OPVP_FIX_FRACT_WIDTH)
-#define OPVP_FIX_FLOOR_WIDTH (sizeof(int)*8-OPVP_FIX_FRACT_WIDTH)
-
-/* convert macro */
-#define OPVP_I2FIX(i,fix) (fix=(i)<<OPVP_FIX_FRACT_WIDTH)
-#define OPVP_F2FIX(f,fix) (fix=((int)floor(f)<<OPVP_FIX_FRACT_WIDTH)\
- |((int)((f-floor(f))*OPVP_FIX_FRACT_DENOM)\
- &(OPVP_FIX_FRACT_DENOM-1)))
-
-/* graphic elements */
-typedef struct _opvp_point {
- opvp_fix_t x, y;
-} opvp_point_t;
-
-typedef struct _opvp_rectangle {
- opvp_point_t p0; /* start point */
- opvp_point_t p1; /* diagonal point */
-} opvp_rectangle_t;
-
-typedef struct _opvp_roundrectangle {
- opvp_point_t p0; /* start point */
- opvp_point_t p1; /* diagonal point */
- opvp_fix_t xellipse, yellipse;
-} opvp_roundrectangle_t;
-
-/* Image Formats */
-typedef enum _opvp_imageformat {
- OPVP_IFORMAT_RAW = 0,
- OPVP_IFORMAT_MASK = 1,
- OPVP_IFORMAT_RLE = 2,
- OPVP_IFORMAT_JPEG = 3,
- OPVP_IFORMAT_PNG = 4
-} opvp_imageformat_t;
-
-/* Color Presentation */
-typedef enum _opvp_colormapping {
- OPVP_CMAP_DIRECT = 0,
- OPVP_CMAP_INDEXED = 1
-} opvp_colormapping_t;
-
-typedef enum _opvp_cspace {
- OPVP_CSPACE_BW = 0,
- OPVP_CSPACE_DEVICEGRAY = 1,
- OPVP_CSPACE_DEVICECMY = 2,
- OPVP_CSPACE_DEVICECMYK = 3,
- OPVP_CSPACE_DEVICERGB = 4,
- OPVP_CSPACE_DEVICEKRGB = 5,
- OPVP_CSPACE_STANDARDRGB = 6,
- OPVP_CSPACE_STANDARDRGB64 = 7
-} opvp_cspace_t;
-
-/* Fill, Paint, Clip */
-typedef enum _opvp_fillmode {
- OPVP_FILLMODE_EVENODD = 0,
- OPVP_FILLMODE_WINDING = 1
-} opvp_fillmode_t;
-
-typedef enum _opvp_paintmode {
- OPVP_PAINTMODE_OPAQUE = 0,
- OPVP_PAINTMODE_TRANSPARENT = 1
-} opvp_paintmode_t;
-
-typedef enum _opvp_cliprule {
- OPVP_CLIPRULE_EVENODD = 0,
- OPVP_CLIPRULE_WINDING = 1
-} opvp_cliprule_t;
-
-/* Line */
-typedef enum _opvp_linestyle {
- OPVP_LINESTYLE_SOLID = 0,
- OPVP_LINESTYLE_DASH = 1
-} opvp_linestyle_t;
-
-typedef enum _opvp_linecap {
- OPVP_LINECAP_BUTT = 0,
- OPVP_LINECAP_ROUND = 1,
- OPVP_LINECAP_SQUARE = 2
-} opvp_linecap_t;
-
-typedef enum _opvp_linejoin {
- OPVP_LINEJOIN_MITER = 0,
- OPVP_LINEJOIN_ROUND = 1,
- OPVP_LINEJOIN_BEVEL = 2
-} opvp_linejoin_t;
-
-/* Brush */
-typedef enum _opvp_bdtype {
- OPVP_BDTYPE_NORMAL = 0
-} opvp_bdtype_t;
-
-typedef struct _opvp_brushdata {
- opvp_bdtype_t type;
- opvp_int_t width, height, pitch;
- opvp_byte_t data[1];
-
-} opvp_brushdata_t;
-
-typedef struct _opvp_brush {
- opvp_cspace_t colorSpace;
- opvp_int_t color[4]; /* aRGB quadruplet */
- opvp_int_t xorg, yorg; /* brush origin */
- /* ignored for opvpSetBgColor */
- opvp_brushdata_t *pbrush; /* pointer to brush data */
- /* solid brush used, if NULL */
-} opvp_brush_t;
-
-/* Misc. Flags */
-typedef enum _opvp_arcmode {
- OPVP_ARC = 0,
- OPVP_CHORD = 1,
- OPVP_PIE = 2
-} opvp_arcmode_t;
-
-typedef enum _opvp_arcdir {
- OPVP_CLOCKWISE = 0,
- OPVP_COUNTERCLOCKWISE = 1
-} opvp_arcdir_t;
-
-typedef enum _opvp_pathmode {
- OPVP_PATHCLOSE = 0,
- OPVP_PATHOPEN = 1
-} opvp_pathmode_t;
-
-/* CTM */
-typedef struct _opvp_ctm {
- opvp_float_t a, b, c, d, e, f;
-} opvp_ctm_t;
-
-/* Device Information and Capabilites */
-typedef enum _opvp_queryinfoflags {
- OPVP_QF_DEVICERESOLUTION = 0x00000001,
- OPVP_QF_MEDIASIZE = 0x00000002,
- OPVP_QF_PAGEROTATION = 0x00000004,
- OPVP_QF_MEDIANUP = 0x00000008,
- OPVP_QF_MEDIADUPLEX = 0x00000010,
- OPVP_QF_MEDIASOURCE = 0x00000020,
- OPVP_QF_MEDIADESTINATION = 0x00000040,
- OPVP_QF_MEDIATYPE = 0x00000080,
- OPVP_QF_MEDIACOPY = 0x00000100, /* Maximum copy number
- supported */
- OPVP_QF_PRINTREGION = 0x00010000 /* only for opvpQueryDeviceInfo */
-} opvp_queryinfoflags_t;
-
-
-/* API Procedure Entries */
-typedef struct _opvp_api_procs {
- opvp_dc_t (*opvpOpenPrinter)(opvp_int_t,const opvp_char_t*,const opvp_int_t[2],struct _opvp_api_procs**);
- opvp_result_t (*opvpClosePrinter)(opvp_dc_t);
- opvp_result_t (*opvpStartJob)(opvp_dc_t,const opvp_char_t*);
- opvp_result_t (*opvpEndJob)(opvp_dc_t);
- opvp_result_t (*opvpAbortJob)(opvp_dc_t);
- opvp_result_t (*opvpStartDoc)(opvp_dc_t,const opvp_char_t*);
- opvp_result_t (*opvpEndDoc)(opvp_dc_t);
- opvp_result_t (*opvpStartPage)(opvp_dc_t,const opvp_char_t*);
- opvp_result_t (*opvpEndPage)(opvp_dc_t);
- opvp_result_t (*opvpQueryDeviceCapability)(opvp_dc_t,opvp_flag_t,opvp_int_t*,opvp_byte_t*);
- opvp_result_t (*opvpQueryDeviceInfo)(opvp_dc_t,opvp_flag_t,opvp_int_t*,opvp_char_t*);
- opvp_result_t (*opvpResetCTM)(opvp_dc_t);
- opvp_result_t (*opvpSetCTM)(opvp_dc_t,const opvp_ctm_t*);
- opvp_result_t (*opvpGetCTM)(opvp_dc_t,opvp_ctm_t*);
- opvp_result_t (*opvpInitGS)(opvp_dc_t);
- opvp_result_t (*opvpSaveGS)(opvp_dc_t);
- opvp_result_t (*opvpRestoreGS)(opvp_dc_t);
- opvp_result_t (*opvpQueryColorSpace)(opvp_dc_t,opvp_int_t*,opvp_cspace_t*);
- opvp_result_t (*opvpSetColorSpace)(opvp_dc_t,opvp_cspace_t);
- opvp_result_t (*opvpGetColorSpace)(opvp_dc_t,opvp_cspace_t*);
- opvp_result_t (*opvpSetFillMode)(opvp_dc_t,opvp_fillmode_t);
- opvp_result_t (*opvpGetFillMode)(opvp_dc_t,opvp_fillmode_t*);
- opvp_result_t (*opvpSetAlphaConstant)(opvp_dc_t,opvp_float_t);
- opvp_result_t (*opvpGetAlphaConstant)(opvp_dc_t,opvp_float_t*);
- opvp_result_t (*opvpSetLineWidth)(opvp_dc_t,opvp_fix_t);
- opvp_result_t (*opvpGetLineWidth)(opvp_dc_t,opvp_fix_t*);
- opvp_result_t (*opvpSetLineDash)(opvp_dc_t,opvp_int_t,const opvp_fix_t*);
- opvp_result_t (*opvpGetLineDash)(opvp_dc_t,opvp_int_t*,opvp_fix_t*);
- opvp_result_t (*opvpSetLineDashOffset)(opvp_dc_t,opvp_fix_t);
- opvp_result_t (*opvpGetLineDashOffset)(opvp_dc_t,opvp_fix_t*);
- opvp_result_t (*opvpSetLineStyle)(opvp_dc_t,opvp_linestyle_t);
- opvp_result_t (*opvpGetLineStyle)(opvp_dc_t,opvp_linestyle_t*);
- opvp_result_t (*opvpSetLineCap)(opvp_dc_t,opvp_linecap_t);
- opvp_result_t (*opvpGetLineCap)(opvp_dc_t,opvp_linecap_t*);
- opvp_result_t (*opvpSetLineJoin)(opvp_dc_t,opvp_linejoin_t);
- opvp_result_t (*opvpGetLineJoin)(opvp_dc_t,opvp_linejoin_t*);
- opvp_result_t (*opvpSetMiterLimit)(opvp_dc_t,opvp_fix_t);
- opvp_result_t (*opvpGetMiterLimit)(opvp_dc_t,opvp_fix_t*);
- opvp_result_t (*opvpSetPaintMode)(opvp_dc_t,opvp_paintmode_t);
- opvp_result_t (*opvpGetPaintMode)(opvp_dc_t,opvp_paintmode_t*);
- opvp_result_t (*opvpSetStrokeColor)(opvp_dc_t,const opvp_brush_t*);
- opvp_result_t (*opvpSetFillColor)(opvp_dc_t,const opvp_brush_t*);
- opvp_result_t (*opvpSetBgColor)(opvp_dc_t,const opvp_brush_t*);
- opvp_result_t (*opvpNewPath)(opvp_dc_t);
- opvp_result_t (*opvpEndPath)(opvp_dc_t);
- opvp_result_t (*opvpStrokePath)(opvp_dc_t);
- opvp_result_t (*opvpFillPath)(opvp_dc_t);
- opvp_result_t (*opvpStrokeFillPath)(opvp_dc_t);
- opvp_result_t (*opvpSetClipPath)(opvp_dc_t,opvp_cliprule_t);
- opvp_result_t (*opvpResetClipPath)(opvp_dc_t);
- opvp_result_t (*opvpSetCurrentPoint)(opvp_dc_t,opvp_fix_t,opvp_fix_t);
- opvp_result_t (*opvpLinePath)(opvp_dc_t,opvp_pathmode_t,opvp_int_t,const opvp_point_t*);
- opvp_result_t (*opvpPolygonPath)(opvp_dc_t,opvp_int_t,const opvp_int_t*,const opvp_point_t*);
- opvp_result_t (*opvpRectanglePath)(opvp_dc_t,opvp_int_t,const opvp_rectangle_t*);
- opvp_result_t (*opvpRoundRectanglePath)(opvp_dc_t,opvp_int_t,const opvp_roundrectangle_t*);
- opvp_result_t (*opvpBezierPath)(opvp_dc_t,opvp_int_t,const opvp_point_t*);
- opvp_result_t (*opvpArcPath)(opvp_dc_t,opvp_arcmode_t,opvp_arcdir_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t);
- opvp_result_t (*opvpDrawImage)(opvp_dc_t,opvp_int_t,opvp_int_t,opvp_int_t,opvp_imageformat_t,opvp_int_t, opvp_int_t ,const void*);
- opvp_result_t (*opvpStartDrawImage)(opvp_dc_t,opvp_int_t,opvp_int_t,opvp_int_t,opvp_imageformat_t,opvp_int_t, opvp_int_t);
- opvp_result_t (*opvpTransferDrawImage)(opvp_dc_t,opvp_int_t,const void*);
- opvp_result_t (*opvpEndDrawImage)(opvp_dc_t);
- opvp_result_t (*opvpStartScanline)(opvp_dc_t,opvp_int_t);
- opvp_result_t (*opvpScanline)(opvp_dc_t,opvp_int_t,const opvp_int_t*);
- opvp_result_t (*opvpEndScanline)(opvp_dc_t);
- opvp_result_t (*opvpStartRaster)(opvp_dc_t,opvp_int_t);
- opvp_result_t (*opvpTransferRasterData)(opvp_dc_t,opvp_int_t,const opvp_byte_t*);
- opvp_result_t (*opvpSkipRaster)(opvp_dc_t,opvp_int_t);
- opvp_result_t (*opvpEndRaster)(opvp_dc_t);
- opvp_result_t (*opvpStartStream)(opvp_dc_t);
- opvp_result_t (*opvpTransferStreamData)(opvp_dc_t,opvp_int_t,const void*);
- opvp_result_t (*opvpEndStream)(opvp_dc_t);
-} opvp_api_procs_t;
-
-/* Function prototype */
-opvp_dc_t opvpOpenPrinter(
- opvp_int_t outputFD,
- const opvp_char_t *printerModel,
- const opvp_int_t apiVersion[2],
- opvp_api_procs_t **apiProcs);
-
-/* error no */
-extern opvp_int_t opvpErrorNo;
-
-#endif /* _OPVP_H_ */
diff --git a/filter/pdftoopvp/opvp/opvp_0_2_0.h b/filter/pdftoopvp/opvp/opvp_0_2_0.h
deleted file mode 100644
index f766858..0000000
--- a/filter/pdftoopvp/opvp/opvp_0_2_0.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
-
-Copyright (c) 2003-2004, AXE, Inc. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-/* $Id: opvp_0_2_0.h 85 2007-02-15 08:48:56Z sho-otani $ */
-/* opvp_common.h ver.1.00 rel.1.0 26 Nov 2004 */
-/* OpenPrinting Vector Printer Driver Glue Code */
-
-#ifndef _FSGPD_0_2_0_H
-#define _FSGPD_0_2_0_H
-
-#define _PDAPI_VERSION_MAJOR_ 0
-#define _PDAPI_VERSION_MINOR_ 2
-
-/* Return Values */
-#define OPVP_OK 0 /* error is -1 */
-
-/* Error Codes */
-#define OPVP_FATALERROR -101 /* unrecoverable error occurred within the */
- /* library */
-#define OPVP_BADREQUEST -102 /* invalid function parameters */
-#define OPVP_BADCONTEXT -103 /* bad parameter precontext */
-#define OPVP_NOTSUPPORTED -104 /* printer or driver request not supported */
-#define OPVP_JOBCANCELED -105 /* job cancelled */
-#define OPVP_PARAMERROR -106 /* illegal parameter combination */
-
-/* Info params */
-#define OPVP_INFO_PREFIX "updf:"
-
-/* Fix */
-#define OPVP_FIX_FRACT_WIDTH 8
-#define OPVP_FIX_FRACT_DENOM (1<<OPVP_FIX_FRACT_WIDTH)
-#define OPVP_FIX_FLOOR_WIDTH (sizeof(int)*8-OPVP_FIX_FRACT_WIDTH)
-#if 0
-typedef struct {
- unsigned int fract : OPVP_FIX_FRACT_WIDTH;
- signed int floor : OPVP_FIX_FLOOR_WIDTH;
-} OPVP_Fix;
-#define OPVP_i2Fix(i,fix) (fix.fract=0,fix.floor=i)
-#define OPVP_Fix2f(fix,f) (f=(double)fix.floor\
- +(double)(fix.fract)/OPVP_FIX_FRACT_DENOM)
-#define OPVP_f2Fix(f,fix) (fix.fract=(f-floor(f))*OPVP_FIX_FRACT_DENOM,\
- fix.floor=floor(f))
-#else
-typedef int OPVP_Fix;
-#define OPVP_i2Fix(i,fix) (fix=(i)<<8)
-#define OPVP_f2Fix(f,fix) (fix=((int)floor(f)<<8)\
- |((int)(((f)-floor(f))*OPVP_FIX_FRACT_DENOM)\
- &0x000000ff))
-#endif
-
-/* Basic Types */
-typedef struct _OPVP_Point {
- OPVP_Fix x;
- OPVP_Fix y;
-} OPVP_Point;
-
-typedef struct _OPVP_Rectangle {
- OPVP_Point p0; /* start point */
- OPVP_Point p1; /* end point */
-} OPVP_Rectangle;
-
-typedef struct _OPVP_RoundRectangle {
- OPVP_Point p0; /* start point */
- OPVP_Point p1; /* end point */
- OPVP_Fix xellipse;
- OPVP_Fix yellipse;
-} OPVP_RoundRectangle;
-
-/* Image Formats */
-typedef enum _OPVP_ImageFormat {
- OPVP_iformatRaw = 0,
- OPVP_iformatRLE = 1,
- OPVP_iformatJPEG = 2,
- OPVP_iformatPNG = 3
-} OPVP_ImageFormat;
-
-/* Color Presentation */
-typedef enum _OPVP_ColorMapping {
- OPVP_cmapDirect = 0,
- OPVP_cmapIndexed = 1
-} OPVP_ColorMapping;
-
-typedef enum _OPVP_ColorSpace {
- OPVP_cspaceBW = 0,
- OPVP_cspaceDeviceGray = 1,
- OPVP_cspaceDeviceCMY = 2,
- OPVP_cspaceDeviceCMYK = 3,
- OPVP_cspaceDeviceRGB = 4,
- OPVP_cspaceStandardRGB = 5,
- OPVP_cspaceStandardRGB64 = 6
-} OPVP_ColorSpace;
-
-/* Raster Operation modes */
-typedef enum _OPVP_ROP {
- OPVP_ropPset = 0,
- OPVP_ropPreset = 1,
- OPVP_ropOr = 2,
- OPVP_ropAnd = 3,
- OPVP_ropXor = 4
-} OPVP_ROP;
-
-/* Fill, Paint, Clip */
-typedef enum _OPVP_FillMode {
- OPVP_fillModeEvenOdd = 0,
- OPVP_fillModeWinding = 1
-} OPVP_FillMode;
-
-typedef enum _OPVP_PaintMode {
- OPVP_paintModeOpaque = 0,
- OPVP_paintModeTransparent = 1
-} OPVP_PaintMode;
-
-typedef enum _OPVP_ClipRule {
- OPVP_clipRuleEvenOdd = 0,
- OPVP_clipRuleWinding = 1
-} OPVP_ClipRule;
-
-/* Line */
-typedef enum _OPVP_LineStyle {
- OPVP_lineStyleSolid = 0,
- OPVP_lineStyleDash = 1
-} OPVP_LineStyle;
-
-typedef enum _OPVP_LineCap {
- OPVP_lineCapButt = 0,
- OPVP_lineCapRound = 1,
- OPVP_lineCapSquare = 2
-} OPVP_LineCap;
-
-typedef enum _OPVP_LineJoin {
- OPVP_lineJoinMiter = 0,
- OPVP_lineJoinRound = 1,
- OPVP_lineJoinBevel = 2
-} OPVP_LineJoin;
-
-/* Brush */
-typedef enum _OPVP_BrushDataType {
- OPVP_bdtypeNormal = 0
-} OPVP_BrushDataType;
-
-typedef struct _OPVP_BrushData {
- OPVP_BrushDataType type;
- int width;
- int height;
- int pitch;
-#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
- void *data; /* pointer to actual data */
-#else
- char data[1];
-#endif
-} OPVP_BrushData;
-
-typedef struct _OPVP_Brush {
- OPVP_ColorSpace colorSpace;
- int color[4]; /* aRGB quadruplet */
-#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
- OPVP_BrushData *pbrush; /* pointer to brush data */
- /* solid brush used, if null */
- int xorg; /* brush origin */
- int yorg; /* ignored for SetBgColor */
-#else
- int xorg; /* brush origin */
- int yorg; /* ignored for SetBgColor */
- OPVP_BrushData *pbrush; /* pointer to brush data */
- /* solid brush used, if null */
-#endif
-} OPVP_Brush;
-
-/* Misc. Flags */
-#define OPVP_Arc 0 /* circular arc */
-#define OPVP_Chord 1 /* arch */
-#define OPVP_Pie 2 /* pie section */
-#define OPVP_Clockwise 0 /* clockwise */
-#define OPVP_Counterclockwise 1 /* counter-clockwise */
-#define OPVP_PathClose 0 /* Close path when using LinePath */
-#define OPVP_PathOpen 1 /* Do not close path when using LinePath */
-
-/* CTM */
-typedef struct _OPVP_CTM {
- float a;
- float b;
- float c;
- float d;
- float e;
- float f;
-} OPVP_CTM;
-
-/* Vector Driver API Proc. Entries */
-typedef struct _OPVP_api_procs {
- int (*OpenPrinter)(int,char *,int *,struct _OPVP_api_procs **);
- int (*ClosePrinter)(int);
- int (*StartJob)(int,char *);
- int (*EndJob)(int);
- int (*StartDoc)(int,char *);
- int (*EndDoc)(int);
- int (*StartPage)(int,char *);
- int (*EndPage)(int);
-#if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2)
- int (*QueryDeviceCapability)(int,int,int,char *);
- int (*QueryDeviceInfo)(int,int,int,char *);
-#endif
- int (*ResetCTM)(int);
- int (*SetCTM)(int,OPVP_CTM *);
- int (*GetCTM)(int,OPVP_CTM *);
- int (*InitGS)(int);
- int (*SaveGS)(int);
- int (*RestoreGS)(int);
- int (*QueryColorSpace)(int,OPVP_ColorSpace *,int *);
- int (*SetColorSpace)(int,OPVP_ColorSpace);
- int (*GetColorSpace)(int,OPVP_ColorSpace *);
- int (*QueryROP)(int,int *,int *);
- int (*SetROP)(int,int);
- int (*GetROP)(int,int *);
- int (*SetFillMode)(int,OPVP_FillMode);
- int (*GetFillMode)(int,OPVP_FillMode *);
- int (*SetAlphaConstant)(int,float);
- int (*GetAlphaConstant)(int,float *);
- int (*SetLineWidth)(int,OPVP_Fix);
- int (*GetLineWidth)(int,OPVP_Fix *);
- int (*SetLineDash)(int,OPVP_Fix *,int);
- int (*GetLineDash)(int,OPVP_Fix *,int *);
- int (*SetLineDashOffset)(int,OPVP_Fix);
- int (*GetLineDashOffset)(int,OPVP_Fix *);
- int (*SetLineStyle)(int,OPVP_LineStyle);
- int (*GetLineStyle)(int,OPVP_LineStyle *);
- int (*SetLineCap)(int,OPVP_LineCap);
- int (*GetLineCap)(int,OPVP_LineCap *);
- int (*SetLineJoin)(int,OPVP_LineJoin);
- int (*GetLineJoin)(int,OPVP_LineJoin *);
- int (*SetMiterLimit)(int,OPVP_Fix);
- int (*GetMiterLimit)(int,OPVP_Fix *);
- int (*SetPaintMode)(int,OPVP_PaintMode);
- int (*GetPaintMode)(int,OPVP_PaintMode *);
- int (*SetStrokeColor)(int,OPVP_Brush *);
- int (*SetFillColor)(int,OPVP_Brush *);
- int (*SetBgColor)(int,OPVP_Brush *);
- int (*NewPath)(int);
- int (*EndPath)(int);
- int (*StrokePath)(int);
- int (*FillPath)(int);
- int (*StrokeFillPath)(int);
- int (*SetClipPath)(int,OPVP_ClipRule);
-#if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2)
- int (*ResetClipPath)(int);
-#endif
- int (*SetCurrentPoint)(int,OPVP_Fix,OPVP_Fix);
- int (*LinePath)(int,int,int,OPVP_Point *);
- int (*PolygonPath)(int,int,int *,OPVP_Point *);
- int (*RectanglePath)(int,int,OPVP_Rectangle *);
- int (*RoundRectanglePath)(int,int,OPVP_RoundRectangle *);
-#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
- int (*BezierPath)(int,int *,OPVP_Point *);
-#else
- int (*BezierPath)(int,int,OPVP_Point *);
-#endif
- int (*ArcPath)(int,int,int,OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix,
- OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix);
- int (*DrawBitmapText)(int,int,int,int,void *);
- int (*DrawImage)(int,int,int,int,
- OPVP_ImageFormat,OPVP_Rectangle,int,void *);
- int (*StartDrawImage)(int,int,int,int,
- OPVP_ImageFormat,OPVP_Rectangle);
- int (*TransferDrawImage)(int,int,void *);
- int (*EndDrawImage)(int);
- int (*StartScanline)(int,int);
- int (*Scanline)(int,int,int *);
- int (*EndScanline)(int);
- int (*StartRaster)(int,int);
- int (*TransferRasterData)(int,int,unsigned char *);
- int (*SkipRaster)(int,int);
- int (*EndRaster)(int);
- int (*StartStream)(int);
- int (*TransferStreamData)(int,int,void *);
- int (*EndStream)(int);
-} OPVP_api_procs;
-
-#endif /* _OPVP_COMMON_H_ */
-
diff --git a/filter/pdftoopvp/opvp/opvp_common.h b/filter/pdftoopvp/opvp/opvp_common.h
deleted file mode 100644
index 5d65b32..0000000
--- a/filter/pdftoopvp/opvp/opvp_common.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-
-Copyright (c) 2003-2004, AXE, Inc. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-/* OpenPrinting Vector Printer Driver Glue Code */
-
-#ifndef _OPVP_COMMON_H_
-#define _OPVP_COMMON_H_
-
-#include "opvp_0_2_0.h"
-#undef _PDAPI_VERSION_MAJOR_
-#undef _PDAPI_VERSION_MINOR_
-/* undefine conflicted macros */
-#undef OPVP_INFO_PREFIX
-#undef OPVP_OK
-#undef OPVP_FATALERROR
-#undef OPVP_BADREQUEST
-#undef OPVP_BADCONTEXT
-#undef OPVP_NOTSUPPORTED
-#undef OPVP_JOBCANCELED
-#undef OPVP_PARAMERROR
-/* define 0_2 error no as different macros */
-#define OPVP_FATALERROR_0_2 -101
-#define OPVP_BADREQUEST_0_2 -102
-#define OPVP_BADCONTEXT_0_2 -103
-#define OPVP_NOTSUPPORTED_0_2 -104
-#define OPVP_JOBCANCELED_0_2 -105
-#define OPVP_PARAMERROR_0_2 -106
-
-#include "opvp.h"
-#define OPVP_INFO_PREFIX ""
-
-#endif /* _OPVP_COMMON_H_ */
-
diff --git a/filter/pdftoopvp/pdftoopvp.cxx b/filter/pdftoopvp/pdftoopvp.cxx
deleted file mode 100644
index c6178ac..0000000
--- a/filter/pdftoopvp/pdftoopvp.cxx
+++ /dev/null
@@ -1,789 +0,0 @@
-//========================================================================
-//
-// pdftoopvp.cc
-//
-// Copyright 2005 AXE,Inc.
-//
-// 2007,2008,2009 Modified by BBR Inc.
-//========================================================================
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <math.h>
-#ifdef HAVE_CPP_POPPLER_VERSION_H
-#include "cpp/poppler-version.h"
-#endif
-#include "goo/GooString.h"
-#define GSTRING_H // for old GooString.h
-#include "goo/gmem.h"
-#include "GlobalParams.h"
-#include "Object.h"
-#include "PDFDoc.h"
-#include "splash/SplashBitmap.h"
-#include "OPRS.h"
-#include "OPVPOutputDev.h"
-#include "Gfx.h"
-#include <cups/cups.h>
-#include <cups/ppd.h>
-#include "OPVPError.h"
-
-#define MMPERINCH (25.4)
-
-static int resolution = 300;
-static int hResolution = 0;
-static int vResolution = 0;
-static GBool mono = gFalse;
-static GBool reverse = gFalse;
-static GBool gray = gFalse;
-static char enableFreeTypeStr[16] = "";
-static GBool quiet = gFalse;
-static char outputOrderStr[256] = "";
-static GBool oldLipsDriver = gFalse;
-static GBool HPDriver = gFalse;
-static GBool NECDriver = gFalse;
-static GBool clipPathNotSaved = gFalse;
-static GBool noShearImage = gFalse;
-static GBool noLineStyle = gFalse;
-static GBool noImageMask = gFalse;
-static GBool noClipPath = gFalse;
-static GBool ignoreMiterLimit = gFalse;
-static GBool noMiterLimit = gFalse;
-static char printerDriver[1024] = "";
-static char printerModel[1024] = "";
-static char jobInfo[4096] = "";
-static char docInfo[1024] = "";
-static char pageInfo[1024] = "";
-static GBool noBitmapChar = gFalse;
-static char bitmapCharThreshold[20] = "2000";
-static char maxClipPathLength[20] = "2000";
-static char maxFillPathLength[20] = "4000";
-static int pageWidth = -1;
-static int pageHeight = -1;
-
-static int outOnePage(PDFDoc *doc, OPVPOutputDev *opvpOut, int pg)
-{
- char buf[1024];
- char *p;
- double pw = doc->getPageMediaWidth(pg);
- double ph = doc->getPageMediaHeight(pg);
- int paperWidth;
- int paperHeight;
-
- if (pw != pageWidth || ph != pageHeight) {
- if (pageInfo[0] != '\0') {
- snprintf(buf,sizeof(buf),"%s;MediaSize=%dx%dmm",pageInfo,
- (int)(pw*MMPERINCH/72),
- (int)(ph*MMPERINCH/72));
- } else {
- snprintf(buf,sizeof(buf),"MediaSize=%dx%dmm",
- (int)(pw*MMPERINCH/72),
- (int)(ph*MMPERINCH/72));
- }
- p = buf;
- } else {
- pw = pageWidth;
- ph = pageHeight;
- p = pageInfo;
- }
-
- paperWidth = (int)(pw*hResolution/72+0.5);
- paperHeight = (int)(ph*vResolution/72+0.5);
- if (opvpOut->OPVPStartPage(p,paperWidth,paperHeight) < 0) {
- opvpError(-1,"Start Page failed");
- return 2;
- }
- opvpOut->setScale(1.0,1.0,0,0,0,0,paperHeight);
- doc->displayPage(opvpOut, pg, resolution, resolution,
- 0, gTrue, gTrue, gFalse);
- if (opvpOut->outSlice() < 0) {
- opvpError(-1,"OutSlice failed");
- return 2;
- }
- if (opvpOut->OPVPEndPage() < 0) {
- opvpError(-1,"End Page failed");
- return 2;
- }
- return 0;
-}
-
-#define MAX_OPVP_OPTIONS 20
-
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
-void CDECL myErrorFun(void *data, ErrorCategory category,
- int pos, char *msg)
-{
- if (pos >= 0) {
- fprintf(stderr, "ERROR (%d): ", pos);
- } else {
- fprintf(stderr, "ERROR: ");
- }
- fprintf(stderr, "%s\n",msg);
- fflush(stderr);
-}
-#else
-void CDECL myErrorFun(int pos, char *msg, va_list args)
-{
- if (pos >= 0) {
- fprintf(stderr, "ERROR (%d): ", pos);
- } else {
- fprintf(stderr, "ERROR: ");
- }
- vfprintf(stderr, msg, args);
- fprintf(stderr, "\n");
- fflush(stderr);
-}
-#endif
-
-static GBool getColorProfilePath(ppd_file_t *ppd, GooString *path)
-{
- // get color profile path
- const char *colorModel;
- const char *cupsICCQualifier2;
- const char *cupsICCQualifier2Choice;
- const char *cupsICCQualifier3;
- const char *cupsICCQualifier3Choice;
- ppd_attr_t *attr;
- ppd_choice_t *choice;
-
- if ((attr = ppdFindAttr(ppd,"ColorModel",NULL)) != NULL) {
- colorModel = attr->value;
- } else {
- colorModel = NULL;
- }
- if ((attr = ppdFindAttr(ppd,"cupsICCQualifier2",NULL)) != NULL) {
- cupsICCQualifier2 = attr->value;
- } else {
- cupsICCQualifier2 = "MediaType";
- }
- if ((choice = ppdFindMarkedChoice(ppd,cupsICCQualifier2)) != NULL) {
- cupsICCQualifier2Choice = choice->choice;
- } else {
- cupsICCQualifier2Choice = NULL;
- }
- if ((attr = ppdFindAttr(ppd,"cupsICCQualifier3",NULL)) != NULL) {
- cupsICCQualifier3 = attr->value;
- } else {
- cupsICCQualifier3 = "Resolution";
- }
- if ((choice = ppdFindMarkedChoice(ppd,cupsICCQualifier3)) != NULL) {
- cupsICCQualifier3Choice = choice->choice;
- } else {
- cupsICCQualifier3Choice = NULL;
- }
-
- for (attr = ppdFindAttr(ppd,"cupsICCProfile",NULL);attr != NULL;
- attr = ppdFindNextAttr(ppd,"cupsICCProfile",NULL)) {
- // check color model
- char buf[PPD_MAX_NAME];
- char *p, *r;
-
- strncpy(buf,attr->spec,sizeof(buf));
- if ((p = strchr(buf,'.')) != NULL) {
- *p = '\0';
- }
- if (colorModel != NULL && buf[0] != '\0'
- && strcasecmp(buf,colorModel) != 0) continue;
- if (p == NULL) {
- break;
- } else {
- p++;
- if ((r = strchr(p,'.')) != 0) {
- *r = '\0';
- }
- }
- if (cupsICCQualifier2Choice != NULL && p[0] != '\0'
- && strcasecmp(p,cupsICCQualifier2Choice) != 0) continue;
- if (r == NULL) {
- break;
- } else {
- r++;
- if ((p = strchr(r,'.')) != 0) {
- *p = '\0';
- }
- }
- if (cupsICCQualifier3Choice == NULL || r[0] == '\0'
- || strcasecmp(r,cupsICCQualifier3Choice) == 0) break;
- }
- if (attr != NULL) {
- // matched
- path->clear();
- if (attr->value[0] != '/') {
- path->append(CUPS_DATADIR);
- path->append("/profiles/");
- }
- path->append(attr->value);
- return gTrue;
- }
- return gFalse;
-}
-
-int main(int argc, char *argv[]) {
-/* mtrace(); */
- int exitCode;
-{
- PDFDoc *doc;
- SplashColor paperColor;
- OPVPOutputDev *opvpOut;
- GBool ok = gTrue;
- int pg;
- const char *optionKeys[MAX_OPVP_OPTIONS];
- const char *optionVals[MAX_OPVP_OPTIONS];
- int nOptions = 0;
- int numPages;
- int i;
- GooString fileName;
- GooString colorProfilePath("opvp.icc");
-
- exitCode = 99;
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
- setErrorCallback(::myErrorFun,NULL);
-#else
- setErrorFunction(::myErrorFun);
-#endif
-
- // parse args
- int num_options;
- cups_option_t *options;
- const char *val;
- char *ppdFileName;
- ppd_file_t *ppd = 0;
- ppd_attr_t *attr;
- GooString jobInfoStr;
- GooString docInfoStr;
- GooString pageInfoStr;
- GBool colorProfile = gFalse;
-
-
- if (argc < 6 || argc > 7) {
- opvpError(-1,"ERROR: %s job-id user title copies options [file]",
- argv[0]);
- return (1);
- }
-
- if ((ppdFileName = getenv("PPD")) != 0) {
- if ((ppd = ppdOpenFile(ppdFileName)) != 0) {
- /* get attributes from PPD File */
- if ((attr = ppdFindAttr(ppd,"opvpJobInfo",0)) != 0) {
- jobInfoStr.append(attr->value);
- }
- if ((attr = ppdFindAttr(ppd,"opvpDocInfo",0)) != 0) {
- docInfoStr.append(attr->value);
- }
- if ((attr = ppdFindAttr(ppd,"opvpPageInfo",0)) != 0) {
- pageInfoStr.append(attr->value);
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpOldLipsDriver",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- oldLipsDriver = gTrue;
- } else {
- oldLipsDriver = gFalse;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpHPDriver",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- HPDriver = gTrue;
- } else {
- HPDriver = gFalse;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpNECDriver",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- NECDriver = gTrue;
- } else {
- NECDriver = gFalse;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpClipPathNotSaved",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- clipPathNotSaved = gTrue;
- } else {
- clipPathNotSaved = gFalse;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpShearImage",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- noShearImage = gFalse;
- } else {
- noShearImage = gTrue;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpLineStyle",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- noLineStyle = gFalse;
- } else {
- noLineStyle = gTrue;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpImageMask",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- noImageMask = gFalse;
- } else {
- noImageMask = gTrue;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpClipPath",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- noClipPath = gFalse;
- } else {
- noClipPath = gTrue;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpMiterLimit",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- noMiterLimit = gFalse;
- } else {
- noMiterLimit = gTrue;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpIgnoreMiterLimit",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- ignoreMiterLimit = gTrue;
- } else {
- ignoreMiterLimit = gFalse;
- }
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpBitmapCharThreshold",0)) != 0) {
- strncpy(bitmapCharThreshold,attr->value,
- sizeof(bitmapCharThreshold)-1);
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpMaxClipPathLength",0)) != 0) {
- strncpy(maxClipPathLength,attr->value,
- sizeof(maxClipPathLength)-1);
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpMaxFillPathLength",0)) != 0) {
- strncpy(maxFillPathLength,attr->value,
- sizeof(maxFillPathLength)-1);
- }
- if ((attr = ppdFindAttr(ppd,"pdftoopvpBitmapChar",0)) != 0) {
- if (strcasecmp(attr->value,"true") == 0) {
- noBitmapChar = gFalse;
- } else {
- noBitmapChar = gTrue;
- }
- }
- if ((attr = ppdFindAttr(ppd,"opvpDriver",0)) != 0) {
- strncpy(printerDriver,attr->value,sizeof(printerDriver)-1);
- printerDriver[sizeof(printerDriver)-1] = '\0';
- }
- if ((attr = ppdFindAttr(ppd,"opvpModel",0)) != 0) {
- strncpy(printerModel,attr->value,sizeof(printerModel)-1);
- printerModel[sizeof(printerModel)-1] = '\0';
- }
- ppdMarkDefaults(ppd);
- }
- }
- /* get attributes and options from command line option */
- num_options = cupsParseOptions(argv[5],0,&options);
- cupsMarkOptions(ppd,num_options,options);
-
- for (i = 0;i < num_options;i++) {
- if (strcasecmp(options[i].name,"Resolution") == 0) {
- resolution = atoi(options[i].value);
- } else if (strcasecmp(options[i].name,"pdftoopvpOldLipsDriver") == 0) {
- oldLipsDriver = gTrue;
- } else if (strcasecmp(options[i].name,"pdftoopvpHPDriver") == 0) {
- HPDriver = gTrue;
- } else if (strcasecmp(options[i].name,"pdftoopvpNECDriver") == 0) {
- NECDriver = gTrue;
- } else if (strcasecmp(options[i].name,"pdftoopvpClipPathNotSaved") == 0) {
- clipPathNotSaved = gTrue;
- } else if (strcasecmp(options[i].name,"pdftoopvpShearImage") == 0) {
- if (strcasecmp(options[i].value,"false") == 0) {
- noShearImage = gTrue;
- }
- } else if (strcasecmp(options[i].name,"pdftoopvpLineStyle") == 0) {
- if (strcasecmp(options[i].value,"false") == 0) {
- noLineStyle = gTrue;
- }
- } else if (strcasecmp(options[i].name,"pdftoopvpImageMask") == 0) {
- if (strcasecmp(options[i].value,"false") == 0) {
- noImageMask = gTrue;
- }
- } else if (strcasecmp(options[i].name,"pdftoopvpClipPath") == 0) {
- if (strcasecmp(options[i].value,"false") == 0) {
- noClipPath = gTrue;
- }
- } else if (strcasecmp(options[i].name,"pdftoopvpMiterLimit") == 0) {
- if (strcasecmp(options[i].value,"false") == 0) {
- noMiterLimit = gTrue;
- }
- } else if (strcasecmp(options[i].name,"pdftoopvpIgnoreMiterLimit") == 0) {
- if (strcasecmp(options[i].value,"true") == 0) {
- ignoreMiterLimit = gTrue;
- }
- }
- else if (strcasecmp(options[i].name,"pdftoopvpBitmapChar") == 0) {
- if (strcasecmp(options[i].value,"false") == 0) {
- noBitmapChar = gTrue;
- }
- } else if (strcasecmp(options[i].name,"pdftoopvpBitmapCharThreshold") == 0) {
- strncpy(bitmapCharThreshold,options[i].value,
- sizeof(bitmapCharThreshold)-1);
- } else if (strcasecmp(options[i].name,"pdftoopvpMaxClipPathLength") == 0) {
- strncpy(maxClipPathLength,options[i].value,
- sizeof(maxClipPathLength)-1);
- } else if (strcasecmp(options[i].name,"pdftoopvpMaxFillPathLength") == 0) {
- strncpy(maxFillPathLength,options[i].value,
- sizeof(maxFillPathLength)-1);
- } else if (strcasecmp(options[i].name,"opvpDriver") == 0) {
- strncpy(printerDriver,options[i].value,sizeof(printerDriver)-1);
- printerDriver[sizeof(printerDriver)-1] = '\0';
- } else if (strcasecmp(options[i].name,"opvpModel") == 0) {
- strncpy(printerModel,options[i].value,sizeof(printerModel)-1);
- printerModel[sizeof(printerModel)-1] = '\0';
- } else if (strcasecmp(options[i].name,"opvpJobInfo") == 0) {
- /* do nothing here */;
- } else if (strcasecmp(options[i].name,"opvpDocInfo") == 0) {
- /* do nothing here */;
- } else if (strcasecmp(options[i].name,"opvpPageInfo") == 0) {
- /* do nothing here */;
- }
- }
- if (ppd != 0) {
- int section;
- ppd_choice_t **choices;
- ppd_size_t *pagesize;
-
- if ((pagesize = ppdPageSize(ppd,0)) != 0) {
- pageWidth = (int)pagesize->width;
- pageHeight = (int)pagesize->length;
- }
- for (section = (int)PPD_ORDER_ANY;
- section <= (int)PPD_ORDER_PROLOG;section++) {
- int n;
-
- n = ppdCollect(ppd,(ppd_section_t)section,&choices);
- for (i = 0;i < n;i++) {
-
- if (strcasecmp(((ppd_option_t *)(choices[i]->option))->keyword,
- "Resolution") == 0) {
- resolution = atoi(choices[i]->choice);
- }
- }
- if (choices != 0) free(choices);
- }
-
- strncpy(jobInfo,jobInfoStr.getCString(),sizeof(jobInfo)-1);
- jobInfo[sizeof(jobInfo)-1] = '\0';
- strncpy(docInfo,docInfoStr.getCString(),sizeof(docInfo)-1);
- docInfo[sizeof(docInfo)-1] = '\0';
- strncpy(pageInfo,pageInfoStr.getCString(),sizeof(pageInfo)-1);
- pageInfo[sizeof(pageInfo)-1] = '\0';
-
- colorProfile = getColorProfilePath(ppd,&colorProfilePath);
-
- ppdClose(ppd);
- }
- if ((val = cupsGetOption("opvpJobInfo",num_options, options)) != 0) {
- /* override ppd value */
- strncpy(jobInfo,val,sizeof(jobInfo)-1);
- jobInfo[sizeof(jobInfo)-1] = '\0';
- }
- if ((val = cupsGetOption("opvpDocInfo",num_options, options)) != 0) {
- /* override ppd value */
- strncpy(docInfo,val,sizeof(docInfo)-1);
- docInfo[sizeof(docInfo)-1] = '\0';
- }
- if ((val = cupsGetOption("opvpPageInfo",num_options, options)) != 0) {
- /* override ppd value */
- strncpy(pageInfo,val,sizeof(pageInfo)-1);
- pageInfo[sizeof(pageInfo)-1] = '\0';
- }
-
- cupsFreeOptions(num_options,options);
-#if 0
- /* for debug parameters */
- fprintf(stderr,"WARNING:resolution=%d\n",resolution);
- fprintf(stderr,"WARNING:sliceHeight=%d\n",sliceHeight);
- fprintf(stderr,"WARNING:oldLipsDriver=%d\n",oldLipsDriver);
- fprintf(stderr,"WARNING:HPDriver=%d\n",HPDriver);
- fprintf(stderr,"WARNING:NECDriver=%d\n",NECDriver);
- fprintf(stderr,"WARNING:clipPathNotSaved=%d\n",clipPathNotSaved);
- fprintf(stderr,"WARNING:noShearImage=%d\n",noShearImage);
- fprintf(stderr,"WARNING:noLineStyle=%d\n",noLineStyle);
- fprintf(stderr,"WARNING:noClipPath=%d\n",noClipPath);
- fprintf(stderr,"WARNING:noMiterLimit=%d\n",noMiterLimit);
- fprintf(stderr,"WARNING:printerDriver=%s\n",printerDriver);
- fprintf(stderr,"WARNING:printerModel=%s\n",printerModel);
- fprintf(stderr,"WARNING:jobInfo=%s\n",jobInfo);
- fprintf(stderr,"WARNING:docInfo=%s\n",docInfo);
- fprintf(stderr,"WARNING:pageInfo=%s\n",pageInfo);
- fprintf(stderr,"WARNING:noBitmapChar=%d\n",noBitmapChar);
- fprintf(stderr,"WARNING:bitmapCharThreshold=%s\n",bitmapCharThreshold);
- fprintf(stderr,"WARNING:maxClipPathLength=%s\n",maxClipPathLength);
- fprintf(stderr,"WARNING:maxFillPathLength=%s\n",maxFillPathLength);
-exit(0);
-#endif
-
- if (oldLipsDriver) {
- optionKeys[nOptions] = "OPVP_OLDLIPSDRIVER";
- optionVals[nOptions] = "1";
- nOptions++;
- clipPathNotSaved = gTrue;
- noShearImage = gTrue;
- }
- if (HPDriver) {
- noClipPath = gTrue;
- noLineStyle = gTrue;
- noShearImage = gTrue;
- }
- if (NECDriver) {
- noMiterLimit = gTrue;
- strcpy(maxClipPathLength,"6");
- noShearImage = gTrue;
- }
- if (clipPathNotSaved) {
- optionKeys[nOptions] = "OPVP_CLIPPATHNOTSAVED";
- optionVals[nOptions] = "1";
- nOptions++;
- }
- if (noShearImage) {
- optionKeys[nOptions] = "OPVP_NOSHEARIMAGE";
- optionVals[nOptions] = "1";
- nOptions++;
- }
- if (noLineStyle) {
- optionKeys[nOptions] = "OPVP_NOLINESTYLE";
- optionVals[nOptions] = "1";
- nOptions++;
- }
- if (noImageMask) {
- optionKeys[nOptions] = "OPVP_NOIMAGEMASK";
- optionVals[nOptions] = "1";
- nOptions++;
- }
- if (noClipPath) {
- optionKeys[nOptions] = "OPVP_NOCLIPPATH";
- optionVals[nOptions] = "1";
- nOptions++;
- }
- if (noMiterLimit) {
- optionKeys[nOptions] = "OPVP_NOMITERLIMIT";
- optionVals[nOptions] = "1";
- nOptions++;
- }
- if (noBitmapChar) {
- optionKeys[nOptions] = "OPVP_NOBITMAPCHAR";
- optionVals[nOptions] = "1";
- nOptions++;
- }
- if (ignoreMiterLimit) {
- optionKeys[nOptions] = "OPVP_IGNOREMITERLIMIT";
- optionVals[nOptions] = "1";
- nOptions++;
- }
- optionKeys[nOptions] = "OPVP_BITMAPCHARTHRESHOLD";
- optionVals[nOptions] = bitmapCharThreshold;
- nOptions++;
- optionKeys[nOptions] = "OPVP_MAXCLIPPATHLENGTH";
- optionVals[nOptions] = maxClipPathLength;
- nOptions++;
- optionKeys[nOptions] = "OPVP_MAXFILLPATHLENGTH";
- optionVals[nOptions] = maxFillPathLength;
- nOptions++;
- if (hResolution == 0) hResolution = resolution;
- if (hResolution == 0) hResolution = resolution;
- if (vResolution == 0) vResolution = resolution;
- if (strcasecmp(outputOrderStr,"reverse") == 0) {
- reverse = gTrue;
- }
-
- if (argc > 6) {
- fileName.append(argv[6]);
- } else {
- fileName.append("-");
- }
-
- // read config file
- globalParams = new GlobalParams();
- if (enableFreeTypeStr[0]) {
- if (!globalParams->setEnableFreeType(enableFreeTypeStr)) {
- opvpError(-1,"Bad '-freetype' value on command line");
- ok = gFalse;
- }
- }
- globalParams->setAntialias("no");
- if (quiet) {
- globalParams->setErrQuiet(quiet);
- }
- if (!ok) {
- exitCode = 2;
- goto err0;
- }
-
- if (fileName.cmp("-") == 0) {
- /* stdin */
- char *s;
- GooString name;
- int fd;
- Object obj;
- BaseStream *str;
- FILE *fp;
- char buf[4096];
- int n;
-
- /* create a tmp file */
- if ((s = getenv("TMPDIR")) != 0) {
- name.append(s);
- } else {
- name.append("/tmp");
- }
- name.append("/XXXXXX");
- fd = mkstemp(name.getCString());
- /* remove name */
- unlink(name.getCString());
- if (fd < 0) {
- opvpError(-1,"Can't create temporary file");
- exitCode = 2;
- goto err0;
- }
-
- /* check JCL */
- while (fgets(buf,sizeof(buf)-1,stdin) != NULL
- && strncmp(buf,"%PDF",4) != 0) {
- if (strncmp(buf,"pdftoopvp jobInfo:",18) == 0) {
- /* JCL jobInfo exists, override jobInfo */
- strncpy(jobInfo,buf+18,sizeof(jobInfo)-1);
- for (i = sizeof(jobInfo)-2;i >= 0
- && (jobInfo[i] == 0 || jobInfo[i] == '\n' || jobInfo[i] == ';')
- ;i--);
- jobInfo[i+1] = 0;
- }
- }
- if (strncmp(buf,"%PDF",4) != 0) {
- opvpError(-1,"Can't find PDF header");
- exitCode = 2;
- goto err0;
- }
- /* copy PDF header */
- n = strlen(buf);
- if (write(fd,buf,n) != n) {
- opvpError(-1,"Can't copy stdin to temporary file");
- close(fd);
- exitCode = 2;
- goto err0;
- }
- /* copy rest stdin to the tmp file */
- while ((n = fread(buf,1,sizeof(buf),stdin)) > 0) {
- if (write(fd,buf,n) != n) {
- opvpError(-1,"Can't copy stdin to temporary file");
- close(fd);
- exitCode = 2;
- goto err0;
- }
- }
- if (lseek(fd,0,SEEK_SET) < 0) {
- opvpError(-1,"Can't rewind temporary file");
- close(fd);
- exitCode = 2;
- goto err0;
- }
-
- if ((fp = fdopen(fd,"rb")) == 0) {
- opvpError(-1,"Can't fdopen temporary file");
- close(fd);
- exitCode = 2;
- goto err0;
- }
-
- obj.initNull();
- str = new FileStream(fp,0,gFalse,0,&obj);
- doc = new PDFDoc(str);
- } else {
- /* no jcl check */
- doc = new PDFDoc(fileName.copy());
- }
- if (!doc->isOk()) {
- opvpError(-1," Parsing PDF failed: error code %d",
- doc->getErrorCode());
- exitCode = 2;
- goto err05;
- }
-
- if (doc->isEncrypted() && !doc->okToPrint()) {
- opvpError(-1,"Print Permission Denied");
- exitCode = 2;
- goto err05;
- }
-
- /* paperColor is white */
- paperColor[0] = 255;
- paperColor[1] = 255;
- paperColor[2] = 255;
-#ifdef USE_CMS
- /* set color profile file name */
- GfxColorSpace::setDisplayProfileName(&colorProfilePath);
-#endif
- opvpOut = new OPVPOutputDev();
- if (opvpOut->init(mono ? splashModeMono1 :
- gray ? splashModeMono8 :
- splashModeRGB8,
- colorProfile,
- gFalse, paperColor,
- printerDriver,1,printerModel,
- nOptions,optionKeys,optionVals) < 0) {
- opvpError(-1,"OPVPOutputDev Initialize fail");
- exitCode = 2;
- goto err1;
- }
-
- opvpOut->startDoc(doc->getXRef());
-
-#if 0
-fprintf(stderr,"JobInfo=%s\n",jobInfo);
-#endif
- if (opvpOut->OPVPStartJob(jobInfo) < 0) {
- opvpError(-1,"Start job failed");
- exitCode = 2;
- goto err1;
- }
- if (opvpOut->OPVPStartDoc(docInfo) < 0) {
- opvpError(-1,"Start Document failed");
- exitCode = 2;
- goto err2;
- }
- numPages = doc->getNumPages();
- for (pg = 1; pg <= numPages; ++pg) {
- if ((exitCode = outOnePage(doc,opvpOut,pg)) != 0) break;
- }
- if (opvpOut->OPVPEndDoc() < 0) {
- opvpError(-1,"End Document failed");
- exitCode = 2;
- }
-err2:
- if (opvpOut->OPVPEndJob() < 0) {
- opvpError(-1,"End job failed");
- exitCode = 2;
- }
-
- // clean up
- err1:
- delete opvpOut;
- err05:
- delete doc;
- err0:
- delete globalParams;
-
- // check for memory leaks
- Object::memCheck(stderr);
- gMemReport(stderr);
-
-}
-/* muntrace(); */
- return exitCode;
-}
-
-/* for memory debug */
-void *operator new(size_t size) throw (std::bad_alloc)
-{
- void *p = malloc(size);
- return p;
-}
-
-void operator delete(void *p) throw ()
-{
- free(p);
-}
diff --git a/filter/pdftopdf/nup.cc b/filter/pdftopdf/nup.cc
index fc07d6f..8be9b86 100644
--- a/filter/pdftopdf/nup.cc
+++ b/filter/pdftopdf/nup.cc
@@ -52,7 +52,7 @@ bool NupParameters::possible(int nup) // {{{
{
// 1 2 3 4 6 8 9 10 12 15 16
return (nup>=1)&&(nup<=16)&&
- ( (nup!=5)||(nup!=7)||(nup!=11)||(nup!=13)||(nup!=14) );
+ ( (nup!=5)&&(nup!=7)&&(nup!=11)&&(nup!=13)&&(nup!=14) );
}
// }}}
diff --git a/filter/pdftopdf/pdftopdf.cc b/filter/pdftopdf/pdftopdf.cc
index 7c56f84..b6d5c53 100644
--- a/filter/pdftopdf/pdftopdf.cc
+++ b/filter/pdftopdf/pdftopdf.cc
@@ -9,6 +9,8 @@
#include <assert.h>
#include <cups/cups.h>
#include <cups/ppd.h>
+#include <iomanip>
+#include <sstream>
#include <memory>
#include "pdftopdf_processor.h"
@@ -20,7 +22,7 @@ static void error(const char *fmt,...) // {{{
va_list ap;
va_start(ap,fmt);
- fputs("Error: ",stderr);
+ fputs("ERROR: ",stderr);
vfprintf(stderr,fmt,ap);
fputs("\n",stderr);
@@ -402,8 +404,27 @@ void getParameters(ppd_file_t *ppd,int num_options,cups_option_t *options,Proces
param.reverse=ppdDefaultOrder(ppd);
}
- // TODO: pageLabel (not used)
- // param.pageLabel=cupsGetOption("page-label",num_options,options); // strdup?
+ std::string rawlabel;
+ char *classification = getenv("CLASSIFICATION");
+ if (classification)
+ rawlabel.append (classification);
+
+ if ( (val=cupsGetOption("page-label", num_options, options)) != NULL) {
+ if (!rawlabel.empty())
+ rawlabel.append (" - ");
+ rawlabel.append(cupsGetOption("page-label",num_options,options));
+ }
+
+ std::ostringstream cookedlabel;
+ for (std::string::iterator it = rawlabel.begin();
+ it != rawlabel.end ();
+ ++it) {
+ if (*it < 32 || *it > 126)
+ cookedlabel << "\\" << std::oct << std::setfill('0') << std::setw(3) << (unsigned int) *it;
+ else
+ cookedlabel.put (*it);
+ }
+ param.pageLabel = cookedlabel.str ();
if ( (val=cupsGetOption("page-set",num_options,options)) != NULL) {
if (strcasecmp(val,"even")==0) {
@@ -534,17 +555,7 @@ void calculate(ppd_file_t *ppd,ProcessingParameters &param) // {{{
}
}
- if (param.numCopies==1) {
- // collate is not needed
- param.collate=false; // does not make a big difference for us
- }
-/* TODO? instead:
- if (...numOutputPages==1 [after nup,evenDuplex!]) {
- param.collate=false; // does not make a big difference for us
- }
-*/
-
-#if 0 // for now
+#if 1 // for now
// enable hardware copy generation
if (ppd) {
if (!ppd->manual_copies) {
@@ -555,22 +566,29 @@ void calculate(ppd_file_t *ppd,ProcessingParameters &param) // {{{
param.deviceCopies=1;
}
}
-#endif
+#endif
setFinalPPD(ppd,param);
- // check collate device, with current ppd settings
- if (param.collate) {
- if (param.deviceCopies==1) { // e.g. ppd->manual_copies
- param.deviceCollate=false;
- } else {
- param.deviceCollate=printerWillCollate(ppd);
- }
+ if ( (param.numCopies==1)&&(param.deviceCopies==1) ) {
+ // collate is never needed for a single page
+ param.collate=false; // (this does not make a big difference for us)
+ param.deviceCollate=false;
+ } else if ( (param.deviceCopies==1)&&(param.duplex) ) { // i.e. (numCopies>1), in software
+ // duplex printing of multiple software copies:
+ // collate + evenDuplex must be forced to prevent copies on the backsides
+ param.collate=true;
+ param.deviceCollate=false; // either (!ppd) or (ppd->manual_copies)
+ } else if (param.collate) { // collate requested by user
+ // check collate device, with current/final(!) ppd settings
+ param.deviceCollate=printerWillCollate(ppd);
+ } else { // (!param.collate)
+ param.deviceCollate=false;
+ }
- if (!param.deviceCollate) {
- ppdMarkOption(ppd,"Collate","False"); // disable any hardware-collate
- param.evenDuplex=true; // software collate always needs fillers
- }
+ if ( (param.collate)&&(!param.deviceCollate) ) { // software collate
+ ppdMarkOption(ppd,"Collate","False"); // disable any hardware-collate (in JCL)
+ param.evenDuplex=true; // fillers always needed
}
if (!param.duplex) {
@@ -726,10 +744,10 @@ proc1->emitFilename("out.pdf");
ppdClose(ppd);
} catch (std::exception &e) {
// TODO? exception type
- fprintf(stderr,"Exception: %s\n",e.what());
+ error("Exception: %s",e.what());
return 5;
} catch (...) {
- fprintf(stderr,"Unknown exception caught. Exiting.\n");
+ error("Unknown exception caught. Exiting.");
return 6;
}
diff --git a/filter/pdftopdf/pdftopdf_processor.cc b/filter/pdftopdf/pdftopdf_processor.cc
index 4174244..7721d73 100644
--- a/filter/pdftopdf/pdftopdf_processor.cc
+++ b/filter/pdftopdf/pdftopdf_processor.cc
@@ -80,12 +80,8 @@ void ProcessingParameters::dump() const // {{{
fprintf(stderr,"evenDuplex: %s\n",
(evenDuplex)?"true":"false");
-/*
- // std::string pageLabel; // or NULL? must stay/dup!
- ...
- ...
-
-*/
+ fprintf(stderr,"pageLabel: %s\n",
+ pageLabel.empty () ? "(none)" : pageLabel.c_str());
fprintf(stderr,"bookletMode: ");
BookletMode_dump(booklet);
@@ -206,6 +202,10 @@ bool processPDFTOPDF(PDFTOPDF_Processor &proc,ProcessingParameters &param) // {{
page->mirror();
}
+ if (!param.pageLabel.empty()) {
+ page->add_label(param.page, param.pageLabel);
+ }
+
// place border
if ( (param.border!=BorderType::NONE)&&(iA<numOrigPages) ) {
#if 0 // would be nice, but is not possible
@@ -310,6 +310,10 @@ const bool origls=param.nup.landscape;
page->add_border_rect(rect,param.border,1.0/pgedit.scale);
}
+ if (!param.pageLabel.empty()) {
+ page->add_label(param.page, param.pageLabel);
+ }
+
if (!param.fitplot) {
curpage->add_subpage(page,pgedit.xpos+xpos,pgedit.ypos+ypos,pgedit.scale,&rect);
} else {
@@ -329,7 +333,6 @@ const bool origls=param.nup.landscape;
if (param.mirror) {
curpage->mirror();
}
- outputno++;
proc.add_page(curpage,param.reverse); // reverse -> insert at beginning
}
}
diff --git a/filter/pdftopdf/pdftopdf_processor.h b/filter/pdftopdf/pdftopdf_processor.h
index 72f3971..31a13ca 100644
--- a/filter/pdftopdf/pdftopdf_processor.h
+++ b/filter/pdftopdf/pdftopdf_processor.h
@@ -20,7 +20,7 @@ struct ProcessingParameters {
border(NONE),
reverse(false),
-// pageLabel(NULL),
+ pageLabel(),
evenPages(true),oddPages(true),
mirror(false),
@@ -60,7 +60,7 @@ struct ProcessingParameters {
NupParameters nup;
bool reverse;
- // std::string pageLabel; // or NULL? must stay/dup!
+ std::string pageLabel;
bool evenPages,oddPages;
IntervalSet pageRange;
@@ -105,6 +105,7 @@ public:
virtual void add_subpage(const std::shared_ptr<PDFTOPDF_PageHandle> &sub,float xpos,float ypos,float scale,const PageRect *crop=NULL) =0;
virtual void mirror() =0;
virtual void rotate(Rotation rot) =0;
+ virtual void add_label(const PageRect &rect, const std::string label) =0;
};
// TODO: ... error output?
diff --git a/filter/pdftopdf/qpdf_cm.cc b/filter/pdftopdf/qpdf_cm.cc
index 811cf59..82fa9eb 100644
--- a/filter/pdftopdf/qpdf_cm.cc
+++ b/filter/pdftopdf/qpdf_cm.cc
@@ -98,6 +98,8 @@ void addOutputIntent(QPDF &pdf,const char *filename) // {{{
? what if page already defines /Default? -- probably keep!
+? maybe we need to set /ColorSpace in /Images ? [gs idea is to just add the /Default-key and then reprocess...]
+
*/
// TODO? test
diff --git a/filter/pdftopdf/qpdf_pdftopdf.cc b/filter/pdftopdf/qpdf_pdftopdf.cc
index 46db5ac..42a3dee 100644
--- a/filter/pdftopdf/qpdf_pdftopdf.cc
+++ b/filter/pdftopdf/qpdf_pdftopdf.cc
@@ -1,6 +1,7 @@
#include "qpdf_pdftopdf.h"
#include <assert.h>
#include <stdexcept>
+#include <qpdf/QUtil.hh>
PageRect getBoxAsRect(QPDFObjectHandle box) // {{{
{
@@ -24,14 +25,18 @@ Rotation getRotate(QPDFObjectHandle page) // {{{
return ROT_0;
}
double rot=page.getKey("/Rotate").getNumericValue();
+ rot=fmod(rot,360.0);
+ if (rot<0) {
+ rot+=360.0;
+ }
if (rot==90.0) { // CW
return ROT_270; // CCW
} else if (rot==180.0) {
return ROT_180;
} else if (rot==270.0) {
return ROT_90;
- } else {
- assert(rot==0.0);
+ } else if (rot!=0.0) {
+ throw std::runtime_error("Unexpected /Rotation value: "+QUtil::double_to_string(rot));
}
return ROT_0;
}
diff --git a/filter/pdftopdf/qpdf_pdftopdf_processor.cc b/filter/pdftopdf/qpdf_pdftopdf_processor.cc
index 22a3d62..68b52b7 100644
--- a/filter/pdftopdf/qpdf_pdftopdf_processor.cc
+++ b/filter/pdftopdf/qpdf_pdftopdf_processor.cc
@@ -257,6 +257,94 @@ void QPDF_PDFTOPDF_PageHandle::rotate(Rotation rot) // {{{
}
// }}}
+void QPDF_PDFTOPDF_PageHandle::add_label(const PageRect &_rect, const std::string label) // {{{
+{
+ assert(isExisting());
+
+ PageRect rect = ungetRect (_rect, *this, rotation, page);
+
+ assert (rect.left <= rect.right);
+ assert (rect.bottom <= rect.top);
+
+ // TODO: Only add in the font once, not once per page.
+ QPDFObjectHandle font = page.getOwningQPDF()->makeIndirectObject (
+ QPDFObjectHandle::parse(
+ "<<"
+ " /Type /Font"
+ " /Subtype /Type1"
+ " /Name /pagelabel-font"
+ " /BaseFont /Helvetica" // TODO: support UTF-8 labels?
+ ">>"));
+ QPDFObjectHandle resources = page.getKey ("/Resources");
+ QPDFObjectHandle rfont = resources.getKey ("/Font");
+ rfont.replaceKey ("/pagelabel-font", font);
+
+ double margin = 2.25;
+ double height = 12;
+
+ std::string boxcmd = "q\n";
+
+ // White filled rectangle (top)
+ boxcmd += " 1 1 1 rg\n";
+ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " +
+ QUtil::double_to_string(rect.top - height - 2 * margin) + " " +
+ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " +
+ QUtil::double_to_string(height + 2 * margin) + " re f\n";
+
+ // White filled rectangle (bottom)
+ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " +
+ QUtil::double_to_string(rect.bottom + height + margin) + " " +
+ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " +
+ QUtil::double_to_string(height + 2 * margin) + " re f\n";
+
+ // Black outline (top)
+ boxcmd += " 0 0 0 RG\n";
+ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " +
+ QUtil::double_to_string(rect.top - height - 2 * margin) + " " +
+ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " +
+ QUtil::double_to_string(height + 2 * margin) + " re S\n";
+
+ // Black outline (bottom)
+ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " +
+ QUtil::double_to_string(rect.bottom + height + margin) + " " +
+ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " +
+ QUtil::double_to_string(height + 2 * margin) + " re S\n";
+
+ // Black text (top)
+ boxcmd += " 0 0 0 rg\n";
+ boxcmd += " BT\n";
+ boxcmd += " /pagelabel-font 12 Tf\n";
+ boxcmd += " " + QUtil::double_to_string(rect.left + 2 * margin) + " " +
+ QUtil::double_to_string(rect.top - height - margin) + " Td\n";
+ boxcmd += " (" + label + ") Tj\n";
+ boxcmd += " ET\n";
+
+ // Black text (bottom)
+ boxcmd += " BT\n";
+ boxcmd += " /pagelabel-font 12 Tf\n";
+ boxcmd += " " + QUtil::double_to_string(rect.left + 2 * margin) + " " +
+ QUtil::double_to_string(rect.bottom + height + 2 * margin) + " Td\n";
+ boxcmd += " (" + label + ") Tj\n";
+ boxcmd += " ET\n";
+
+ boxcmd += "Q\n";
+
+ assert(page.getOwningQPDF()); // existing pages are always indirect
+ static const char *pre="%pdftopdf q\n"
+ "q\n",
+ *post="%pdftopdf Q\n"
+ "Q\n";
+
+ QPDFObjectHandle stm1=QPDFObjectHandle::newStream(page.getOwningQPDF(),
+ std::string(pre)),
+ stm2=QPDFObjectHandle::newStream(page.getOwningQPDF(),
+ std::string(post) + boxcmd);
+
+ page.addPageContents(stm1,true); // before
+ page.addPageContents(stm2,false); // after
+}
+// }}}
+
void QPDF_PDFTOPDF_PageHandle::debug(const PageRect &rect,float xpos,float ypos) // {{{
{
assert(!isExisting());
@@ -264,7 +352,7 @@ void QPDF_PDFTOPDF_PageHandle::debug(const PageRect &rect,float xpos,float ypos)
}
// }}}
-
+// }}}
void QPDF_PDFTOPDF_Processor::closeFile() // {{{
{
pdf.reset();
@@ -277,6 +365,7 @@ void QPDF_PDFTOPDF_Processor::error(const char *fmt,...) // {{{
va_list ap;
va_start(ap,fmt);
+ fputs("ERROR: ",stderr);
vfprintf(stderr,fmt,ap);
fputs("\n",stderr);
va_end(ap);
@@ -484,7 +573,7 @@ void QPDF_PDFTOPDF_Processor::addCM(const char *defaulticc,const char *outputicc
return; // nothing to do
}
- QPDFObjectHandle srcicc=setDefaultICC(*pdf,defaulticc);
+ QPDFObjectHandle srcicc=setDefaultICC(*pdf,defaulticc); // TODO? rename to putDefaultICC?
addDefaultRGB(*pdf,srcicc);
addOutputIntent(*pdf,outputicc);
diff --git a/filter/pdftopdf/qpdf_pdftopdf_processor.h b/filter/pdftopdf/qpdf_pdftopdf_processor.h
index 97e007f..b38dd53 100644
--- a/filter/pdftopdf/qpdf_pdftopdf_processor.h
+++ b/filter/pdftopdf/qpdf_pdftopdf_processor.h
@@ -11,6 +11,7 @@ public:
virtual void add_subpage(const std::shared_ptr<PDFTOPDF_PageHandle> &sub,float xpos,float ypos,float scale,const PageRect *crop=NULL);
virtual void mirror();
virtual void rotate(Rotation rot);
+ virtual void add_label(const PageRect &rect, const std::string label);
void debug(const PageRect &rect,float xpos,float ypos);
private:
diff --git a/filter/pdftops.c b/filter/pdftops.c
index ded014f..f896632 100644
--- a/filter/pdftops.c
+++ b/filter/pdftops.c
@@ -42,7 +42,7 @@
*/
typedef unsigned renderer_t;
-enum renderer_e {GS = 0, PDFTOPS = 1, ACROREAD = 2};
+enum renderer_e {GS = 0, PDFTOPS = 1, ACROREAD = 2, PDFTOCAIRO = 3};
/*
* Local functions...
@@ -231,7 +231,7 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
- renderer_t renderer = CUPS_PDFTOPS_RENDERER; /* Renderer: gs or pdftops or acroread */
+ renderer_t renderer = PDFTOPS; /* Renderer: gs or pdftops or acroread */
int fd = 0; /* Copy file descriptor */
char *filename, /* PDF file to convert */
tempfile[1024]; /* Temporary file */
@@ -273,6 +273,7 @@ main(int argc, /* I - Number of command-line args */
*pstops_options, /* Options for pstops filter */
*pstops_end; /* End of pstops filter option */
const char *cups_serverbin; /* CUPS_SERVERBIN environment variable */
+ const char *content_type; /* CONTENT_TYPE environment variable */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@@ -381,6 +382,8 @@ main(int argc, /* I - Number of command-line args */
renderer = PDFTOPS;
else if (strcasecmp(val, "acroread") == 0)
renderer = ACROREAD;
+ else if (strcasecmp(val, "pdftocairo") == 0)
+ renderer = PDFTOCAIRO;
else
fprintf(stderr,
"WARNING: Invalid value for \"pdftops-renderer\": \"%s\"\n", val);
@@ -436,6 +439,7 @@ main(int argc, /* I - Number of command-line args */
* Build the command-line for the pdftops or gs filter...
*/
+ content_type = getenv("FINAL_CONTENT_TYPE");
if (renderer == PDFTOPS)
{
pdf_argv[0] = (char *)"pdftops";
@@ -456,6 +460,12 @@ main(int argc, /* I - Number of command-line args */
pdf_argv[6] = (char *)"-sOUTPUTFILE=%stdout";
pdf_argc = 7;
}
+ else if (renderer == PDFTOCAIRO)
+ {
+ pdf_argv[0] = (char *)"pdftocairo";
+ pdf_argv[1] = (char *)"-ps";
+ pdf_argc = 2;
+ }
else
{
pdf_argv[0] = (char *)"acroread";
@@ -478,6 +488,8 @@ main(int argc, /* I - Number of command-line args */
}
else if (renderer == GS)
pdf_argv[pdf_argc++] = (char *)"-dLanguageLevel=1";
+ else if (renderer == PDFTOCAIRO)
+ fprintf(stderr, "WARNING: Level 1 PostScript not supported by pdftocairo.");
else
fprintf(stderr, "WARNING: Level 1 PostScript not supported by acroread.");
}
@@ -491,18 +503,26 @@ main(int argc, /* I - Number of command-line args */
}
else if (renderer == GS)
pdf_argv[pdf_argc++] = (char *)"-dLanguageLevel=2";
- else
+ else /* PDFTOCAIRO || ACROREAD */
pdf_argv[pdf_argc++] = (char *)"-level2";
}
else
{
if (renderer == PDFTOPS)
- /* Do not emit PS Level 3 with Poppler, some HP PostScript printers
- do not like it. See https://bugs.launchpad.net/bugs/277404. */
- pdf_argv[pdf_argc++] = (char *)"-level2";
+ {
+ /* Do not emit PS Level 3 with Poppler on HP PostScript laser printers
+ as some do not like it. See https://bugs.launchpad.net/bugs/277404.*/
+ if (ppd->manufacturer &&
+ (!strncasecmp(ppd->manufacturer, "HP", 2) ||
+ !strncasecmp(ppd->manufacturer, "Hewlett-Packard", 15)) &&
+ (strcasestr(ppd->nickname, "laserjet")))
+ pdf_argv[pdf_argc++] = (char *)"-level2";
+ else
+ pdf_argv[pdf_argc++] = (char *)"-level3";
+ }
else if (renderer == GS)
pdf_argv[pdf_argc++] = (char *)"-dLanguageLevel=3";
- else
+ else /* PDFTOCAIRO || ACROREAD */
pdf_argv[pdf_argc++] = (char *)"-level3";
}
@@ -551,7 +571,7 @@ main(int argc, /* I - Number of command-line args */
orientation ^= 1;
}
- if (renderer == PDFTOPS)
+ if ((renderer == PDFTOPS) || (renderer == PDFTOCAIRO))
{
if (orientation & 1)
{
@@ -605,14 +625,16 @@ main(int argc, /* I - Number of command-line args */
}
}
#ifdef HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES
- else if (renderer == PDFTOPS)
+ else if ((renderer == PDFTOPS) || (renderer == PDFTOCAIRO))
{
/*
* Use the page sizes of the original PDF document, this way documents
* which contain pages of different sizes can be printed correctly
*/
- pdf_argv[pdf_argc++] = (char *)"-origpagesizes";
+ /* Only do this for unprocessed PDF files */
+ if (content_type && !strstr (content_type, "/vnd.cups-"))
+ pdf_argv[pdf_argc++] = (char *)"-origpagesizes";
}
#endif /* HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES */
else if (renderer == ACROREAD)
@@ -622,7 +644,9 @@ main(int argc, /* I - Number of command-line args */
* which contain pages of different sizes can be printed correctly
*/
- pdf_argv[pdf_argc++] = (char *)"-choosePaperByPDFPageSize";
+ /* Only do this for unprocessed PDF files */
+ if (content_type && !strstr (content_type, "/vnd.cups-"))
+ pdf_argv[pdf_argc++] = (char *)"-choosePaperByPDFPageSize";
}
/*
@@ -678,7 +702,7 @@ main(int argc, /* I - Number of command-line args */
while (xres > maxres)
xres = xres / 2;
- if (renderer == PDFTOPS)
+ if ((renderer == PDFTOPS) || (renderer == PDFTOCAIRO))
{
#ifdef HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION
/*
@@ -734,6 +758,7 @@ main(int argc, /* I - Number of command-line args */
pdf_argv[pdf_argc++] = (char *)"-dEncodeMonoImages=false";
pdf_argv[pdf_argc++] = (char *)"-dEncodeColorImages=false";
}
+ pdf_argv[pdf_argc++] = (char *)"-dNOINTERPOLATE";
pdf_argv[pdf_argc++] = (char *)"-c";
pdf_argv[pdf_argc++] = (char *)"save pop";
pdf_argv[pdf_argc++] = (char *)"-f";
@@ -748,7 +773,7 @@ main(int argc, /* I - Number of command-line args */
* of the printer's PostScript interpreter?
*/
- if (renderer == PDFTOPS)
+ if ((renderer == PDFTOPS) || (renderer == PDFTOPS))
need_post_proc = 0;
else if (renderer == GS)
need_post_proc =
@@ -800,14 +825,19 @@ main(int argc, /* I - Number of command-line args */
if (renderer == PDFTOPS)
{
- execv(CUPS_POPPLER_PDFTOPS, pdf_argv);
+ execvp(CUPS_POPPLER_PDFTOPS, pdf_argv);
perror("DEBUG: Unable to execute pdftops program");
}
else if (renderer == GS)
{
- execv(CUPS_GHOSTSCRIPT, pdf_argv);
+ execvp(CUPS_GHOSTSCRIPT, pdf_argv);
perror("DEBUG: Unable to execute gs program");
}
+ else if (renderer == PDFTOCAIRO)
+ {
+ execvp(CUPS_POPPLER_PDFTOCAIRO, pdf_argv);
+ perror("DEBUG: Unable to execute pdftocairo program");
+ }
else
{
/*
@@ -820,7 +850,7 @@ main(int argc, /* I - Number of command-line args */
close(fd);
}
- execv(CUPS_ACROREAD, pdf_argv);
+ execvp(CUPS_ACROREAD, pdf_argv);
perror("DEBUG: Unable to execute acroread program");
}
@@ -836,6 +866,8 @@ main(int argc, /* I - Number of command-line args */
perror("DEBUG: Unable to execute pdftops program");
else if (renderer == GS)
perror("DEBUG: Unable to execute gs program");
+ else if (renderer == PDFTOCAIRO)
+ perror("DEBUG: Unable to execute pdftocairo program");
else
perror("DEBUG: Unable to execute acroread program");
@@ -1097,7 +1129,8 @@ main(int argc, /* I - Number of command-line args */
fprintf(stderr, "DEBUG: PID %d (%s) stopped with status %d!\n",
wait_pid,
wait_pid == pdf_pid ? (renderer == PDFTOPS ? "pdftops" :
- (renderer == GS ? "gs" : "acroread")) :
+ (renderer == PDFTOCAIRO ? "pdftocairo" :
+ (renderer == GS ? "gs" : "acroread"))) :
(wait_pid == pstops_pid ? "pstops" : "Post-processing"),
exit_status);
}
@@ -1107,7 +1140,8 @@ main(int argc, /* I - Number of command-line args */
"DEBUG: PID %d (%s) was terminated normally with signal %d!\n",
wait_pid,
wait_pid == pdf_pid ? (renderer == PDFTOPS ? "pdftops" :
- (renderer == GS ? "gs" : "acroread")) :
+ (renderer == PDFTOCAIRO ? "pdftocairo" :
+ (renderer == GS ? "gs" : "acroread"))) :
(wait_pid == pstops_pid ? "pstops" : "Post-processing"),
exit_status);
}
@@ -1117,7 +1151,8 @@ main(int argc, /* I - Number of command-line args */
fprintf(stderr, "DEBUG: PID %d (%s) crashed on signal %d!\n", wait_pid,
wait_pid == pdf_pid ? (renderer == PDFTOPS ? "pdftops" :
- (renderer == GS ? "gs" : "acroread")) :
+ (renderer == PDFTOCAIRO ? "pdftocairo" :
+ (renderer == GS ? "gs" : "acroread"))) :
(wait_pid == pstops_pid ? "pstops" : "Post-processing"),
exit_status);
}
@@ -1126,7 +1161,8 @@ main(int argc, /* I - Number of command-line args */
{
fprintf(stderr, "DEBUG: PID %d (%s) exited with no errors.\n", wait_pid,
wait_pid == pdf_pid ? (renderer == PDFTOPS ? "pdftops" :
- (renderer == GS ? "gs" : "acroread")) :
+ (renderer == PDFTOCAIRO ? "pdftocairo" :
+ (renderer == GS ? "gs" : "acroread"))) :
(wait_pid == pstops_pid ? "pstops" : "Post-processing"));
}
}
diff --git a/filter/pdftoraster.cxx b/filter/pdftoraster.cxx
index c1985fd..650e66c 100644
--- a/filter/pdftoraster.cxx
+++ b/filter/pdftoraster.cxx
@@ -26,6 +26,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pdf to raster filter
*/
+#include <cups/cups.h>
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 6)
+#define HAVE_CUPS_1_7 1
+#endif
+
#define USE_CMS
#include <config.h>
@@ -41,13 +46,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "PDFDoc.h"
#include "SplashOutputDev.h"
#include "GfxState.h"
-#include <cups/cups.h>
#include <cups/ppd.h>
#include <stdarg.h>
#include "PDFError.h"
#include "GlobalParams.h"
#include <cups/raster.h>
#include <cupsfilters/image.h>
+#include <cupsfilters/raster.h>
#include <splash/SplashTypes.h>
#include <splash/SplashBitmap.h>
#include <strings.h>
@@ -184,31 +189,40 @@ namespace {
int renderingIntent = INTENT_PERCEPTUAL;
}
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
void CDECL myErrorFun(void *data, ErrorCategory category,
- int pos, char *msg)
+ Goffset pos, char *msg)
+//#else
+//void CDECL myErrorFun(void *data, ErrorCategory category,
+// int pos, char *msg)
+//#endif
{
if (pos >= 0) {
- fprintf(stderr, "ERROR (%d): ", pos);
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
+ fprintf(stderr, "ERROR (%lld): ", pos);
+//#else
+// fprintf(stderr, "ERROR (%d): ", pos);
+//#endif
} else {
fprintf(stderr, "ERROR: ");
}
fprintf(stderr, "%s\n",msg);
fflush(stderr);
}
-#else
-void CDECL myErrorFun(int pos, char *msg, va_list args)
-{
- if (pos >= 0) {
- fprintf(stderr, "ERROR (%d): ", pos);
- } else {
- fprintf(stderr, "ERROR: ");
- }
- vfprintf(stderr, msg, args);
- fprintf(stderr, "\n");
- fflush(stderr);
-}
-#endif
+//#else
+//void CDECL myErrorFun(int pos, char *msg, va_list args)
+//{
+// if (pos >= 0) {
+// fprintf(stderr, "ERROR (%d): ", pos);
+// } else {
+// fprintf(stderr, "ERROR: ");
+// }
+// vfprintf(stderr, msg, args);
+// fprintf(stderr, "\n");
+// fflush(stderr);
+//}
+//#endif
#ifdef USE_LCMS1
static int lcmsErrorHandler(int ErrorCode, const char *ErrorText)
@@ -357,80 +371,89 @@ static void parseOpts(int argc, char **argv)
}
ppd = ppdOpenFile(getenv("PPD"));
- if (ppd == NULL) {
- pdfError(-1,const_cast<char *>("PPD file is not specified"));
- exit(1);
- }
- ppdMarkDefaults(ppd);
+ if (ppd == NULL)
+ fprintf(stderr, "DEBUG: PPD file is not specified.\n");
+ if (ppd)
+ ppdMarkDefaults(ppd);
options = NULL;
num_options = cupsParseOptions(argv[5],0,&options);
- cupsMarkOptions(ppd,num_options,options);
- handleRqeuiresPageRegion();
- cupsRasterInterpretPPD(&header,ppd,num_options,options,0);
- attr = ppdFindAttr(ppd,"pdftorasterRenderingIntent",NULL);
- if (attr != NULL && attr->value != NULL) {
- if (strcasecmp(attr->value,"PERCEPTUAL") != 0) {
- renderingIntent = INTENT_PERCEPTUAL;
- } else if (strcasecmp(attr->value,"RELATIVE_COLORIMETRIC") != 0) {
- renderingIntent = INTENT_RELATIVE_COLORIMETRIC;
- } else if (strcasecmp(attr->value,"SATURATION") != 0) {
- renderingIntent = INTENT_SATURATION;
- } else if (strcasecmp(attr->value,"ABSOLUTE_COLORIMETRIC") != 0) {
- renderingIntent = INTENT_ABSOLUTE_COLORIMETRIC;
- }
- }
- if (header.Duplex) {
- /* analyze options relevant to Duplex */
- const char *backside = "";
- /* APDuplexRequiresFlippedMargin */
- enum {
- FM_NO, FM_FALSE, FM_TRUE
- } flippedMargin = FM_NO;
-
- attr = ppdFindAttr(ppd,"cupsBackSide",NULL);
- if (attr != NULL && attr->value != NULL) {
- ppd->flip_duplex = 0;
- backside = attr->value;
- } else if (ppd->flip_duplex) {
- backside = "Rotated"; /* compatible with Max OS and GS 8.71 */
- }
-
- attr = ppdFindAttr(ppd,"APDuplexRequiresFlippedMargin",NULL);
+ if (ppd) {
+ cupsMarkOptions(ppd,num_options,options);
+ handleRqeuiresPageRegion();
+ cupsRasterInterpretPPD(&header,ppd,num_options,options,0);
+ attr = ppdFindAttr(ppd,"pdftorasterRenderingIntent",NULL);
if (attr != NULL && attr->value != NULL) {
- if (strcasecmp(attr->value,"true") == 0) {
- flippedMargin = FM_TRUE;
- } else {
- flippedMargin = FM_FALSE;
+ if (strcasecmp(attr->value,"PERCEPTUAL") != 0) {
+ renderingIntent = INTENT_PERCEPTUAL;
+ } else if (strcasecmp(attr->value,"RELATIVE_COLORIMETRIC") != 0) {
+ renderingIntent = INTENT_RELATIVE_COLORIMETRIC;
+ } else if (strcasecmp(attr->value,"SATURATION") != 0) {
+ renderingIntent = INTENT_SATURATION;
+ } else if (strcasecmp(attr->value,"ABSOLUTE_COLORIMETRIC") != 0) {
+ renderingIntent = INTENT_ABSOLUTE_COLORIMETRIC;
}
}
- if (strcasecmp(backside,"ManualTumble") == 0 && header.Tumble) {
- swap_image_x = swap_image_y = true;
- swap_margin_x = swap_margin_y = true;
- if (flippedMargin == FM_TRUE) {
- swap_margin_y = false;
- }
- } else if (strcasecmp(backside,"Rotated") == 0 && !header.Tumble) {
- swap_image_x = swap_image_y = true;
- swap_margin_x = swap_margin_y = true;
- if (flippedMargin == FM_TRUE) {
- swap_margin_y = false;
+ if (header.Duplex) {
+ /* analyze options relevant to Duplex */
+ const char *backside = "";
+ /* APDuplexRequiresFlippedMargin */
+ enum {
+ FM_NO, FM_FALSE, FM_TRUE
+ } flippedMargin = FM_NO;
+
+ attr = ppdFindAttr(ppd,"cupsBackSide",NULL);
+ if (attr != NULL && attr->value != NULL) {
+ ppd->flip_duplex = 0;
+ backside = attr->value;
+ } else if (ppd->flip_duplex) {
+ backside = "Rotated"; /* compatible with Max OS and GS 8.71 */
}
- } else if (strcasecmp(backside,"Flipped") == 0) {
- if (header.Tumble) {
- swap_image_x = true;
- swap_margin_x = swap_margin_y = true;
- } else {
- swap_image_y = true;
+
+ attr = ppdFindAttr(ppd,"APDuplexRequiresFlippedMargin",NULL);
+ if (attr != NULL && attr->value != NULL) {
+ if (strcasecmp(attr->value,"true") == 0) {
+ flippedMargin = FM_TRUE;
+ } else {
+ flippedMargin = FM_FALSE;
+ }
}
- if (flippedMargin == FM_FALSE) {
- swap_margin_y = !swap_margin_y;
+ if (strcasecmp(backside,"ManualTumble") == 0 && header.Tumble) {
+ swap_image_x = swap_image_y = true;
+ swap_margin_x = swap_margin_y = true;
+ if (flippedMargin == FM_TRUE) {
+ swap_margin_y = false;
+ }
+ } else if (strcasecmp(backside,"Rotated") == 0 && !header.Tumble) {
+ swap_image_x = swap_image_y = true;
+ swap_margin_x = swap_margin_y = true;
+ if (flippedMargin == FM_TRUE) {
+ swap_margin_y = false;
+ }
+ } else if (strcasecmp(backside,"Flipped") == 0) {
+ if (header.Tumble) {
+ swap_image_x = true;
+ swap_margin_x = swap_margin_y = true;
+ } else {
+ swap_image_y = true;
+ }
+ if (flippedMargin == FM_FALSE) {
+ swap_margin_y = !swap_margin_y;
+ }
}
}
+ if (getColorProfilePath(ppd,&profilePath)) {
+ /* ICCProfile is specified */
+ colorProfile = cmsOpenProfileFromFile(profilePath.getCString(),"r");
+ }
+ } else
+#ifdef HAVE_CUPS_1_7
+ cupsRasterParseIPPOptions(&header,num_options,options,1,1);
+#else
+ {
+ fprintf(stderr, "ERROR: No PPD file specified.\n");
+ exit(1);
}
- if (getColorProfilePath(ppd,&profilePath)) {
- /* ICCProfile is specified */
- colorProfile = cmsOpenProfileFromFile(profilePath.getCString(),"r");
- }
+#endif /* HAVE_CUPS_1_7 */
}
static void parsePDFTOPDFComment(FILE *fp)
@@ -503,7 +526,7 @@ static unsigned char *reverseLineSwapBit(unsigned char *src,
bp = src+size-1;
dp = dst;
for (unsigned int j = 0;j < size;j++,bp--,dp++) {
- *dp = revTable[~*bp];
+ *dp = revTable[(unsigned char)(~*bp)];
}
} else {
unsigned int pd,d;
@@ -1548,48 +1571,23 @@ static void outPage(PDFDoc *doc, Catalog *catalog, int pageNo,
memset(paperdimensions, 0, sizeof(paperdimensions));
memset(margins, 0, sizeof(margins));
- for (i = ppd->num_sizes, size = ppd->sizes;
- i > 0;
- i --, size ++) {
- /* Skip page sizes which conflict with settings of the other options */
- /* TODO XXX */
- /* Find size of document's page under the PPD page sizes */
- if (fabs(header.PageSize[1] - size->length) < 5.0 &&
- fabs(header.PageSize[0] - size->width) < 5.0)
- break;
- }
- if (i > 0) {
- /*
- * Standard size...
- */
- fprintf(stderr, "DEBUG: size = %s\n", size->name);
- landscape = 0;
- paperdimensions[0] = size->width;
- paperdimensions[1] = size->length;
- margins[0] = size->left;
- margins[1] = size->bottom;
- margins[2] = size->width - size->right;
- margins[3] = size->length - size->top;
- strncpy(header.cupsPageSizeName, size->name, 64);
- } else {
- /*
- * No matching portrait size; look for a matching size in
- * landscape orientation...
- */
-
+ if (ppd) {
for (i = ppd->num_sizes, size = ppd->sizes;
i > 0;
- i --, size ++)
- if (fabs(header.PageSize[0] - size->length) < 5.0 &&
- fabs(header.PageSize[1] - size->width) < 5.0)
+ i --, size ++) {
+ /* Skip page sizes which conflict with settings of the other options */
+ /* TODO XXX */
+ /* Find size of document's page under the PPD page sizes */
+ if (fabs(header.PageSize[1] - size->length) < 5.0 &&
+ fabs(header.PageSize[0] - size->width) < 5.0)
break;
-
+ }
if (i > 0) {
/*
- * Standard size in landscape orientation...
+ * Standard size...
*/
- fprintf(stderr, "DEBUG: landscape size = %s\n", size->name);
- landscape = 1;
+ fprintf(stderr, "DEBUG: size = %s\n", size->name);
+ landscape = 0;
paperdimensions[0] = size->width;
paperdimensions[1] = size->length;
margins[0] = size->left;
@@ -1599,17 +1597,53 @@ static void outPage(PDFDoc *doc, Catalog *catalog, int pageNo,
strncpy(header.cupsPageSizeName, size->name, 64);
} else {
/*
- * Custom size...
+ * No matching portrait size; look for a matching size in
+ * landscape orientation...
*/
- fprintf(stderr, "DEBUG: size = Custom\n");
- landscape = 0;
- paperdimensions[1] = size->length;
- for (i = 0; i < 2; i ++)
- paperdimensions[i] = header.PageSize[i];
- for (i = 0; i < 4; i ++)
- margins[i] = ppd->custom_margins[i];
- header.cupsPageSizeName[0] = '\0';
+
+ for (i = ppd->num_sizes, size = ppd->sizes;
+ i > 0;
+ i --, size ++)
+ if (fabs(header.PageSize[0] - size->length) < 5.0 &&
+ fabs(header.PageSize[1] - size->width) < 5.0)
+ break;
+
+ if (i > 0) {
+ /*
+ * Standard size in landscape orientation...
+ */
+ fprintf(stderr, "DEBUG: landscape size = %s\n", size->name);
+ landscape = 1;
+ paperdimensions[0] = size->width;
+ paperdimensions[1] = size->length;
+ margins[0] = size->left;
+ margins[1] = size->bottom;
+ margins[2] = size->width - size->right;
+ margins[3] = size->length - size->top;
+ strncpy(header.cupsPageSizeName, size->name, 64);
+ } else {
+ /*
+ * Custom size...
+ */
+ fprintf(stderr, "DEBUG: size = Custom\n");
+ landscape = 0;
+ paperdimensions[1] = size->length;
+ for (i = 0; i < 2; i ++)
+ paperdimensions[i] = header.PageSize[i];
+ for (i = 0; i < 4; i ++)
+ margins[i] = ppd->custom_margins[i];
+ header.cupsPageSizeName[0] = '\0';
+ }
}
+ } else {
+ for (i = 0; i < 2; i ++)
+ paperdimensions[i] = header.PageSize[i];
+ for (i = 0; i < 4; i ++)
+ margins[i] = 0.0;
+ /*margins[0] = 0.0;
+ margins[1] = 0.0;
+ margins[2] = header.PageSize[0];
+ margins[3] = header.PageSize[1];*/
}
if (header.Duplex && (pageNo & 1) == 0) {
@@ -1750,11 +1784,11 @@ int main(int argc, char *argv[]) {
int rowpad;
Catalog *catalog;
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
setErrorCallback(::myErrorFun,NULL);
-#else
- setErrorFunction(::myErrorFun);
-#endif
+//#else
+// setErrorFunction(::myErrorFun);
+//#endif
cmsSetLogErrorHandler(lcmsErrorHandler);
globalParams = new GlobalParams();
parseOpts(argc, argv);
@@ -1762,19 +1796,15 @@ int main(int argc, char *argv[]) {
if (argc == 6) {
/* stdin */
int fd;
- Object obj;
- BaseStream *str;
- FILE *fp;
+ char name[BUFSIZ];
char buf[BUFSIZ];
int n;
- fd = cupsTempFd(buf,sizeof(buf));
+ fd = cupsTempFd(name,sizeof(name));
if (fd < 0) {
pdfError(-1,const_cast<char *>("Can't create temporary file"));
exit(1);
}
- /* remove name */
- unlink(buf);
/* copy stdin to the tmp file */
while ((n = read(0,buf,BUFSIZ)) > 0) {
@@ -1784,23 +1814,10 @@ int main(int argc, char *argv[]) {
exit(1);
}
}
- if (lseek(fd,0,SEEK_SET) < 0) {
- pdfError(-1,const_cast<char *>("Can't rewind temporary file"));
- close(fd);
- exit(1);
- }
-
- if ((fp = fdopen(fd,"rb")) == 0) {
- pdfError(-1,const_cast<char *>("Can't fdopen temporary file"));
- close(fd);
- exit(1);
- }
-
- obj.initNull();
- parsePDFTOPDFComment(fp);
- rewind(fp);
- str = new FileStream(fp,0,gFalse,0,&obj);
- doc = new PDFDoc(str);
+ close(fd);
+ doc = new PDFDoc(new GooString(name));
+ /* remove name */
+ unlink(name);
} else {
GooString *fileName = new GooString(argv[6]);
/* argc == 7 filenmae is specified */
@@ -1921,11 +1938,11 @@ int main(int argc, char *argv[]) {
out = new SplashOutputDev(cmode,rowpad/* row padding */,
gFalse,paperColor,gTrue,gFalse);
-#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
+//#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
out->startDoc(doc);
-#else
- out->startDoc(doc->getXRef());
-#endif
+//#else
+// out->startDoc(doc->getXRef());
+//#endif
if ((raster = cupsRasterOpen(1,CUPS_RASTER_WRITE)) == 0) {
pdfError(-1,const_cast<char *>("Can't open raster stream"));
diff --git a/filter/pdfutils.c b/filter/pdfutils.c
index 8e2ecb6..aa3986a 100644
--- a/filter/pdfutils.c
+++ b/filter/pdfutils.c
@@ -42,7 +42,7 @@ void pdfOut_putString(pdfOut *pdf,const char *str,int len) // {{{ - >len==-1: st
for (;len>0;iA++,len--) {
if ( (str[iA]<32)||(str[iA]>126) ) {
fwrite(str,1,iA,stdout);
- fprintf(stdout,"\\%03o",str[iA]);
+ fprintf(stdout,"\\%03o",(unsigned char)str[iA]);
pdf->filepos+=iA+4;
str+=iA+1;
iA=-1;
diff --git a/filter/textcommon.c b/filter/textcommon.c
index ba36768..6e6279b 100644
--- a/filter/textcommon.c
+++ b/filter/textcommon.c
@@ -608,6 +608,8 @@ TextMain(const char *name, /* I - Name of filter */
if (PageColumns < 1)
{
+ if (fp != stdin)
+ fclose(fp);
fprintf(stderr, "ERROR: Bad columns value %d.\n", PageColumns);
return (1);
}
@@ -619,6 +621,8 @@ TextMain(const char *name, /* I - Name of filter */
if (CharsPerInch <= 0.0)
{
+ if (fp != stdin)
+ fclose(fp);
fprintf(stderr, "ERROR: Bad cpi value %f.\n", CharsPerInch);
return (1);
}
@@ -630,6 +634,8 @@ TextMain(const char *name, /* I - Name of filter */
if (LinesPerInch <= 0.0)
{
+ if (fp != stdin)
+ fclose(fp);
fprintf(stderr, "ERROR: Bad lpi value %f.", LinesPerInch);
return (1);
}
@@ -1110,6 +1116,9 @@ TextMain(const char *name, /* I - Name of filter */
WriteEpilogue();
+ if (fp != stdin)
+ fclose(fp);
+
if (ppd != NULL)
ppdClose(ppd);
diff --git a/filter/texttopdf.c b/filter/texttopdf.c
index d09e769..a4ede03 100644
--- a/filter/texttopdf.c
+++ b/filter/texttopdf.c
@@ -1148,8 +1148,7 @@ static void write_font_str(float x,float y,int fontid, lchar_t *str, int len)
}
font = Codes[ch];
- if (lastfont != font) {
- assert(0); // should never happen; TODO
+ if (lastfont != font) { // only possible, when not used via write_string (e.g. utf-8filename.txt in prettyprint)
break;
}
if (otf) { // TODO
@@ -1221,6 +1220,7 @@ static void write_pretty_header() // {{{
x = PageRight - PageLeft - 36.0f / LinesPerInch - stringwidth_x(pagestr);
}
write_font_str(x,y,ATTR_BOLD,pagestr,-1);
+ free(pagestr);
pdfOut_printf(pdf,"Q\n");
}
diff --git a/fontembed/embed_sfnt.c b/fontembed/embed_sfnt.c
index c51dd40..565f2cc 100644
--- a/fontembed/embed_sfnt.c
+++ b/fontembed/embed_sfnt.c
@@ -335,7 +335,7 @@ static const char *emb_otf_get_post_name(const char *post,unsigned short gid) //
if (gid<num_glyphs) {
unsigned short idx=get_USHORT(post+34+2*gid);
if (idx<258) {
- if (gid<sizeof(macRoman)/sizeof(macRoman[0])) {
+ if (idx<sizeof(macRoman)/sizeof(macRoman[0])) {
return macRoman[idx];
}
} else if (idx<32768) {
diff --git a/ltmain.sh b/ltmain.sh
index 0096fe6..b9205ee 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -70,7 +70,7 @@
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
-# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2
+# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1
# automake: $automake_version
# autoconf: $autoconf_version
#
@@ -80,7 +80,7 @@
PROGRAM=libtool
PACKAGE=libtool
-VERSION="2.4.2 Debian-2.4.2-1ubuntu2"
+VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1"
TIMESTAMP=""
package_revision=1.3337
diff --git a/mime/cupsfilters.convs b/mime/cupsfilters.convs
index d027a01..896afd8 100644
--- a/mime/cupsfilters.convs
+++ b/mime/cupsfilters.convs
@@ -42,10 +42,10 @@
# if it comes from an encrypted PDF file, we simply override pstopdf and the
# PDF workflow.
-application/postscript application/pdf 22 pstopdf
+application/postscript application/pdf 100 pstopdf
application/vnd.adobe-reader-postscript application/vnd.cups-postscript 66 pstops
-application/pdf application/vnd.cups-pdf 22 pdftopdf
+application/pdf application/vnd.cups-pdf 66 pdftopdf
application/x-cshell application/pdf 0 texttopdf
application/x-csource application/pdf 0 texttopdf
application/x-perl application/pdf 0 texttopdf
@@ -74,7 +74,7 @@ image/x-sun-raster application/vnd.cups-pdf 33 imagetopdf
#
#application/pdf application/vnd.cups-postscript 66 pdftops
-application/vnd.cups-pdf application/vnd.cups-postscript 22 pdftops
+application/vnd.cups-pdf application/vnd.cups-postscript 100 pdftops
#application/postscript application/vnd.cups-postscript 66 pstops
########################################################################
diff --git a/cups-filters.manifest b/packaging/cups-filters.manifest
index b771fc9..3897e20 100644
--- a/cups-filters.manifest
+++ b/packaging/cups-filters.manifest
@@ -1,5 +1,5 @@
<manifest>
<request>
- <domain name="mobileprint"/>
+ <domain name="org.tizen.mobileprint"/>
</request>
</manifest>
diff --git a/packaging/cups-filters.spec b/packaging/cups-filters.spec
index 4dd3574..516b12f 100644
--- a/packaging/cups-filters.spec
+++ b/packaging/cups-filters.spec
@@ -2,27 +2,30 @@
Summary: cups-filters
Name: cups-filters
-Version: 1.0.25
-Release: 3
-License: GPL
+Version: 1.0.36_2
+Release: 1
+License: GPL-2.0+ and MIT
Group: System Environment/Daemons
Source0: %{name}-%{version}.tar.gz
+Source1001: cups-filters.manifest
+Source1002: libcupsfilters1.manifest
+Source1003: libfontembed.manifest
Url: http://www.cups.org
Patch1: tizen-pdftoraster-oom-fix.patch
Patch2: tizen_fix_ignore_sigpipe.patch
-Requires(post): eglibc
+Requires(post): glibc
Requires: libcupsfilters1
#used only for texttopdf
#Requires: libfontembed
BuildRequires: cups
BuildRequires: pkgconfig(poppler)
-BuildRequires: pkgconfig(poppler-cpp)
+#BuildRequires: pkgconfig(poppler-cpp)
BuildRequires: pkgconfig(lcms2)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(ijs)
-BuildRequires: xpdf-tools
+#BuildRequires: xpdf-tools
BuildRequires: libjpeg-turbo-devel
BuildRequires: libtiff-devel
BuildRequires: zlib-devel
@@ -31,6 +34,7 @@ BuildRequires: cups-libs
BuildRequires: pkgconfig(gnutls)
BuildRequires: pkgconfig(libqpdf)
BuildRequires: which
+BuildRequires: libgcrypt-devel
%description
This package provides the CUPS shared libraries.
@@ -72,6 +76,9 @@ This package provides the CUPS headers and development environment.
%prep
%setup -q
+cp %{SOURCE1001} .
+cp %{SOURCE1002} .
+cp %{SOURCE1003} .
# OOM can be happened in using pdftoraster, becuase 600dpi use huge memory(about 1.6G)
# This patch fixes pdftoraster to use about 400M in 600dpi printing.
%patch1 -p1
@@ -80,19 +87,21 @@ This package provides the CUPS headers and development environment.
%patch2 -p1
%build
+
+export GC_SECTIONS_FLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections"
+export CFLAGS+=" ${GC_SECTIONS_FLAGS} -Wvariadic-macros"
+export CXXFLAGS+=" ${GC_SECTIONS_FLAGS} -fpermissive -Wvariadic-macros"
+
./autogen.sh
%configure \
--prefix=/usr --mandir=/usr/share/man --without-tiff --without-php \
--enable-imagefilters --with-jpeg --with-png \
--enable-largefile \
- --with-pdftops=pdftops
- #--with-pdftops-path=/usr/bin/pdftops
+ --with-pdftops=pdftops
BUILDROOT=$RPM_BUILD_ROOT DESTDIR=$RPM_BUILD_ROOT DSTROOT=$RPM_BUILD_ROOT make -Ioprs -Iopvp -I../opvp -I. -I.. -I/usr/include/poppler -I/usr/include/ijs -I/usr/include/poppler/splash
%install
-rm -rf $RPM_BUILD_ROOT
-#make BUILDROOT=$RPM_BUILD_ROOT install
%make_install
mkdir -p %{buildroot}/usr/share/license
@@ -100,26 +109,15 @@ cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/%{name}
cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/libcupsfilters1
cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/libfontembed
-#%post
-#if [ "$1" = "configure" ]; then
-#
-# if [ -r /var/run/cups/cups.sock ]; then
-# # Restart CUPS (to register new and updated MIME rules)
-# invoke-rc.d cups force-reload || true
-#
-# # Wait for the CUPS daemon getting ready after reloading it
-# for i in 1 2 3 4 5; do if [ -r /var/run/cups/cups.sock ]; then break; fi; sleep 1; echo -n "."; done; #echo;
-# fi
-#
-#elif [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-remove" ] || [ "$1" = "abort-deconfigure" ]; then
-# :
-#else
-# echo "postinst called with unknown argument \`$1'" >&2
-# exit 0
-#fi
+%post -n libfontembed -p /sbin/ldconfig
+
+%post -n libcupsfilters1 -p /sbin/ldconfig
+
+%postun -n libfontembed -p /sbin/ldconfig
+
+%postun -n libcupsfilters1 -p /sbin/ldconfig
%files
-%defattr (-,root,root)
%manifest cups-filters.manifest
/usr/share/license/%{name}
%exclude /etc/fonts/conf.d/99pdftoopvp.conf
@@ -135,21 +133,24 @@ cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/libfontemb
%exclude %{_libdir}/cups/filter/rastertopclx
%exclude %{_libdir}/cups/filter/pdftoijs
%exclude %{_libdir}/cups/filter/pdftoopvp
-#%exclude /usr/share/cups/banners
-#%exclude /usr/share/cups/drv/*
+%exclude %{_libdir}/cups/filter/gstopxl
+%exclude %{_libdir}/cups/filter/gstoraster
+%exclude %{_docdir}/cups-filters/*
+%exclude /etc/rc0.d/*
+%exclude /etc/rc2.d/*
+%exclude /etc/rc3.d/*
+%exclude /etc/rc5.d/*
+%exclude %{_bindir}/ttfread
%exclude /usr/share/ppd/*
%dir /usr/share/cups
/usr/share/cups/*
-#../*.ppd-updater usr/share/cups/ppd-updaters/
%files -n libfontembed
%manifest libfontembed.manifest
-%defattr(-,root,root)
/usr/share/license/libfontembed
%{_libdir}/libfontembed.so.*
%files -n libfontembed-devel
-%defattr(-,root,root)
%{_libdir}/libfontembed.so
#%{_libdir}/libcupsfilters.a
%{_libdir}/pkgconfig/libfontembed.pc
@@ -157,13 +158,10 @@ cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/libfontemb
%files -n libcupsfilters1
%manifest libcupsfilters1.manifest
-%defattr(-,root,root)
/usr/share/license/libcupsfilters1
%{_libdir}/libcupsfilters.so.*
%files -n libcupsfilters-devel
-%defattr(-,root,root)
%{_libdir}/libcupsfilters.so
-#%{_libdir}/libcupsfilters.a
%{_libdir}/pkgconfig/libcupsfilters.pc
%{_includedir}/cupsfilters/*.h
diff --git a/libcupsfilters1.manifest b/packaging/libcupsfilters1.manifest
index 75b0fa5..75b0fa5 100644
--- a/libcupsfilters1.manifest
+++ b/packaging/libcupsfilters1.manifest
diff --git a/libfontembed.manifest b/packaging/libfontembed.manifest
index 75b0fa5..75b0fa5 100644
--- a/libfontembed.manifest
+++ b/packaging/libfontembed.manifest
diff --git a/packaging/tizen-pdftoraster-oom-fix.patch b/packaging/tizen-pdftoraster-oom-fix.patch
index ccca86a..f8be34d 100644
--- a/packaging/tizen-pdftoraster-oom-fix.patch
+++ b/packaging/tizen-pdftoraster-oom-fix.patch
@@ -58,8 +58,8 @@ diff -urN cups-filters.orig/filter/pdftoraster.cxx cups-filters/filter/pdftorast
+ for(unsigned int i=0;i<numSlices;i++) {
+ unsigned int linesToPrint = linesInSlice > linesRemained ? linesRemained : linesInSlice;
+ doc->displayPageSlice(out,pageNo,header.HWResolution[0],
-+ header.HWResolution[1],(landscape == 0 ? 0 : 90),
-+ gTrue,gTrue,gTrue, 0, linesInSlice*i, header.cupsWidth, linesToPrint);
++ header.HWResolution[1], 0,
++ gTrue,gTrue,gTrue, bitmapoffset[0], bitmapoffset[1] + linesInSlice*i, header.cupsWidth, linesToPrint);
+ bitmap = out->getBitmap();
+ writePageImage(raster,bitmap,pageNo, linesToPrint);
+ linesRemained = linesRemained - linesInSlice;
diff --git a/ppd/pxlcolor.ppd b/ppd/pxlcolor.ppd
new file mode 100644
index 0000000..4c59c72
--- /dev/null
+++ b/ppd/pxlcolor.ppd
@@ -0,0 +1,215 @@
+*PPD-Adobe: "4.3"
+*%
+*%
+*% Sample color PCL XL/PCL 6 driver PPD file for the Common UNIX
+*% Printing System (CUPS).
+*%
+*% Copyright 1997-2005 by Easy Software Products.
+*%
+*% These coded instructions, statements, and computer programs are the
+*% property of Easy Software Products and are protected by Federal
+*% copyright law. Distribution and use rights are outlined in the file
+*% "LICENSE.txt" which should have been included with this file. If this
+*% file is missing or damaged please contact Easy Software Products
+*% at:
+*%
+*% Attn: CUPS Licensing Information
+*% Easy Software Products
+*% 44141 Airport View Drive, Suite 204
+*% Hollywood, Maryland 20636 USA
+*%
+*% Voice: (301) 373-9600
+*% EMail: cups-info@cups.org
+*% WWW: http://www.cups.org
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "PXLCOLOR.PPD"
+*Manufacturer: "HP"
+*Product: "(GPL Ghostscript)"
+*cupsVersion: 1.1
+*cupsManualCopies: False
+*cupsFilter: "application/vnd.cups-postscript 100 gstopxl"
+*cupsFilter: "application/vnd.cups-pdf 0 gstopxl"
+*ModelName: "HP Color LaserJet Series PCL 6"
+*ShortNickName: "HP Color LaserJet Series PCL 6"
+*NickName: "HP Color LaserJet Series PCL 6 CUPS"
+*PSVersion: "(3010.000) 86000"
+*LanguageLevel: "3"
+*ColorDevice: True
+*DefaultColorSpace: RGB
+*FileSystem: False
+*Throughput: "8"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+
+*UIConstraints: *PageSize Executive *InputSlot Envelope
+*UIConstraints: *PageSize Letter *InputSlot Envelope
+*UIConstraints: *PageSize Legal *InputSlot Envelope
+*UIConstraints: *PageSize Tabloid *InputSlot Envelope
+*UIConstraints: *PageSize A3 *InputSlot Envelope
+*UIConstraints: *PageSize A4 *InputSlot Envelope
+*UIConstraints: *PageSize A5 *InputSlot Envelope
+*UIConstraints: *PageSize B5 *InputSlot Envelope
+*UIConstraints: *Duplex *OptionDuplex False
+*UIConstraints: *InputSlot Envelope *PageSize Executive
+*UIConstraints: *InputSlot Envelope *PageSize Letter
+*UIConstraints: *InputSlot Envelope *PageSize Legal
+*UIConstraints: *InputSlot Envelope *PageSize Tabloid
+*UIConstraints: *InputSlot Envelope *PageSize A3
+*UIConstraints: *InputSlot Envelope *PageSize A4
+*UIConstraints: *InputSlot Envelope *PageSize A5
+*UIConstraints: *InputSlot Envelope *PageSize B5
+*UIConstraints: *OptionDuplex False *Duplex
+
+*OpenUI *PageSize/Media Size: PickOne
+*OrderDependency: 10 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*PageSize Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+*PageSize Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
+*PageSize Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
+*PageSize A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
+*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+*PageSize A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
+*PageSize B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
+*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
+*PageSize Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
+*PageSize EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
+*PageSize EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
+*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 10 AnySetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*PageRegion Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+*PageRegion Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
+*PageRegion Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
+*PageRegion A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
+*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+*PageRegion A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
+*PageRegion B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
+*PageRegion Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageRegion
+
+*DefaultImageableArea: Letter
+*ImageableArea Letter/US Letter: "12 12 600 780"
+*ImageableArea Legal/US Legal: "12 12 600 996"
+*ImageableArea Executive/US Executive: "12 12 510 708"
+*ImageableArea Tabloid/US Tabloid: "12 12 780 1212"
+*ImageableArea A3/A3: "12 12 830 1179"
+*ImageableArea A4/A4: "12 12 583 830"
+*ImageableArea A5/A5: "12 12 409 583"
+*ImageableArea B5/JIS B5: "12 12 504 717"
+*ImageableArea EnvISOB5/B5 (ISO): "12 12 469 697"
+*ImageableArea Env10/Com-10: "12 12 285 672"
+*ImageableArea EnvC5/EnvC5: "12 12 447 637"
+*ImageableArea EnvDL/EnvDL: "12 12 300 612"
+*ImageableArea EnvMonarch/Envelope Monarch: "12 12 267 528"
+
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/US Letter: "612 792"
+*PaperDimension Legal/US Legal: "612 1008"
+*PaperDimension Executive/US Executive: "522 756"
+*PaperDimension Tabloid/US Tabloid: "792 1224"
+*PaperDimension A3/A3: "842 1191"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension A5/A5: "421 595"
+*PaperDimension B5/B5 (JIS): "516 729"
+*PaperDimension EnvISOB5/Envelope B5: "499 709"
+*PaperDimension Env10/Envelope #10: "297 684"
+*PaperDimension EnvC5/Envelope C5: "459 649"
+*PaperDimension EnvDL/Envelope DL: "312 624"
+*PaperDimension EnvMonarch/Envelope Monarch: "279 540"
+
+*OpenUI *InputSlot/Media Source: PickOne
+*OrderDependency: 10 AnySetup *InputSlot
+*DefaultInputSlot: Default
+*InputSlot Default/Default: "<</MediaPosition 0>>setpagedevice"
+*InputSlot Auto/Automatically Select: "<</MediaPosition 1>>setpagedevice"
+*InputSlot MultiPurpose/Tray 1: "<</MediaPosition 3>>setpagedevice"
+*InputSlot Upper/Tray 2: "<</MediaPosition 4>>setpagedevice"
+*InputSlot Lower/Tray 3: "<</MediaPosition 5>>setpagedevice"
+*InputSlot LargeCapacity/Tray 4: "<</MediaPosition 7>>setpagedevice"
+*InputSlot Manual/Manual Feed: "<</MediaPosition 2>>setpagedevice"
+*InputSlot Envelope/Envelope Feed: "<</MediaPosition 6>>setpagedevice"
+*CloseUI: *InputSlot
+
+*OpenUI *ColorModel/Output Mode: PickOne
+*OrderDependency: 10 AnySetup *ColorModel
+*DefaultColorModel: RGB
+*ColorModel RGB/Color: "<</BitsPerPixel 24>>setpagedevice"
+*ColorModel Gray/Grayscale: "<</BitsPerPixel 8>>setpagedevice"
+*CloseUI: *ColorModel
+
+*OpenUI *Resolution/Output Resolution: PickOne
+*OrderDependency: 20 AnySetup *Resolution
+*DefaultResolution: 600dpi
+*Resolution 150dpi/150 DPI: "<</HWResolution[150 150]>>setpagedevice"
+*Resolution 300dpi/300 DPI: "<</HWResolution[300 300]>>setpagedevice"
+*Resolution 600dpi/600 DPI: "<</HWResolution[600 600]>>setpagedevice"
+*Resolution 1200dpi/1200 DPI: "<</HWResolution[1200 1200]>>setpagedevice"
+*CloseUI: *Resolution
+
+*OpenUI *Duplex/Double-Sided Printing: PickOne
+*OrderDependency: 20 AnySetup *Duplex
+*DefaultDuplex: None
+*Duplex None/Off: "<</Duplex false>>setpagedevice"
+*Duplex DuplexNoTumble/Long Edge (Standard): "<</Duplex true/Tumble false>>setpagedevice"
+*Duplex DuplexTumble/Short Edge (Flip): "<</Duplex true/Tumble true>>setpagedevice"
+*CloseUI: *Duplex
+
+*OpenGroup: InstallableOptions
+*OpenUI *OptionDuplex/Duplexer: Boolean
+*DefaultOptionDuplex: False
+*OptionDuplex True/Installed: ""
+*OptionDuplex False/Not Installed: ""
+*CloseUI: *OptionDuplex
+*CloseGroup: InstallableOptions
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+*%
+*%
diff --git a/ppd/pxlmono.ppd b/ppd/pxlmono.ppd
new file mode 100644
index 0000000..b1b0b82
--- /dev/null
+++ b/ppd/pxlmono.ppd
@@ -0,0 +1,208 @@
+*PPD-Adobe: "4.3"
+*%
+*%
+*% Sample monochrome PCL XL/PCL 6 driver PPD file for the Common UNIX
+*% Printing System (CUPS).
+*%
+*% Copyright 1997-2005 by Easy Software Products.
+*%
+*% These coded instructions, statements, and computer programs are the
+*% property of Easy Software Products and are protected by Federal
+*% copyright law. Distribution and use rights are outlined in the file
+*% "LICENSE.txt" which should have been included with this file. If this
+*% file is missing or damaged please contact Easy Software Products
+*% at:
+*%
+*% Attn: CUPS Licensing Information
+*% Easy Software Products
+*% 44141 Airport View Drive, Suite 204
+*% Hollywood, Maryland 20636 USA
+*%
+*% Voice: (301) 373-9600
+*% EMail: cups-info@cups.org
+*% WWW: http://www.cups.org
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "PXLMONO.PPD"
+*Manufacturer: "HP"
+*Product: "(GPL Ghostscript)"
+*cupsVersion: 1.1
+*cupsManualCopies: False
+*cupsFilter: "application/vnd.cups-postscript 100 gstopxl"
+*cupsFilter: "application/vnd.cups-pdf 0 gstopxl"
+*ModelName: "HP LaserJet Series PCL 6"
+*ShortNickName: "HP LaserJet Series PCL 6"
+*NickName: "HP LaserJet Series PCL 6 CUPS"
+*PSVersion: "(3010.000) 86000"
+*LanguageLevel: "3"
+*ColorDevice: False
+*DefaultColorSpace: Gray
+*FileSystem: False
+*Throughput: "8"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+
+*UIConstraints: *PageSize Executive *InputSlot Envelope
+*UIConstraints: *PageSize Letter *InputSlot Envelope
+*UIConstraints: *PageSize Legal *InputSlot Envelope
+*UIConstraints: *PageSize Tabloid *InputSlot Envelope
+*UIConstraints: *PageSize A3 *InputSlot Envelope
+*UIConstraints: *PageSize A4 *InputSlot Envelope
+*UIConstraints: *PageSize A5 *InputSlot Envelope
+*UIConstraints: *PageSize B5 *InputSlot Envelope
+*UIConstraints: *Duplex *OptionDuplex False
+*UIConstraints: *InputSlot Envelope *PageSize Executive
+*UIConstraints: *InputSlot Envelope *PageSize Letter
+*UIConstraints: *InputSlot Envelope *PageSize Legal
+*UIConstraints: *InputSlot Envelope *PageSize Tabloid
+*UIConstraints: *InputSlot Envelope *PageSize A3
+*UIConstraints: *InputSlot Envelope *PageSize A4
+*UIConstraints: *InputSlot Envelope *PageSize A5
+*UIConstraints: *InputSlot Envelope *PageSize B5
+*UIConstraints: *OptionDuplex False *Duplex
+
+*OpenUI *PageSize/Media Size: PickOne
+*OrderDependency: 10 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*PageSize Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+*PageSize Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
+*PageSize Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
+*PageSize A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
+*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+*PageSize A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
+*PageSize B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
+*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
+*PageSize Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
+*PageSize EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
+*PageSize EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
+*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 10 AnySetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*PageRegion Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+*PageRegion Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
+*PageRegion Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
+*PageRegion A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
+*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+*PageRegion A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
+*PageRegion B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
+*PageRegion Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
+*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageRegion
+
+*DefaultImageableArea: Letter
+*ImageableArea Letter/US Letter: "12 12 600 780"
+*ImageableArea Legal/US Legal: "12 12 600 996"
+*ImageableArea Executive/US Executive: "12 12 510 708"
+*ImageableArea Tabloid/US Tabloid: "12 12 780 1212"
+*ImageableArea A3/A3: "12 12 830 1179"
+*ImageableArea A4/A4: "12 12 583 830"
+*ImageableArea A5/A5: "12 12 409 583"
+*ImageableArea B5/JIS B5: "12 12 504 717"
+*ImageableArea EnvISOB5/B5 (ISO): "12 12 469 697"
+*ImageableArea Env10/Com-10: "12 12 285 672"
+*ImageableArea EnvC5/EnvC5: "12 12 447 637"
+*ImageableArea EnvDL/EnvDL: "12 12 300 612"
+*ImageableArea EnvMonarch/Envelope Monarch: "12 12 267 528"
+
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/US Letter: "612 792"
+*PaperDimension Legal/US Legal: "612 1008"
+*PaperDimension Executive/US Executive: "522 756"
+*PaperDimension Tabloid/US Tabloid: "792 1224"
+*PaperDimension A3/A3: "842 1191"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension A5/A5: "421 595"
+*PaperDimension B5/B5 (JIS): "516 729"
+*PaperDimension EnvISOB5/Envelope B5: "499 709"
+*PaperDimension Env10/Envelope #10: "297 684"
+*PaperDimension EnvC5/Envelope C5: "459 649"
+*PaperDimension EnvDL/Envelope DL: "312 624"
+*PaperDimension EnvMonarch/Envelope Monarch: "279 540"
+
+*OpenUI *InputSlot/Media Source: PickOne
+*OrderDependency: 10 AnySetup *InputSlot
+*DefaultInputSlot: Default
+*InputSlot Default/Default: "<</MediaPosition 0>>setpagedevice"
+*InputSlot Auto/Automatically Select: "<</MediaPosition 1>>setpagedevice"
+*InputSlot MultiPurpose/Tray 1: "<</MediaPosition 3>>setpagedevice"
+*InputSlot Upper/Tray 2: "<</MediaPosition 4>>setpagedevice"
+*InputSlot Lower/Tray 3: "<</MediaPosition 5>>setpagedevice"
+*InputSlot LargeCapacity/Tray 4: "<</MediaPosition 7>>setpagedevice"
+*InputSlot Manual/Manual Feed: "<</MediaPosition 2>>setpagedevice"
+*InputSlot Envelope/Envelope Feed: "<</MediaPosition 6>>setpagedevice"
+*CloseUI: *InputSlot
+
+*OpenUI *Resolution/Output Resolution: PickOne
+*OrderDependency: 20 AnySetup *Resolution
+*DefaultResolution: 600dpi
+*Resolution 150dpi/150 DPI: "<</HWResolution[150 150]>>setpagedevice"
+*Resolution 300dpi/300 DPI: "<</HWResolution[300 300]>>setpagedevice"
+*Resolution 600dpi/600 DPI: "<</HWResolution[600 600]>>setpagedevice"
+*Resolution 1200dpi/1200 DPI: "<</HWResolution[1200 1200]>>setpagedevice"
+*CloseUI: *Resolution
+
+*OpenUI *Duplex/Double-Sided Printing: PickOne
+*OrderDependency: 20 AnySetup *Duplex
+*DefaultDuplex: None
+*Duplex None/Off: "<</Duplex false>>setpagedevice"
+*Duplex DuplexNoTumble/Long Edge (Standard): "<</Duplex true/Tumble false>>setpagedevice"
+*Duplex DuplexTumble/Short Edge (Flip): "<</Duplex true/Tumble true>>setpagedevice"
+*CloseUI: *Duplex
+
+*OpenGroup: InstallableOptions
+*OpenUI *OptionDuplex/Duplexer: Boolean
+*DefaultOptionDuplex: False
+*OptionDuplex True/Installed: ""
+*OptionDuplex False/Not Installed: ""
+*CloseUI: *OptionDuplex
+*CloseGroup: InstallableOptions
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+*%
+*%
diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c
new file mode 100644
index 0000000..e4ee510
--- /dev/null
+++ b/utils/cups-browsed.c
@@ -0,0 +1,2029 @@
+/***
+ This file is part of cups-filters.
+
+ This file is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ This file 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 Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with avahi; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <ifaddrs.h>
+#if defined(__OpenBSD__)
+#include <sys/socket.h>
+#endif /* __OpenBSD__ */
+#include <net/if.h>
+#include <netinet/in.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <time.h>
+#include <signal.h>
+
+#include <glib.h>
+
+#ifdef HAVE_AVAHI
+#include <avahi-client/client.h>
+#include <avahi-client/lookup.h>
+
+#include <avahi-glib/glib-watch.h>
+#include <avahi-common/malloc.h>
+#include <avahi-common/error.h>
+#endif /* HAVE_AVAHI */
+
+#include <cups/cups.h>
+
+/* Attribute to mark a CUPS queue as created by us */
+#define CUPS_BROWSED_MARK "cups-browsed"
+
+/* Timeout values in sec */
+#define TIMEOUT_IMMEDIATELY -1
+#define TIMEOUT_CONFIRM 10
+#define TIMEOUT_RETRY 10
+#define TIMEOUT_REMOVE -1
+#define TIMEOUT_CHECK_LIST 2
+
+/* Status of remote printer */
+typedef enum printer_status_e {
+ STATUS_UNCONFIRMED = 0,
+ STATUS_CONFIRMED,
+ STATUS_TO_BE_CREATED,
+ STATUS_BROWSE_PACKET_RECEIVED,
+ STATUS_DISAPPEARED
+} printer_status_t;
+
+/* Data structure for remote printers */
+typedef struct remote_printer_s {
+ char *name;
+ char *uri;
+ printer_status_t status;
+ time_t timeout;
+ int duplicate;
+ char *host;
+ char *service_name;
+ char *type;
+ char *domain;
+} remote_printer_t;
+
+/* Data structure for network interfaces */
+typedef struct netif_s {
+ char *address;
+ http_addr_t broadcast;
+} netif_t;
+
+/* Data structure for browse allow/deny rules */
+typedef enum allow_type_e {
+ ALLOW_IP,
+ ALLOW_NET
+} allow_type_t;
+typedef struct allow_s {
+ allow_type_t type;
+ http_addr_t addr;
+ http_addr_t mask;
+} allow_t;
+
+cups_array_t *remote_printers;
+static cups_array_t *netifs;
+static cups_array_t *browseallow;
+
+static GMainLoop *gmainloop = NULL;
+#ifdef HAVE_AVAHI
+static AvahiGLibPoll *glib_poll = NULL;
+#endif /* HAVE_AVAHI */
+static guint queues_timer_id = (guint) -1;
+static int browsesocket = -1;
+
+#define BROWSE_DNSSD (1<<0)
+#define BROWSE_CUPS (1<<1)
+static unsigned int BrowseLocalProtocols = 0;
+static unsigned int BrowseRemoteProtocols = BROWSE_DNSSD;
+static unsigned int BrowseInterval = 60;
+static unsigned int BrowseTimeout = 300;
+static uint16_t BrowsePort = 631;
+static char **BrowsePoll = NULL;
+static size_t NumBrowsePoll = 0;
+static char *DomainSocket = NULL;
+
+static int debug = 0;
+
+static void recheck_timer (void);
+
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5)
+#define HAVE_CUPS_1_6 1
+#endif
+
+/*
+ * CUPS 1.6 makes various structures private and
+ * introduces these ippGet and ippSet functions
+ * for all of the fields in these structures.
+ * http://www.cups.org/str.php?L3928
+ * We define (same signatures) our own accessors when CUPS < 1.6.
+ */
+#ifndef HAVE_CUPS_1_6
+const char *
+ippGetName(ipp_attribute_t *attr)
+{
+ return (attr->name);
+}
+
+ipp_op_t
+ippGetOperation(ipp_t *ipp)
+{
+ return (ipp->request.op.operation_id);
+}
+
+ipp_status_t
+ippGetStatusCode(ipp_t *ipp)
+{
+ return (ipp->request.status.status_code);
+}
+
+ipp_tag_t
+ippGetGroupTag(ipp_attribute_t *attr)
+{
+ return (attr->group_tag);
+}
+
+ipp_tag_t
+ippGetValueTag(ipp_attribute_t *attr)
+{
+ return (attr->value_tag);
+}
+
+int
+ippGetCount(ipp_attribute_t *attr)
+{
+ return (attr->num_values);
+}
+
+int
+ippGetInteger(ipp_attribute_t *attr,
+ int element)
+{
+ return (attr->values[element].integer);
+}
+
+int
+ippGetBoolean(ipp_attribute_t *attr,
+ int element)
+{
+ return (attr->values[element].boolean);
+}
+
+const char *
+ippGetString(ipp_attribute_t *attr,
+ int element,
+ const char **language)
+{
+ return (attr->values[element].string.text);
+}
+
+ipp_attribute_t *
+ippFirstAttribute(ipp_t *ipp)
+{
+ if (!ipp)
+ return (NULL);
+ return (ipp->current = ipp->attrs);
+}
+
+ipp_attribute_t *
+ippNextAttribute(ipp_t *ipp)
+{
+ if (!ipp || !ipp->current)
+ return (NULL);
+ return (ipp->current = ipp->current->next);
+}
+
+#endif
+
+void debug_printf(const char *format, ...) {
+ if (debug) {
+ va_list arglist;
+ va_start(arglist, format);
+ vfprintf(stderr, format, arglist);
+ fflush(stderr);
+ va_end(arglist);
+ }
+}
+
+static remote_printer_t *
+create_local_queue (const char *name,
+ const char *uri,
+ const char *host,
+ const char *info,
+ const char *type,
+ const char *domain)
+{
+ remote_printer_t *p;
+ remote_printer_t *q;
+
+ /* Mark this as a queue to be created locally pointing to the printer */
+ if ((p = (remote_printer_t *)calloc(1, sizeof(remote_printer_t))) == NULL) {
+ debug_printf("cups-browsed: ERROR: Unable to allocate memory.\n");
+ return NULL;
+ }
+
+ /* Queue name */
+ p->name = strdup(name);
+ if (!p->name)
+ goto fail;
+
+ p->uri = strdup(uri);
+ if (!p->uri)
+ goto fail;
+
+ p->host = strdup (host);
+ if (!p->host)
+ goto fail;
+
+ p->service_name = strdup (info);
+ if (!p->service_name)
+ goto fail;
+
+ /* Record Bonjour service parameters to identify print queue
+ entry for removal when service disappears */
+ p->type = strdup (type);
+ if (!p->type)
+ goto fail;
+
+ p->domain = strdup (domain);
+ if (!p->domain) {
+ fail:
+ debug_printf("cups-browsed: ERROR: Unable to allocate memory.\n");
+ free (p->type);
+ free (p->service_name);
+ free (p->host);
+ free (p->uri);
+ free (p->name);
+ free (p);
+ return NULL;
+ }
+
+ /* Schedule for immediate creation of the CUPS queue */
+ p->status = STATUS_TO_BE_CREATED;
+ p->timeout = time(NULL) + TIMEOUT_IMMEDIATELY;
+
+ /* Check whether we have an equally named queue already from another
+ server */
+ for (q = (remote_printer_t *)cupsArrayFirst(remote_printers);
+ q;
+ q = (remote_printer_t *)cupsArrayNext(remote_printers))
+ if (!strcmp(q->name, p->name))
+ break;
+ p->duplicate = q ? 1 : 0;
+
+ /* Add the new remote printer entry */
+ cupsArrayAdd(remote_printers, p);
+
+ if (p->duplicate)
+ debug_printf("cups-browsed: Printer already available through host %s.\n",
+ q->host);
+
+ return p;
+}
+
+gboolean handle_cups_queues(gpointer unused) {
+ remote_printer_t *p;
+ http_t *http;
+ char uri[HTTP_MAX_URI];
+ int num_options;
+ cups_option_t *options;
+ int num_jobs;
+ cups_job_t *jobs;
+ ipp_t *request, *response;
+ time_t current_time = time(NULL);
+ const char *default_printer_name;
+ ipp_attribute_t *attr;
+
+ debug_printf("cups-browsed: Processing printer list ...\n");
+ for (p = (remote_printer_t *)cupsArrayFirst(remote_printers);
+ p; p = (remote_printer_t *)cupsArrayNext(remote_printers)) {
+ switch (p->status) {
+
+ /* Print queue generated by us in a previous session */
+ case STATUS_UNCONFIRMED:
+
+ /* Only act if the timeout has passed */
+ if (p->timeout > current_time)
+ break;
+
+ /* Queue not reported again by Bonjour, remove it */
+ p->status = STATUS_DISAPPEARED;
+ p->timeout = current_time + TIMEOUT_IMMEDIATELY;
+
+ debug_printf("cups-browsed: No remote printer named %s available, removing entry from previous session.\n",
+ p->name);
+
+ /* Bonjour has reported this printer as disappeared or we have replaced
+ this printer by another one */
+ case STATUS_DISAPPEARED:
+
+ /* Only act if the timeout has passed */
+ if (p->timeout > current_time)
+ break;
+
+ debug_printf("cups-browsed: Removing entry %s%s.\n", p->name,
+ (p->duplicate ? "" : " and its CUPS queue"));
+
+ /* Remove the CUPS queue */
+ if (!p->duplicate) { /* Duplicates do not have a CUPS queue */
+ if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
+ cupsEncryption())) == NULL) {
+ debug_printf("cups-browsed: Unable to connect to CUPS!\n");
+ p->timeout = current_time + TIMEOUT_RETRY;
+ break;
+ }
+
+ /* Check whether there are still jobs and do not remove the queue
+ then */
+ num_jobs = 0;
+ jobs = NULL;
+ num_jobs = cupsGetJobs2(http, &jobs, p->name, 0, CUPS_WHICHJOBS_ACTIVE);
+ if (num_jobs != 0) { /* error or jobs */
+ debug_printf("cups-browsed: Queue has still jobs or CUPS error!\n");
+ cupsFreeJobs(num_jobs, jobs);
+ httpClose(http);
+ /* Schedule the removal of the queue for later */
+ p->timeout = current_time + TIMEOUT_RETRY;
+ break;
+ }
+
+ /* Check whether the queue is the system default. In this case do not
+ remove it, so that this user setting does not get lost */
+ default_printer_name = NULL;
+ request = ippNewRequest(CUPS_GET_DEFAULT);
+ /* Default user */
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ "requesting-user-name", NULL, cupsUser());
+ /* Do it */
+ response = cupsDoRequest(http, request, "/");
+ if (cupsLastError() > IPP_OK_CONFLICT || !response) {
+ debug_printf("cups-browsed: Could not determine system default printer!\n");
+ } else {
+ for (attr = ippFirstAttribute(response); attr != NULL;
+ attr = ippNextAttribute(response)) {
+ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_PRINTER)
+ attr = ippNextAttribute(response);
+ if (attr) {
+ for (; attr && ippGetGroupTag(attr) == IPP_TAG_PRINTER;
+ attr = ippNextAttribute(response)) {
+ if (!strcmp(ippGetName(attr), "printer-name") &&
+ ippGetValueTag(attr) == IPP_TAG_NAME) {
+ default_printer_name = ippGetString(attr, 0, NULL);
+ break;
+ }
+ }
+ }
+ if (default_printer_name)
+ break;
+ }
+ }
+ if (default_printer_name &&
+ !strcasecmp(default_printer_name, p->name)) {
+ /* Printer is currently the system's default printer,
+ do not remove it */
+ httpClose(http);
+ /* Schedule the removal of the queue for later */
+ p->timeout = current_time + TIMEOUT_RETRY;
+ break;
+ }
+ if (response)
+ ippDelete(response);
+
+ /* No jobs, not default printer, remove the CUPS queue */
+ request = ippNewRequest(CUPS_DELETE_PRINTER);
+ /* Printer URI: ipp://localhost:631/printers/<queue name> */
+ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
+ "localhost", 0, "/printers/%s", p->name);
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
+ "printer-uri", NULL, uri);
+ /* Default user */
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ "requesting-user-name", NULL, cupsUser());
+ /* Do it */
+ ippDelete(cupsDoRequest(http, request, "/admin/"));
+ if (cupsLastError() > IPP_OK_CONFLICT) {
+ debug_printf("cups-browsed: Unable to remove CUPS queue!\n");
+ p->timeout = current_time + TIMEOUT_RETRY;
+ httpClose(http);
+ break;
+ }
+ httpClose(http);
+ }
+
+ /* CUPS queue removed, remove the list entry */
+ cupsArrayRemove(remote_printers, p);
+ if (p->name) free (p->name);
+ if (p->uri) free (p->uri);
+ if (p->host) free (p->host);
+ if (p->service_name) free (p->service_name);
+ if (p->type) free (p->type);
+ if (p->domain) free (p->domain);
+ free(p);
+ break;
+
+ /* Bonjour has reported a new remote printer, create a CUPS queue for it,
+ or upgrade an existing queue, or update a queue to use a backup host
+ when it has disappeared on the currently used host */
+ case STATUS_TO_BE_CREATED:
+ /* (...or, we've just received a CUPS Browsing packet for this queue) */
+ case STATUS_BROWSE_PACKET_RECEIVED:
+
+ /* Do not create a queue for duplicates */
+ if (p->duplicate) {
+ p->timeout = (time_t) -1;
+ break;
+ }
+
+ /* Only act if the timeout has passed */
+ if (p->timeout > current_time)
+ break;
+
+ debug_printf("cups-browsed: Creating/Updating CUPS queue for %s\n",
+ p->name);
+
+ /* Create a new CUPS queue or modify the existing queue */
+ if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
+ cupsEncryption())) == NULL) {
+ debug_printf("cups-browsed: Unable to connect to CUPS!\n");
+ p->timeout = current_time + TIMEOUT_RETRY;
+ break;
+ }
+ request = ippNewRequest(CUPS_ADD_MODIFY_PRINTER);
+ /* Printer URI: ipp://localhost:631/printers/<queue name> */
+ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
+ "localhost", ippPort(), "/printers/%s", p->name);
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
+ "printer-uri", NULL, uri);
+ /* Default user */
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ "requesting-user-name", NULL, cupsUser());
+ /* Queue should be enabled ... */
+ ippAddInteger(request, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state",
+ IPP_PRINTER_IDLE);
+ /* ... and accepting jobs */
+ ippAddBoolean(request, IPP_TAG_PRINTER, "printer-is-accepting-jobs", 1);
+ num_options = 0;
+ options = NULL;
+ /* Device URI: ipp(s)://<remote host>:631/printers/<remote queue> */
+ num_options = cupsAddOption("device-uri", p->uri,
+ num_options, &options);
+ /* Option cups-browsed=true, marking that we have created this queue */
+ num_options = cupsAddOption("cups-browsed-default", "true",
+ num_options, &options);
+ /* Do not share a queue which serves only to point to a remote printer */
+ num_options = cupsAddOption("printer-is-shared", "false",
+ num_options, &options);
+ /* Description: <Bonjour service name> */
+ num_options = cupsAddOption("printer-info", p->service_name,
+ num_options, &options);
+ /* Location: <Remote host name> */
+ num_options = cupsAddOption("printer-location", p->host,
+ num_options, &options);
+ cupsEncodeOptions2(request, num_options, options, IPP_TAG_PRINTER);
+ /* Do it */
+ ippDelete(cupsDoRequest(http, request, "/admin/"));
+ cupsFreeOptions(num_options, options);
+ if (cupsLastError() > IPP_OK_CONFLICT) {
+ debug_printf("cups-browsed: Unable to create CUPS queue!\n");
+ p->timeout = current_time + TIMEOUT_RETRY;
+ httpClose(http);
+ break;
+ }
+ httpClose(http);
+
+ if (p->status == STATUS_BROWSE_PACKET_RECEIVED) {
+ p->status = STATUS_DISAPPEARED;
+ p->timeout = time(NULL) + BrowseTimeout;
+ debug_printf("cups-browsed: starting BrowseTimeout timer for %s (%ds)\n",
+ p->name, BrowseTimeout);
+ } else {
+ p->status = STATUS_CONFIRMED;
+ p->timeout = (time_t) -1;
+ }
+
+ break;
+
+ /* Nothing to do */
+ case STATUS_CONFIRMED:
+ break;
+
+ }
+ }
+
+ recheck_timer ();
+
+ /* Don't run this callback again */
+ return FALSE;
+}
+
+static void
+recheck_timer (void)
+{
+ remote_printer_t *p;
+ time_t timeout = (time_t) -1;
+ time_t now = time(NULL);
+
+ if (!gmainloop)
+ return;
+
+ for (p = (remote_printer_t *)cupsArrayFirst(remote_printers);
+ p;
+ p = (remote_printer_t *)cupsArrayNext(remote_printers))
+ if (p->timeout == (time_t) -1)
+ continue;
+ else if (now > p->timeout) {
+ timeout = 0;
+ break;
+ } else if (timeout == (time_t) -1 || p->timeout - now < timeout)
+ timeout = p->timeout - now;
+
+ if (queues_timer_id != (guint) -1)
+ g_source_remove (queues_timer_id);
+
+ if (timeout != (time_t) -1) {
+ queues_timer_id = g_timeout_add_seconds (timeout, handle_cups_queues, NULL);
+ debug_printf("cups-browsed: checking queues in %ds\n", timeout);
+ } else {
+ queues_timer_id = (guint) -1;
+ debug_printf("cups-browsed: listening\n");
+ }
+}
+
+void generate_local_queue(const char *host,
+ uint16_t port,
+ char *resource,
+ const char *name,
+ const char *type,
+ const char *domain) {
+ char *remote_queue, *remote_host;
+ remote_printer_t *p;
+ char *backup_queue_name, *local_queue_name = NULL;
+ cups_dest_t *dests, *dest;
+ int i, num_dests;
+ const char *val;
+
+ /* This is a remote CUPS queue, find queue name and host name */
+ remote_queue = resource + 9;
+ remote_host = strdup(host);
+ if (!strcmp(remote_host + strlen(remote_host) - 6, ".local"))
+ remote_host[strlen(remote_host) - 6] = '\0';
+ if (!strcmp(remote_host + strlen(remote_host) - 7, ".local."))
+ remote_host[strlen(remote_host) - 7] = '\0';
+ debug_printf("cups-browsed: Found CUPS queue: %s on host %s.\n",
+ remote_queue, remote_host);
+
+ /* Check if there exists already a CUPS queue with the
+ requested name Try name@host in such a case and if
+ this is also taken, ignore the printer */
+ if ((backup_queue_name = malloc((strlen(remote_queue) +
+ strlen(remote_host) + 2) *
+ sizeof(char))) == NULL) {
+ debug_printf("cups-browsed: ERROR: Unable to allocate memory.\n");
+ exit(1);
+ }
+ sprintf(backup_queue_name, "%s@%s", remote_queue, remote_host);
+
+ /* Get available CUPS queues */
+ num_dests = cupsGetDests(&dests);
+
+ local_queue_name = remote_queue;
+ if (num_dests > 0) {
+ /* Is there a local queue with the name of the remote queue? */
+ for (i = num_dests, dest = dests; i > 0; i --, dest ++)
+ /* Only consider CUPS queues not created by us */
+ if ((((val =
+ cupsGetOption(CUPS_BROWSED_MARK, dest->num_options,
+ dest->options)) == NULL) ||
+ (strcasecmp(val, "yes") != 0 &&
+ strcasecmp(val, "on") != 0 &&
+ strcasecmp(val, "true") != 0)) &&
+ !strcmp(local_queue_name, dest->name))
+ break;
+ if (i > 0) {
+ /* Found local queue with same name as remote queue */
+ /* Is there a local queue with the name <queue>@<host>? */
+ local_queue_name = backup_queue_name;
+ debug_printf("cups-browsed: %s already taken, using fallback name: %s\n",
+ remote_queue, local_queue_name);
+ for (i = num_dests, dest = dests; i > 0; i --, dest ++)
+ /* Only consider CUPS queues not created by us */
+ if ((((val =
+ cupsGetOption(CUPS_BROWSED_MARK, dest->num_options,
+ dest->options)) == NULL) ||
+ (strcasecmp(val, "yes") != 0 &&
+ strcasecmp(val, "on") != 0 &&
+ strcasecmp(val, "true") != 0)) &&
+ !strcmp(local_queue_name, dest->name))
+ break;
+ if (i > 0) {
+ /* Found also a local queue with name <queue>@<host>, so
+ ignore this remote printer */
+ debug_printf("cups-browsed: %s also taken, printer ignored.\n",
+ local_queue_name);
+ free (backup_queue_name);
+ free (remote_host);
+ cupsFreeDests(num_dests, dests);
+ return;
+ }
+ }
+ cupsFreeDests(num_dests, dests);
+ }
+
+ /* Check if we have already created a queue for the discovered
+ printer */
+ for (p = (remote_printer_t *)cupsArrayFirst(remote_printers);
+ p; p = (remote_printer_t *)cupsArrayNext(remote_printers))
+ if (!strcmp(p->name, local_queue_name) &&
+ (p->host[0] == '\0' ||
+ !strcmp(p->host, remote_host)))
+ break;
+
+ if (p) {
+ /* We have already created a local queue, check whether the
+ discovered service allows us to upgrade the queue to IPPS */
+ if (strcasestr(type, "_ipps") &&
+ !strncmp(p->uri, "ipp:", 4)) {
+
+ /* Schedule local queue for upgrade to ipps: */
+ if ((p->uri = realloc(p->uri, strlen(p->uri) + 2)) == NULL){
+ debug_printf("cups-browsed: ERROR: Unable to allocate memory.\n");
+ exit(1);
+ }
+ memmove((void *)(p->uri + 4), (const void *)(p->uri + 3),
+ strlen(p->uri) - 2);
+ p->uri[3] = 's';
+ p->status = STATUS_TO_BE_CREATED;
+ p->timeout = time(NULL) + TIMEOUT_IMMEDIATELY;
+ p->host = strdup(remote_host);
+ p->service_name = strdup(name);
+ p->type = strdup(type);
+ p->domain = strdup(domain);
+ debug_printf("cups-browsed: Upgrading printer %s (Host: %s) to IPPS. New URI: %s\n",
+ p->name, p->host, p->uri);
+
+ } else {
+
+ /* Nothing to do, mark queue entry as confirmed if the entry
+ is unconfirmed */
+ debug_printf("cups-browsed: Entry for %s (Host: %s, URI: %s) already exists.\n",
+ p->name, p->host, p->uri);
+ if (p->status == STATUS_UNCONFIRMED) {
+ p->status = STATUS_CONFIRMED;
+ p->timeout = (time_t) -1;
+ debug_printf("cups-browsed: Marking entry for %s (Host: %s, URI: %s) as confirmed.\n",
+ p->name, p->host, p->uri);
+ }
+
+ }
+ if (p->host[0] == '\0')
+ p->host = strdup(remote_host);
+ if (p->service_name[0] == '\0' && name)
+ p->service_name = strdup(name);
+ if (p->type[0] == '\0' && type)
+ p->type = strdup(type);
+ if (p->domain[0] == '\0' && domain)
+ p->domain = strdup(domain);
+
+ } else {
+
+ /* We need to create a local queue pointing to the
+ discovered printer */
+
+ /* Device URI: ipp(s)://<remote host>:631/printers/<remote queue> */
+ char *uri = malloc(strlen(host) +
+ strlen(remote_queue) + 34);
+ if (uri == NULL) {
+ debug_printf("cups-browsed: ERROR: Unable to allocate memory.\n");
+ exit(1);
+ }
+ sprintf(uri, "ipp%s://%s:%u/printers/%s",
+ (strcasestr(type, "_ipps") ? "s" : ""), host,
+ port, remote_queue);
+
+ p = create_local_queue (local_queue_name, uri, remote_host,
+ name ? name : "", type, domain);
+ free (uri);
+ }
+
+ free (backup_queue_name);
+ free (remote_host);
+
+ if (p)
+ debug_printf("cups-browsed: Bonjour IDs: Service name: \"%s\", "
+ "Service type: \"%s\", Domain: \"%s\"\n",
+ p->service_name, p->type, p->domain);
+}
+
+#ifdef HAVE_AVAHI
+static void resolve_callback(
+ AvahiServiceResolver *r,
+ AVAHI_GCC_UNUSED AvahiIfIndex interface,
+ AVAHI_GCC_UNUSED AvahiProtocol protocol,
+ AvahiResolverEvent event,
+ const char *name,
+ const char *type,
+ const char *domain,
+ const char *host_name,
+ const AvahiAddress *address,
+ uint16_t port,
+ AvahiStringList *txt,
+ AvahiLookupResultFlags flags,
+ AVAHI_GCC_UNUSED void* userdata) {
+
+ assert(r);
+
+ /* Called whenever a service has been resolved successfully or timed out */
+
+ switch (event) {
+
+ /* Resolver error */
+ case AVAHI_RESOLVER_FAILURE:
+ debug_printf("cups-browsed: Avahi-Resolver: Failed to resolve service '%s' of type '%s' in domain '%s': %s\n",
+ name, type, domain,
+ avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r))));
+ break;
+
+ /* New remote printer found */
+ case AVAHI_RESOLVER_FOUND: {
+ AvahiStringList *rp_entry, *adminurl_entry;
+ char *rp_key, *rp_value, *adminurl_key, *adminurl_value;
+
+ debug_printf("cups-browsed: Avahi Resolver: Service '%s' of type '%s' in domain '%s'.\n",
+ name, type, domain);
+
+ /* Check if we have a remote CUPS queue, other remote printers are not
+ handled by us */
+ rp_entry = avahi_string_list_find(txt, "rp");
+ adminurl_entry = avahi_string_list_find(txt, "adminurl");
+ if (rp_entry && adminurl_entry) {
+ avahi_string_list_get_pair(rp_entry, &rp_key, &rp_value, NULL);
+ avahi_string_list_get_pair(adminurl_entry, &adminurl_key,
+ &adminurl_value, NULL);
+
+ /* Check by "rp" and "adminurl" TXT record fields whether
+ the discovered printer is a CUPS queue */
+ if (rp_key && rp_value && adminurl_key && adminurl_value &&
+ !strcmp(rp_key, "rp") && !strncmp(rp_value, "printers/", 9) &&
+ !strcmp(adminurl_key, "adminurl") &&
+ !strcmp(adminurl_value + strlen(adminurl_value) -
+ strlen(rp_value), rp_value)) {
+ generate_local_queue(host_name, port, rp_value, name, type, domain);
+ }
+
+ /* Clean up */
+ avahi_free(rp_key);
+ avahi_free(rp_value);
+ avahi_free(adminurl_key);
+ avahi_free(adminurl_value);
+ }
+ break;
+ }
+ }
+
+ avahi_service_resolver_free(r);
+
+ recheck_timer ();
+}
+
+static void browse_callback(
+ AvahiServiceBrowser *b,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiBrowserEvent event,
+ const char *name,
+ const char *type,
+ const char *domain,
+ AvahiLookupResultFlags flags,
+ void* userdata) {
+
+ AvahiClient *c = userdata;
+ assert(b);
+
+ /* Called whenever a new services becomes available on the LAN or
+ is removed from the LAN */
+
+ switch (event) {
+
+ /* Avah browser error */
+ case AVAHI_BROWSER_FAILURE:
+
+ debug_printf("cups-browsed: Avahi Browser: ERROR: %s\n",
+ avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b))));
+ g_main_loop_quit(gmainloop);
+ return;
+
+ /* New service (remote printer) */
+ case AVAHI_BROWSER_NEW:
+
+ /* Ignore events from the local machine */
+ if (flags & AVAHI_LOOKUP_RESULT_LOCAL)
+ break;
+
+ debug_printf("cups-browsed: Avahi Browser: NEW: service '%s' of type '%s' in domain '%s'\n",
+ name, type, domain);
+
+ /* We ignore the returned resolver object. In the callback
+ function we free it. If the server is terminated before
+ the callback function is called the server will free
+ the resolver for us. */
+
+ if (!(avahi_service_resolver_new(c, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, resolve_callback, c)))
+ debug_printf("Failed to resolve service '%s': %s\n",
+ name, avahi_strerror(avahi_client_errno(c)));
+ break;
+
+ /* A service (remote printer) has disappeared */
+ case AVAHI_BROWSER_REMOVE: {
+ remote_printer_t *p, *q;
+
+ /* Ignore events from the local machine */
+ if (flags & AVAHI_LOOKUP_RESULT_LOCAL)
+ break;
+
+ debug_printf("cups-browsed: Avahi Browser: REMOVE: service '%s' of type '%s' in domain '%s'\n",
+ name, type, domain);
+
+ /* Check whether we have listed this printer */
+ for (p = (remote_printer_t *)cupsArrayFirst(remote_printers);
+ p; p = (remote_printer_t *)cupsArrayNext(remote_printers))
+ if (!strcmp(p->service_name, name) &&
+ !strcmp(p->type, type) &&
+ !strcmp(p->domain, domain))
+ break;
+ if (p) {
+ /* Check whether this queue has a duplicate from another server */
+ q = NULL;
+ if (!p->duplicate) {
+ for (q = (remote_printer_t *)cupsArrayFirst(remote_printers);
+ q;
+ q = (remote_printer_t *)cupsArrayNext(remote_printers))
+ if (!strcmp(q->name, p->name) &&
+ strcmp(q->host, p->host) &&
+ q->duplicate)
+ break;
+ }
+ if (q) {
+ /* Remove the data of the disappeared remote printer */
+ free (p->uri);
+ free (p->host);
+ free (p->service_name);
+ free (p->type);
+ free (p->domain);
+ /* Replace the data with the data of the duplicate printer */
+ p->uri = strdup(q->uri);
+ p->host = strdup(q->host);
+ p->service_name = strdup(q->service_name);
+ p->type = strdup(q->type);
+ p->domain = strdup(q->domain);
+ /* Schedule this printer for updating the CUPS queue */
+ p->status = STATUS_TO_BE_CREATED;
+ p->timeout = time(NULL) + TIMEOUT_IMMEDIATELY;
+ /* Schedule the remote printer for removal */
+ q->status = STATUS_DISAPPEARED;
+ q->timeout = time(NULL) + TIMEOUT_IMMEDIATELY;
+
+ debug_printf("cups-browsed: Printer %s diasappeared, replacing by backup on host %s with URI %s.\n",
+ p->name, p->host, p->uri);
+ } else {
+
+ /* Schedule CUPS queue for removal */
+ p->status = STATUS_DISAPPEARED;
+ p->timeout = time(NULL) + TIMEOUT_REMOVE;
+
+ debug_printf("cups-browsed: Printer %s (Host: %s, URI: %s) disappeared and no backup available, removing entry.\n",
+ p->name, p->host, p->uri);
+
+ }
+
+ debug_printf("cups-browsed: Bonjour IDs: Service name: \"%s\", Service type: \"%s\", Domain: \"%s\"\n",
+ p->service_name, p->type, p->domain);
+
+ recheck_timer ();
+ }
+ break;
+ }
+
+ /* All cached Avahi events are treated now */
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
+ debug_printf("cups-browsed: Avahi Browser: %s\n",
+ event == AVAHI_BROWSER_CACHE_EXHAUSTED ?
+ "CACHE_EXHAUSTED" : "ALL_FOR_NOW");
+ break;
+ }
+
+}
+
+static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
+ assert(c);
+
+ /* Called whenever the client or server state changes */
+
+ if (state == AVAHI_CLIENT_FAILURE) {
+ debug_printf("cups-browsed: ERROR: Avahi server connection failure: %s\n",
+ avahi_strerror(avahi_client_errno(c)));
+ g_main_loop_quit(gmainloop);
+ }
+
+}
+#endif /* HAVE_AVAHI */
+
+void
+found_cups_printer (const char *remote_host, const char *uri,
+ const char *info)
+{
+ char scheme[32];
+ char username[64];
+ char host[HTTP_MAX_HOST];
+ char resource[HTTP_MAX_URI];
+ int port;
+ netif_t *iface;
+ char local_resource[HTTP_MAX_URI];
+ char *c;
+
+ httpSeparateURI (HTTP_URI_CODING_ALL, uri,
+ scheme, sizeof(scheme),
+ username, sizeof(username),
+ host, sizeof(host),
+ &port,
+ resource, sizeof(resource));
+
+ /* Check this isn't one of our own broadcasts */
+ for (iface = cupsArrayFirst (netifs);
+ iface;
+ iface = cupsArrayNext (netifs))
+ if (!strcmp (host, iface->address))
+ break;
+ if (iface) {
+ debug_printf("cups-browsed: ignoring own broadcast on %s\n",
+ iface->address);
+ return;
+ }
+
+ if (strncmp (resource, "/printers/", 10)) {
+ debug_printf("cups-browsed: don't understand URI: %s\n", uri);
+ return;
+ }
+
+ strncpy (local_resource, resource + 1, sizeof (local_resource) - 1);
+ local_resource[sizeof (local_resource) - 1] = '\0';
+ c = strchr (local_resource, '?');
+ if (c)
+ *c = '\0';
+
+ debug_printf("cups-browsed: browsed queue name is %s\n",
+ local_resource + 9);
+
+ generate_local_queue(host, port, local_resource, info ? info : "", "", "");
+}
+
+static gboolean
+allowed (struct sockaddr *srcaddr)
+{
+ allow_t *allow;
+ if (cupsArrayCount(browseallow) == 0) {
+ /* No "BrowseAllow" line, allow all servers */
+ return TRUE;
+ }
+ for (allow = cupsArrayFirst (browseallow);
+ allow;
+ allow = cupsArrayNext (browseallow)) {
+ switch (allow->type) {
+ case ALLOW_IP:
+ switch (srcaddr->sa_family) {
+ case AF_INET:
+ if (((struct sockaddr_in *) srcaddr)->sin_addr.s_addr ==
+ allow->addr.ipv4.sin_addr.s_addr)
+ return TRUE;
+ break;
+
+ case AF_INET6:
+ if (!memcmp (&((struct sockaddr_in6 *) srcaddr)->sin6_addr,
+ &allow->addr.ipv6.sin6_addr,
+ sizeof (allow->addr.ipv6.sin6_addr)))
+ return TRUE;
+ break;
+ }
+ break;
+
+ case ALLOW_NET:
+ switch (srcaddr->sa_family) {
+ struct sockaddr_in6 *src6addr;
+
+ case AF_INET:
+ if ((((struct sockaddr_in *) srcaddr)->sin_addr.s_addr &
+ allow->mask.ipv4.sin_addr.s_addr) ==
+ allow->addr.ipv4.sin_addr.s_addr)
+ return TRUE;
+ break;
+
+ case AF_INET6:
+ src6addr = (struct sockaddr_in6 *) srcaddr;
+ if (((src6addr->sin6_addr.s6_addr[0] &
+ allow->mask.ipv6.sin6_addr.s6_addr[0]) ==
+ allow->addr.ipv6.sin6_addr.s6_addr[0]) &&
+ ((src6addr->sin6_addr.s6_addr[1] &
+ allow->mask.ipv6.sin6_addr.s6_addr[1]) ==
+ allow->addr.ipv6.sin6_addr.s6_addr[1]) &&
+ ((src6addr->sin6_addr.s6_addr[2] &
+ allow->mask.ipv6.sin6_addr.s6_addr[2]) ==
+ allow->addr.ipv6.sin6_addr.s6_addr[2]) &&
+ ((src6addr->sin6_addr.s6_addr[3] &
+ allow->mask.ipv6.sin6_addr.s6_addr[3]) ==
+ allow->addr.ipv6.sin6_addr.s6_addr[3]))
+ return TRUE;
+ break;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+gboolean
+process_browse_data (GIOChannel *source,
+ GIOCondition condition,
+ gpointer data)
+{
+ char packet[2048];
+ http_addr_t srcaddr;
+ socklen_t srclen;
+ ssize_t got;
+ unsigned int type;
+ unsigned int state;
+ char remote_host[256];
+ char uri[1024];
+ char info[1024];
+ char *c;
+
+ srclen = sizeof (srcaddr);
+ got = recvfrom (browsesocket, packet, sizeof (packet) - 1, 0,
+ &srcaddr.addr, &srclen);
+ if (got == -1) {
+ debug_printf ("cupsd-browsed: error receiving browse packet: %s\n",
+ strerror (errno));
+ /* Remove this I/O source */
+ return FALSE;
+ }
+
+ packet[got] = '\0';
+ httpAddrString (&srcaddr, remote_host, sizeof (remote_host));
+
+ /* Check this packet is allowed */
+ if (!allowed ((struct sockaddr *) &srcaddr)) {
+ debug_printf("cups-browsed: browse packet from %s disallowed\n",
+ remote_host);
+ return TRUE;
+ }
+
+ debug_printf("cups-browsed: browse packet received from %s\n",
+ remote_host);
+
+ if (sscanf (packet, "%x%x%1023s", &type, &state, uri) < 3) {
+ debug_printf("cups-browsed: incorrect browse packet format\n");
+ return TRUE;
+ }
+
+ info[0] = '\0';
+ c = strchr (packet, '\"');
+ if (c) {
+ /* Skip location field */
+ for (c++; *c != '\"'; c++)
+ ;
+
+ if (*c == '\"') {
+ for (c++; isspace(*c); c++)
+ ;
+ }
+
+ /* Is there an info field? */
+ if (*c == '\"') {
+ int i;
+ c++;
+ for (i = 0;
+ i < sizeof (info) - 1 && *c != '\"';
+ i++, c++)
+ info[i] = *c;
+ info[i] = '\0';
+ }
+ }
+
+ found_cups_printer (remote_host, uri, info);
+ recheck_timer ();
+
+ /* Don't remove this I/O source */
+ return TRUE;
+}
+
+void
+update_netifs (void)
+{
+ struct ifaddrs *ifaddr, *ifa;
+ netif_t *iface;
+
+ if (getifaddrs (&ifaddr) == -1) {
+ debug_printf("cups-browsed: unable to get interface addresses: %s\n",
+ strerror (errno));
+ return;
+ }
+
+ while ((iface = cupsArrayFirst (netifs)) != NULL) {
+ cupsArrayRemove (netifs, iface);
+ free (iface->address);
+ free (iface);
+ }
+
+ for (ifa = ifaddr; ifa; ifa = ifa->ifa_next) {
+ netif_t *iface;
+
+ if (ifa->ifa_addr == NULL)
+ continue;
+
+ if (ifa->ifa_broadaddr == NULL)
+ continue;
+
+ if (ifa->ifa_flags & IFF_LOOPBACK)
+ continue;
+
+ if (!(ifa->ifa_flags & IFF_BROADCAST))
+ continue;
+
+ iface = malloc (sizeof (netif_t));
+ if (iface == NULL) {
+ debug_printf ("cups-browsed: malloc failure\n");
+ exit (1);
+ }
+
+ iface->address = malloc (HTTP_MAX_HOST);
+ if (iface->address == NULL) {
+ free (iface);
+ debug_printf ("cups-browsed: malloc failure\n");
+ exit (1);
+ }
+
+ iface->address[0] = '\0';
+ switch (ifa->ifa_addr->sa_family) {
+ case AF_INET:
+ getnameinfo (ifa->ifa_addr, sizeof (struct sockaddr_in),
+ iface->address, HTTP_MAX_HOST,
+ NULL, 0, NI_NUMERICHOST);
+ memcpy (&iface->broadcast, ifa->ifa_broadaddr,
+ sizeof (struct sockaddr_in));
+ iface->broadcast.ipv4.sin_port = htons (BrowsePort);
+ break;
+
+ case AF_INET6:
+ if (IN6_IS_ADDR_LINKLOCAL (&((struct sockaddr_in6 *)(ifa->ifa_addr))
+ ->sin6_addr))
+ break;
+
+ getnameinfo (ifa->ifa_addr, sizeof (struct sockaddr_in6),
+ iface->address, HTTP_MAX_HOST, NULL, 0, NI_NUMERICHOST);
+ memcpy (&iface->broadcast, ifa->ifa_broadaddr,
+ sizeof (struct sockaddr_in6));
+ iface->broadcast.ipv6.sin6_port = htons (BrowsePort);
+ break;
+ }
+
+ if (iface->address[0]) {
+ cupsArrayAdd (netifs, iface);
+ debug_printf("cups-browsed: network interface at %s\n", iface->address);
+ } else {
+ free (iface->address);
+ free (iface);
+ }
+ }
+
+ freeifaddrs (ifaddr);
+}
+
+void
+broadcast_browse_packets (int type, int state,
+ const char *local_uri, const char *location,
+ const char *info, const char *make_model,
+ const char *browse_options)
+{
+ netif_t *browse;
+ char packet[2048];
+ char uri[HTTP_MAX_URI];
+ char scheme[32];
+ char username[64];
+ char host[HTTP_MAX_HOST];
+ int port;
+ char resource[HTTP_MAX_URI];
+
+ for (browse = (netif_t *)cupsArrayFirst (netifs);
+ browse != NULL;
+ browse = (netif_t *)cupsArrayNext (netifs)) {
+ /* Replace 'localhost' with our IP address on this interface */
+ httpSeparateURI(HTTP_URI_CODING_ALL, local_uri,
+ scheme, sizeof(scheme),
+ username, sizeof(username),
+ host, sizeof(host),
+ &port,
+ resource, sizeof(resource));
+ httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof (uri),
+ scheme, username, browse->address, port, resource);
+
+ if (snprintf (packet, sizeof (packet),
+ "%x " /* type */
+ "%x " /* state */
+ "%s " /* uri */
+ "\"%s\" " /* location */
+ "\"%s\" " /* info */
+ "\"%s\" " /* make-and-model */
+ "lease-duration=%d" /* BrowseTimeout */
+ "%s%s" /* other browse options */
+ "\n",
+ type, state, uri, location,
+ info, make_model,
+ BrowseTimeout,
+ browse_options ? " " : "",
+ browse_options ? browse_options : "") >= sizeof (packet)) {
+ debug_printf ("cups-browsed: oversize packet not sent\n");
+ continue;
+ }
+
+ debug_printf("cups-browsed: packet to send:\n%s", packet);
+
+ int err = sendto (browsesocket, packet,
+ strlen (packet), 0,
+ &browse->broadcast.addr,
+ httpAddrLength (&browse->broadcast));
+ if (err)
+ debug_printf("cupsd-browsed: sendto returned %d: %s\n",
+ err, strerror (errno));
+ }
+}
+
+gboolean
+send_browse_data (gpointer data)
+{
+ static const char * const rattrs[] = { "printer-type",
+ "printer-state",
+ "printer-uri-supported",
+ "printer-info",
+ "printer-location",
+ "printer-make-and-model",
+ "auth-info-required",
+ "printer-uuid",
+ "job-template" };
+ ipp_t *request, *response = NULL;
+ ipp_attribute_t *attr;
+ http_t *conn = NULL;
+
+ update_netifs ();
+ res_init ();
+ conn = httpConnectEncrypt ("localhost", BrowsePort,
+ HTTP_ENCRYPT_IF_REQUESTED);
+
+ if (conn == NULL) {
+ debug_printf("cups-browsed: browse send failed to connect to localhost\n");
+ goto fail;
+ }
+
+ request = ippNewRequest(CUPS_GET_PRINTERS);
+ ippAddStrings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+ "requested-attributes", sizeof (rattrs) / sizeof (rattrs[0]),
+ NULL, rattrs);
+ ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ "requesting-user-name", NULL, cupsUser ());
+
+ response = cupsDoRequest (conn, request, "/");
+ if (cupsLastError() > IPP_OK_CONFLICT) {
+ debug_printf("cups-browsed: browse send failed for localhost: %s\n",
+ cupsLastErrorString ());
+ goto fail;
+ }
+
+ for (attr = ippFirstAttribute(response); attr;
+ attr = ippNextAttribute(response)) {
+ int type = -1, state = -1;
+ const char *uri = NULL;
+ gchar *location = NULL;
+ gchar *info = NULL;
+ gchar *make_model = NULL;
+ GString *browse_options = g_string_new ("");
+
+ /* Skip any non-printer attributes */
+ while (attr && ippGetGroupTag(attr) != IPP_TAG_PRINTER)
+ attr = ippNextAttribute(response);
+
+ if (!attr)
+ break;
+
+ while (attr && ippGetGroupTag(attr) == IPP_TAG_PRINTER) {
+ const char *attrname = ippGetName(attr);
+ int value_tag = ippGetValueTag(attr);
+
+ if (!strcmp(attrname, "printer-type") &&
+ value_tag == IPP_TAG_ENUM) {
+ type = ippGetInteger(attr, 0);
+ if (type & CUPS_PRINTER_NOT_SHARED) {
+ /* Skip CUPS queues not marked as shared */
+ state = -1;
+ type = -1;
+ break;
+ }
+ } else if (!strcmp(attrname, "printer-state") &&
+ value_tag == IPP_TAG_ENUM)
+ state = ippGetInteger(attr, 0);
+ else if (!strcmp(attrname, "printer-uri-supported") &&
+ value_tag == IPP_TAG_URI)
+ uri = ippGetString(attr, 0, NULL);
+ else if (!strcmp(attrname, "printer-location") &&
+ value_tag == IPP_TAG_TEXT) {
+ /* Remove quotes */
+ gchar **tokens = g_strsplit (ippGetString(attr, 0, NULL), "\"", -1);
+ location = g_strjoinv ("", tokens);
+ g_strfreev (tokens);
+ } else if (!strcmp(attrname, "printer-info") &&
+ value_tag == IPP_TAG_TEXT) {
+ /* Remove quotes */
+ gchar **tokens = g_strsplit (ippGetString(attr, 0, NULL), "\"", -1);
+ info = g_strjoinv ("", tokens);
+ g_strfreev (tokens);
+ } else if (!strcmp(attrname, "printer-make-and-model") &&
+ value_tag == IPP_TAG_TEXT) {
+ /* Remove quotes */
+ gchar **tokens = g_strsplit (ippGetString(attr, 0, NULL), "\"", -1);
+ make_model = g_strjoinv ("", tokens);
+ g_strfreev (tokens);
+ } else if (!strcmp(attrname, "auth-info-required") &&
+ value_tag == IPP_TAG_KEYWORD) {
+ if (strcmp (ippGetString(attr, 0, NULL), "none"))
+ g_string_append_printf (browse_options, "auth-info-required=%s ",
+ ippGetString(attr, 0, NULL));
+ } else if (!strcmp(attrname, "printer-uuid") &&
+ value_tag == IPP_TAG_URI)
+ g_string_append_printf (browse_options, "uuid=%s ",
+ ippGetString(attr, 0, NULL));
+ else if (!strcmp(attrname, "job-sheets-default") &&
+ value_tag == IPP_TAG_NAME &&
+ ippGetCount(attr) == 2)
+ g_string_append_printf (browse_options, "job-sheets=%s,%s ",
+ ippGetString(attr, 0, NULL),
+ ippGetString(attr, 1, NULL));
+ else if (strstr(attrname, "-default")) {
+ gchar *name = g_strdup (attrname);
+ gchar *value = NULL;
+ *strstr (name, "-default") = '\0';
+
+ switch (value_tag) {
+ gchar **tokens;
+
+ case IPP_TAG_KEYWORD:
+ case IPP_TAG_STRING:
+ case IPP_TAG_NAME:
+ /* Escape value */
+ tokens = g_strsplit_set (ippGetString(attr, 0, NULL),
+ " \"\'\\", -1);
+ value = g_strjoinv ("\\", tokens);
+ g_strfreev (tokens);
+ break;
+
+ default:
+ /* other values aren't needed? */
+ debug_printf("cups-browsed: skipping %s (%d)\n", name, value_tag);
+ break;
+ }
+
+ if (value) {
+ g_string_append_printf (browse_options, "%s=%s ", name, value);
+ g_free (value);
+ }
+
+ g_free (name);
+ }
+
+ attr = ippNextAttribute(response);
+ }
+
+ if (type != -1 && state != -1 && uri && location && info && make_model) {
+ gchar *browse_options_str = g_string_free (browse_options, FALSE);
+ browse_options = NULL;
+ g_strchomp (browse_options_str);
+
+ broadcast_browse_packets (type, state, uri, location,
+ info, make_model,
+ browse_options_str);
+
+ g_free (browse_options_str);
+ }
+
+ if (make_model)
+ g_free (make_model);
+
+ if (info)
+ g_free (info);
+
+ if (location)
+ g_free (location);
+
+ if (browse_options)
+ g_string_free (browse_options, TRUE);
+
+ if (!attr)
+ break;
+ }
+
+ fail:
+ if (response)
+ ippDelete(response);
+
+ if (conn)
+ httpClose (conn);
+
+ g_timeout_add_seconds (BrowseInterval, send_browse_data, NULL);
+
+ /* Stop this timeout handler, we called a new one */
+ return FALSE;
+}
+
+gboolean
+browse_poll (gpointer data)
+{
+ static const char * const rattrs[] = { "printer-uri-supported" };
+ char *server = strdup (data);
+ ipp_t *request, *response = NULL;
+ ipp_attribute_t *attr;
+ http_t *conn;
+ int port = BrowsePort;
+ char *colon,*slash;
+ int major = 0;
+ int minor = 0;
+
+ slash = strchr (server, '/');
+ if (slash) {
+ *slash++ = '\0';
+ if (!strcmp(slash, "version=1.0")) {
+ major = 1;
+ minor = 0;
+ } else if (!strcmp(slash, "version=1.1")) {
+ major = 1;
+ minor = 1;
+ } else if (!strcmp(slash, "version=2.0")) {
+ major = 2;
+ minor = 0;
+ } else if (!strcmp(slash, "version=2.1")) {
+ major = 2;
+ minor = 1;
+ } else if (!strcmp(slash, "version=2.2")) {
+ major = 2;
+ minor = 2;
+ } else {
+ debug_printf ("ignoring unknown server option: %s\n", slash);
+ }
+ }
+
+ debug_printf ("cups-browsed: browse polling %s\n", server);
+
+ colon = strchr (server, ':');
+ if (colon) {
+ char *endptr;
+ unsigned long n;
+ *colon++ = '\0';
+ n = strtoul (colon, &endptr, 10);
+ if (endptr != colon && n < INT_MAX)
+ port = (int) n;
+ }
+
+ res_init ();
+ conn = httpConnectEncrypt (server, port, HTTP_ENCRYPT_IF_REQUESTED);
+
+ if (conn == NULL) {
+ debug_printf("cups-browsed: browse poll failed to connect to %s\n", server);
+ goto fail;
+ }
+
+ request = ippNewRequest(CUPS_GET_PRINTERS);
+ if (major > 0) {
+ debug_printf("cups-browsed: setting IPP version %d.%d\n", major, minor);
+ ippSetVersion (request, major, minor);
+ }
+
+ ippAddStrings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+ "requested-attributes", sizeof (rattrs) / sizeof (rattrs[0]),
+ NULL,
+ rattrs);
+
+ /* Ask the server to exclude printers that are remote or not shared,
+ or implicit classes. */
+ ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
+ "printer-type-mask",
+ CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT |
+ CUPS_PRINTER_NOT_SHARED);
+ ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
+ "printer-type", 0);
+
+ ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ "requesting-user-name", NULL, cupsUser ());
+
+ response = cupsDoRequest(conn, request, "/");
+ if (cupsLastError() > IPP_OK_CONFLICT) {
+ debug_printf("cups-browsed: browse poll failed for server %s: %s\n",
+ server, cupsLastErrorString ());
+ goto fail;
+ }
+
+ for (attr = ippFirstAttribute(response); attr;
+ attr = ippNextAttribute(response)) {
+ const char *uri, *info;
+
+ while (attr && ippGetGroupTag(attr) != IPP_TAG_PRINTER)
+ attr = ippNextAttribute(response);
+
+ if (!attr)
+ break;
+
+ uri = NULL;
+ info = NULL;
+ while (attr && ippGetGroupTag(attr) == IPP_TAG_PRINTER) {
+ if (!strcmp (ippGetName(attr), "printer-uri-supported") &&
+ ippGetValueTag(attr) == IPP_TAG_URI)
+ uri = ippGetString(attr, 0, NULL);
+ else if (!strcmp (ippGetName(attr), "printer-info") &&
+ ippGetValueTag(attr) == IPP_TAG_TEXT)
+ info = ippGetString(attr, 0, NULL);
+
+ attr = ippNextAttribute(response);
+ }
+
+ if (uri)
+ found_cups_printer (server, uri, info);
+
+ if (!attr)
+ break;
+ }
+
+ recheck_timer ();
+
+fail:
+ if (response)
+ ippDelete(response);
+
+ if (conn)
+ httpClose (conn);
+
+ if (server)
+ free (server);
+
+ /* Call a new timeout handler so that we run again */
+ g_timeout_add_seconds (BrowseInterval, browse_poll, data);
+
+ /* Stop this timeout handler, we called a new one */
+ return FALSE;
+}
+
+int
+compare_pointers (void *a, void *b, void *data)
+{
+ if (a < b)
+ return -1;
+ if (a > b)
+ return 1;
+ return 0;
+}
+
+int compare_remote_printers (remote_printer_t *a, remote_printer_t *b) {
+ return strcmp(a->name, b->name);
+}
+
+static void
+sigterm_handler(int sig) {
+ (void)sig; /* remove compiler warnings... */
+
+ /* Flag that we should stop and return... */
+ g_main_loop_quit(gmainloop);
+ debug_printf("cups-browsed: Caught signal %d, shutting down ...\n", sig);
+}
+
+static int
+read_browseallow_value (const char *value)
+{
+ char *p;
+ struct in_addr addr;
+ allow_t *allow = calloc (1, sizeof (allow_t));
+ p = strchr (value, '/');
+ if (p) {
+ char *s = strdup (value);
+ s[p - value] = '\0';
+
+ if (!inet_aton (s, &addr)) {
+ free (s);
+ goto fail;
+ }
+
+ free (s);
+ allow->type = ALLOW_NET;
+ allow->addr.ipv4.sin_addr.s_addr = addr.s_addr;
+
+ p++;
+ if (strchr (p, '.')) {
+ if (inet_aton (p, &addr))
+ allow->mask.ipv4.sin_addr.s_addr = addr.s_addr;
+ else
+ goto fail;
+ } else {
+ char *endptr;
+ unsigned long bits = strtoul (p, &endptr, 10);
+ if (p == endptr)
+ goto fail;
+
+ if (bits > 32)
+ goto fail;
+
+ allow->mask.ipv4.sin_addr.s_addr = htonl (((0xffffffff << (32 - bits)) &
+ 0xffffffff));
+ }
+ } else if (inet_aton (value, &addr)) {
+ allow->type = ALLOW_IP;
+ allow->addr.ipv4.sin_addr.s_addr = addr.s_addr;
+ } else
+ goto fail;
+
+ cupsArrayAdd (browseallow, allow);
+ return 0;
+
+fail:
+ free (allow);
+ return 1;
+}
+
+void
+read_configuration (const char *filename)
+{
+ cups_file_t *fp;
+ int linenum;
+ char line[HTTP_MAX_BUFFER];
+ char *value;
+ const char *delim = " \t,";
+
+ if (!filename)
+ filename = CUPS_SERVERROOT "/cups-browsed.conf";
+
+ if ((fp = cupsFileOpen(filename, "r")) == NULL) {
+ debug_printf("cups-browsed: unable to open configuration file; "
+ "using defaults\n");
+ return;
+ }
+
+ while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) {
+ debug_printf("cups-browsed: Reading config: %s %s\n", line, value);
+ if ((!strcasecmp(line, "BrowseProtocols") ||
+ !strcasecmp(line, "BrowseLocalProtocols") ||
+ !strcasecmp(line, "BrowseRemoteProtocols")) && value) {
+ int protocols = 0;
+ char *p, *saveptr;
+ p = strtok_r (value, delim, &saveptr);
+ while (p) {
+ if (!strcasecmp(p, "dnssd"))
+ protocols |= BROWSE_DNSSD;
+ else if (!strcasecmp(p, "cups"))
+ protocols |= BROWSE_CUPS;
+ else if (strcasecmp(p, "none"))
+ debug_printf("cups-browsed: unknown protocol '%s'\n", p);
+
+ p = strtok_r (NULL, delim, &saveptr);
+ }
+
+ if (!strcasecmp(line, "BrowseLocalProtocols"))
+ BrowseLocalProtocols = protocols;
+ else if (!strcasecmp(line, "BrowseRemoteProtocols"))
+ BrowseRemoteProtocols = protocols;
+ else
+ BrowseLocalProtocols = BrowseRemoteProtocols = protocols;
+ } else if (!strcasecmp(line, "BrowsePoll") && value) {
+ char **old = BrowsePoll;
+ BrowsePoll = realloc (BrowsePoll, (NumBrowsePoll + 1) * sizeof (char *));
+ if (!BrowsePoll) {
+ debug_printf("cups-browsed: unable to realloc: ignoring BrowsePoll line\n");
+ BrowsePoll = old;
+ } else {
+ debug_printf("cups-browsed: Adding BrowsePoll server: %s\n", value);
+ BrowsePoll[NumBrowsePoll++] = strdup (value);
+ }
+ } else if (!strcasecmp(line, "BrowseAllow") && value) {
+ if (read_browseallow_value (value))
+ debug_printf ("cups-browsed: BrowseAllow value \"%s\" not understood\n",
+ value);
+ } else if (!strcasecmp(line, "DomainSocket") && value) {
+ if (value[0] != '\0')
+ DomainSocket = strdup(value);
+ }
+ }
+
+ cupsFileClose(fp);
+}
+
+int main(int argc, char*argv[]) {
+#ifdef HAVE_AVAHI
+ AvahiClient *client = NULL;
+ AvahiServiceBrowser *sb1 = NULL, *sb2 = NULL;
+ int error;
+#endif /* HAVE_AVAHI */
+ int ret = 1;
+ http_t *http;
+ cups_dest_t *dests,
+ *dest;
+ int i,
+ num_dests;
+ const char *val;
+ remote_printer_t *p;
+
+ /* Turn on debug mode if requested */
+ if (argc >= 2 &&
+ (!strcmp(argv[1], "--debug") || !strcmp(argv[1], "-d") ||
+ !strncmp(argv[1], "-v", 2)))
+ debug = 1;
+
+ /* Initialise the browseallow array */
+ browseallow = cupsArrayNew(compare_pointers, NULL);
+
+ /* Read in cups-browsed.conf */
+ read_configuration (NULL);
+
+ /* Set the CUPS_SERVER environment variable to assure that cups-browsed
+ always works with the local CUPS daemon and never with a remote one
+ specified by a client.conf file */
+#ifdef CUPS_DEFAULT_DOMAINSOCKET
+ if (DomainSocket == NULL)
+ DomainSocket = CUPS_DEFAULT_DOMAINSOCKET;
+#endif
+ if (DomainSocket != NULL) {
+ struct stat sockinfo; /* Domain socket information */
+ if (!stat(DomainSocket, &sockinfo) &&
+ (sockinfo.st_mode & S_IRWXO) == S_IRWXO)
+ setenv("CUPS_SERVER", DomainSocket, 1);
+ else
+ setenv("CUPS_SERVER", "localhost", 1);
+ } else
+ setenv("CUPS_SERVER", "localhost", 1);
+
+ if (BrowseLocalProtocols & BROWSE_DNSSD) {
+ fprintf(stderr, "Local support for DNSSD not implemented\n");
+ BrowseLocalProtocols &= ~BROWSE_DNSSD;
+ }
+
+#ifndef HAVE_AVAHI
+ if (BrowseRemoteProtocols & BROWSE_DNSSD) {
+ fprintf(stderr, "Remote support for DNSSD not supported\n");
+ BrowseRemoteProtocols &= ~BROWSE_DNSSD;
+ }
+#endif /* HAVE_AVAHI */
+
+ /* Wait for CUPS daemon to start */
+ while ((http = httpConnectEncrypt(cupsServer(), ippPort(),
+ cupsEncryption())) == NULL)
+ sleep(1);
+
+ /* Initialise the array of network interfaces */
+ netifs = cupsArrayNew(compare_pointers, NULL);
+ update_netifs ();
+
+ /* Read out the currently defined CUPS queues and find the ones which we
+ have added in an earlier session */
+ num_dests = cupsGetDests(&dests);
+ remote_printers = cupsArrayNew((cups_array_func_t)compare_remote_printers,
+ NULL);
+ if (num_dests > 0) {
+ for (i = num_dests, dest = dests; i > 0; i --, dest ++) {
+ if ((val = cupsGetOption(CUPS_BROWSED_MARK, dest->num_options,
+ dest->options)) != NULL) {
+ if (strcasecmp(val, "no") != 0 && strcasecmp(val, "off") != 0 &&
+ strcasecmp(val, "false") != 0) {
+ /* Queue found, add to our list */
+ p = create_local_queue (dest->name,
+ strdup(cupsGetOption("device-uri",
+ dest->num_options,
+ dest->options)),
+ "", "", "", "");
+ if (p) {
+ /* Mark as unconfirmed, if no Avahi report of this queue appears
+ in a certain time frame, we will remove the queue */
+ p->status = STATUS_UNCONFIRMED;
+
+ if (BrowseRemoteProtocols & BROWSE_CUPS)
+ p->timeout = time(NULL) + BrowseTimeout;
+ else
+ p->timeout = time(NULL) + TIMEOUT_CONFIRM;
+
+ p->duplicate = 0;
+ debug_printf("cups-browsed: Found CUPS queue %s (URI: %s) from previous session.\n",
+ p->name, p->uri);
+ } else {
+ debug_printf("cups-browsed: ERROR: Unable to allocate memory.\n");
+ exit(1);
+ }
+ }
+ }
+ }
+ cupsFreeDests(num_dests, dests);
+ }
+ httpClose(http);
+
+ /* Redirect SIGINT and SIGTERM so that we do a proper shutdown, removing
+ the CUPS queues which we have created */
+#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+ sigset(SIGTERM, sigterm_handler);
+ sigset(SIGINT, sigterm_handler);
+ debug_printf("cups-browsed: Using signal handler SIGSET\n");
+#elif defined(HAVE_SIGACTION)
+ struct sigaction action; /* Actions for POSIX signals */
+ memset(&action, 0, sizeof(action));
+ sigemptyset(&action.sa_mask);
+ sigaddset(&action.sa_mask, SIGTERM);
+ action.sa_handler = sigterm_handler;
+ sigaction(SIGTERM, &action, NULL);
+ sigemptyset(&action.sa_mask);
+ sigaddset(&action.sa_mask, SIGINT);
+ action.sa_handler = sigterm_handler;
+ sigaction(SIGINT, &action, NULL);
+ debug_printf("cups-browsed: Using signal handler SIGACTION\n");
+#else
+ signal(SIGTERM, sigterm_handler);
+ signal(SIGINT, sigterm_handler);
+ debug_printf("cups-browsed: Using signal handler SIGNAL\n");
+#endif /* HAVE_SIGSET */
+
+#ifdef HAVE_AVAHI
+ if (BrowseRemoteProtocols & BROWSE_DNSSD) {
+ /* Allocate main loop object */
+ if (!(glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT))) {
+ debug_printf("cups-browsed: ERROR: Failed to create glib poll object.\n");
+ goto avahi_fail;
+ }
+
+ /* Allocate a new client */
+ client = avahi_client_new(avahi_glib_poll_get(glib_poll), 0,
+ client_callback, NULL, &error);
+
+ /* Check wether creating the client object succeeded */
+ if (!client) {
+ debug_printf("cups-browsed: ERROR: Failed to create client: %s\n",
+ avahi_strerror(error));
+ goto avahi_fail;
+ }
+
+ /* Create the service browsers */
+ if (!(sb1 =
+ avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
+ "_ipp._tcp", NULL, 0, browse_callback,
+ client))) {
+ debug_printf("cups-browsed: ERROR: Failed to create service browser for IPP: %s\n",
+ avahi_strerror(avahi_client_errno(client)));
+ goto avahi_fail;
+ }
+ if (!(sb2 =
+ avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
+ "_ipps._tcp", NULL, 0, browse_callback,
+ client))) {
+ debug_printf("cups-browsed: ERROR: Failed to create service browser for IPPS: %s\n",
+ avahi_strerror(avahi_client_errno(client)));
+ avahi_fail:
+ BrowseRemoteProtocols &= ~BROWSE_DNSSD;
+ if (sb2) {
+ avahi_service_browser_free(sb2);
+ sb2 = NULL;
+ }
+
+ if (client) {
+ avahi_client_free(client);
+ client = NULL;
+ }
+
+ if (glib_poll) {
+ avahi_glib_poll_free(glib_poll);
+ glib_poll = NULL;
+ }
+ }
+ }
+#endif /* HAVE_AVAHI */
+
+ if (BrowseLocalProtocols & BROWSE_CUPS ||
+ BrowseRemoteProtocols & BROWSE_CUPS) {
+ /* Set up our CUPS Browsing socket */
+ browsesocket = socket (AF_INET, SOCK_DGRAM, 0);
+ if (browsesocket == -1) {
+ debug_printf("cups-browsed: failed to create CUPS Browsing socket: %s\n",
+ strerror (errno));
+ } else {
+ struct sockaddr_in addr;
+ memset (&addr, 0, sizeof (addr));
+ addr.sin_addr.s_addr = htonl (INADDR_ANY);
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons (BrowsePort);
+ if (bind (browsesocket, (struct sockaddr *)&addr, sizeof (addr))) {
+ debug_printf("cups-browsed: failed to bind CUPS Browsing socket: %s\n",
+ strerror (errno));
+ close (browsesocket);
+ browsesocket = -1;
+ } else {
+ int on = 1;
+ if (setsockopt (browsesocket, SOL_SOCKET, SO_BROADCAST,
+ &on, sizeof (on))) {
+ debug_printf("cups-browsed: failed to allow broadcast: %s\n",
+ strerror (errno));
+ BrowseLocalProtocols &= ~BROWSE_CUPS;
+ }
+ }
+ }
+
+ if (browsesocket == -1) {
+ BrowseLocalProtocols &= ~BROWSE_CUPS;
+ BrowseRemoteProtocols &= ~BROWSE_CUPS;
+ }
+ }
+
+ if (BrowseLocalProtocols == 0 &&
+ BrowseRemoteProtocols == 0 &&
+ !BrowsePoll) {
+ debug_printf("cups-browsed: nothing left to do\n");
+ ret = 0;
+ goto fail;
+ }
+
+ /* Run the main loop */
+ gmainloop = g_main_loop_new (NULL, FALSE);
+ recheck_timer ();
+
+ if (BrowseRemoteProtocols & BROWSE_CUPS) {
+ GIOChannel *browse_channel = g_io_channel_unix_new (browsesocket);
+ g_io_channel_set_close_on_unref (browse_channel, FALSE);
+ g_io_add_watch (browse_channel, G_IO_IN, process_browse_data, NULL);
+ }
+
+ if (BrowseLocalProtocols & BROWSE_CUPS) {
+ debug_printf ("cups-browsed: will send browse data every %ds\n",
+ BrowseInterval);
+ g_idle_add (send_browse_data, NULL);
+ }
+
+ if (BrowsePoll) {
+ size_t index;
+ for (index = 0;
+ index < NumBrowsePoll;
+ index++) {
+ debug_printf ("cups-browsed: will browse poll %s every %ds\n",
+ BrowsePoll[index], BrowseInterval);
+ g_idle_add (browse_poll, BrowsePoll[index]);
+ }
+ }
+
+ g_main_loop_run (gmainloop);
+
+ debug_printf("cups-browsed: main loop exited\n");
+ g_main_loop_unref (gmainloop);
+ gmainloop = NULL;
+ ret = 0;
+
+fail:
+
+ /* Clean up things */
+
+ /* Remove all queues which we have set up */
+ for (p = (remote_printer_t *)cupsArrayFirst(remote_printers);
+ p; p = (remote_printer_t *)cupsArrayNext(remote_printers)) {
+ p->status = STATUS_DISAPPEARED;
+ p->timeout = time(NULL) + TIMEOUT_IMMEDIATELY;
+ }
+ handle_cups_queues(NULL);
+
+#ifdef HAVE_AVAHI
+ /* Free the data structures for Bonjour browsing */
+ if (sb1)
+ avahi_service_browser_free(sb1);
+ if (sb2)
+ avahi_service_browser_free(sb2);
+
+ if (client)
+ avahi_client_free(client);
+
+ if (glib_poll)
+ avahi_glib_poll_free(glib_poll);
+#endif /* HAVE_AVAHI */
+
+ if (browsesocket != -1)
+ close (browsesocket);
+
+ return ret;
+}
diff --git a/utils/cups-browsed.conf.in b/utils/cups-browsed.conf.in
new file mode 100644
index 0000000..f19c1f3
--- /dev/null
+++ b/utils/cups-browsed.conf.in
@@ -0,0 +1,31 @@
+# Which protocols will we use to discover printers on the network?
+# Can use DNSSD and/or CUPS, or 'none' for neither.
+BrowseRemoteProtocols @BROWSEREMOTEPROTOCOLS@
+
+# Which protocols will we use to broadcast shared local printers to the network?
+# Can use DNSSD and/or CUPS, or 'none' for neither.
+# Only CUPS is actually supported, as DNSSD is done by CUPS itself (we ignore
+# DNSSD in this directive).
+# BrowseLocalProtocols none
+
+# Settings of this directive apply to both BrowseRemoteProtocols and
+# BrowseLocalProtocols.
+# Can use DNSSD and/or CUPS, or 'none' for neither.
+# BrowseProtocols none
+
+# Only browse remote printers from selected servers
+# BrowseAllow cups.example.com
+# BrowseAllow 192.168.1.12
+# BrowseAllow 192.168.1.0/24
+# BrowseAllow 192.168.1.0/255.255.255.0
+
+# Use BrowsePoll to poll a particular CUPS server
+# BrowsePoll cups.example.com
+# BrowsePoll cups.example.com:631
+# BrowsePoll cups.example.com:631/version=1.1
+
+# Use DomainSocket to access the local CUPS daemon via another than the
+# default domain socket
+# DomainSocket @CUPS_DEFAULT_DOMAINSOCKET@
+
+# Unknown directives are ignored, also unknown values.
diff --git a/utils/cups-browsed.in b/utils/cups-browsed.in
new file mode 100644
index 0000000..d85ecb1
--- /dev/null
+++ b/utils/cups-browsed.in
@@ -0,0 +1,154 @@
+#!/bin/sh
+# Provides: cups-browsed
+# Required-Start: $local_fs $remote_fs $network $named $time $avahi-daemon $cups
+# Required-Stop: $local_fs $remote_fs $network $named $time $avahi-daemon $cups
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: cups-browsed - Make remote CUPS printers available locally
+# Description: This daemon browses Bonjour broadcasts of shared remote CUPS
+# printers and makes these printers available locally by creating
+# local CUPS queues pointing to the remote queues. This replaces
+# the CUPS browsing which was dropped in CUPS 1.6.1. For the end
+# the behavior is the same as with the old CUPS broadcasting/
+# browsing, but in the background the standard method for network
+# service announcement and discovery, Bonjour, is used.
+### END INIT INFO
+
+#
+# Linux chkconfig stuff:
+#
+# chkconfig: 235 99 00
+# description: Startup/shutdown script for cups-browsed.
+#
+
+#
+# NetBSD 1.5+ rcorder script lines. The format of the following two
+# lines is very strict -- please don't add additional spaces!
+#
+# PROVIDE: cups-browsed
+# REQUIRE: cups
+#
+
+
+#### OS-Dependent Configuration
+
+case "`uname`" in
+ *BSD*)
+ IS_ON=:
+ ECHO=echo
+ ECHO_OK=:
+ ECHO_ERROR=:
+ ;;
+
+ Darwin*)
+ . /etc/rc.common
+
+ if test "${CUPS_BROWSED:=-YES-}" = "-NO-"; then
+ exit 0
+ fi
+
+ IS_ON=:
+ ECHO=ConsoleMessage
+ ECHO_OK=:
+ ECHO_ERROR=:
+ ;;
+
+ Linux*)
+ IS_ON=/bin/true
+ if test -f /etc/init.d/functions; then
+ . /etc/init.d/functions
+ ECHO=echo
+ ECHO_OK="echo_success"
+ ECHO_ERROR="echo_failure"
+ else
+ ECHO=echo
+ ECHO_OK=:
+ ECHO_ERROR=:
+ fi
+ ;;
+
+ *)
+ IS_ON=/bin/true
+ ECHO=echo
+ ECHO_OK=:
+ ECHO_ERROR=:
+ ;;
+esac
+
+#
+# Make sure we have the standard program directories in the path
+# since some operating systems (this means YOU HP-UX!) don't
+# provide a standard path on boot-up...
+#
+
+if test "x$PATH" = x; then
+ PATH="/bin:/usr/bin:/sbin:/usr/sbin"
+else
+ PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
+fi
+
+export PATH
+
+#
+# See if the CUPS server (cupsd) is running...
+#
+
+case "`uname`" in
+ Linux* | *BSD* | Darwin*)
+ pid=`ps ax | awk '{if (match($5, ".*/cups-browsed$") || $5 == "cups-browsed") print $1}'`
+ ;;
+ *)
+ pid=""
+ ;;
+esac
+
+#
+# Start or stop cups-browsed based upon the first argument to the script.
+#
+
+case $1 in
+ start | restart | reload)
+ if $IS_ON cups; then
+ if test "$pid" != ""; then
+ kill -TERM $pid
+ fi
+ prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ @sbindir@/cups-browsed &
+ if test $? != 0; then
+ $ECHO_FAIL
+ $ECHO "cups-browsed: unable to $1."
+ exit 1
+ fi
+ $ECHO_OK
+ $ECHO "cups-browsed: ${1}ed."
+ fi
+ ;;
+
+ stop)
+ if test "$pid" != ""; then
+ kill -TERM $pid
+ $ECHO_OK
+ $ECHO "cups-browsed: stopped."
+ fi
+ ;;
+
+ status)
+ if test "$pid" != ""; then
+ echo "cups-browsed: running."
+ else
+ echo "cups-browsed: not running."
+ fi
+ ;;
+
+ *)
+ echo "Usage: cups-browsed {reload|restart|start|status|stop}"
+ exit 1
+ ;;
+esac
+
+#
+# Exit with no errors.
+#
+
+exit 0