summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2018-09-25 08:33:05 +0200
committerDidier Raboud <odyx@debian.org>2018-09-25 08:33:05 +0200
commite50542121e724e851fc5d6c68bb773f80c0bc12c (patch)
tree655c3f6331a6e8fd8b09ceb4da8f5896484ae16a /src/main
parent9dd97a029bf391c42b1dc76f2f7c5e386bb8f466 (diff)
New upstream version 5.3.1
Diffstat (limited to 'src/main')
-rw-r--r--src/main/Makefile.am6
-rw-r--r--src/main/Makefile.in354
-rw-r--r--src/main/array.c228
-rw-r--r--src/main/bit-ops.c134
-rw-r--r--src/main/buffer-image.c3
-rw-r--r--src/main/canon-inks.h3
-rw-r--r--src/main/canon-media-mode.h17
-rw-r--r--src/main/canon-media.h26
-rw-r--r--src/main/canon-modes.h45
-rw-r--r--src/main/canon-printers.h28
-rw-r--r--src/main/channel.c262
-rw-r--r--src/main/color-conversion.h3
-rw-r--r--src/main/color-conversions.c1397
-rw-r--r--src/main/color.c3
-rw-r--r--src/main/curve-cache.c3
-rw-r--r--src/main/curve.c114
-rw-r--r--src/main/dither-ed.c3
-rw-r--r--src/main/dither-eventone.c3
-rw-r--r--src/main/dither-impl.h5
-rw-r--r--src/main/dither-inks.c3
-rw-r--r--src/main/dither-inlined-functions.h3
-rw-r--r--src/main/dither-main.c3
-rw-r--r--src/main/dither-ordered.c3
-rw-r--r--src/main/dither-predithered.c3
-rw-r--r--src/main/dither-very-fast.c3
-rw-r--r--src/main/escp2-channels.c89
-rw-r--r--src/main/escp2-driver.c3
-rw-r--r--src/main/escp2-papers.c276
-rw-r--r--src/main/escp2-resolutions.c175
-rw-r--r--src/main/generic-options.c3
-rw-r--r--src/main/generic-options.h3
-rw-r--r--src/main/gutenprint-internal.h182
-rw-r--r--src/main/image.c3
-rw-r--r--src/main/libgutenprint.sym108
-rw-r--r--src/main/module.c22
-rw-r--r--src/main/mxml-node.c9
-rw-r--r--src/main/path.c53
-rw-r--r--src/main/print-canon.c197
-rw-r--r--src/main/print-canon.h7
-rw-r--r--src/main/print-color.c24
-rw-r--r--src/main/print-dither-matrices.c10
-rw-r--r--src/main/print-dpl.c84
-rw-r--r--src/main/print-dyesub.c (renamed from src/main/print-olympus.c)3353
-rw-r--r--src/main/print-escp2-data.c131
-rw-r--r--src/main/print-escp2.c344
-rw-r--r--src/main/print-escp2.h53
-rw-r--r--src/main/print-lexmark.c134
-rw-r--r--src/main/print-list.c74
-rw-r--r--src/main/print-papers.c308
-rw-r--r--src/main/print-pcl.c638
-rw-r--r--src/main/print-ps.c104
-rw-r--r--src/main/print-raw.c23
-rw-r--r--src/main/print-util.c177
-rw-r--r--src/main/print-vars.c207
-rw-r--r--src/main/print-version.c3
-rw-r--r--src/main/print-weave.c9
-rw-r--r--src/main/printers.c118
-rw-r--r--src/main/refcache.c231
-rw-r--r--src/main/sequence.c16
-rw-r--r--src/main/string-list.c3
-rw-r--r--src/main/xml.c294
-rw-r--r--src/main/xmlppd.h3
62 files changed, 6578 insertions, 3548 deletions
diff --git a/src/main/Makefile.am b/src/main/Makefile.am
index 6b41313..f75a2b4 100644
--- a/src/main/Makefile.am
+++ b/src/main/Makefile.am
@@ -11,8 +11,7 @@
## 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.
+## along with this program. If not, see <https://www.gnu.org/licenses/>.
## Process this file with automake to produce Makefile.in.
@@ -82,7 +81,7 @@ print_dpl_la_LDFLAGS = -module -avoid-version
print_ps_la_SOURCES = print-ps.c xmlppd.c xmlppd.h
print_ps_la_LDFLAGS = -module -avoid-version
-print_dyesub_la_SOURCES = print-olympus.c
+print_dyesub_la_SOURCES = print-dyesub.c
print_dyesub_la_LDFLAGS = -module -avoid-version
print_raw_la_SOURCES = print-raw.c
@@ -144,6 +143,7 @@ libgutenprint_la_SOURCES = \
print-version.c \
print-weave.c \
printers.c \
+ refcache.c \
sequence.c \
string-list.c \
xml.c \
diff --git a/src/main/Makefile.in b/src/main/Makefile.in
index defa705..8990a52 100644
--- a/src/main/Makefile.in
+++ b/src/main/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.13.4 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,17 @@
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@@ -84,23 +94,21 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-DIST_COMMON = $(top_srcdir)/scripts/global.mk $(srcdir)/Makefile.in \
- $(srcdir)/Makefile.am $(srcdir)/gutenprint.pc.in \
- $(top_srcdir)/scripts/depcomp
subdir = src/main
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
- $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
- $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \
- $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \
+ $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_option.m4 \
$(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = gutenprint.pc
@@ -156,7 +164,7 @@ am__libgutenprint_la_SOURCES_DIST = array.c bit-ops.c channel.c \
dither-very-fast.c dither-predithered.c generic-options.c \
image.c buffer-image.c module.c path.c print-dither-matrices.c \
print-list.c print-papers.c print-util.c print-vars.c \
- print-version.c print-weave.c printers.c sequence.c \
+ print-version.c print-weave.c printers.c refcache.c sequence.c \
string-list.c xml.c mxml-attr.c mxml-file.c mxml-node.c \
mxml-search.c dither-impl.h dither-inlined-functions.h \
generic-options.h gutenprint-internal.h print-color.c \
@@ -166,7 +174,7 @@ am__libgutenprint_la_SOURCES_DIST = array.c bit-ops.c channel.c \
escp2-driver.c print-escp2.h print-escp2-data.c \
escp2-channels.c escp2-papers.c escp2-resolutions.c \
print-lexmark.c print-pcl.c print-dpl.c print-ps.c xmlppd.c \
- xmlppd.h print-olympus.c print-raw.c
+ xmlppd.h print-dyesub.c print-raw.c
am__objects_1 = mxml-attr.lo mxml-file.lo mxml-node.lo mxml-search.lo
am__objects_2 =
am__objects_3 = print-color.lo color-conversions.lo
@@ -177,7 +185,7 @@ am__objects_6 = print-lexmark.lo
am__objects_7 = print-pcl.lo
am__objects_8 = print-dpl.lo
am__objects_9 = print-ps.lo xmlppd.lo
-am__objects_10 = print-olympus.lo
+am__objects_10 = print-dyesub.lo
am__objects_11 = print-raw.lo
am__objects_12 = $(am__objects_3) $(am__objects_4) $(am__objects_5) \
$(am__objects_6) $(am__objects_7) $(am__objects_8) \
@@ -190,8 +198,8 @@ am_libgutenprint_la_OBJECTS = array.lo bit-ops.lo channel.lo color.lo \
image.lo buffer-image.lo module.lo path.lo \
print-dither-matrices.lo print-list.lo print-papers.lo \
print-util.lo print-vars.lo print-version.lo print-weave.lo \
- printers.lo sequence.lo string-list.lo xml.lo $(am__objects_1) \
- $(am__objects_2) $(am__objects_13)
+ printers.lo refcache.lo sequence.lo string-list.lo xml.lo \
+ $(am__objects_1) $(am__objects_2) $(am__objects_13)
libgutenprint_la_OBJECTS = $(am_libgutenprint_la_OBJECTS)
libgutenprint_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
@@ -213,7 +221,7 @@ print_dpl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(print_dpl_la_LDFLAGS) $(LDFLAGS) -o $@
@BUILD_MODULES_TRUE@am_print_dpl_la_rpath = -rpath $(pkgmoduledir)
print_dyesub_la_LIBADD =
-am_print_dyesub_la_OBJECTS = print-olympus.lo
+am_print_dyesub_la_OBJECTS = print-dyesub.lo
print_dyesub_la_OBJECTS = $(am_print_dyesub_la_OBJECTS)
print_dyesub_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
@@ -273,7 +281,34 @@ am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/array.Plo ./$(DEPDIR)/bit-ops.Plo \
+ ./$(DEPDIR)/buffer-image.Plo ./$(DEPDIR)/channel.Plo \
+ ./$(DEPDIR)/color-conversions.Plo ./$(DEPDIR)/color.Plo \
+ ./$(DEPDIR)/curve-cache.Plo ./$(DEPDIR)/curve.Plo \
+ ./$(DEPDIR)/dither-ed.Plo ./$(DEPDIR)/dither-eventone.Plo \
+ ./$(DEPDIR)/dither-inks.Plo ./$(DEPDIR)/dither-main.Plo \
+ ./$(DEPDIR)/dither-ordered.Plo \
+ ./$(DEPDIR)/dither-predithered.Plo \
+ ./$(DEPDIR)/dither-very-fast.Plo \
+ ./$(DEPDIR)/escp2-channels.Plo ./$(DEPDIR)/escp2-driver.Plo \
+ ./$(DEPDIR)/escp2-papers.Plo ./$(DEPDIR)/escp2-resolutions.Plo \
+ ./$(DEPDIR)/generic-options.Plo ./$(DEPDIR)/image.Plo \
+ ./$(DEPDIR)/module.Plo ./$(DEPDIR)/mxml-attr.Plo \
+ ./$(DEPDIR)/mxml-file.Plo ./$(DEPDIR)/mxml-node.Plo \
+ ./$(DEPDIR)/mxml-search.Plo ./$(DEPDIR)/path.Plo \
+ ./$(DEPDIR)/print-canon.Plo ./$(DEPDIR)/print-color.Plo \
+ ./$(DEPDIR)/print-dither-matrices.Plo \
+ ./$(DEPDIR)/print-dpl.Plo ./$(DEPDIR)/print-dyesub.Plo \
+ ./$(DEPDIR)/print-escp2-data.Plo ./$(DEPDIR)/print-escp2.Plo \
+ ./$(DEPDIR)/print-lexmark.Plo ./$(DEPDIR)/print-list.Plo \
+ ./$(DEPDIR)/print-papers.Plo ./$(DEPDIR)/print-pcl.Plo \
+ ./$(DEPDIR)/print-ps.Plo ./$(DEPDIR)/print-raw.Plo \
+ ./$(DEPDIR)/print-util.Plo ./$(DEPDIR)/print-vars.Plo \
+ ./$(DEPDIR)/print-version.Plo ./$(DEPDIR)/print-weave.Plo \
+ ./$(DEPDIR)/printers.Plo ./$(DEPDIR)/refcache.Plo \
+ ./$(DEPDIR)/sequence.Plo ./$(DEPDIR)/string-list.Plo \
+ ./$(DEPDIR)/xml.Plo ./$(DEPDIR)/xmlppd.Plo
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -329,6 +364,8 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/gutenprint.pc.in \
+ $(top_srcdir)/scripts/depcomp $(top_srcdir)/scripts/global.mk
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALL_LINGUAS = @ALL_LINGUAS@
@@ -339,6 +376,8 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH = @BASH@
+BASHREAL = @BASHREAL@
BUILD_CUPS_PPDS = @BUILD_CUPS_PPDS@
BZIP2 = @BZIP2@
CC = @CC@
@@ -359,7 +398,6 @@ DB2PDF = @DB2PDF@
DB2PS = @DB2PS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
-DIALOG = @DIALOG@
DLLTOOL = @DLLTOOL@
DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
@@ -376,6 +414,7 @@ EXEEXT = @EXEEXT@
FGREP = @FGREP@
FIND = @FIND@
GENPPD_LIBS = @GENPPD_LIBS@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GIMP2_CFLAGS = @GIMP2_CFLAGS@
GIMP2_LIBS = @GIMP2_LIBS@
GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@
@@ -438,10 +477,12 @@ LTALLOCA = @LTALLOCA@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
+MINIMAL_PRINTERS_TO_TEST = @MINIMAL_PRINTERS_TO_TEST@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
MSGFMT_015 = @MSGFMT_015@
@@ -465,7 +506,6 @@ PKGROOT = @PKGROOT@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLUG_IN_PATH = @PLUG_IN_PATH@
POSUB = @POSUB@
RANLIB = @RANLIB@
RELEASE_DATE = @RELEASE_DATE@
@@ -483,9 +523,11 @@ VERSION = @VERSION@
WHICH_PPDS = @WHICH_PPDS@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
XZ = @XZ@
YACC = @YACC@
YFLAGS = @YFLAGS@
+ZPAQ = @ZPAQ@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -553,7 +595,6 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS)
-GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la
pkgconfigdatadir = $(libdir)/pkgconfig
pkgmoduledir = $(pkglibdir)/@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@/modules
@BUILD_MODULES_TRUE@pkgmodule_LTLIBRARIES = \
@@ -601,7 +642,7 @@ print_dpl_la_SOURCES = print-dpl.c
print_dpl_la_LDFLAGS = -module -avoid-version
print_ps_la_SOURCES = print-ps.c xmlppd.c xmlppd.h
print_ps_la_LDFLAGS = -module -avoid-version
-print_dyesub_la_SOURCES = print-olympus.c
+print_dyesub_la_SOURCES = print-dyesub.c
print_dyesub_la_LDFLAGS = -module -avoid-version
print_raw_la_SOURCES = print-raw.c
print_raw_la_LDFLAGS = -module -avoid-version
@@ -657,6 +698,7 @@ libgutenprint_la_SOURCES = \
print-version.c \
print-weave.c \
printers.c \
+ refcache.c \
sequence.c \
string-list.c \
xml.c \
@@ -694,16 +736,15 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/main/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu src/main/Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
-$(top_srcdir)/scripts/global.mk:
+$(top_srcdir)/scripts/global.mk $(am__empty):
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -822,69 +863,76 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bit-ops.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer-image.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color-conversions.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve-cache.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-ed.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-eventone.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-inks.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-main.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-ordered.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-predithered.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-very-fast.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escp2-channels.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escp2-driver.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escp2-papers.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escp2-resolutions.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic-options.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mxml-attr.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mxml-file.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mxml-node.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mxml-search.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-canon.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-color.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-dither-matrices.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-dpl.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-escp2-data.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-escp2.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-lexmark.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-list.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-olympus.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-papers.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-pcl.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-ps.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-raw.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-util.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-vars.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-version.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-weave.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printers.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sequence.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string-list.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlppd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bit-ops.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer-image.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color-conversions.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve-cache.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-ed.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-eventone.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-inks.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-main.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-ordered.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-predithered.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither-very-fast.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escp2-channels.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escp2-driver.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escp2-papers.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escp2-resolutions.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic-options.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mxml-attr.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mxml-file.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mxml-node.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mxml-search.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-canon.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-color.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-dither-matrices.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-dpl.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-dyesub.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-escp2-data.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-escp2.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-lexmark.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-list.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-papers.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-pcl.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-ps.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-raw.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-util.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-vars.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-version.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-weave.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printers.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/refcache.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sequence.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string-list.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlppd.Plo@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -972,7 +1020,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@@ -1046,7 +1097,56 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
clean-pkgmoduleLTLIBRARIES mostlyclean-am
distclean: distclean-am
- -rm -rf ./$(DEPDIR)
+ -rm -f ./$(DEPDIR)/array.Plo
+ -rm -f ./$(DEPDIR)/bit-ops.Plo
+ -rm -f ./$(DEPDIR)/buffer-image.Plo
+ -rm -f ./$(DEPDIR)/channel.Plo
+ -rm -f ./$(DEPDIR)/color-conversions.Plo
+ -rm -f ./$(DEPDIR)/color.Plo
+ -rm -f ./$(DEPDIR)/curve-cache.Plo
+ -rm -f ./$(DEPDIR)/curve.Plo
+ -rm -f ./$(DEPDIR)/dither-ed.Plo
+ -rm -f ./$(DEPDIR)/dither-eventone.Plo
+ -rm -f ./$(DEPDIR)/dither-inks.Plo
+ -rm -f ./$(DEPDIR)/dither-main.Plo
+ -rm -f ./$(DEPDIR)/dither-ordered.Plo
+ -rm -f ./$(DEPDIR)/dither-predithered.Plo
+ -rm -f ./$(DEPDIR)/dither-very-fast.Plo
+ -rm -f ./$(DEPDIR)/escp2-channels.Plo
+ -rm -f ./$(DEPDIR)/escp2-driver.Plo
+ -rm -f ./$(DEPDIR)/escp2-papers.Plo
+ -rm -f ./$(DEPDIR)/escp2-resolutions.Plo
+ -rm -f ./$(DEPDIR)/generic-options.Plo
+ -rm -f ./$(DEPDIR)/image.Plo
+ -rm -f ./$(DEPDIR)/module.Plo
+ -rm -f ./$(DEPDIR)/mxml-attr.Plo
+ -rm -f ./$(DEPDIR)/mxml-file.Plo
+ -rm -f ./$(DEPDIR)/mxml-node.Plo
+ -rm -f ./$(DEPDIR)/mxml-search.Plo
+ -rm -f ./$(DEPDIR)/path.Plo
+ -rm -f ./$(DEPDIR)/print-canon.Plo
+ -rm -f ./$(DEPDIR)/print-color.Plo
+ -rm -f ./$(DEPDIR)/print-dither-matrices.Plo
+ -rm -f ./$(DEPDIR)/print-dpl.Plo
+ -rm -f ./$(DEPDIR)/print-dyesub.Plo
+ -rm -f ./$(DEPDIR)/print-escp2-data.Plo
+ -rm -f ./$(DEPDIR)/print-escp2.Plo
+ -rm -f ./$(DEPDIR)/print-lexmark.Plo
+ -rm -f ./$(DEPDIR)/print-list.Plo
+ -rm -f ./$(DEPDIR)/print-papers.Plo
+ -rm -f ./$(DEPDIR)/print-pcl.Plo
+ -rm -f ./$(DEPDIR)/print-ps.Plo
+ -rm -f ./$(DEPDIR)/print-raw.Plo
+ -rm -f ./$(DEPDIR)/print-util.Plo
+ -rm -f ./$(DEPDIR)/print-vars.Plo
+ -rm -f ./$(DEPDIR)/print-version.Plo
+ -rm -f ./$(DEPDIR)/print-weave.Plo
+ -rm -f ./$(DEPDIR)/printers.Plo
+ -rm -f ./$(DEPDIR)/refcache.Plo
+ -rm -f ./$(DEPDIR)/sequence.Plo
+ -rm -f ./$(DEPDIR)/string-list.Plo
+ -rm -f ./$(DEPDIR)/xml.Plo
+ -rm -f ./$(DEPDIR)/xmlppd.Plo
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@@ -1093,7 +1193,56 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
+ -rm -f ./$(DEPDIR)/array.Plo
+ -rm -f ./$(DEPDIR)/bit-ops.Plo
+ -rm -f ./$(DEPDIR)/buffer-image.Plo
+ -rm -f ./$(DEPDIR)/channel.Plo
+ -rm -f ./$(DEPDIR)/color-conversions.Plo
+ -rm -f ./$(DEPDIR)/color.Plo
+ -rm -f ./$(DEPDIR)/curve-cache.Plo
+ -rm -f ./$(DEPDIR)/curve.Plo
+ -rm -f ./$(DEPDIR)/dither-ed.Plo
+ -rm -f ./$(DEPDIR)/dither-eventone.Plo
+ -rm -f ./$(DEPDIR)/dither-inks.Plo
+ -rm -f ./$(DEPDIR)/dither-main.Plo
+ -rm -f ./$(DEPDIR)/dither-ordered.Plo
+ -rm -f ./$(DEPDIR)/dither-predithered.Plo
+ -rm -f ./$(DEPDIR)/dither-very-fast.Plo
+ -rm -f ./$(DEPDIR)/escp2-channels.Plo
+ -rm -f ./$(DEPDIR)/escp2-driver.Plo
+ -rm -f ./$(DEPDIR)/escp2-papers.Plo
+ -rm -f ./$(DEPDIR)/escp2-resolutions.Plo
+ -rm -f ./$(DEPDIR)/generic-options.Plo
+ -rm -f ./$(DEPDIR)/image.Plo
+ -rm -f ./$(DEPDIR)/module.Plo
+ -rm -f ./$(DEPDIR)/mxml-attr.Plo
+ -rm -f ./$(DEPDIR)/mxml-file.Plo
+ -rm -f ./$(DEPDIR)/mxml-node.Plo
+ -rm -f ./$(DEPDIR)/mxml-search.Plo
+ -rm -f ./$(DEPDIR)/path.Plo
+ -rm -f ./$(DEPDIR)/print-canon.Plo
+ -rm -f ./$(DEPDIR)/print-color.Plo
+ -rm -f ./$(DEPDIR)/print-dither-matrices.Plo
+ -rm -f ./$(DEPDIR)/print-dpl.Plo
+ -rm -f ./$(DEPDIR)/print-dyesub.Plo
+ -rm -f ./$(DEPDIR)/print-escp2-data.Plo
+ -rm -f ./$(DEPDIR)/print-escp2.Plo
+ -rm -f ./$(DEPDIR)/print-lexmark.Plo
+ -rm -f ./$(DEPDIR)/print-list.Plo
+ -rm -f ./$(DEPDIR)/print-papers.Plo
+ -rm -f ./$(DEPDIR)/print-pcl.Plo
+ -rm -f ./$(DEPDIR)/print-ps.Plo
+ -rm -f ./$(DEPDIR)/print-raw.Plo
+ -rm -f ./$(DEPDIR)/print-util.Plo
+ -rm -f ./$(DEPDIR)/print-vars.Plo
+ -rm -f ./$(DEPDIR)/print-version.Plo
+ -rm -f ./$(DEPDIR)/print-weave.Plo
+ -rm -f ./$(DEPDIR)/printers.Plo
+ -rm -f ./$(DEPDIR)/refcache.Plo
+ -rm -f ./$(DEPDIR)/sequence.Plo
+ -rm -f ./$(DEPDIR)/string-list.Plo
+ -rm -f ./$(DEPDIR)/xml.Plo
+ -rm -f ./$(DEPDIR)/xmlppd.Plo
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -1115,22 +1264,25 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgconfigdataDATA \
.MAKE: install-am install-strip
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
- clean-libLTLIBRARIES clean-libtool clean-pkgmoduleLTLIBRARIES \
- cscopelist-am ctags ctags-am distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am 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-pkgconfigdataDATA install-pkgmoduleLTLIBRARIES \
- 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 tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \
- uninstall-pkgconfigdataDATA uninstall-pkgmoduleLTLIBRARIES
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-pkgmoduleLTLIBRARIES cscopelist-am ctags ctags-am \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am 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-pkgconfigdataDATA \
+ install-pkgmoduleLTLIBRARIES 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 tags-am uninstall uninstall-am \
+ uninstall-libLTLIBRARIES uninstall-pkgconfigdataDATA \
+ uninstall-pkgmoduleLTLIBRARIES
+
+.PRECIOUS: Makefile
@SET_MAKE@
@@ -1141,10 +1293,6 @@ $(top_builddir)/src/main/libgutenprint.la:
cd $(top_builddir)/src/main; \
$(MAKE)
-$(top_builddir)/src/gutenprintui/libgutenprintui.la:
- cd $(top_builddir)/src/gutenprintui; \
- $(MAKE)
-
$(top_builddir)/src/gutenprintui2/libgutenprintui2.la:
cd $(top_builddir)/src/gutenprintui2; \
$(MAKE)
diff --git a/src/main/array.c b/src/main/array.c
index c6545bd..a1ef327 100644
--- a/src/main/array.c
+++ b/src/main/array.c
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -31,6 +30,10 @@
#include <string.h>
#include <stdlib.h>
#include <limits.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <strings.h>
struct stp_array
@@ -169,6 +172,81 @@ stp_array_get_sequence(const stp_array_t *array)
return array->data;
}
+static stp_array_t *
+xml_doc_get_array(stp_mxml_node_t *doc)
+{
+ stp_mxml_node_t *cur;
+ stp_mxml_node_t *xmlarray;
+ stp_array_t *array = NULL;
+
+ if (doc == NULL )
+ {
+ stp_deprintf(STP_DBG_ARRAY_ERRORS,
+ "xml_doc_get_array: XML file not parsed successfully.\n");
+ return NULL;
+ }
+
+ cur = doc->child;
+
+ if (cur == NULL)
+ {
+ stp_deprintf(STP_DBG_ARRAY_ERRORS,
+ "xml_doc_get_array: empty document\n");
+ return NULL;
+ }
+
+ xmlarray = stp_xml_get_node(cur, "gutenprint", "array", NULL);
+
+ if (xmlarray)
+ array = stp_array_create_from_xmltree(xmlarray);
+
+ return array;
+}
+
+stp_array_t *
+stp_array_create_from_file(const char* file)
+{
+ stp_array_t *array = NULL;
+ stp_mxml_node_t *doc;
+ FILE *fp = NULL;
+ if (file[0] != '/' && strncmp(file, "./", 2) && strncmp(file, "../", 3))
+ {
+ char *fn = stp_path_find_file(NULL, file);
+ if (fn)
+ {
+ fp = fopen(file, "r");
+ free(fn);
+ }
+ }
+ else if (file)
+ {
+ fp = fopen(file, "r");
+ }
+ if (!fp)
+ {
+ stp_deprintf(STP_DBG_ARRAY_ERRORS,
+ "stp_array_create_from_file: unable to open %s: %s\n",
+ file, strerror(errno));
+ return NULL;
+ }
+ stp_deprintf(STP_DBG_XML, "stp_array_create_from_file: reading `%s'...\n",
+ file);
+
+ stp_xml_init();
+
+ doc = stp_mxmlLoadFile(NULL, fp, STP_MXML_NO_CALLBACK);
+
+ array = xml_doc_get_array(doc);
+
+ if (doc)
+ stp_mxmlDelete(doc);
+
+ stp_xml_exit();
+ (void) fclose(fp);
+ return array;
+
+}
+
stp_array_t *
stp_array_create_from_xmltree(stp_mxml_node_t *array) /* The array node */
{
@@ -179,6 +257,9 @@ stp_array_create_from_xmltree(stp_mxml_node_t *array) /* The array node */
stp_sequence_t *seq = NULL;
stp_array_t *ret = NULL;
+ /* FIXME Need protection against unlimited recursion */
+ if ((stmp = stp_mxmlElementGetAttr(array, "src")) != NULL)
+ return stp_array_create_from_file(stmp);
stmp = stp_mxmlElementGetAttr(array, "x-size");
if (stmp)
{
@@ -203,7 +284,7 @@ stp_array_create_from_xmltree(stp_mxml_node_t *array) /* The array node */
/* Get the sequence data */
- child = stp_mxmlFindElement(array, array, "sequence", NULL, NULL, STP_MXML_DESCEND);
+ child = stp_xml_get_node(array, "sequence", NULL);
if (child)
seq = stp_sequence_create_from_xmltree(child);
@@ -269,3 +350,144 @@ stp_xmltree_create_from_array(const stp_array_t *array) /* The array */
return arraynode;
}
+
+static stp_mxml_node_t *
+xmldoc_create_from_array(const stp_array_t *array)
+{
+ stp_mxml_node_t *xmldoc;
+ stp_mxml_node_t *rootnode;
+ stp_mxml_node_t *arraynode;
+
+ /* Get array details */
+ arraynode = stp_xmltree_create_from_array(array);
+ if (arraynode == NULL)
+ {
+ stp_deprintf(STP_DBG_ARRAY_ERRORS,
+ "xmldoc_create_from_array: error creating array node\n");
+ return NULL;
+ }
+ /* Create the XML tree */
+ xmldoc = stp_xmldoc_create_generic();
+ if (xmldoc == NULL)
+ {
+ stp_deprintf(STP_DBG_ARRAY_ERRORS,
+ "xmldoc_create_from_array: error creating XML document\n");
+ return NULL;
+ }
+ rootnode = xmldoc->child;
+ if (rootnode == NULL)
+ {
+ stp_mxmlDelete(xmldoc);
+ stp_deprintf(STP_DBG_ARRAY_ERRORS,
+ "xmldoc_create_from_array: error getting XML document root node\n");
+ return NULL;
+ }
+
+ stp_mxmlAdd(rootnode, STP_MXML_ADD_AFTER, NULL, arraynode);
+
+ return xmldoc;
+}
+
+static int
+array_whitespace_callback(stp_mxml_node_t *node, int where)
+{
+ if (node->type != STP_MXML_ELEMENT)
+ return 0;
+ if (strcasecmp(node->value.element.name, "gutenprint") == 0)
+ {
+ switch (where)
+ {
+ case STP_MXML_WS_AFTER_OPEN:
+ case STP_MXML_WS_BEFORE_CLOSE:
+ case STP_MXML_WS_AFTER_CLOSE:
+ return '\n';
+ case STP_MXML_WS_BEFORE_OPEN:
+ default:
+ return 0;
+ }
+ }
+ else if (strcasecmp(node->value.element.name, "array") == 0)
+ {
+ switch (where)
+ {
+ case STP_MXML_WS_AFTER_OPEN:
+ return '\n';
+ case STP_MXML_WS_BEFORE_CLOSE:
+ case STP_MXML_WS_AFTER_CLOSE:
+ case STP_MXML_WS_BEFORE_OPEN:
+ default:
+ return 0;
+ }
+ }
+ else if (strcasecmp(node->value.element.name, "sequence") == 0)
+ {
+ const char *count;
+ switch (where)
+ {
+ case STP_MXML_WS_BEFORE_CLOSE:
+ count = stp_mxmlElementGetAttr(node, "count");
+ if (strcmp(count, "0") == 0)
+ return 0;
+ else
+ return '\n';
+ case STP_MXML_WS_AFTER_OPEN:
+ case STP_MXML_WS_AFTER_CLOSE:
+ return '\n';
+ case STP_MXML_WS_BEFORE_OPEN:
+ default:
+ return 0;
+ }
+ }
+ else
+ return 0;
+}
+
+
+int
+stp_array_write(FILE *file, const stp_array_t *array) /* The array */
+{
+ stp_mxml_node_t *xmldoc = NULL;
+
+ stp_xml_init();
+
+ xmldoc = xmldoc_create_from_array(array);
+ if (xmldoc == NULL)
+ {
+ stp_xml_exit();
+ return 1;
+ }
+
+ stp_mxmlSaveFile(xmldoc, file, array_whitespace_callback);
+
+ if (xmldoc)
+ stp_mxmlDelete(xmldoc);
+
+ stp_xml_exit();
+
+ return 0;
+}
+
+char *
+stp_array_write_string(const stp_array_t *array) /* The array */
+{
+ stp_mxml_node_t *xmldoc = NULL;
+ char *retval;
+
+ stp_xml_init();
+
+ xmldoc = xmldoc_create_from_array(array);
+ if (xmldoc == NULL)
+ {
+ stp_xml_exit();
+ return NULL;
+ }
+
+ retval = stp_mxmlSaveAllocString(xmldoc, array_whitespace_callback);
+
+ if (xmldoc)
+ stp_mxmlDelete(xmldoc);
+
+ stp_xml_exit();
+
+ return retval;
+}
diff --git a/src/main/bit-ops.c b/src/main/bit-ops.c
index 965a481..bfcdf0a 100644
--- a/src/main/bit-ops.c
+++ b/src/main/bit-ops.c
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -35,6 +34,13 @@
#include <limits.h>
#endif
+#ifdef __GNUC__
+#define inline __inline__
+#define NOINLINE __attribute__ ((noinline))
+#else
+$define NOINLINE
+#endif
+
void
stp_fold(const unsigned char *line,
int single_length,
@@ -477,7 +483,7 @@ stp_split_4(int length,
}
-static void
+static void NOINLINE
stpi_unpack_2_1(int length,
const unsigned char *in,
unsigned char **outs)
@@ -532,7 +538,7 @@ stpi_unpack_2_1(int length,
}
}
-static void
+static void NOINLINE
stpi_unpack_2_2(int length,
const unsigned char *in,
unsigned char **outs)
@@ -558,7 +564,7 @@ stpi_unpack_2_2(int length,
}
}
-static void
+static void NOINLINE
stpi_unpack_4_1(int length,
const unsigned char *in,
unsigned char **outs)
@@ -617,7 +623,7 @@ stpi_unpack_4_1(int length,
}
}
-static void
+static void NOINLINE
stpi_unpack_4_2(int length,
const unsigned char *in,
unsigned char **outs)
@@ -677,7 +683,7 @@ stpi_unpack_4_2(int length,
}
}
-static void
+static void NOINLINE
stpi_unpack_8_1(int length,
const unsigned char *in,
unsigned char **outs)
@@ -750,7 +756,7 @@ stpi_unpack_8_1(int length,
}
}
-static void
+static void NOINLINE
stpi_unpack_8_2(int length,
const unsigned char *in,
unsigned char **outs)
@@ -837,7 +843,7 @@ stpi_unpack_8_2(int length,
}
}
-static void
+static void NOINLINE
stpi_unpack_16_1(int length,
const unsigned char *in,
unsigned char **outs)
@@ -908,7 +914,7 @@ stpi_unpack_16_1(int length,
*outs[j]++ = temp[j];
}
-static void
+static void NOINLINE
stpi_unpack_16_2(int length,
const unsigned char *in,
unsigned char **outs)
@@ -1138,29 +1144,32 @@ stp_unpack_16(int length,
stp_unpack(length, bits, 16, in, outs);
}
-static void
+static void NOINLINE
find_first_and_last(const unsigned char *line, int length,
int *first, int *last)
{
- int i;
int found_first = 0;
- if (!first || !last)
- return;
- *first = 0;
- *last = 0;
- for (i = 0; i < length; i++)
+ int f = 0;
+ int l = 0;
+ for (f = 0; f < length; f++)
{
- if (line[i] == 0)
- {
- if (!found_first)
- (*first)++;
- }
- else
+ if (line[f])
{
- *last = i;
found_first = 1;
+ break;
}
}
+ *first = f;
+ if (!found_first)
+ {
+ *last = 0;
+ return;
+ }
+ for (l = length - 1; l >= f; l--)
+ if (line[l])
+ break;
+ ;
+ *last = l;
}
int
@@ -1190,96 +1199,89 @@ stp_pack_tiff(stp_vars_t *v,
int *first,
int *last)
{
- const unsigned char *start; /* Start of compressed data */
- unsigned char repeat; /* Repeating char */
- int count; /* Count of compressed bytes */
- int tcount; /* Temporary count < 128 */
- register const unsigned char *xline = line;
- register int xlength = length;
- find_first_and_last(line, length, first, last);
+ unsigned char *comp_pti = comp_buf;
+ if (first && last)
+ find_first_and_last(line, length, first, last);
/*
* Compress using TIFF "packbits" run-length encoding...
*/
- (*comp_ptr) = comp_buf;
-
- while (xlength > 0)
+ while (length > 0)
{
+ const unsigned char *start = line; /* Start of compressed data */
+ unsigned char repeat; /* Repeating char */
+ int count; /* Count of compressed bytes */
/*
- * Get a run of non-repeated chars...
+ * Get a run of at least 3 non-repeated chars...
*/
- start = xline;
- xline += 2;
- xlength -= 2;
+ line += 2;
+ length -= 2;
- while (xlength > 0 && (xline[-2] != xline[-1] || xline[-1] != xline[0]))
+ while (length > 0 && (line[-2] != line[-1] || line[-1] != line[0]))
{
- xline ++;
- xlength --;
+ line ++;
+ length --;
}
- xline -= 2;
- xlength += 2;
+ line -= 2;
+ length += 2;
/*
* Output the non-repeated sequences (max 128 at a time).
*/
- count = xline - start;
+ count = line - start;
while (count > 0)
{
- tcount = count > 128 ? 128 : count;
+ int tcount = count > 128 ? 128 : count;
- (*comp_ptr)[0] = tcount - 1;
- memcpy((*comp_ptr) + 1, start, tcount);
+ comp_pti[0] = tcount - 1;
+ memcpy(comp_pti + 1, start, tcount);
- (*comp_ptr) += tcount + 1;
+ comp_pti += tcount + 1;
start += tcount;
count -= tcount;
}
- if (xlength <= 0)
+ if (length <= 0)
break;
/*
* Find the repeated sequences...
*/
- start = xline;
- repeat = xline[0];
+ start = line;
+ repeat = line[0];
- xline ++;
- xlength --;
+ line ++;
+ length --;
- if (xlength > 0)
+ while (length > 0 && *line == repeat)
{
- int ylength = xlength;
- while (ylength && *xline == repeat)
- {
- xline ++;
- ylength --;
- }
- xlength = ylength;
+ line++;
+ length--;
}
/*
* Output the repeated sequences (max 128 at a time).
*/
- count = xline - start;
+ count = line - start;
while (count > 0)
{
- tcount = count > 128 ? 128 : count;
+ int tcount = count > 128 ? 128 : count;
- (*comp_ptr)[0] = 1 - tcount;
- (*comp_ptr)[1] = repeat;
+ comp_pti[0] = 1 - tcount;
+ comp_pti[1] = repeat;
- (*comp_ptr) += 2;
+ comp_pti += 2;
count -= tcount;
}
}
+ (*comp_ptr) = comp_pti;
+
if (first && last && *first > *last)
return 0;
else
diff --git a/src/main/buffer-image.c b/src/main/buffer-image.c
index d49f63f..1cd3c34 100644
--- a/src/main/buffer-image.c
+++ b/src/main/buffer-image.c
@@ -14,8 +14,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
diff --git a/src/main/canon-inks.h b/src/main/canon-inks.h
index 26f5476..3d72640 100644
--- a/src/main/canon-inks.h
+++ b/src/main/canon-inks.h
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* This file contains definitions for the various inks
diff --git a/src/main/canon-media-mode.h b/src/main/canon-media-mode.h
index 2e695b3..228167e 100644
--- a/src/main/canon-media-mode.h
+++ b/src/main/canon-media-mode.h
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* This file contains the usage matrix matching media with modes
@@ -106,9 +105,17 @@ DECLARE_MODEUSES(canon_BJC_30);
/* ----------------------------------- Canon BJC 85 ----------------------------------- */
/* TODO: mode-media correlation */
static const char* canon_BJC_85_modeuses_plain[] = {
- "720x360dpi",
- "360x360dmt",
- "360x360dpi",
+ "360x360dmt_high",
+ "360x360dmt", /* original */
+ "360x360dpi_high"
+ "360x360dpi", /* original */
+ "720x360dpi_high",
+ "720x360dpi", /* original */
+ "720x360dpi_draft",
+ "360x360dpi_draft",
+ "180x180dpi_high",
+ "180x180dpi",
+ "180x180dpi_draft",
NULL
};
diff --git a/src/main/canon-media.h b/src/main/canon-media.h
index c277cf0..37a324a 100644
--- a/src/main/canon-media.h
+++ b/src/main/canon-media.h
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* This file contains the definitions for the possible Media Types
@@ -139,6 +138,12 @@ static const canon_slot_t canon_BJC_S800_slots[] = {
};
DECLARE_SLOTS(canon_BJC_S800);
+static const canon_slot_t canon_BJC_85_slots[] = {
+ { "Auto", N_ ("Auto Sheet Feeder"), 0x4 },
+ { "Manual", N_ ("Manual Feed"), 0x1 },
+};
+DECLARE_SLOTS(canon_BJC_85);
+
static const canon_slot_t canon_MULTIPASS_MX7600_slots[] = {
{ "Cassette", N_ ("Cassette"), 0x8 },
};
@@ -320,6 +325,23 @@ static const canon_paper_t canon_default_papers[] = { /*
};
DECLARE_PAPERS(canon_default);
+static const canon_paper_t canon_BJC_1000_papers[] = {
+ /* Name Text (c (l (P (w Density k_upper lum_adj */
+ { "Plain", N_ ("Plain Paper"), 0x00,0x00,0x00,0x00,0.50, 0.25, 0.500, 0, 0, 0 },
+ { "Transparency", N_ ("Transparencies"), 0x02,0x02,0x00,0x00,1.00, 1.00, 0.900, 0, 0, 0 },
+ { "BackPrint", N_ ("Back Print Film"), 0x03,0x03,0x00,0x00,1.00, 1.00, 0.900, 0, 0, 0 },
+ { "Fabric", N_ ("Fabric Sheets"), 0x04,0x05,0x00,0x00,0.50, 0.25, 0.500, 0, 0, 0 },
+ { "Envelope", N_ ("Envelope"), 0x00,0x08,0x00,0x00,0.50, 0.25, 0.500, 0, 0, 0 },
+ { "Coated", N_ ("High Resolution Paper"), 0x07,0x0b,0x00,0x00,0.78, 0.25, 0.500, 0, 0, 0 },
+ { "TShirt", N_ ("T-Shirt Transfers"), 0x03,0x03,0x00,0x00,0.50, 0.25, 0.500, 0, 0, 0 },
+ { "GlossyFilm", N_ ("High Gloss Film"), 0x06,0x07,0x00,0x00,1.00, 1.00, 0.999, 0, 0, 0 },
+ { "GlossyPaper", N_ ("Glossy Photo Paper"), 0x05,0x06,0x00,0x00,1.00, 1.00, 0.999, 0, 0, 0 },
+ { "GlossyCard", N_ ("Glossy Photo Cards"), 0x05,0x0c,0x00,0x00,1.00, 1.00, 0.999, 0, 0, 0 },
+ { "GlossyPro", N_ ("Photo Paper Pro"), 0x09,0x09,0x00,0x00,1.00, 1.00, 0.999, 0, 0, 0 },
+ { "Other", N_ ("Other"), 0x01,0x09,0x00,0x00,0.50, 0.25, 0.500, 0, 0, 0 },
+};
+DECLARE_PAPERS(canon_BJC_1000);
+
static const canon_paper_t canon_BJC_2100_papers[] = {
/* Name Text (c (l (P (w Density k_upper lum_adj */
{ "Plain", N_ ("Plain Paper"), 0x00,0x00,0x00,0x00,0.50, 0.25, 0.500, 0, 0, 0 },
diff --git a/src/main/canon-modes.h b/src/main/canon-modes.h
index 0dfe07b..f88a051 100644
--- a/src/main/canon-modes.h
+++ b/src/main/canon-modes.h
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* This file contains definitions for the various printmodes
@@ -151,14 +150,40 @@ DECLARE_MODES(canon_BJC_30,0);
static const canon_mode_t canon_BJC_85_modes[] = {
- { 720, 360,CANON_INK_K | CANON_INK_CMYK | CANON_INK_CcMmYK,
- "720x360dpi",N_("720x360 DPI"),INKSET(6_C2M2Y2K2c2m2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,2},
- { 360, 360,CANON_INK_K | CANON_INK_CMYK | CANON_INK_CcMmYK,
- "360x360dmt",N_("360x360 DPI DMT"),INKSET(6_C4M4Y4K4c4m4),8,0,NULL,1.0,1.0,NULL,NULL,NULL,2},
- { 360, 360,CANON_INK_K | CANON_INK_CMYK | CANON_INK_CcMmYK,
- "360x360dpi",N_("360x360 DPI"),INKSET(6_C2M2Y2K2c2m2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,2},
-};
-DECLARE_MODES(canon_BJC_85,0);
+ // DMT is the highest quality mode in Windows driver - but only has quality 1 not 2
+ { 360, 360,CANON_INK_K | CANON_INK_CMYK,
+ "360x360dmt_high",N_("360x360 DPI DMT HIGH"),INKSET(4_C4M4Y4K4),8,0,NULL,1.0,1.0,NULL,NULL,NULL,2},/* original*/
+ // Quality level 1 in Windows driver (High)
+ { 360, 360,CANON_INK_K | CANON_INK_CMYK,
+ "360x360dmt",N_("360x360 DPI DMT"),INKSET(4_C4M4Y4K4),8,0,NULL,1.0,1.0,NULL,NULL,NULL,1},
+ // Windows driver does not use quality level 2
+ { 360, 360,CANON_INK_K | CANON_INK_CMYK,
+ "360x360dpi_high",N_("360x360 DPI HIGH"),INKSET(4_C2M2Y2K2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,2},/* original */
+ // Quality level 2 in Windows driver
+ { 360, 360,CANON_INK_K | CANON_INK_CMYK,
+ "360x360dpi",N_("360x360 DPI"),INKSET(4_C2M2Y2K2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,1},
+ // Windows driver does not use quality level 2
+ { 720, 360,CANON_INK_K | CANON_INK_CMYK,
+ "720x360dpi_high",N_("720x360 DPI HIGH"),INKSET(4_C2M2Y2K2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,2}, /* original */
+ // Windows driver does not use quality level 1
+ { 720, 360,CANON_INK_K | CANON_INK_CMYK,
+ "720x360dpi",N_("720x360 DPI"),INKSET(4_C2M2Y2K2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,1},
+ // Quality level 3 in Windows driver
+ { 720, 360,CANON_INK_K | CANON_INK_CMYK,
+ "720x360dpi_draft",N_("720x360 DPI DRAFT"),INKSET(4_C2M2Y2K2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,0},
+ // Quality level 4 in Windows driver
+ { 360, 360,CANON_INK_K | CANON_INK_CMYK,
+ "360x360dpi_draft",N_("360x360 DPI DRAFT"),INKSET(4_C2M2Y2K2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,0},
+ // Quality level 5 in Windows driver
+ { 180, 180,CANON_INK_K | CANON_INK_CMYK,
+ "180x180dpi_high",N_("180x180 DPI HIGH"),INKSET(4_C2M2Y2K2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,2},
+ // Test low res modes with qualities 1 and 0
+ { 180, 180,CANON_INK_K | CANON_INK_CMYK,
+ "180x180dpi",N_("180x180 DPI"),INKSET(4_C2M2Y2K2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,1},
+ { 180, 180,CANON_INK_K | CANON_INK_CMYK,
+ "180x180dpi_draft",N_("180x180 DPI DRAFT"),INKSET(4_C2M2Y2K2),8,0,NULL,1.0,1.0,NULL,NULL,NULL,0},
+};
+DECLARE_MODES(canon_BJC_85,4); // <= final selection after testing: 720x360 Qlty 2 mode
/* we treat the printers that can either print in K or CMY as CMYK printers here by assigning a CMYK inkset */
diff --git a/src/main/canon-printers.h b/src/main/canon-printers.h
index 6345443..3658a38 100644
--- a/src/main/canon-printers.h
+++ b/src/main/canon-printers.h
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* This file contains the capabilities of the various canon printers
@@ -596,6 +595,23 @@ static const canon_cap_t canon_model_capabilities[] =
NULL,
NULL
},
+ { /* Canon BJC S9000 */
+ "S9000", 3,
+ INCH(13), INCH(23), /* from product specs online: H: 13", V: 19" (leave at 23") */
+ 10, 10, 9, 15, /* confirmed */
+ &canon_MULTIPASS_MP150_slotlist,
+ CANON_CAP_STD0|CANON_CAP_I|CANON_CAP_px|CANON_CAP_rr,0,
+ 2,0,
+ 0, /* Upper/Lower Cassette option */
+ control_cmd_PIXMA_iP2700,
+ &canon_BJC_S900_modelist,
+ &canon_BJC_S800_paperlist,
+ &canon_BJC_S900_modeuselist,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ },
{ /* Canon BJ 30 *//* heads: BC-10 */
"30", 1,
INCH(19/2), INCH(14),
@@ -617,13 +633,13 @@ static const canon_cap_t canon_model_capabilities[] =
"85", 1,
INCH(19/2), INCH(23), /* from MacOSX driver */
10, 10, 9, 20, /* confirmed */
- &canon_default_slotlist,
+ &canon_BJC_85_slotlist,
CANON_CAP_STD0 | CANON_CAP_a,0,
2,0,
0, /* Upper/Lower Cassette option */
NULL,
&canon_BJC_85_modelist,
- &canon_default_paperlist,
+ &canon_BJC_1000_paperlist,
&canon_BJC_85_modeuselist,
NULL,
NULL,
@@ -638,7 +654,7 @@ static const canon_cap_t canon_model_capabilities[] =
10, 10, 9, 20, /* for A4 from user manual */
&canon_default_slotlist,
CANON_CAP_STD0 | CANON_CAP_a | CANON_CAP_cart,0,
- 3,0,
+ 2,0,
0, /* Upper/Lower Cassette option */
NULL,/* only SetTime */
&canon_BJC_2100_modelist,
@@ -842,7 +858,7 @@ static const canon_cap_t canon_model_capabilities[] =
0, /* Upper/Lower Cassette option */
NULL,
&canon_BJC_240_modelist,
- &canon_default_paperlist,
+ &canon_BJC_1000_paperlist,
&canon_BJC_240_modeuselist,
NULL,
NULL,
diff --git a/src/main/channel.c b/src/main/channel.c
index f65a94a..6cd4ca9 100644
--- a/src/main/channel.c
+++ b/src/main/channel.c
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
@@ -37,6 +36,10 @@
#ifdef __GNUC__
#define inline __inline__
+// No reason to inline functions outside of the inner loop.
+#define NOINLINE __attribute__ ((noinline))
+#else
+$define NOINLINE
#endif
#define FMAX(a, b) ((a) > (b) ? (a) : (b))
@@ -63,15 +66,6 @@ typedef struct
typedef struct
{
- unsigned channel_count;
- unsigned total_channels;
- unsigned input_channels;
- unsigned gcr_channels;
- unsigned aux_output_channels;
- size_t width;
- int initialized;
- unsigned ink_limit;
- unsigned max_density;
stpi_channel_t *c;
stp_curve_t *gcr_curve;
unsigned curve_count;
@@ -84,12 +78,23 @@ typedef struct
unsigned short *alloc_data_1;
unsigned short *alloc_data_2;
unsigned short *alloc_data_3;
- int black_channel;
- int gloss_channel;
- int gloss_physical_channel;
+ unsigned char *output_data_8bit;
+ size_t width;
double cyan_balance;
double magenta_balance;
double yellow_balance;
+ unsigned channel_count;
+ unsigned total_channels;
+ unsigned input_channels;
+ unsigned gcr_channels;
+ unsigned aux_output_channels;
+ unsigned ink_limit;
+ unsigned max_density;
+ int black_channel;
+ int gloss_channel;
+ int gloss_physical_channel;
+ int initialized;
+ int valid_8bit;
} stpi_channel_group_t;
@@ -141,6 +146,7 @@ stpi_channel_clear(void *vc)
cg->total_channels = 0;
cg->input_channels = 0;
cg->initialized = 0;
+ cg->valid_8bit = 0;
}
void
@@ -385,7 +391,7 @@ stp_channel_get_gcr_curve(stp_vars_t *v)
stpi_channel_group_t *cg = get_channel_group(v);
if (!cg)
return NULL;
- stp_dprintf(STP_DBG_INK, v, "set_gcr_curve\n");
+ stp_dprintf(STP_DBG_INK, v, "get_gcr_curve\n");
return cg->gcr_curve;
}
@@ -422,34 +428,26 @@ stp_channel_get_curve(stp_vars_t *v, int color)
}
static int
-input_has_special_channels(const stp_vars_t *v)
+input_has_special_channels(const stpi_channel_group_t *cg)
{
- const stpi_channel_group_t *cg =
- ((const stpi_channel_group_t *) stp_get_component_data(v, "Channel"));
return (cg->curve_count > 0);
}
static int
-output_needs_gcr(const stp_vars_t *v)
+output_needs_gcr(const stpi_channel_group_t *cg)
{
- const stpi_channel_group_t *cg =
- ((const stpi_channel_group_t *) stp_get_component_data(v, "Channel"));
return (cg->gcr_curve && cg->black_channel == 0);
}
static int
-output_has_gloss(const stp_vars_t *v)
+output_has_gloss(const stpi_channel_group_t *cg)
{
- const stpi_channel_group_t *cg =
- ((const stpi_channel_group_t *) stp_get_component_data(v, "Channel"));
return (cg->gloss_channel >= 0);
}
static int
-input_needs_splitting(const stp_vars_t *v)
+input_needs_splitting(const stpi_channel_group_t *cg)
{
- const stpi_channel_group_t *cg =
- ((const stpi_channel_group_t *) stp_get_component_data(v, "Channel"));
#if 0
return cg->total_channels != cg->aux_output_channels;
#else
@@ -465,6 +463,51 @@ input_needs_splitting(const stp_vars_t *v)
#endif
}
+static void
+stp_dump_channels(const stp_vars_t *v)
+{
+ stpi_channel_group_t *cg = get_channel_group(v);
+ int i, j;
+ stp_dprintf(STP_DBG_INK, v, " channel_count %d\n", cg->channel_count);
+ stp_dprintf(STP_DBG_INK, v, " total_channels %d\n", cg->total_channels);
+ stp_dprintf(STP_DBG_INK, v, " input_channels %d\n", cg->input_channels);
+ stp_dprintf(STP_DBG_INK, v, " aux_channels %d\n", cg->aux_output_channels);
+ stp_dprintf(STP_DBG_INK, v, " gcr_channels %d\n", cg->gcr_channels);
+ stp_dprintf(STP_DBG_INK, v, " width %ld\n", (long)cg->width);
+ stp_dprintf(STP_DBG_INK, v, " ink_limit %d\n", cg->ink_limit);
+ stp_dprintf(STP_DBG_INK, v, " gloss_limit %d\n", cg->gloss_limit);
+ stp_dprintf(STP_DBG_INK, v, " max_density %d\n", cg->max_density);
+ stp_dprintf(STP_DBG_INK, v, " curve_count %d\n", cg->curve_count);
+ stp_dprintf(STP_DBG_INK, v, " black_channel %d\n", cg->black_channel);
+ stp_dprintf(STP_DBG_INK, v, " gloss_channel %d\n", cg->gloss_channel);
+ stp_dprintf(STP_DBG_INK, v, " gloss_physical %d\n", cg->gloss_physical_channel);
+ stp_dprintf(STP_DBG_INK, v, " cyan %.3f\n", cg->cyan_balance);
+ stp_dprintf(STP_DBG_INK, v, " magenta %.3f\n", cg->magenta_balance);
+ stp_dprintf(STP_DBG_INK, v, " yellow %.3f\n", cg->yellow_balance);
+ stp_dprintf(STP_DBG_INK, v, " input_data %p\n", (void *) cg->input_data);
+ stp_dprintf(STP_DBG_INK, v, " multi_tmp %p\n", (void *) cg->multi_tmp);
+ stp_dprintf(STP_DBG_INK, v, " split_input %p\n", (void *) cg->split_input);
+ stp_dprintf(STP_DBG_INK, v, " output_data %p\n", (void *) cg->output_data);
+ stp_dprintf(STP_DBG_INK, v, " gcr_data %p\n", (void *) cg->gcr_data);
+ stp_dprintf(STP_DBG_INK, v, " alloc_data_1 %p\n", (void *) cg->alloc_data_1);
+ stp_dprintf(STP_DBG_INK, v, " alloc_data_2 %p\n", (void *) cg->alloc_data_2);
+ stp_dprintf(STP_DBG_INK, v, " alloc_data_3 %p\n", (void *) cg->alloc_data_3);
+ stp_dprintf(STP_DBG_INK, v, " gcr_curve %p\n", (void *) cg->gcr_curve);
+ for (i = 0; i < cg->channel_count; i++)
+ {
+ stp_dprintf(STP_DBG_INK, v, " Channel %d:\n", i);
+ for (j = 0; j < cg->c[i].subchannel_count; j++)
+ {
+ stpi_subchannel_t *sch = &(cg->c[i].sc[j]);
+ stp_dprintf(STP_DBG_INK, v, " Subchannel %d:\n", j);
+ stp_dprintf(STP_DBG_INK, v, " value %.3f:\n", sch->value);
+ stp_dprintf(STP_DBG_INK, v, " lower %.3f:\n", sch->lower);
+ stp_dprintf(STP_DBG_INK, v, " upper %.3f:\n", sch->upper);
+ stp_dprintf(STP_DBG_INK, v, " cutoff %.3f:\n", sch->cutoff);
+ stp_dprintf(STP_DBG_INK, v, " density %d:\n", sch->s_density);
+ }
+ }
+}
void
stp_channel_initialize(stp_vars_t *v, stp_image_t *image,
@@ -568,7 +611,7 @@ stp_channel_initialize(stp_vars_t *v, stp_image_t *image,
if (curve_count == 0)
{
cg->gcr_channels = cg->input_channels;
- if (input_needs_splitting(v))
+ if (input_needs_splitting(cg))
{
cg->alloc_data_2 =
stp_malloc(sizeof(unsigned short) * cg->input_channels * width);
@@ -596,7 +639,7 @@ stp_channel_initialize(stp_vars_t *v, stp_image_t *image,
cg->alloc_data_2 =
stp_malloc(sizeof(unsigned short) * cg->input_channels * width);
cg->input_data = cg->alloc_data_2;
- if (input_needs_splitting(v))
+ if (input_needs_splitting(cg))
{
cg->alloc_data_3 =
stp_malloc(sizeof(unsigned short) * cg->aux_output_channels * width);
@@ -616,57 +659,11 @@ stp_channel_initialize(stp_vars_t *v, stp_image_t *image,
cg->magenta_balance = stp_get_float_parameter(v, "MagentaBalance");
cg->yellow_balance = stp_get_float_parameter(v, "YellowBalance");
stp_dprintf(STP_DBG_INK, v, "stp_channel_initialize:\n");
- stp_dprintf(STP_DBG_INK, v, " channel_count %d\n", cg->channel_count);
- stp_dprintf(STP_DBG_INK, v, " total_channels %d\n", cg->total_channels);
- stp_dprintf(STP_DBG_INK, v, " input_channels %d\n", cg->input_channels);
- stp_dprintf(STP_DBG_INK, v, " aux_channels %d\n", cg->aux_output_channels);
- stp_dprintf(STP_DBG_INK, v, " gcr_channels %d\n", cg->gcr_channels);
- stp_dprintf(STP_DBG_INK, v, " width %ld\n", (long)cg->width);
- stp_dprintf(STP_DBG_INK, v, " ink_limit %d\n", cg->ink_limit);
- stp_dprintf(STP_DBG_INK, v, " gloss_limit %d\n", cg->gloss_limit);
- stp_dprintf(STP_DBG_INK, v, " max_density %d\n", cg->max_density);
- stp_dprintf(STP_DBG_INK, v, " curve_count %d\n", cg->curve_count);
- stp_dprintf(STP_DBG_INK, v, " black_channel %d\n", cg->black_channel);
- stp_dprintf(STP_DBG_INK, v, " gloss_channel %d\n", cg->gloss_channel);
- stp_dprintf(STP_DBG_INK, v, " gloss_physical %d\n", cg->gloss_physical_channel);
- stp_dprintf(STP_DBG_INK, v, " cyan %.3f\n", cg->cyan_balance);
- stp_dprintf(STP_DBG_INK, v, " magenta %.3f\n", cg->magenta_balance);
- stp_dprintf(STP_DBG_INK, v, " yellow %.3f\n", cg->yellow_balance);
- stp_dprintf(STP_DBG_INK, v, " input_data %p\n",
- (void *) cg->input_data);
- stp_dprintf(STP_DBG_INK, v, " multi_tmp %p\n",
- (void *) cg->multi_tmp);
- stp_dprintf(STP_DBG_INK, v, " split_input %p\n",
- (void *) cg->split_input);
- stp_dprintf(STP_DBG_INK, v, " output_data %p\n",
- (void *) cg->output_data);
- stp_dprintf(STP_DBG_INK, v, " gcr_data %p\n",
- (void *) cg->gcr_data);
- stp_dprintf(STP_DBG_INK, v, " alloc_data_1 %p\n",
- (void *) cg->alloc_data_1);
- stp_dprintf(STP_DBG_INK, v, " alloc_data_2 %p\n",
- (void *) cg->alloc_data_2);
- stp_dprintf(STP_DBG_INK, v, " alloc_data_3 %p\n",
- (void *) cg->alloc_data_3);
- stp_dprintf(STP_DBG_INK, v, " gcr_curve %p\n",
- (void *) cg->gcr_curve);
- for (i = 0; i < cg->channel_count; i++)
- {
- stp_dprintf(STP_DBG_INK, v, " Channel %d:\n", i);
- for (j = 0; j < cg->c[i].subchannel_count; j++)
- {
- stpi_subchannel_t *sch = &(cg->c[i].sc[j]);
- stp_dprintf(STP_DBG_INK, v, " Subchannel %d:\n", j);
- stp_dprintf(STP_DBG_INK, v, " value %.3f:\n", sch->value);
- stp_dprintf(STP_DBG_INK, v, " lower %.3f:\n", sch->lower);
- stp_dprintf(STP_DBG_INK, v, " upper %.3f:\n", sch->upper);
- stp_dprintf(STP_DBG_INK, v, " cutoff %.3f:\n", sch->cutoff);
- stp_dprintf(STP_DBG_INK, v, " density %d:\n", sch->s_density);
- }
- }
+ if (stp_get_debug_level() & STP_DBG_INK)
+ stp_dump_channels(v);
}
-static void
+static void NOINLINE
clear_channel(unsigned short *data, unsigned width, unsigned depth)
{
int i;
@@ -675,7 +672,7 @@ clear_channel(unsigned short *data, unsigned width, unsigned depth)
data[i] = 0;
}
-static int
+static int NOINLINE
scale_channel(unsigned short *data, unsigned width, unsigned depth,
unsigned short density)
{
@@ -706,7 +703,7 @@ scale_channel(unsigned short *data, unsigned width, unsigned depth,
return retval;
}
-static int
+static int NOINLINE
scan_channel(unsigned short *data, unsigned width, unsigned depth)
{
int i;
@@ -729,15 +726,15 @@ ink_sum(const unsigned short *data, int total_channels)
return total_ink;
}
-static int
-limit_ink(const stp_vars_t *v)
+static int NOINLINE
+limit_ink(stpi_channel_group_t *cg)
{
int i;
int retval = 0;
- stpi_channel_group_t *cg = get_channel_group(v);
unsigned short *ptr;
if (!cg || cg->ink_limit == 0 || cg->ink_limit >= cg->max_density)
return 0;
+ cg->valid_8bit = 0;
ptr = cg->output_data;
for (i = 0; i < cg->width; i++)
{
@@ -784,10 +781,9 @@ short_copy(unsigned short *out, const unsigned short *in, size_t count)
#endif
}
-static void
-copy_channels(const stp_vars_t *v)
+static void NOINLINE
+copy_channels(stpi_channel_group_t *cg)
{
- stpi_channel_group_t *cg = get_channel_group(v);
int i, j, k;
const unsigned short *input;
unsigned short *output;
@@ -841,10 +837,9 @@ interpolate_value(const double *vec, double val)
return lval;
}
-static void
-generate_special_channels(const stp_vars_t *v)
+static void NOINLINE
+generate_special_channels(stpi_channel_group_t *cg)
{
- stpi_channel_group_t *cg = get_channel_group(v);
int i, j;
const unsigned short *input_cache = NULL;
const unsigned short *output_cache = NULL;
@@ -854,6 +849,7 @@ generate_special_channels(const stp_vars_t *v)
int outbytes;
if (!cg)
return;
+ cg->valid_8bit = 0;
input = cg->input_data;
output = cg->multi_tmp;
offset = (cg->black_channel >= 0 ? 0 : -1);
@@ -916,10 +912,9 @@ generate_special_channels(const stp_vars_t *v)
}
}
-static void
-split_channels(const stp_vars_t *v, unsigned *zero_mask)
+static void NOINLINE
+split_channels(stpi_channel_group_t *cg, unsigned *zero_mask)
{
- stpi_channel_group_t *cg = get_channel_group(v);
int i, j, k;
int nz[STP_CHANNEL_LIMIT];
int outbytes;
@@ -929,6 +924,7 @@ split_channels(const stp_vars_t *v, unsigned *zero_mask)
unsigned short *output;
if (!cg)
return;
+ cg->valid_8bit = 0;
outbytes = cg->total_channels * sizeof(unsigned short);
input = cg->split_input;
output = cg->output_data;
@@ -1016,14 +1012,15 @@ split_channels(const stp_vars_t *v, unsigned *zero_mask)
}
}
-static void
-scale_channels(const stp_vars_t *v, unsigned *zero_mask)
+static void NOINLINE
+scale_channels(stpi_channel_group_t *cg, unsigned *zero_mask,
+ int zero_mask_valid)
{
- stpi_channel_group_t *cg = get_channel_group(v);
int i, j;
int physical_channel = 0;
if (!cg)
return;
+ cg->valid_8bit = 0;
if (zero_mask)
*zero_mask = 0;
for (i = 0; i < cg->channel_count; i++)
@@ -1050,7 +1047,7 @@ scale_channels(const stp_vars_t *v, unsigned *zero_mask)
if (zero_mask)
*zero_mask |= 1 << physical_channel;
}
- else if (zero_mask)
+ else if (zero_mask && ! zero_mask_valid)
{
if (scan_channel(output, cg->width, cg->total_channels)==0)
*zero_mask |= 1 << physical_channel;
@@ -1061,15 +1058,15 @@ scale_channels(const stp_vars_t *v, unsigned *zero_mask)
}
}
-static void
-generate_gloss(const stp_vars_t *v, unsigned *zero_mask)
+static void NOINLINE
+generate_gloss(stpi_channel_group_t *cg, unsigned *zero_mask)
{
- stpi_channel_group_t *cg = get_channel_group(v);
unsigned short *output;
unsigned gloss_mask;
int i, j, k;
if (!cg || cg->gloss_channel == -1 || cg->gloss_limit <= 0)
return;
+ cg->valid_8bit = 0;
output = cg->output_data;
gloss_mask = ~(1 << cg->gloss_physical_channel);
for (i = 0; i < cg->width; i++)
@@ -1105,17 +1102,22 @@ generate_gloss(const stp_vars_t *v, unsigned *zero_mask)
}
}
-static void
-do_gcr(const stp_vars_t *v)
+static void NOINLINE
+do_gcr(stpi_channel_group_t *cg, unsigned *zero_mask)
{
- stpi_channel_group_t *cg = get_channel_group(v);
const unsigned short *gcr_lookup;
unsigned short *output;
size_t count;
int i;
+ union {
+ unsigned short nz[4];
+ unsigned long long nzl;
+ } nzx;
+ nzx.nzl = 0ull;
if (!cg)
return;
+ cg->valid_8bit = 0;
output = cg->gcr_data;
stp_curve_resample(cg->gcr_curve, 65536);
@@ -1134,26 +1136,40 @@ do_gcr(const stp_vars_t *v)
output[1] += ck * cg->cyan_balance;
output[2] += ck * cg->magenta_balance;
output[3] += ck * cg->yellow_balance;
+ nzx.nzl |= *(unsigned long long *) output;
}
output += cg->gcr_channels;
}
+ *zero_mask = 0;
+ for (i = 0; i < 4; i++)
+ if (nzx.nz[i] == 0)
+ *zero_mask |= (1 << i);
}
void
stp_channel_convert(const stp_vars_t *v, unsigned *zero_mask)
{
- if (input_has_special_channels(v))
- generate_special_channels(v);
- else if (output_has_gloss(v) && !input_needs_splitting(v))
- copy_channels(v);
- if (output_needs_gcr(v))
- do_gcr(v);
- if (input_needs_splitting(v))
- split_channels(v, zero_mask);
+ int zero_mask_valid = 1;
+ stpi_channel_group_t *cg =
+ ((stpi_channel_group_t *) stp_get_component_data(v, "Channel"));
+ if (input_has_special_channels(cg))
+ {
+ generate_special_channels(cg);
+ zero_mask_valid = 0;
+ }
+ else if (output_has_gloss(cg) && !input_needs_splitting(cg))
+ {
+ copy_channels(cg);
+ zero_mask_valid = 0;
+ }
+ if (output_needs_gcr(cg))
+ do_gcr(cg, zero_mask);
+ if (input_needs_splitting(cg))
+ split_channels(cg, zero_mask);
else
- scale_channels(v, zero_mask);
- (void) limit_ink(v);
- (void) generate_gloss(v, zero_mask);
+ scale_channels(cg, zero_mask, zero_mask_valid);
+ (void) limit_ink(cg);
+ (void) generate_gloss(cg, zero_mask);
}
unsigned short *
@@ -1173,3 +1189,23 @@ stp_channel_get_output(const stp_vars_t *v)
return NULL;
return cg->output_data;
}
+
+unsigned char *
+stp_channel_get_output_8bit(const stp_vars_t *v)
+{
+ stpi_channel_group_t *cg = get_channel_group(v);
+ if (!cg)
+ return NULL;
+ if (cg->valid_8bit)
+ return cg->output_data_8bit;
+ if (! cg->output_data_8bit)
+ cg->output_data_8bit = stp_malloc(sizeof(unsigned char) *
+ cg->total_channels * cg->width);
+ int i;
+ (void) memset(cg->output_data_8bit, 0, sizeof(unsigned char) *
+ cg->total_channels * cg->width);
+ for (i = 0; i < cg->width * cg->total_channels; i++)
+ cg->output_data_8bit[i] = cg->output_data[i] / (unsigned short) 257;
+ cg->valid_8bit = 1;
+ return cg->output_data_8bit;
+}
diff --git a/src/main/color-conversion.h b/src/main/color-conversion.h
index 5d60cdc..ea29211 100644
--- a/src/main/color-conversion.h
+++ b/src/main/color-conversion.h
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GUTENPRINT_INTERNAL_COLOR_CONVERSION_H
diff --git a/src/main/color-conversions.c b/src/main/color-conversions.c
index e2a15e9..e5a31a8 100644
--- a/src/main/color-conversions.c
+++ b/src/main/color-conversions.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -41,8 +40,17 @@
#ifdef __GNUC__
#define inline __inline__
+// There's no reason to inline the main loop with the dispatch
+// functions only to fail inlining of calls from the inner loop.
+// Also, inlining the main loop makes it hard to debug because we lose
+// context of which print function is called.
+#define NOINLINE __attribute__ ((noinline))
+#else
+$define NOINLINE
#endif
+#define CFUNC static unsigned NOINLINE
+
/*
* RGB to grayscale luminance constants...
*/
@@ -56,6 +64,8 @@
#define FMAX(a, b) ((a) > (b) ? (a) : (b))
#define FMIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAXB(bits) ((1 << (bits)) - 1)
+
static inline void
calc_rgb_to_hsl(unsigned short *rgb, double *hue, double *sat,
double *lightness)
@@ -199,7 +209,7 @@ update_saturation(double sat, double adjust, double isat, int bright_colors)
static inline double
interpolate_value(const double *vec, double val)
{
- double base = floor(val);
+ double base = (double)((int)(val));
double frac = val - base;
int ibase = (int) base;
double lval = vec[ibase];
@@ -248,51 +258,48 @@ adjust_hsl(unsigned short *rgbout, lut_t *lut, double ssat, double isat,
const double *hue_map = CURVE_CACHE_FAST_DOUBLE(&(lut->hue_map));
const double *lum_map = CURVE_CACHE_FAST_DOUBLE(&(lut->lum_map));
const double *sat_map = CURVE_CACHE_FAST_DOUBLE(&(lut->sat_map));
- if ((split_saturation || lum_map || hue_map || sat_map) &&
- (rgbout[0] != rgbout[1] || rgbout[0] != rgbout[2]))
+ size_t hue_count = CURVE_CACHE_FAST_COUNT(&(lut->hue_map));
+ size_t lum_count = CURVE_CACHE_FAST_COUNT(&(lut->lum_map));
+ size_t sat_count = CURVE_CACHE_FAST_COUNT(&(lut->sat_map));
+ double h, s, l;
+ double oh;
+ rgbout[0] ^= 65535;
+ rgbout[1] ^= 65535;
+ rgbout[2] ^= 65535;
+ calc_rgb_to_hsl(rgbout, &h, &s, &l);
+ s = update_saturation(s, ssat, isat, 0);
+ if (!adjust_hue_only && lut->sat_map.d_cache)
{
- size_t hue_count = CURVE_CACHE_FAST_COUNT(&(lut->hue_map));
- size_t lum_count = CURVE_CACHE_FAST_COUNT(&(lut->lum_map));
- size_t sat_count = CURVE_CACHE_FAST_COUNT(&(lut->sat_map));
- double h, s, l;
- double oh;
- rgbout[0] ^= 65535;
- rgbout[1] ^= 65535;
- rgbout[2] ^= 65535;
- calc_rgb_to_hsl(rgbout, &h, &s, &l);
- s = update_saturation(s, ssat, isat, 0);
- if (!adjust_hue_only && lut->sat_map.d_cache)
- {
- double nh = h * sat_count / 6.0;
- double tmp = interpolate_value(sat_map, nh);
- if (tmp < .9999 || tmp > 1.0001)
- {
- s = update_saturation(s, tmp, tmp > 1.0 ? 1.0 / tmp : 1.0,
- bright_colors);
- }
- }
- oh = h;
- h = adjust_hue(hue_map, h, hue_count);
- calc_hsl_to_rgb(rgbout, h, s, l);
+ double nh = h * sat_count / 6.0;
+ double tmp = interpolate_value(sat_map, nh);
+ if (tmp < .9999 || tmp > 1.0001)
+ s = update_saturation(s, tmp, tmp > 1.0 ? 1.0 / tmp : 1.0,
+ bright_colors);
+ }
+ oh = h;
+ h = adjust_hue(hue_map, h, hue_count);
+ calc_hsl_to_rgb(rgbout, h, s, l);
- if (!adjust_hue_only && s > 0.00001)
+ if (!adjust_hue_only && s > 0.00001)
+ {
+ /*
+ * Perform luminosity adjustment only on color component.
+ * This way the luminosity of the gray component won't be affected.
+ * We'll add the gray back at the end.
+ */
+
+ unsigned gray = FMIN(rgbout[0], FMIN(rgbout[1], rgbout[2]));
+ int i;
+ /*
+ * Scale the components by the amount of color left.
+ * This way the luminosity calculations will come out right.
+ */
+ if (gray > 0)
+ for (i = 0; i < 3; i++)
+ rgbout[i] = (rgbout[i] - gray) * 65535.0 / (65535 - gray);
+
+ if (lut->lum_map.d_cache)
{
- /*
- * Perform luminosity adjustment only on color component.
- * This way the luminosity of the gray component won't be affected.
- * We'll add the gray back at the end.
- */
-
- unsigned gray = FMIN(rgbout[0], FMIN(rgbout[1], rgbout[2]));
- int i;
- /*
- * Scale the components by the amount of color left.
- * This way the luminosity calculations will come out right.
- */
- if (gray > 0)
- for (i = 0; i < 3; i++)
- rgbout[i] = (rgbout[i] - gray) * 65535.0 / (65535 - gray);
-
calc_rgb_to_hsl(rgbout, &h, &s, &l);
if (lut->lum_map.d_cache && l > 0.00001 && l < .99999)
{
@@ -306,115 +313,21 @@ adjust_hsl(unsigned short *rgbout, lut_t *lut, double ssat, double isat,
double g2 = 1.0 - pow(1.0 - l, oel);
l = FMIN(g1, g2);
}
+ calc_hsl_to_rgb(rgbout, h, s, l);
}
- calc_hsl_to_rgb(rgbout, h, s, l);
- if (gray > 0)
- for (i = 0; i < 3; i++)
- rgbout[i] = gray + (rgbout[i] * (65535 - gray) / 65535.0);
}
-
- rgbout[0] ^= 65535;
- rgbout[1] ^= 65535;
- rgbout[2] ^= 65535;
+ if (gray > 0)
+ for (i = 0; i < 3; i++)
+ rgbout[i] = gray + (rgbout[i] * (65535 - gray) / 65535.0);
}
-}
-static inline void
-lookup_rgb(lut_t *lut, unsigned short *rgbout,
- const unsigned short *red, const unsigned short *green,
- const unsigned short *blue, unsigned steps)
-{
- if (steps == 65536)
- {
- rgbout[0] = red[rgbout[0]];
- rgbout[1] = green[rgbout[1]];
- rgbout[2] = blue[rgbout[2]];
- }
- else
- {
- rgbout[0] = red[rgbout[0] / 257];
- rgbout[1] = green[rgbout[1] / 257];
- rgbout[2] = blue[rgbout[2] / 257];
- }
-}
-
-static inline int
-short_eq(const unsigned short *i1, const unsigned short *i2, size_t count)
-{
-#if 1
- int i;
- for (i = 0; i < count; i++)
- if (i1[i] != i2[i])
- return 0;
- return 1;
-#else
- return !memcmp(i1, i2, count * sizeof(unsigned short));
-#endif
-}
-
-static inline void
-short_copy(unsigned short *out, const unsigned short *in, size_t count)
-{
-#if 1
- int i;
- for (i = 0; i < count; i++)
- out[i] = in[i];
-#else
- (void) memcpy(out, in, count * sizeof(unsigned short));
-#endif
-}
-
-static unsigned
-raw_cmy_to_kcmy(const stp_vars_t *vars, const unsigned short *in,
- unsigned short *out)
-{
- lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color"));
- int width = lut->image_width;
-
- int i;
- int j;
- unsigned short nz[4];
- unsigned retval = 0;
- const unsigned short *input_cache = NULL;
- const unsigned short *output_cache = NULL;
-
- memset(nz, 0, sizeof(nz));
-
- for (i = 0; i < width; i++, out += 4, in += 3)
- {
- if (input_cache && short_eq(input_cache, in, 3))
- short_copy(out, output_cache, 4);
- else
- {
- int c = in[0];
- int m = in[1];
- int y = in[2];
- int k = FMIN(c, FMIN(m, y));
- input_cache = in;
- out[0] = 0;
- for (j = 0; j < 3; j++)
- out[j + 1] = in[j];
- if (k > 0)
- {
- out[0] = k;
- out[1] -= k;
- out[2] -= k;
- out[3] -= k;
- }
- output_cache = out;
- for (j = 0; j < 4; j++)
- if (out[j])
- nz[j] = 1;
- }
- }
- for (j = 0; j < 4; j++)
- if (nz[j] == 0)
- retval |= (1 << j);
- return retval;
+ rgbout[0] ^= 65535;
+ rgbout[1] ^= 65535;
+ rgbout[2] ^= 65535;
}
#define GENERIC_COLOR_FUNC(fromname, toname) \
-static unsigned \
+CFUNC \
fromname##_to_##toname(const stp_vars_t *vars, const unsigned char *in, \
unsigned short *out) \
{ \
@@ -435,203 +348,390 @@ fromname##_to_##toname(const stp_vars_t *vars, const unsigned char *in, \
return fromname##_16_to_##toname(vars, in, out); \
}
-#define COLOR_TO_COLOR_FUNC(T, bits) \
-static unsigned \
-color_##bits##_to_color(const stp_vars_t *vars, const unsigned char *in, \
- unsigned short *out) \
-{ \
- int i; \
- double isat = 1.0; \
- double ssat = stp_get_float_parameter(vars, "Saturation"); \
- double sbright = stp_get_float_parameter(vars, "Brightness"); \
- int i0 = -1; \
- int i1 = -1; \
- int i2 = -1; \
- unsigned short o0 = 0; \
- unsigned short o1 = 0; \
- unsigned short o2 = 0; \
- unsigned short nz0 = 0; \
- unsigned short nz1 = 0; \
- unsigned short nz2 = 0; \
- const unsigned short *red; \
- const unsigned short *green; \
- const unsigned short *blue; \
- const unsigned short *brightness; \
- const unsigned short *contrast; \
- const T *s_in = (const T *) in; \
- lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
- int compute_saturation = ssat <= .99999 || ssat >= 1.00001; \
- int split_saturation = ssat > 1.4; \
- int bright_color_adjustment = 0; \
- int hue_only_color_adjustment = 0; \
- int do_user_adjustment = 0; \
- if (lut->color_correction->correction == COLOR_CORRECTION_BRIGHT) \
- bright_color_adjustment = 1; \
- if (lut->color_correction->correction == COLOR_CORRECTION_HUE) \
- hue_only_color_adjustment = 1; \
- if (sbright != 1) \
- do_user_adjustment = 1; \
- compute_saturation |= do_user_adjustment; \
- \
- for (i = CHANNEL_C; i <= CHANNEL_Y; i++) \
+#define BD(bits) (65535u / (unsigned) MAXB(bits))
+
+#define COLOR_TO_COLOR_FUNC(T, bits) \
+CFUNC \
+color_##bits##_to_color(const stp_vars_t *vars, const unsigned char *in, \
+ unsigned short *out) \
+{ \
+ int i; \
+ double isat = 1.0; \
+ double ssat = stp_get_float_parameter(vars, "Saturation"); \
+ double sbright = stp_get_float_parameter(vars, "Brightness"); \
+ int i0 = -1; \
+ int i1 = -1; \
+ int i2 = -1; \
+ unsigned short o0 = 0; \
+ unsigned short o1 = 0; \
+ unsigned short o2 = 0; \
+ unsigned short nz0 = 0; \
+ unsigned short nz1 = 0; \
+ unsigned short nz2 = 0; \
+ const unsigned short *red; \
+ const unsigned short *green; \
+ const unsigned short *blue; \
+ const unsigned short *brightness; \
+ const unsigned short *contrast; \
+ const T *s_in = (const T *) in; \
+ lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
+ int compute_saturation = ssat <= .99999 || ssat >= 1.00001; \
+ int split_saturation = ssat > 1.4; \
+ int bright_color_adjustment = 0; \
+ int hue_only_color_adjustment = 0; \
+ int do_user_adjustment = 0; \
+ if (lut->color_correction->correction == COLOR_CORRECTION_BRIGHT) \
+ bright_color_adjustment = 1; \
+ if (lut->color_correction->correction == COLOR_CORRECTION_HUE) \
+ hue_only_color_adjustment = 1; \
+ if (sbright != 1) \
+ do_user_adjustment = 1; \
+ compute_saturation |= do_user_adjustment; \
+ \
+ for (i = CHANNEL_C; i <= CHANNEL_Y; i++) \
stp_curve_resample(stp_curve_cache_get_curve(&(lut->channel_curves[i])), \
- 1 << bits); \
- stp_curve_resample \
- (stp_curve_cache_get_curve(&(lut->brightness_correction)), 65536); \
- stp_curve_resample \
- (stp_curve_cache_get_curve(&(lut->contrast_correction)), 1 << bits); \
- red = \
- stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_C])); \
- green = \
- stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_M])); \
- blue = \
- stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_Y])); \
- brightness= \
- stp_curve_cache_get_ushort_data(&(lut->brightness_correction)); \
- contrast = \
- stp_curve_cache_get_ushort_data(&(lut->contrast_correction)); \
- (void) stp_curve_cache_get_double_data(&(lut->hue_map)); \
- (void) stp_curve_cache_get_double_data(&(lut->lum_map)); \
- (void) stp_curve_cache_get_double_data(&(lut->sat_map)); \
- \
- if (split_saturation) \
- ssat = sqrt(ssat); \
- if (ssat > 1) \
- isat = 1.0 / ssat; \
- for (i = 0; i < lut->image_width; i++) \
- { \
- if (i0 == s_in[0] && i1 == s_in[1] && i2 == s_in[2]) \
- { \
- out[0] = o0; \
- out[1] = o1; \
- out[2] = o2; \
- } \
- else \
- { \
- i0 = s_in[0]; \
- i1 = s_in[1]; \
- i2 = s_in[2]; \
- out[0] = i0 * (65535u / (unsigned) ((1 << bits) - 1)); \
- out[1] = i1 * (65535u / (unsigned) ((1 << bits) - 1)); \
- out[2] = i2 * (65535u / (unsigned) ((1 << bits) - 1)); \
- lookup_rgb(lut, out, contrast, contrast, contrast, 1 << bits); \
- if ((compute_saturation)) \
- update_saturation_from_rgb(out, brightness, ssat, isat, \
- do_user_adjustment); \
- adjust_hsl(out, lut, ssat, isat, split_saturation, \
- hue_only_color_adjustment, bright_color_adjustment); \
- lookup_rgb(lut, out, red, green, blue, 1 << bits); \
- o0 = out[0]; \
- o1 = out[1]; \
- o2 = out[2]; \
- nz0 |= o0; \
- nz1 |= o1; \
- nz2 |= o2; \
- } \
- s_in += 3; \
- out += 3; \
- } \
- return (nz0 ? 0 : 1) + (nz1 ? 0 : 2) + (nz2 ? 0 : 4); \
+ 1 << bits); \
+ stp_curve_resample \
+ (stp_curve_cache_get_curve(&(lut->brightness_correction)), 65536); \
+ stp_curve_resample \
+ (stp_curve_cache_get_curve(&(lut->contrast_correction)), 1 << bits); \
+ red = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_C])); \
+ green = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_M])); \
+ blue = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_Y])); \
+ brightness= \
+ stp_curve_cache_get_ushort_data(&(lut->brightness_correction)); \
+ contrast = \
+ stp_curve_cache_get_ushort_data(&(lut->contrast_correction)); \
+ (void) stp_curve_cache_get_double_data(&(lut->hue_map)); \
+ (void) stp_curve_cache_get_double_data(&(lut->lum_map)); \
+ (void) stp_curve_cache_get_double_data(&(lut->sat_map)); \
+ const double *hue_map = CURVE_CACHE_FAST_DOUBLE(&(lut->hue_map)); \
+ const double *lum_map = CURVE_CACHE_FAST_DOUBLE(&(lut->lum_map)); \
+ const double *sat_map = CURVE_CACHE_FAST_DOUBLE(&(lut->sat_map)); \
+ \
+ if (split_saturation) \
+ ssat = sqrt(ssat); \
+ if (ssat > 1) \
+ isat = 1.0 / ssat; \
+ for (i = 0; i < lut->image_width; i++) \
+ { \
+ if (i0 == s_in[0] && i1 == s_in[1] && i2 == s_in[2]) \
+ { \
+ out[0] = o0; \
+ out[1] = o1; \
+ out[2] = o2; \
+ } \
+ else \
+ { \
+ i0 = s_in[0]; \
+ i1 = s_in[1]; \
+ i2 = s_in[2]; \
+ out[0] = contrast[i0]; \
+ out[1] = contrast[i1]; \
+ out[2] = contrast[i2]; \
+ if ((compute_saturation)) \
+ update_saturation_from_rgb(out, brightness, ssat, isat, \
+ do_user_adjustment); \
+ if ((split_saturation || lum_map || hue_map || sat_map) && \
+ (out[0] != out[1] || out[0] != out[2])) \
+ adjust_hsl(out, lut, ssat, isat, split_saturation, \
+ hue_only_color_adjustment, bright_color_adjustment); \
+ out[0] = red[out[0] / BD(bits)]; \
+ out[1] = green[out[1] / BD(bits)]; \
+ out[2] = blue[out[2] / BD(bits)]; \
+ o0 = out[0]; \
+ o1 = out[1]; \
+ o2 = out[2]; \
+ nz0 |= o0; \
+ nz1 |= o1; \
+ nz2 |= o2; \
+ } \
+ s_in += 3; \
+ out += 3; \
+ } \
+ return (nz0 ? 0 : 1) + (nz1 ? 0 : 2) + (nz2 ? 0 : 4); \
}
-COLOR_TO_COLOR_FUNC(unsigned char, 8)
-COLOR_TO_COLOR_FUNC(unsigned short, 16)
+COLOR_TO_COLOR_FUNC(unsigned char, 8) // color_8_to_color
+COLOR_TO_COLOR_FUNC(unsigned short, 16) // color_16_to_color
GENERIC_COLOR_FUNC(color, color)
+#define COLOR_TO_KCMY_FUNC(T, bits) \
+CFUNC \
+color_##bits##_to_kcmy(const stp_vars_t *vars, const unsigned char *in, \
+ unsigned short *out) \
+{ \
+ int i; \
+ double isat = 1.0; \
+ double ssat = stp_get_float_parameter(vars, "Saturation"); \
+ double sbright = stp_get_float_parameter(vars, "Brightness"); \
+ union { \
+ unsigned short nz[4]; \
+ unsigned long long nzl; \
+ } nzx; \
+ unsigned retval = 0; \
+ const unsigned short *red; \
+ const unsigned short *green; \
+ const unsigned short *blue; \
+ const unsigned short *brightness; \
+ const unsigned short *contrast; \
+ const T *s_in = (const T *) in; \
+ lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
+ int compute_saturation = ssat <= .99999 || ssat >= 1.00001; \
+ int split_saturation = ssat > 1.4; \
+ int bright_color_adjustment = 0; \
+ int hue_only_color_adjustment = 0; \
+ int do_user_adjustment = 0; \
+ if (lut->color_correction->correction == COLOR_CORRECTION_BRIGHT) \
+ bright_color_adjustment = 1; \
+ if (lut->color_correction->correction == COLOR_CORRECTION_HUE) \
+ hue_only_color_adjustment = 1; \
+ if (sbright != 1) \
+ do_user_adjustment = 1; \
+ compute_saturation |= do_user_adjustment; \
+ nzx.nzl = 0ull; \
+ \
+ for (i = CHANNEL_C; i <= CHANNEL_Y; i++) \
+ stp_curve_resample(stp_curve_cache_get_curve(&(lut->channel_curves[i])), \
+ 1 << bits); \
+ stp_curve_resample \
+ (stp_curve_cache_get_curve(&(lut->brightness_correction)), 65536); \
+ stp_curve_resample \
+ (stp_curve_cache_get_curve(&(lut->contrast_correction)), 1 << bits); \
+ red = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_C])); \
+ green = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_M])); \
+ blue = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_Y])); \
+ brightness= \
+ stp_curve_cache_get_ushort_data(&(lut->brightness_correction)); \
+ contrast = \
+ stp_curve_cache_get_ushort_data(&(lut->contrast_correction)); \
+ (void) stp_curve_cache_get_double_data(&(lut->hue_map)); \
+ (void) stp_curve_cache_get_double_data(&(lut->lum_map)); \
+ (void) stp_curve_cache_get_double_data(&(lut->sat_map)); \
+ const double *hue_map = CURVE_CACHE_FAST_DOUBLE(&(lut->hue_map)); \
+ const double *lum_map = CURVE_CACHE_FAST_DOUBLE(&(lut->lum_map)); \
+ const double *sat_map = CURVE_CACHE_FAST_DOUBLE(&(lut->sat_map)); \
+ \
+ if (split_saturation) \
+ ssat = sqrt(ssat); \
+ if (ssat > 1) \
+ isat = 1.0 / ssat; \
+ for (i = 0; i < lut->image_width; i++, out += 4, s_in += 3) \
+ { \
+ out[1] = contrast[s_in[0]]; \
+ out[2] = contrast[s_in[1]]; \
+ out[3] = contrast[s_in[2]]; \
+ if ((compute_saturation)) \
+ update_saturation_from_rgb(out + 1, brightness, ssat, isat, \
+ do_user_adjustment); \
+ if ((split_saturation || lum_map || hue_map || sat_map) && \
+ (out[1] != out[2] || out[1] != out[3])) \
+ adjust_hsl(out + 1, lut, ssat, isat, split_saturation, \
+ hue_only_color_adjustment, bright_color_adjustment); \
+ out[1] = red[out[1] / BD(bits)]; \
+ out[2] = green[out[2] / BD(bits)]; \
+ out[3] = blue[out[3] / BD(bits)]; \
+ out[0] = FMIN(out[1], FMIN(out[2], out[3])); \
+ out[1] -= out[0]; \
+ out[2] -= out[0]; \
+ out[3] -= out[0]; \
+ nzx.nzl |= *(unsigned long long *) out; \
+ } \
+ for (i = 0; i < 4; i++) \
+ if (nzx.nz[i] == 0) \
+ retval |= (1 << i); \
+ return retval; \
+}
+
+COLOR_TO_KCMY_FUNC(unsigned char, 8) // color_8_to_kcmy
+COLOR_TO_KCMY_FUNC(unsigned short, 16) // color_16_to_kcmy
+GENERIC_COLOR_FUNC(color, kcmy)
+
/*
* 'rgb_to_rgb()' - Convert rgb image data to RGB.
*/
-#define FAST_COLOR_TO_COLOR_FUNC(T, bits) \
-static unsigned \
+#define FAST_COLOR_TO_COLOR_FUNC(T, bits) \
+CFUNC \
color_##bits##_to_color_fast(const stp_vars_t *vars, const unsigned char *in, \
- unsigned short *out) \
-{ \
- int i; \
- int i0 = -1; \
- int i1 = -1; \
- int i2 = -1; \
- int o0 = 0; \
- int o1 = 0; \
- int o2 = 0; \
- int nz0 = 0; \
- int nz1 = 0; \
- int nz2 = 0; \
- const T *s_in = (const T *) in; \
- lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
- const unsigned short *red; \
- const unsigned short *green; \
- const unsigned short *blue; \
- const unsigned short *brightness; \
- const unsigned short *contrast; \
- double isat = 1.0; \
- double saturation = stp_get_float_parameter(vars, "Saturation"); \
- double sbright = stp_get_float_parameter(vars, "Brightness"); \
- int compute_saturation = saturation <= .99999 || saturation >= 1.00001; \
- int do_user_adjustment = 0; \
- if (sbright != 1) \
- do_user_adjustment = 1; \
- compute_saturation |= do_user_adjustment; \
- \
- for (i = CHANNEL_C; i <= CHANNEL_Y; i++) \
- stp_curve_resample(lut->channel_curves[i].curve, 65536); \
- stp_curve_resample \
- (stp_curve_cache_get_curve(&(lut->brightness_correction)), 65536); \
- stp_curve_resample \
- (stp_curve_cache_get_curve(&(lut->contrast_correction)), 1 << bits); \
- red = \
- stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_C])); \
- green = \
- stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_M])); \
- blue = \
- stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_Y])); \
- brightness= \
- stp_curve_cache_get_ushort_data(&(lut->brightness_correction)); \
- contrast = \
- stp_curve_cache_get_ushort_data(&(lut->contrast_correction)); \
- \
- if (saturation > 1) \
- isat = 1.0 / saturation; \
- for (i = 0; i < lut->image_width; i++) \
- { \
- if (i0 == s_in[0] && i1 == s_in[1] && i2 == s_in[2]) \
- { \
- out[0] = o0; \
- out[1] = o1; \
- out[2] = o2; \
- } \
- else \
- { \
- i0 = s_in[0]; \
- i1 = s_in[1]; \
- i2 = s_in[2]; \
- out[0] = contrast[s_in[0]]; \
- out[1] = contrast[s_in[1]]; \
- out[2] = contrast[s_in[2]]; \
- if ((compute_saturation)) \
+ unsigned short *out) \
+{ \
+ int i; \
+ int i0 = -1; \
+ int i1 = -1; \
+ int i2 = -1; \
+ int o0 = 0; \
+ int o1 = 0; \
+ int o2 = 0; \
+ int nz0 = 0; \
+ int nz1 = 0; \
+ int nz2 = 0; \
+ const T *s_in = (const T *) in; \
+ lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
+ const unsigned short *red; \
+ const unsigned short *green; \
+ const unsigned short *blue; \
+ const unsigned short *brightness; \
+ const unsigned short *contrast; \
+ double isat = 1.0; \
+ double saturation = stp_get_float_parameter(vars, "Saturation"); \
+ double sbright = stp_get_float_parameter(vars, "Brightness"); \
+ int compute_saturation = saturation <= .99999 || saturation >= 1.00001; \
+ int do_user_adjustment = 0; \
+ if (sbright != 1) \
+ do_user_adjustment = 1; \
+ compute_saturation |= do_user_adjustment; \
+ \
+ for (i = CHANNEL_C; i <= CHANNEL_Y; i++) \
+ stp_curve_resample(lut->channel_curves[i].curve, 65536); \
+ stp_curve_resample \
+ (stp_curve_cache_get_curve(&(lut->brightness_correction)), 65536); \
+ stp_curve_resample \
+ (stp_curve_cache_get_curve(&(lut->contrast_correction)), 1 << bits); \
+ red = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_C])); \
+ green = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_M])); \
+ blue = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_Y])); \
+ brightness= \
+ stp_curve_cache_get_ushort_data(&(lut->brightness_correction)); \
+ contrast = \
+ stp_curve_cache_get_ushort_data(&(lut->contrast_correction)); \
+ \
+ if (saturation > 1) \
+ isat = 1.0 / saturation; \
+ for (i = 0; i < lut->image_width; i++) \
+ { \
+ if (i0 == s_in[0] && i1 == s_in[1] && i2 == s_in[2]) \
+ { \
+ out[0] = o0; \
+ out[1] = o1; \
+ out[2] = o2; \
+ } \
+ else \
+ { \
+ i0 = s_in[0]; \
+ i1 = s_in[1]; \
+ i2 = s_in[2]; \
+ out[0] = contrast[s_in[0]]; \
+ out[1] = contrast[s_in[1]]; \
+ out[2] = contrast[s_in[2]]; \
+ if ((compute_saturation)) \
update_saturation_from_rgb(out, brightness, saturation, isat, 1); \
- out[0] = red[out[0]]; \
- out[1] = green[out[1]]; \
- out[2] = blue[out[2]]; \
- o0 = out[0]; \
- o1 = out[1]; \
- o2 = out[2]; \
- nz0 |= o0; \
- nz1 |= o1; \
- nz2 |= o2; \
- } \
- s_in += 3; \
- out += 3; \
- } \
- return (nz0 ? 0 : 1) + (nz1 ? 0 : 2) + (nz2 ? 0 : 4); \
+ out[0] = red[out[0]]; \
+ out[1] = green[out[1]]; \
+ out[2] = blue[out[2]]; \
+ o0 = out[0]; \
+ o1 = out[1]; \
+ o2 = out[2]; \
+ nz0 |= o0; \
+ nz1 |= o1; \
+ nz2 |= o2; \
+ } \
+ s_in += 3; \
+ out += 3; \
+ } \
+ return (nz0 ? 0 : 1) + (nz1 ? 0 : 2) + (nz2 ? 0 : 4); \
}
-FAST_COLOR_TO_COLOR_FUNC(unsigned char, 8)
-FAST_COLOR_TO_COLOR_FUNC(unsigned short, 16)
+FAST_COLOR_TO_COLOR_FUNC(unsigned char, 8) // color_8_to_color_fast
+FAST_COLOR_TO_COLOR_FUNC(unsigned short, 16) // color_16_to_color_fast
GENERIC_COLOR_FUNC(color, color_fast)
+#define FAST_COLOR_TO_KCMY_FUNC(T, bits) \
+CFUNC \
+color_##bits##_to_kcmy_fast(const stp_vars_t *vars, const unsigned char *in, \
+ unsigned short *out) \
+{ \
+ int i; \
+ union { \
+ unsigned short nz[4]; \
+ unsigned long long nzl; \
+ } nzx; \
+ unsigned retval = 0; \
+ unsigned short c, m, y, k; \
+ const T *s_in = (const T *) in; \
+ lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
+ const unsigned short *red; \
+ const unsigned short *green; \
+ const unsigned short *blue; \
+ const unsigned short *brightness; \
+ const unsigned short *contrast; \
+ double isat = 1.0; \
+ double saturation = stp_get_float_parameter(vars, "Saturation"); \
+ double sbright = stp_get_float_parameter(vars, "Brightness"); \
+ int compute_saturation = saturation <= .99999 || saturation >= 1.00001; \
+ int do_user_adjustment = 0; \
+ if (sbright != 1) \
+ do_user_adjustment = 1; \
+ compute_saturation |= do_user_adjustment; \
+ nzx.nzl = 0ull; \
+ \
+ for (i = CHANNEL_C; i <= CHANNEL_Y; i++) \
+ stp_curve_resample(lut->channel_curves[i].curve, 65536); \
+ stp_curve_resample \
+ (stp_curve_cache_get_curve(&(lut->brightness_correction)), 65536); \
+ stp_curve_resample \
+ (stp_curve_cache_get_curve(&(lut->contrast_correction)), 1 << bits); \
+ red = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_C])); \
+ green = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_M])); \
+ blue = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_Y])); \
+ brightness= \
+ stp_curve_cache_get_ushort_data(&(lut->brightness_correction)); \
+ contrast = \
+ stp_curve_cache_get_ushort_data(&(lut->contrast_correction)); \
+ \
+ if (saturation > 1) \
+ isat = 1.0 / saturation; \
+ for (i = 0; i < lut->image_width; i++, out += 4, s_in += 3) \
+ { \
+ c = contrast[s_in[0]]; \
+ m = contrast[s_in[1]]; \
+ y = contrast[s_in[2]]; \
+ if (compute_saturation) \
+ { \
+ unsigned short tmp[3]; \
+ tmp[0] = c; \
+ tmp[1] = m; \
+ tmp[2] = y; \
+ update_saturation_from_rgb(tmp, brightness, saturation, \
+ isat, 1); \
+ c = tmp[0]; \
+ m = tmp[1]; \
+ y = tmp[2]; \
+ } \
+ c = red[c]; \
+ m = green[m]; \
+ y = blue[y]; \
+ k = FMIN(c, FMIN(m, y)); \
+ out[0] = k; \
+ out[1] = c - k; \
+ out[2] = m - k; \
+ out[3] = y - k; \
+ nzx.nzl |= *(unsigned long long *) out; \
+ } \
+ for (i = 0; i < 4; i++) \
+ if (nzx.nz[i] == 0) \
+ retval |= (1 << i); \
+ return retval; \
+}
+
+FAST_COLOR_TO_KCMY_FUNC(unsigned char, 8) // color_8_to_kcmy_fast
+FAST_COLOR_TO_KCMY_FUNC(unsigned short, 16) // color_16_to_color_fast
+GENERIC_COLOR_FUNC(color, kcmy_fast)
+
#define RAW_COLOR_TO_COLOR_FUNC(T, bits) \
-static unsigned \
+CFUNC \
color_##bits##_to_color_raw(const stp_vars_t *vars, const unsigned char *in,\
unsigned short *out) \
{ \
@@ -659,16 +759,56 @@ color_##bits##_to_color_raw(const stp_vars_t *vars, const unsigned char *in,\
return nz; \
}
-RAW_COLOR_TO_COLOR_FUNC(unsigned char, 8)
-RAW_COLOR_TO_COLOR_FUNC(unsigned short, 16)
+RAW_COLOR_TO_COLOR_FUNC(unsigned char, 8) // color_8_to_color_raw
+RAW_COLOR_TO_COLOR_FUNC(unsigned short, 16) // color_16_to_color_raw
GENERIC_COLOR_FUNC(color, color_raw)
+#define RAW_COLOR_TO_KCMY_FUNC(T, bits) \
+CFUNC \
+color_##bits##_to_kcmy_raw(const stp_vars_t *vars, const unsigned char *in, \
+ unsigned short *out) \
+{ \
+ int i; \
+ union { \
+ unsigned short nz[4]; \
+ unsigned long long nzl; \
+ } nzx; \
+ unsigned retval = 0; \
+ const T *s_in = (const T *) in; \
+ lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
+ unsigned mask = 0; \
+ if (lut->invert_output) \
+ mask = 0xffff; \
+ nzx.nzl = 0ull; \
+ \
+ for (i = 0; i < lut->image_width; i++, out += 4, s_in += 3) \
+ { \
+ unsigned c = (s_in[0] * BD(bits)) ^ mask; \
+ unsigned m = (s_in[1] * BD(bits)) ^ mask; \
+ unsigned y = (s_in[2] * BD(bits)) ^ mask; \
+ unsigned k = FMIN(c, FMIN(m, y)); \
+ out[0] = k; \
+ out[1] = c - k; \
+ out[2] = m - k; \
+ out[3] = y - k; \
+ nzx.nzl |= *(unsigned long long *) out; \
+ } \
+ for (i = 0; i < 4; i++) \
+ if (nzx.nz[i] == 0) \
+ retval |= (1 << i); \
+ return retval; \
+}
+
+RAW_COLOR_TO_KCMY_FUNC(unsigned char, 8) // color_8_to_kcmy_raw
+RAW_COLOR_TO_KCMY_FUNC(unsigned short, 16) // color_16_to_kcmy_raw
+GENERIC_COLOR_FUNC(color, kcmy_raw)
+
/*
* 'gray_to_rgb()' - Convert gray image data to RGB.
*/
#define GRAY_TO_COLOR_FUNC(T, bits) \
-static unsigned \
+CFUNC \
gray_##bits##_to_color(const stp_vars_t *vars, const unsigned char *in, \
unsigned short *out) \
{ \
@@ -727,12 +867,64 @@ gray_##bits##_to_color(const stp_vars_t *vars, const unsigned char *in, \
return (nz0 ? 0 : 1) + (nz1 ? 0 : 2) + (nz2 ? 0 : 4); \
}
-GRAY_TO_COLOR_FUNC(unsigned char, 8)
-GRAY_TO_COLOR_FUNC(unsigned short, 16)
+GRAY_TO_COLOR_FUNC(unsigned char, 8) // gray_8_to_color
+GRAY_TO_COLOR_FUNC(unsigned short, 16) // gray_16_to_color
GENERIC_COLOR_FUNC(gray, color)
+#define GRAY_TO_KCMY_FUNC(T, bits) \
+CFUNC \
+gray_##bits##_to_kcmy(const stp_vars_t *vars, const unsigned char *in, \
+ unsigned short *out) \
+{ \
+ int i; \
+ union { \
+ unsigned short nz[4]; \
+ unsigned long long nzl; \
+ } nzx; \
+ unsigned retval = 0; \
+ const T *s_in = (const T *) in; \
+ lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
+ const unsigned short *red; \
+ const unsigned short *green; \
+ const unsigned short *blue; \
+ const unsigned short *user; \
+ \
+ for (i = CHANNEL_C; i <= CHANNEL_Y; i++) \
+ stp_curve_resample(lut->channel_curves[i].curve, 65536); \
+ stp_curve_resample \
+ (stp_curve_cache_get_curve(&(lut->user_color_correction)), 1 << bits); \
+ red = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_C])); \
+ green = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_M])); \
+ blue = \
+ stp_curve_cache_get_ushort_data(&(lut->channel_curves[CHANNEL_Y])); \
+ user = \
+ stp_curve_cache_get_ushort_data(&(lut->user_color_correction)); \
+ \
+ for (i = 0; i < lut->image_width; i++, out += 4, s_in++) \
+ { \
+ out[1] = red[user[s_in[0]]]; \
+ out[2] = green[user[s_in[0]]]; \
+ out[3] = blue[user[s_in[0]]]; \
+ out[0] = FMIN(out[1], FMIN(out[2], out[3])); \
+ out[1] -= out[0]; \
+ out[2] -= out[0]; \
+ out[3] -= out[0]; \
+ nzx.nzl |= *(unsigned long long *) out; \
+ } \
+ for (i = 0; i < 4; i++) \
+ if (nzx.nz[i] == 0) \
+ retval |= (1 << i); \
+ return retval; \
+}
+
+GRAY_TO_KCMY_FUNC(unsigned char, 8) // gray_8_to_kcmy
+GRAY_TO_KCMY_FUNC(unsigned short, 16) // gray_16_to_kcmy
+GENERIC_COLOR_FUNC(gray, kcmy)
+
#define GRAY_TO_COLOR_RAW_FUNC(T, bits) \
-static unsigned \
+CFUNC \
gray_##bits##_to_color_raw(const stp_vars_t *vars, const unsigned char *in,\
unsigned short *out) \
{ \
@@ -758,50 +950,42 @@ gray_##bits##_to_color_raw(const stp_vars_t *vars, const unsigned char *in,\
return nz; \
}
-GRAY_TO_COLOR_RAW_FUNC(unsigned char, 8)
-GRAY_TO_COLOR_RAW_FUNC(unsigned short, 16)
+GRAY_TO_COLOR_RAW_FUNC(unsigned char, 8) // gray_8_to_color_raw
+GRAY_TO_COLOR_RAW_FUNC(unsigned short, 16) // gray_16_to_color_raw
GENERIC_COLOR_FUNC(gray, color_raw)
-#define COLOR_TO_KCMY_FUNC(name, name2, name3, name4, bits) \
-static unsigned \
-name##_##bits##_to_##name2(const stp_vars_t *vars, const unsigned char *in, \
- unsigned short *out) \
-{ \
- lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
- size_t real_steps = lut->steps; \
- unsigned status; \
- if (!lut->cmy_tmp) \
- lut->cmy_tmp = stp_malloc(4 * 2 * lut->image_width); \
- name##_##bits##_to_##name3(vars, in, lut->cmy_tmp); \
- lut->steps = 65536; \
- status = name4##_cmy_to_kcmy(vars, lut->cmy_tmp, out); \
- lut->steps = real_steps; \
- return status; \
+#define GRAY_TO_KCMY_RAW_FUNC(T, bits) \
+CFUNC \
+gray_##bits##_to_kcmy_raw(const stp_vars_t *vars, const unsigned char *in, \
+ unsigned short *out) \
+{ \
+ int i; \
+ int nz = 7; \
+ const T *s_in = (const T *) in; \
+ lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
+ unsigned mask = 0; \
+ if (lut->invert_output) \
+ mask = 0xffff; \
+ \
+ for (i = 0; i < lut->image_width; i++, out += 4, s_in++) \
+ { \
+ unsigned outval = (s_in[0] * (65535 / (1 << bits))) ^ mask; \
+ out[0] = outval; \
+ out[1] = 0; \
+ out[2] = 0; \
+ out[3] = 0; \
+ if (outval) \
+ nz = 0; \
+ } \
+ return nz; \
}
-COLOR_TO_KCMY_FUNC(gray, kcmy, color, raw, 8)
-COLOR_TO_KCMY_FUNC(gray, kcmy, color, raw, 16)
-GENERIC_COLOR_FUNC(gray, kcmy)
-
-COLOR_TO_KCMY_FUNC(gray, kcmy_raw, color_raw, raw, 8)
-COLOR_TO_KCMY_FUNC(gray, kcmy_raw, color_raw, raw, 16)
+GRAY_TO_KCMY_RAW_FUNC(unsigned char, 8) // gray_8_to_kcmy_raw
+GRAY_TO_KCMY_RAW_FUNC(unsigned short, 16) // gray_16_to_kcmy_raw
GENERIC_COLOR_FUNC(gray, kcmy_raw)
-COLOR_TO_KCMY_FUNC(color, kcmy, color, raw, 8)
-COLOR_TO_KCMY_FUNC(color, kcmy, color, raw, 16)
-GENERIC_COLOR_FUNC(color, kcmy)
-
-COLOR_TO_KCMY_FUNC(color, kcmy_fast, color_fast, raw, 8)
-COLOR_TO_KCMY_FUNC(color, kcmy_fast, color_fast, raw, 16)
-GENERIC_COLOR_FUNC(color, kcmy_fast)
-
-COLOR_TO_KCMY_FUNC(color, kcmy_raw, color_raw, raw, 8)
-COLOR_TO_KCMY_FUNC(color, kcmy_raw, color_raw, raw, 16)
-GENERIC_COLOR_FUNC(color, kcmy_raw)
-
-
#define COLOR_TO_KCMY_THRESHOLD_FUNC(T, name) \
-static unsigned \
+CFUNC \
name##_to_kcmy_threshold(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -853,12 +1037,12 @@ name##_to_kcmy_threshold(const stp_vars_t *vars, \
return z; \
}
-COLOR_TO_KCMY_THRESHOLD_FUNC(unsigned char, color_8)
-COLOR_TO_KCMY_THRESHOLD_FUNC(unsigned short, color_16)
+COLOR_TO_KCMY_THRESHOLD_FUNC(unsigned char, color_8) // color_8_to_kcmy_threshold
+COLOR_TO_KCMY_THRESHOLD_FUNC(unsigned short, color_16) // color_16_to_kcmy_threshold
GENERIC_COLOR_FUNC(color, kcmy_threshold)
#define CMYK_TO_KCMY_THRESHOLD_FUNC(T, name) \
-static unsigned \
+CFUNC \
name##_to_kcmy_threshold(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -900,12 +1084,12 @@ name##_to_kcmy_threshold(const stp_vars_t *vars, \
return z; \
}
-CMYK_TO_KCMY_THRESHOLD_FUNC(unsigned char, cmyk_8)
-CMYK_TO_KCMY_THRESHOLD_FUNC(unsigned short, cmyk_16)
+CMYK_TO_KCMY_THRESHOLD_FUNC(unsigned char, cmyk_8) // cmyk_8_to_kcmy_threshold
+CMYK_TO_KCMY_THRESHOLD_FUNC(unsigned short, cmyk_16) // cmyk_16_to_kcmy_threshodl
GENERIC_COLOR_FUNC(cmyk, kcmy_threshold)
#define KCMY_TO_KCMY_THRESHOLD_FUNC(T, name) \
-static unsigned \
+CFUNC \
name##_to_kcmy_threshold(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -940,12 +1124,12 @@ name##_to_kcmy_threshold(const stp_vars_t *vars, \
return z; \
}
-KCMY_TO_KCMY_THRESHOLD_FUNC(unsigned char, kcmy_8)
-KCMY_TO_KCMY_THRESHOLD_FUNC(unsigned short, kcmy_16)
+KCMY_TO_KCMY_THRESHOLD_FUNC(unsigned char, kcmy_8) // kcmy_8_to_kcmy_threshold
+KCMY_TO_KCMY_THRESHOLD_FUNC(unsigned short, kcmy_16) // kcmy_8_to_kcmy_threshold
GENERIC_COLOR_FUNC(kcmy, kcmy_threshold)
#define GRAY_TO_COLOR_THRESHOLD_FUNC(T, name, bits, channels) \
-static unsigned \
+CFUNC \
gray_##bits##_to_##name##_threshold(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -975,16 +1159,16 @@ gray_##bits##_to_##name##_threshold(const stp_vars_t *vars, \
}
-GRAY_TO_COLOR_THRESHOLD_FUNC(unsigned char, color, 8, 3)
-GRAY_TO_COLOR_THRESHOLD_FUNC(unsigned short, color, 16, 3)
+GRAY_TO_COLOR_THRESHOLD_FUNC(unsigned char, color, 8, 3) // gray_8_to_color_threshold
+GRAY_TO_COLOR_THRESHOLD_FUNC(unsigned short, color, 16, 3) // gray_16_to_color_threshold
GENERIC_COLOR_FUNC(gray, color_threshold)
-GRAY_TO_COLOR_THRESHOLD_FUNC(unsigned char, kcmy, 8, 4)
-GRAY_TO_COLOR_THRESHOLD_FUNC(unsigned short, kcmy, 16, 4)
+GRAY_TO_COLOR_THRESHOLD_FUNC(unsigned char, kcmy, 8, 4) // gray_8_to_kcmy_threshold
+GRAY_TO_COLOR_THRESHOLD_FUNC(unsigned short, kcmy, 16, 4) // gray_16_to_kcmy_threshold
GENERIC_COLOR_FUNC(gray, kcmy_threshold)
#define COLOR_TO_COLOR_THRESHOLD_FUNC(T, name) \
-static unsigned \
+CFUNC \
name##_to_color_threshold(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1021,12 +1205,12 @@ name##_to_color_threshold(const stp_vars_t *vars, \
return z; \
}
-COLOR_TO_COLOR_THRESHOLD_FUNC(unsigned char, color_8)
-COLOR_TO_COLOR_THRESHOLD_FUNC(unsigned short, color_16)
+COLOR_TO_COLOR_THRESHOLD_FUNC(unsigned char, color_8) // color_8_to_color_threshold
+COLOR_TO_COLOR_THRESHOLD_FUNC(unsigned short, color_16) // color_8_to_color_threshold
GENERIC_COLOR_FUNC(color, color_threshold)
#define COLOR_TO_GRAY_THRESHOLD_FUNC(T, name, channels, max_channels) \
-static unsigned \
+CFUNC \
name##_to_gray_threshold(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1059,95 +1243,92 @@ name##_to_gray_threshold(const stp_vars_t *vars, \
return z; \
}
-COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned char, cmyk_8, 4, 4)
-COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned short, cmyk_16, 4, 4)
+COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned char, cmyk_8, 4, 4) // cmyk_8_to_gray_threshold
+COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned short, cmyk_16, 4, 4) // cmyk_16_to_gray_threshold
GENERIC_COLOR_FUNC(cmyk, gray_threshold)
-COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned char, kcmy_8, 4, 4)
-COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned short, kcmy_16, 4, 4)
+COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned char, kcmy_8, 4, 4) // kcmy_8_to_gray_threshold
+COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned short, kcmy_16, 4, 4) // kcmy_16_to_gray_threshold
GENERIC_COLOR_FUNC(kcmy, gray_threshold)
-COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned char, color_8, 3, 3)
-COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned short, color_16, 3, 3)
+COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned char, color_8, 3, 3) // color_8_to_gray_threshold
+COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned short, color_16, 3, 3) // color_16_to_gray_threshold
GENERIC_COLOR_FUNC(color, gray_threshold)
-COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned char, gray_8, 1, 1)
-COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned short, gray_16, 1, 1)
+COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned char, gray_8, 1, 1) // gray_8_to_gray_threshold
+COLOR_TO_GRAY_THRESHOLD_FUNC(unsigned short, gray_16, 1, 1) // gray_16_to_gray_threshold
GENERIC_COLOR_FUNC(gray, gray_threshold)
-#define CMYK_TO_COLOR_FUNC(namein, name2, T, bits, offset) \
-static unsigned \
+#define CMYK_TO_COLOR_FUNC(namein, name2, T, bits, offset) \
+static unsigned \
namein##_##bits##_to_##name2(const stp_vars_t *vars, const unsigned char *in, \
- unsigned short *out) \
-{ \
- int i; \
- lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
- unsigned status; \
- size_t real_steps = lut->steps; \
- const T *s_in = (const T *) in; \
- unsigned short *tmp; \
- int width = lut->image_width; \
- unsigned mask = 0; \
- \
- if (!lut->cmy_tmp) \
- lut->cmy_tmp = stp_malloc(3 * 2 * lut->image_width); \
- tmp = lut->cmy_tmp; \
- memset(lut->cmy_tmp, 0, width * 3 * sizeof(unsigned short)); \
- if (lut->invert_output) \
- mask = 0xffff; \
- \
- for (i = 0; i < width; i++, tmp += 3, s_in += 4) \
- { \
- unsigned c = (s_in[0 + offset] + s_in[(3 + offset) % 4]) * \
- (65535 / ((1 << bits) - 1)); \
- unsigned m = (s_in[1 + offset] + s_in[(3 + offset) % 4]) * \
- (65535 / ((1 << bits) - 1)); \
- unsigned y = (s_in[2 + offset] + s_in[(3 + offset) % 4]) * \
- (65535 / ((1 << bits) - 1)); \
- if (c > 65535) \
- c = 65535; \
- if (m > 65535) \
- m = 65535; \
- if (y > 65535) \
- y = 65535; \
- tmp[0] = c ^ mask; \
- tmp[1] = m ^ mask; \
- tmp[2] = y ^ mask; \
- } \
- lut->steps = 65536; \
- status = \
- color_16_to_##name2(vars, (const unsigned char *) lut->cmy_tmp, out); \
- lut->steps = real_steps; \
- return status; \
+ unsigned short *out) \
+{ \
+ int i; \
+ lut_t *lut = (lut_t *)(stp_get_component_data(vars, "Color")); \
+ unsigned status; \
+ size_t real_steps = lut->steps; \
+ const T *s_in = (const T *) in; \
+ unsigned short *tmp; \
+ int width = lut->image_width; \
+ \
+ if (!lut->cmy_tmp) \
+ lut->cmy_tmp = stp_malloc(3 * 2 * lut->image_width); \
+ tmp = lut->cmy_tmp; \
+ memset(lut->cmy_tmp, 0, width * 3 * sizeof(unsigned short)); \
+ \
+ for (i = 0; i < width; i++, tmp += 3, s_in += 4) \
+ { \
+ unsigned c = (s_in[0 + offset] + s_in[(3 + offset) % 4]) * \
+ (65535 / MAXB(bits)); \
+ unsigned m = (s_in[1 + offset] + s_in[(3 + offset) % 4]) * \
+ (65535 / MAXB(bits)); \
+ unsigned y = (s_in[2 + offset] + s_in[(3 + offset) % 4]) * \
+ (65535 / MAXB(bits)); \
+ if (c > MAXB(16)) \
+ c = MAXB(16); \
+ if (m > MAXB(16)) \
+ m = MAXB(16); \
+ if (y > MAXB(16)) \
+ y = MAXB(16); \
+ tmp[0] = c; \
+ tmp[1] = m; \
+ tmp[2] = y; \
+ } \
+ lut->steps = 65536; \
+ status = \
+ color_16_to_##name2(vars, (const unsigned char *) lut->cmy_tmp, out); \
+ lut->steps = real_steps; \
+ return status; \
}
-CMYK_TO_COLOR_FUNC(cmyk, color, unsigned char, 8, 0)
-CMYK_TO_COLOR_FUNC(cmyk, color, unsigned short, 16, 0)
+CMYK_TO_COLOR_FUNC(cmyk, color, unsigned char, 8, 0) // cmyk_8_to_color
+CMYK_TO_COLOR_FUNC(cmyk, color, unsigned short, 16, 0) // cmyk_16_to_color
GENERIC_COLOR_FUNC(cmyk, color)
-CMYK_TO_COLOR_FUNC(kcmy, color, unsigned char, 8, 1)
-CMYK_TO_COLOR_FUNC(kcmy, color, unsigned short, 16, 1)
+CMYK_TO_COLOR_FUNC(kcmy, color, unsigned char, 8, 1) // kcmy_8_to_color
+CMYK_TO_COLOR_FUNC(kcmy, color, unsigned short, 16, 1) // kcmy_16_to_color
GENERIC_COLOR_FUNC(kcmy, color)
-CMYK_TO_COLOR_FUNC(cmyk, color_threshold, unsigned char, 8, 0)
-CMYK_TO_COLOR_FUNC(cmyk, color_threshold, unsigned short, 16, 0)
+CMYK_TO_COLOR_FUNC(cmyk, color_threshold, unsigned char, 8, 0) // cmyk_8_to_color_threshold
+CMYK_TO_COLOR_FUNC(cmyk, color_threshold, unsigned short, 16, 0) // cmyk_16_to_color_threshold
GENERIC_COLOR_FUNC(cmyk, color_threshold)
-CMYK_TO_COLOR_FUNC(kcmy, color_threshold, unsigned char, 8, 1)
-CMYK_TO_COLOR_FUNC(kcmy, color_threshold, unsigned short, 16, 1)
+CMYK_TO_COLOR_FUNC(kcmy, color_threshold, unsigned char, 8, 1) // kcmy_8_to_color_threshold
+CMYK_TO_COLOR_FUNC(kcmy, color_threshold, unsigned short, 16, 1) // kcmy_16_to_color_threshold
GENERIC_COLOR_FUNC(kcmy, color_threshold)
-CMYK_TO_COLOR_FUNC(cmyk, color_fast, unsigned char, 8, 0)
-CMYK_TO_COLOR_FUNC(cmyk, color_fast, unsigned short, 16, 0)
+CMYK_TO_COLOR_FUNC(cmyk, color_fast, unsigned char, 8, 0) // cmyk_8_to_color_fast
+CMYK_TO_COLOR_FUNC(cmyk, color_fast, unsigned short, 16, 0) // cmyk_16_to_color_fast
GENERIC_COLOR_FUNC(cmyk, color_fast)
-CMYK_TO_COLOR_FUNC(kcmy, color_fast, unsigned char, 8, 1)
-CMYK_TO_COLOR_FUNC(kcmy, color_fast, unsigned short, 16, 1)
+CMYK_TO_COLOR_FUNC(kcmy, color_fast, unsigned char, 8, 1) // kcmy_8_to_color_fast
+CMYK_TO_COLOR_FUNC(kcmy, color_fast, unsigned short, 16, 1) // kcmy_16_to_color_fast
GENERIC_COLOR_FUNC(kcmy, color_fast)
-CMYK_TO_COLOR_FUNC(cmyk, color_raw, unsigned char, 8, 0)
-CMYK_TO_COLOR_FUNC(cmyk, color_raw, unsigned short, 16, 0)
+CMYK_TO_COLOR_FUNC(cmyk, color_raw, unsigned char, 8, 0) // cmyk_8_to_color_raw
+CMYK_TO_COLOR_FUNC(cmyk, color_raw, unsigned short, 16, 0) // cmyk_16_to_color_raw
GENERIC_COLOR_FUNC(cmyk, color_raw)
-CMYK_TO_COLOR_FUNC(kcmy, color_raw, unsigned char, 8, 1)
-CMYK_TO_COLOR_FUNC(kcmy, color_raw, unsigned short, 16, 1)
+CMYK_TO_COLOR_FUNC(kcmy, color_raw, unsigned char, 8, 1) // kcmy_8_to_color_raw
+CMYK_TO_COLOR_FUNC(kcmy, color_raw, unsigned short, 16, 1) // kcmy_16_to_color_raw
GENERIC_COLOR_FUNC(kcmy, color_raw)
#define CMYK_TO_KCMY_FUNC(T, size) \
-static unsigned \
+CFUNC \
cmyk_##size##_to_kcmy(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1187,12 +1368,12 @@ cmyk_##size##_to_kcmy(const stp_vars_t *vars, \
return retval; \
}
-CMYK_TO_KCMY_FUNC(unsigned char, 8)
-CMYK_TO_KCMY_FUNC(unsigned short, 16)
+CMYK_TO_KCMY_FUNC(unsigned char, 8) // cmyk_8_to_kcmy
+CMYK_TO_KCMY_FUNC(unsigned short, 16) // cmyk_16_to_kcmy
GENERIC_COLOR_FUNC(cmyk, kcmy)
#define KCMY_TO_KCMY_FUNC(T, size) \
-static unsigned \
+CFUNC \
kcmy_##size##_to_kcmy(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1231,13 +1412,13 @@ kcmy_##size##_to_kcmy(const stp_vars_t *vars, \
return retval; \
}
-KCMY_TO_KCMY_FUNC(unsigned char, 8)
-KCMY_TO_KCMY_FUNC(unsigned short, 16)
+KCMY_TO_KCMY_FUNC(unsigned char, 8) // kcmy_8_to_kcmy
+KCMY_TO_KCMY_FUNC(unsigned short, 16) // kcmy_16_to_kcmy
GENERIC_COLOR_FUNC(kcmy, kcmy)
#define GRAY_TO_GRAY_FUNC(T, bits) \
-static unsigned \
+CFUNC \
gray_##bits##_to_gray(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1276,12 +1457,12 @@ gray_##bits##_to_gray(const stp_vars_t *vars, \
return nz == 0; \
}
-GRAY_TO_GRAY_FUNC(unsigned char, 8)
-GRAY_TO_GRAY_FUNC(unsigned short, 16)
+GRAY_TO_GRAY_FUNC(unsigned char, 8) // gray_8_to_gray
+GRAY_TO_GRAY_FUNC(unsigned short, 16) // gray_16_to_gray
GENERIC_COLOR_FUNC(gray, gray)
#define COLOR_TO_GRAY_FUNC(T, bits) \
-static unsigned \
+CFUNC \
color_##bits##_to_gray(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1332,13 +1513,13 @@ color_##bits##_to_gray(const stp_vars_t *vars, \
return nz == 0; \
}
-COLOR_TO_GRAY_FUNC(unsigned char, 8)
-COLOR_TO_GRAY_FUNC(unsigned short, 16)
+COLOR_TO_GRAY_FUNC(unsigned char, 8) // color_8_to_gray
+COLOR_TO_GRAY_FUNC(unsigned short, 16) // color_16_to_gray
GENERIC_COLOR_FUNC(color, gray)
#define CMYK_TO_GRAY_FUNC(T, bits) \
-static unsigned \
+CFUNC \
cmyk_##bits##_to_gray(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1393,12 +1574,12 @@ cmyk_##bits##_to_gray(const stp_vars_t *vars, \
return nz ? 0 : 1; \
}
-CMYK_TO_GRAY_FUNC(unsigned char, 8)
-CMYK_TO_GRAY_FUNC(unsigned short, 16)
+CMYK_TO_GRAY_FUNC(unsigned char, 8) // cmyk_8_to_gray
+CMYK_TO_GRAY_FUNC(unsigned short, 16) // cmyk_16_to_gray
GENERIC_COLOR_FUNC(cmyk, gray)
#define KCMY_TO_GRAY_FUNC(T, bits) \
-static unsigned \
+CFUNC \
kcmy_##bits##_to_gray(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1453,12 +1634,12 @@ kcmy_##bits##_to_gray(const stp_vars_t *vars, \
return nz ? 0 : 1; \
}
-KCMY_TO_GRAY_FUNC(unsigned char, 8)
-KCMY_TO_GRAY_FUNC(unsigned short, 16)
+KCMY_TO_GRAY_FUNC(unsigned char, 8) // kcmy_8_to_gray
+KCMY_TO_GRAY_FUNC(unsigned short, 16) // kcmy_16_to_gray
GENERIC_COLOR_FUNC(kcmy, gray)
#define GRAY_TO_GRAY_RAW_FUNC(T, bits) \
-static unsigned \
+CFUNC \
gray_##bits##_to_gray_raw(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1484,12 +1665,12 @@ gray_##bits##_to_gray_raw(const stp_vars_t *vars, \
return nz == 0; \
}
-GRAY_TO_GRAY_RAW_FUNC(unsigned char, 8)
-GRAY_TO_GRAY_RAW_FUNC(unsigned short, 16)
+GRAY_TO_GRAY_RAW_FUNC(unsigned char, 8) // gray_8_to_gray_raw
+GRAY_TO_GRAY_RAW_FUNC(unsigned short, 16) // gray_16_to_gray_raw
GENERIC_COLOR_FUNC(gray, gray_raw)
#define COLOR_TO_GRAY_RAW_FUNC(T, bits, invertable, name2) \
-static unsigned \
+CFUNC \
color_##bits##_to_gray_##name2(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1536,15 +1717,16 @@ color_##bits##_to_gray_##name2(const stp_vars_t *vars, \
return nz == 0; \
}
-COLOR_TO_GRAY_RAW_FUNC(unsigned char, 8, 1, raw)
-COLOR_TO_GRAY_RAW_FUNC(unsigned short, 16, 1, raw)
+COLOR_TO_GRAY_RAW_FUNC(unsigned char, 8, 1, raw) // color_8_to_gray_raw
+COLOR_TO_GRAY_RAW_FUNC(unsigned short, 16, 1, raw) // color_16_to_gray_raw
GENERIC_COLOR_FUNC(color, gray_raw)
-COLOR_TO_GRAY_RAW_FUNC(unsigned char, 8, 0, noninvert)
-COLOR_TO_GRAY_RAW_FUNC(unsigned short, 16, 0, noninvert)
+COLOR_TO_GRAY_RAW_FUNC(unsigned char, 8, 0, noninvert) // color_8_to_gray_noninvert
+COLOR_TO_GRAY_RAW_FUNC(unsigned short, 16, 0, noninvert) // color_16_to_gray_noninvert
+// GENERIC_COLOR_FUNC(color, gray_noninvert)
#define CMYK_TO_GRAY_RAW_FUNC(T, bits, invertable, name2) \
-static unsigned \
+CFUNC \
cmyk_##bits##_to_gray_##name2(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1596,14 +1778,15 @@ cmyk_##bits##_to_gray_##name2(const stp_vars_t *vars, \
return nz ? 0 : 1; \
}
-CMYK_TO_GRAY_RAW_FUNC(unsigned char, 8, 1, raw)
-CMYK_TO_GRAY_RAW_FUNC(unsigned short, 16, 1, raw)
+CMYK_TO_GRAY_RAW_FUNC(unsigned char, 8, 1, raw) // cmyk_8_to_gray_raw
+CMYK_TO_GRAY_RAW_FUNC(unsigned short, 16, 1, raw) // cmyk_16_to_gray_raw
GENERIC_COLOR_FUNC(cmyk, gray_raw)
-CMYK_TO_GRAY_RAW_FUNC(unsigned char, 8, 0, noninvert)
-CMYK_TO_GRAY_RAW_FUNC(unsigned short, 16, 0, noninvert)
+CMYK_TO_GRAY_RAW_FUNC(unsigned char, 8, 0, noninvert) // cmyk_8_to_gray_noninvert
+CMYK_TO_GRAY_RAW_FUNC(unsigned short, 16, 0, noninvert) // cmyk_16_to_gray_noninvert
+// GENERIC_COLOR_FUNC(cmyk, gray_noninvert)
#define KCMY_TO_GRAY_RAW_FUNC(T, bits, invertable, name2) \
-static unsigned \
+CFUNC \
kcmy_##bits##_to_gray_##name2(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1655,14 +1838,15 @@ kcmy_##bits##_to_gray_##name2(const stp_vars_t *vars, \
return nz ? 0 : 1; \
}
-KCMY_TO_GRAY_RAW_FUNC(unsigned char, 8, 1, raw)
-KCMY_TO_GRAY_RAW_FUNC(unsigned short, 16, 1, raw)
+KCMY_TO_GRAY_RAW_FUNC(unsigned char, 8, 1, raw) // kcmy_8_to_gray_raw
+KCMY_TO_GRAY_RAW_FUNC(unsigned short, 16, 1, raw) // kcmy_16_to_gray_raw
GENERIC_COLOR_FUNC(kcmy, gray_raw)
-KCMY_TO_GRAY_RAW_FUNC(unsigned char, 8, 0, noninvert)
-KCMY_TO_GRAY_RAW_FUNC(unsigned short, 16, 0, noninvert)
+KCMY_TO_GRAY_RAW_FUNC(unsigned char, 8, 0, noninvert) // kcmy_8_to_gray_noninvert
+KCMY_TO_GRAY_RAW_FUNC(unsigned short, 16, 0, noninvert) // kcmy_16_to_gray_noninvert
+// GENERIC_COLOR_FUNC(kcmy, gray_noninvert)
#define CMYK_TO_KCMY_RAW_FUNC(T, bits) \
-static unsigned \
+CFUNC \
cmyk_##bits##_to_kcmy_raw(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1692,12 +1876,12 @@ cmyk_##bits##_to_kcmy_raw(const stp_vars_t *vars, \
return retval; \
}
-CMYK_TO_KCMY_RAW_FUNC(unsigned char, 8)
-CMYK_TO_KCMY_RAW_FUNC(unsigned short, 16)
+CMYK_TO_KCMY_RAW_FUNC(unsigned char, 8) // cmyk_8_to_kcmy_raw
+CMYK_TO_KCMY_RAW_FUNC(unsigned short, 16) // cmyk_16_to_kcmy_raw
GENERIC_COLOR_FUNC(cmyk, kcmy_raw)
#define KCMY_TO_KCMY_RAW_FUNC(T, bits) \
-static unsigned \
+CFUNC \
kcmy_##bits##_to_kcmy_raw(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1726,12 +1910,12 @@ kcmy_##bits##_to_kcmy_raw(const stp_vars_t *vars, \
return retval; \
}
-KCMY_TO_KCMY_RAW_FUNC(unsigned char, 8)
-KCMY_TO_KCMY_RAW_FUNC(unsigned short, 16)
+KCMY_TO_KCMY_RAW_FUNC(unsigned char, 8) // kcmy_8_to_kcmy_raw
+KCMY_TO_KCMY_RAW_FUNC(unsigned short, 16) // kcmy_16_to_kcmy_raw
GENERIC_COLOR_FUNC(kcmy, kcmy_raw)
#define DESATURATED_FUNC(name, name2, bits) \
-static unsigned \
+CFUNC \
name##_##bits##_to_##name2##_desaturated(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1748,29 +1932,29 @@ name##_##bits##_to_##name2##_desaturated(const stp_vars_t *vars, \
return status; \
}
-DESATURATED_FUNC(color, color, 8)
-DESATURATED_FUNC(color, color, 16)
+DESATURATED_FUNC(color, color, 8) // color_8_to_color_desaturated
+DESATURATED_FUNC(color, color, 16) // color_16_to_color_desaturated
GENERIC_COLOR_FUNC(color, color_desaturated)
-DESATURATED_FUNC(color, kcmy, 8)
-DESATURATED_FUNC(color, kcmy, 16)
+DESATURATED_FUNC(color, kcmy, 8) // color_8_to_kcmy_desaturated
+DESATURATED_FUNC(color, kcmy, 16) // color_8_to_kcmy_desaturated
GENERIC_COLOR_FUNC(color, kcmy_desaturated)
-DESATURATED_FUNC(cmyk, color, 8)
-DESATURATED_FUNC(cmyk, color, 16)
+DESATURATED_FUNC(cmyk, color, 8) // cmyk_8_to_color_desaturated
+DESATURATED_FUNC(cmyk, color, 16) // cmyk_16_to_color_desaturated
GENERIC_COLOR_FUNC(cmyk, color_desaturated)
-DESATURATED_FUNC(cmyk, kcmy, 8)
-DESATURATED_FUNC(cmyk, kcmy, 16)
+DESATURATED_FUNC(cmyk, kcmy, 8) // cmyk_8_to_kcmy_desaturated
+DESATURATED_FUNC(cmyk, kcmy, 16) // cmyk_16_to_kcmy_desaturated
GENERIC_COLOR_FUNC(cmyk, kcmy_desaturated)
-DESATURATED_FUNC(kcmy, color, 8)
-DESATURATED_FUNC(kcmy, color, 16)
+DESATURATED_FUNC(kcmy, color, 8) // kcmy_8_to_color_desaturated
+DESATURATED_FUNC(kcmy, color, 16) // kcmy_16_to_kcmy_desaturated
GENERIC_COLOR_FUNC(kcmy, color_desaturated)
-DESATURATED_FUNC(kcmy, kcmy, 8)
-DESATURATED_FUNC(kcmy, kcmy, 16)
+DESATURATED_FUNC(kcmy, kcmy, 8) // kcmy_8_to_color_desaturated
+DESATURATED_FUNC(kcmy, kcmy, 16) // kcmy_16_to_kcmy_desaturated
GENERIC_COLOR_FUNC(kcmy, kcmy_desaturated)
#define CMYK_DISPATCH(name) \
-static unsigned \
+CFUNC \
CMYK_to_##name(const stp_vars_t *vars, const unsigned char *in, \
unsigned short *out) \
{ \
@@ -1787,21 +1971,21 @@ CMYK_to_##name(const stp_vars_t *vars, const unsigned char *in, \
} \
}
-CMYK_DISPATCH(color)
-CMYK_DISPATCH(color_raw)
-CMYK_DISPATCH(color_fast)
-CMYK_DISPATCH(color_threshold)
-CMYK_DISPATCH(color_desaturated)
-CMYK_DISPATCH(kcmy)
-CMYK_DISPATCH(kcmy_raw)
-CMYK_DISPATCH(kcmy_threshold)
-CMYK_DISPATCH(kcmy_desaturated)
-CMYK_DISPATCH(gray)
-CMYK_DISPATCH(gray_raw)
-CMYK_DISPATCH(gray_threshold)
+CMYK_DISPATCH(color) /* CMYK_to_color */
+CMYK_DISPATCH(color_raw) /* CMYK_to_color_raw */
+CMYK_DISPATCH(color_fast) /* CMYK_to_color_fast */
+CMYK_DISPATCH(color_threshold) /* CMYK_to_color_threshold */
+CMYK_DISPATCH(color_desaturated) /* CMYK_to_color_desaturated */
+CMYK_DISPATCH(kcmy) /* CMYK_to_kcmy */
+CMYK_DISPATCH(kcmy_raw) /* CMYK_to_kcmy_raw */
+CMYK_DISPATCH(kcmy_threshold) /* CMYK_to_kcmy_threshold */
+CMYK_DISPATCH(kcmy_desaturated) /* CMYK_to_kcmy_desaturated */
+CMYK_DISPATCH(gray) /* CMYK_to_gray */
+CMYK_DISPATCH(gray_raw) /* CMYK_to_gray_raw */
+CMYK_DISPATCH(gray_threshold) /* CMYK_to_gray_threshold */
#define RAW_TO_RAW_THRESHOLD_FUNC(T, name) \
-static unsigned \
+CFUNC \
name##_to_raw_threshold(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1836,12 +2020,12 @@ name##_to_raw_threshold(const stp_vars_t *vars, \
return z; \
}
-RAW_TO_RAW_THRESHOLD_FUNC(unsigned char, raw_8)
-RAW_TO_RAW_THRESHOLD_FUNC(unsigned short, raw_16)
+RAW_TO_RAW_THRESHOLD_FUNC(unsigned char, raw_8) // raw_8_to_raw_threshold
+RAW_TO_RAW_THRESHOLD_FUNC(unsigned short, raw_16) // raw_16_to_raw_threshold
GENERIC_COLOR_FUNC(raw, raw_threshold)
#define RAW_TO_RAW_FUNC(T, size) \
-static unsigned \
+CFUNC \
raw_##size##_to_raw(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1880,13 +2064,13 @@ raw_##size##_to_raw(const stp_vars_t *vars, \
return retval; \
}
-RAW_TO_RAW_FUNC(unsigned char, 8)
-RAW_TO_RAW_FUNC(unsigned short, 16)
+RAW_TO_RAW_FUNC(unsigned char, 8) // raw_8_to_raw
+RAW_TO_RAW_FUNC(unsigned short, 16) // raw_8_to_raw
GENERIC_COLOR_FUNC(raw, raw)
#define RAW_TO_RAW_RAW_FUNC(T, bits) \
-static unsigned \
+CFUNC \
raw_##bits##_to_raw_raw(const stp_vars_t *vars, \
const unsigned char *in, \
unsigned short *out) \
@@ -1916,68 +2100,86 @@ raw_##bits##_to_raw_raw(const stp_vars_t *vars, \
return retval; \
}
-RAW_TO_RAW_RAW_FUNC(unsigned char, 8)
-RAW_TO_RAW_RAW_FUNC(unsigned short, 16)
+RAW_TO_RAW_RAW_FUNC(unsigned char, 8) // raw_8_to_raw_raw
+RAW_TO_RAW_RAW_FUNC(unsigned short, 16) // raw_16_to_raw_raw
GENERIC_COLOR_FUNC(raw, raw_raw)
-#define CONVERSION_FUNCTION_WITH_FAST(from, to, from2) \
-static unsigned \
-generic_##from##_to_##to(const stp_vars_t *v, \
- const unsigned char *in, \
- unsigned short *out) \
-{ \
- lut_t *lut = (lut_t *)(stp_get_component_data(v, "Color")); \
- switch (lut->color_correction->correction) \
- { \
- case COLOR_CORRECTION_UNCORRECTED: \
- return from2##_to_##to##_fast(v, in, out); \
- case COLOR_CORRECTION_ACCURATE: \
- case COLOR_CORRECTION_BRIGHT: \
- case COLOR_CORRECTION_HUE: \
- return from2##_to_##to(v, in, out); \
- case COLOR_CORRECTION_DESATURATED: \
- return from2##_to_##to##_desaturated(v, in, out); \
- case COLOR_CORRECTION_THRESHOLD: \
- case COLOR_CORRECTION_PREDITHERED: \
- return from2##_to_##to##_threshold(v, in, out); \
- case COLOR_CORRECTION_DENSITY: \
- case COLOR_CORRECTION_RAW: \
- return from2##_to_##to##_raw(v, in, out); \
- default: \
- return (unsigned) -1; \
- } \
+#define CONVERSION_FUNCTION_WITH_FAST(from, to, from2) \
+CFUNC \
+generic_##from##_to_##to(const stp_vars_t *v, \
+ const unsigned char *in, \
+ unsigned short *out) \
+{ \
+ lut_t *lut = (lut_t *)(stp_get_component_data(v, "Color")); \
+ switch (lut->color_correction->correction) \
+ { \
+ case COLOR_CORRECTION_UNCORRECTED: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s_fast\n", #from2, #to); \
+ return from2##_to_##to##_fast(v, in, out); \
+ case COLOR_CORRECTION_ACCURATE: \
+ case COLOR_CORRECTION_BRIGHT: \
+ case COLOR_CORRECTION_HUE: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s\n", #from2, #to); \
+ return from2##_to_##to(v, in, out); \
+ case COLOR_CORRECTION_DESATURATED: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s_desaturated\n", #from2, #to); \
+ return from2##_to_##to##_desaturated(v, in, out); \
+ case COLOR_CORRECTION_THRESHOLD: \
+ case COLOR_CORRECTION_PREDITHERED: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s_threshold\n", #from2, #to); \
+ return from2##_to_##to##_threshold(v, in, out); \
+ case COLOR_CORRECTION_DENSITY: \
+ case COLOR_CORRECTION_RAW: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s_raw\n", #from2, #to); \
+ return from2##_to_##to##_raw(v, in, out); \
+ default: \
+ return (unsigned) -1; \
+ } \
}
-#define CONVERSION_FUNCTION_WITHOUT_FAST(from, to, from2) \
-static unsigned \
-generic_##from##_to_##to(const stp_vars_t *v, \
- const unsigned char *in, \
- unsigned short *out) \
-{ \
- lut_t *lut = (lut_t *)(stp_get_component_data(v, "Color")); \
- switch (lut->color_correction->correction) \
- { \
- case COLOR_CORRECTION_UNCORRECTED: \
- case COLOR_CORRECTION_ACCURATE: \
- case COLOR_CORRECTION_BRIGHT: \
- case COLOR_CORRECTION_HUE: \
- return from2##_to_##to(v, in, out); \
- case COLOR_CORRECTION_DESATURATED: \
- return from2##_to_##to##_desaturated(v, in, out); \
- case COLOR_CORRECTION_THRESHOLD: \
- case COLOR_CORRECTION_PREDITHERED: \
- return from2##_to_##to##_threshold(v, in, out); \
- case COLOR_CORRECTION_DENSITY: \
- case COLOR_CORRECTION_RAW: \
- return from2##_to_##to##_raw(v, in, out); \
- default: \
- return (unsigned) -1; \
- } \
+#define CONVERSION_FUNCTION_WITHOUT_FAST(from, to, from2) \
+CFUNC \
+generic_##from##_to_##to(const stp_vars_t *v, \
+ const unsigned char *in, \
+ unsigned short *out) \
+{ \
+ lut_t *lut = (lut_t *)(stp_get_component_data(v, "Color")); \
+ switch (lut->color_correction->correction) \
+ { \
+ case COLOR_CORRECTION_UNCORRECTED: \
+ case COLOR_CORRECTION_ACCURATE: \
+ case COLOR_CORRECTION_BRIGHT: \
+ case COLOR_CORRECTION_HUE: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s\n", #from2, #to); \
+ return from2##_to_##to(v, in, out); \
+ case COLOR_CORRECTION_DESATURATED: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s_desaturated\n", #from2, #to); \
+ return from2##_to_##to##_desaturated(v, in, out); \
+ case COLOR_CORRECTION_THRESHOLD: \
+ case COLOR_CORRECTION_PREDITHERED: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s_threshold\n", #from2, #to); \
+ return from2##_to_##to##_threshold(v, in, out); \
+ case COLOR_CORRECTION_DENSITY: \
+ case COLOR_CORRECTION_RAW: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s_raw\n", #from2, #to); \
+ return from2##_to_##to##_raw(v, in, out); \
+ default: \
+ return (unsigned) -1; \
+ } \
}
#define CONVERSION_FUNCTION_WITHOUT_DESATURATED(from, to, from2) \
-static unsigned \
+CFUNC \
generic_##from##_to_##to(const stp_vars_t *v, \
const unsigned char *in, \
unsigned short *out) \
@@ -1990,27 +2192,33 @@ generic_##from##_to_##to(const stp_vars_t *v, \
case COLOR_CORRECTION_BRIGHT: \
case COLOR_CORRECTION_HUE: \
case COLOR_CORRECTION_DESATURATED: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s\n", #from2, #to); \
return from2##_to_##to(v, in, out); \
case COLOR_CORRECTION_THRESHOLD: \
case COLOR_CORRECTION_PREDITHERED: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s_threshold\n", #from2, #to); \
return from2##_to_##to##_threshold(v, in, out); \
case COLOR_CORRECTION_DENSITY: \
case COLOR_CORRECTION_RAW: \
+ stp_dprintf(STP_DBG_COLORFUNC, v, \
+ "Colorfunc: %s_to_%s_raw\n", #from2, #to); \
return from2##_to_##to##_raw(v, in, out); \
default: \
return (unsigned) -1; \
} \
}
-CONVERSION_FUNCTION_WITH_FAST(cmyk, color, CMYK)
-CONVERSION_FUNCTION_WITH_FAST(color, color, color)
-CONVERSION_FUNCTION_WITH_FAST(color, kcmy, color)
-CONVERSION_FUNCTION_WITHOUT_FAST(cmyk, kcmy, CMYK)
-CONVERSION_FUNCTION_WITHOUT_DESATURATED(cmyk, gray, CMYK)
-CONVERSION_FUNCTION_WITHOUT_DESATURATED(color, gray, color)
-CONVERSION_FUNCTION_WITHOUT_DESATURATED(gray, gray, gray)
-CONVERSION_FUNCTION_WITHOUT_DESATURATED(gray, color, gray)
-CONVERSION_FUNCTION_WITHOUT_DESATURATED(gray, kcmy, gray)
+CONVERSION_FUNCTION_WITH_FAST(cmyk, color, CMYK) // generic_cmyk_to_color
+CONVERSION_FUNCTION_WITH_FAST(color, color, color) // generic_color_to_color
+CONVERSION_FUNCTION_WITH_FAST(color, kcmy, color) // generic_color_to_kcmy
+CONVERSION_FUNCTION_WITHOUT_FAST(cmyk, kcmy, CMYK) // generic_cmyk_to_kcmy
+CONVERSION_FUNCTION_WITHOUT_DESATURATED(cmyk, gray, CMYK) // generic_cmyk_to_gray
+CONVERSION_FUNCTION_WITHOUT_DESATURATED(color, gray, color) // generic_color_to_gray
+CONVERSION_FUNCTION_WITHOUT_DESATURATED(gray, gray, gray) // generic_gray_to_gray
+CONVERSION_FUNCTION_WITHOUT_DESATURATED(gray, color, gray) // generic_gray_to_color
+CONVERSION_FUNCTION_WITHOUT_DESATURATED(gray, kcmy, gray) // generic_gray_to_kcmy
unsigned
stpi_color_convert_to_gray(const stp_vars_t *v,
@@ -2088,16 +2296,19 @@ stpi_color_convert_raw(const stp_vars_t *v,
{
case COLOR_CORRECTION_THRESHOLD:
case COLOR_CORRECTION_PREDITHERED:
+ stp_dprintf(STP_DBG_COLORFUNC, v, "Colorfunc: raw_to_raw_threshold\n");
return raw_to_raw_threshold(v, in, out);
case COLOR_CORRECTION_UNCORRECTED:
case COLOR_CORRECTION_BRIGHT:
case COLOR_CORRECTION_HUE:
case COLOR_CORRECTION_ACCURATE:
case COLOR_CORRECTION_DESATURATED:
+ stp_dprintf(STP_DBG_COLORFUNC, v, "Colorfunc: raw_to_raw_desaturated\n");
return raw_to_raw(v, in, out);
case COLOR_CORRECTION_RAW:
case COLOR_CORRECTION_DEFAULT:
case COLOR_CORRECTION_DENSITY:
+ stp_dprintf(STP_DBG_COLORFUNC, v, "Colorfunc: raw_to_raw_raw\n");
return raw_to_raw_raw(v, in, out);
default:
return (unsigned) -1;
diff --git a/src/main/color.c b/src/main/color.c
index c84653e..579c87e 100644
--- a/src/main/color.c
+++ b/src/main/color.c
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
diff --git a/src/main/curve-cache.c b/src/main/curve-cache.c
index ed28423..f09861c 100644
--- a/src/main/curve-cache.c
+++ b/src/main/curve-cache.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
diff --git a/src/main/curve.c b/src/main/curve.c
index a833376..2aeb15e 100644
--- a/src/main/curve.c
+++ b/src/main/curve.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -386,6 +385,25 @@ stpi_curve_set_points(stp_curve_t *curve, size_t points)
return 1;
}
+static int
+stpi_curve_set_data(stp_curve_t *curve, size_t points, const double *data)
+{
+ if (points < 2)
+ return 0;
+ if (points > curve_point_limit ||
+ (curve->wrap_mode == STP_CURVE_WRAP_AROUND &&
+ points > curve_point_limit - 1))
+ return 0;
+ clear_curve_data(curve);
+ if (curve->wrap_mode == STP_CURVE_WRAP_AROUND)
+ points++;
+ if (curve->piecewise)
+ points *= 2;
+ if ((stp_sequence_set_data(curve->seq, points, data)) == 0)
+ return 0;
+ return 1;
+}
+
/*
* Create a default curve
*/
@@ -553,7 +571,7 @@ int
stp_curve_set_interpolation_type(stp_curve_t *curve, stp_curve_type_t itype)
{
CHECK_CURVE(curve);
- if (itype < 0 || itype >= stpi_curve_type_count)
+ if (itype >= stpi_curve_type_count)
return 0;
curve->curve_type = itype;
return 1;
@@ -1031,7 +1049,7 @@ interpolate_gamma_internal(const stp_curve_t *curve, double where)
double blo, bhi;
size_t real_point_count;
- real_point_count = get_real_point_count(curve);;
+ real_point_count = get_real_point_count(curve);
if (real_point_count)
where /= (real_point_count - 1);
@@ -1232,20 +1250,61 @@ stp_curve_resample(stp_curve_t *curve, size_t points)
}
curve->piecewise = 0;
}
+ else if (curve->gamma)
+ {
+ double fgamma = curve->gamma;
+ double blo, bhi;
+ int negative_gamma = 0;
+ stp_sequence_get_bounds(curve->seq, &blo, &bhi);
+ if (fgamma > 0)
+ {
+ fgamma = -fgamma;
+ negative_gamma = 1;
+ }
+ for (i = 0; i < limit; i++)
+ {
+ double where = ((double) i * (double) old / (double) (limit - 1));
+ if (negative_gamma)
+ where = 1.0 - where;
+ new_vec[i] = blo + ((bhi - blo) * pow(where, fgamma));
+ }
+ }
else
{
+ double blo, bhi;
+ const double *seq_data;
+ size_t seq_count;
+ size_t point_count = get_point_count(curve);
+ stp_sequence_get_data(curve->seq, &seq_count, &seq_data);
+ stp_sequence_get_bounds(curve->seq, &blo, &bhi);
+ if (curve->recompute_interval)
+ compute_intervals((stpi_cast_safe(curve)));
for (i = 0; i < limit; i++)
- if (curve->gamma)
- new_vec[i] =
- interpolate_gamma_internal(curve, ((double) i * (double) old /
- (double) (limit - 1)));
- else
- new_vec[i] =
- interpolate_point_internal(curve, ((double) i * (double) old /
- (double) (limit - 1)));
- }
- stpi_curve_set_points(curve, points);
- stp_sequence_set_subrange(curve->seq, 0, limit, new_vec);
+ {
+ double where = ((double) i * (double) old / (double) (limit - 1));
+ int iwhere = (int) where;
+ double frac = where - (double) iwhere;
+ if (frac == 0.0)
+ new_vec[i] = seq_data[iwhere];
+ else if (curve->curve_type == STP_CURVE_TYPE_LINEAR)
+ new_vec[i] = seq_data[iwhere] + (frac * curve->interval[iwhere]);
+ else
+ {
+ int iwhere1 = iwhere + 1;
+ while (iwhere1 > point_count)
+ iwhere1 -= point_count;
+ new_vec[i] =
+ do_interpolate_spline(seq_data[iwhere], seq_data[iwhere1],
+ frac, curve->interval[iwhere],
+ curve->interval[iwhere1], 1.0);
+ if (new_vec[i] > bhi)
+ new_vec[i] = bhi;
+ else if (new_vec[i] < blo)
+ new_vec[i] = blo;
+ }
+ }
+ }
+ stpi_curve_set_data(curve, points, new_vec);
curve->recompute_interval = 1;
stp_free(new_vec);
return 1;
@@ -1447,6 +1506,9 @@ stp_curve_create_from_xmltree(stp_mxml_node_t *curve) /* The curve node */
int piecewise = 0;
stp_xml_init();
+ /* FIXME Need protection against unlimited recursion */
+ if ((stmp = stp_mxmlElementGetAttr(curve, "src")) != NULL)
+ return stp_curve_create_from_file(stmp);
/* Get curve type */
stmp = stp_mxmlElementGetAttr(curve, "type");
if (stmp)
@@ -1518,7 +1580,7 @@ stp_curve_create_from_xmltree(stp_mxml_node_t *curve) /* The curve node */
ret = stp_curve_create(wrap_mode);
stp_curve_set_interpolation_type(ret, curve_type);
- child = stp_mxmlFindElement(curve, curve, "sequence", NULL, NULL, STP_MXML_DESCEND);
+ child = stp_xml_get_node(curve, "sequence", NULL);
if (child)
seq = stp_sequence_create_from_xmltree(child);
@@ -1590,6 +1652,11 @@ stp_curve_create_from_xmltree(stp_mxml_node_t *curve) /* The curve node */
error:
stp_deprintf(STP_DBG_CURVE_ERRORS,
"stp_curve_create_from_xmltree: error during curve read\n");
+ if (seq)
+ {
+ stp_sequence_destroy(seq);
+ seq = NULL;
+ }
if (ret)
stp_curve_destroy(ret);
stp_xml_exit();
@@ -1862,7 +1929,20 @@ stp_curve_create_from_file(const char* file)
{
stp_curve_t *curve = NULL;
stp_mxml_node_t *doc;
- FILE *fp = fopen(file, "r");
+ FILE *fp = NULL;
+ if (file[0] != '/' && strncmp(file, "./", 2) && strncmp(file, "../", 3))
+ {
+ char *fn = stp_path_find_file(NULL, file);
+ if (fn)
+ {
+ fp = fopen(file, "r");
+ free(fn);
+ }
+ }
+ else if (file)
+ {
+ fp = fopen(file, "r");
+ }
if (!fp)
{
stp_deprintf(STP_DBG_CURVE_ERRORS,
diff --git a/src/main/dither-ed.c b/src/main/dither-ed.c
index 7b8ce89..3bf31af 100644
--- a/src/main/dither-ed.c
+++ b/src/main/dither-ed.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
diff --git a/src/main/dither-eventone.c b/src/main/dither-eventone.c
index 121c5fa..b0a03d5 100644
--- a/src/main/dither-eventone.c
+++ b/src/main/dither-eventone.c
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This code uses the Eventone dither algorithm. This is described
* at the website http://www.artofcode.com/eventone/
diff --git a/src/main/dither-impl.h b/src/main/dither-impl.h
index a2a26f2..70a5189 100644
--- a/src/main/dither-impl.h
+++ b/src/main/dither-impl.h
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
@@ -38,8 +37,10 @@ extern "C" {
#include <limits.h>
#ifdef __GNUC__
+#ifndef inline
#define inline __inline__
#endif
+#endif
#define D_FLOYD_HYBRID 0
#define D_ADAPTIVE_BASE 4
diff --git a/src/main/dither-inks.c b/src/main/dither-inks.c
index 4c1250d..68ac9f7 100644
--- a/src/main/dither-inks.c
+++ b/src/main/dither-inks.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
diff --git a/src/main/dither-inlined-functions.h b/src/main/dither-inlined-functions.h
index ac93a02..0f5d2b9 100644
--- a/src/main/dither-inlined-functions.h
+++ b/src/main/dither-inlined-functions.h
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
diff --git a/src/main/dither-main.c b/src/main/dither-main.c
index 240d80d..12b79c6 100644
--- a/src/main/dither-main.c
+++ b/src/main/dither-main.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
diff --git a/src/main/dither-ordered.c b/src/main/dither-ordered.c
index 6e9b533..4588e2b 100644
--- a/src/main/dither-ordered.c
+++ b/src/main/dither-ordered.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
diff --git a/src/main/dither-predithered.c b/src/main/dither-predithered.c
index ed5bdcd..5befe6d 100644
--- a/src/main/dither-predithered.c
+++ b/src/main/dither-predithered.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
diff --git a/src/main/dither-very-fast.c b/src/main/dither-very-fast.c
index db89ce2..f7e7765 100644
--- a/src/main/dither-very-fast.c
+++ b/src/main/dither-very-fast.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
diff --git a/src/main/escp2-channels.c b/src/main/escp2-channels.c
index 1fcfb37..9e3b4e7 100644
--- a/src/main/escp2-channels.c
+++ b/src/main/escp2-channels.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -396,70 +395,56 @@ load_inklist(stp_mxml_node_t *node, stp_mxml_node_t *root, inklist_t *ikl)
}
}
+/*
+ * This is structured differently from the other XML loaders because of
+ * the default black inkset
+ */
static inkgroup_t *
load_inkgroup(const char *name)
{
- stp_list_t *dirlist = stpi_data_path();
- stp_list_item_t *item;
- inkgroup_t *igl = NULL;
- item = stp_list_get_start(dirlist);
- while (item)
+ inkgroup_t *igl = (inkgroup_t *) stp_refcache_find_item("escp2Inkgroup", name);
+ if (! igl)
{
- const char *dn = (const char *) stp_list_item_get_data(item);
- char *ffn = stpi_path_merge(dn, name);
- stp_mxml_node_t *inkgroup =
- stp_mxmlLoadFromFile(NULL, ffn, STP_MXML_NO_CALLBACK);
- stp_free(ffn);
- if (inkgroup)
+ stp_mxml_node_t *node =
+ stp_xml_parse_file_from_path_uncached_safe(name, "escp2InkGroup", NULL);
+ stp_mxml_node_t *child = node->child;
+ igl = stp_zalloc(sizeof(inkgroup_t));
+ stp_refcache_add_item("escpInkgroup", name, igl);
+ size_t count = 0;
+ while (child)
{
- int count = 0;
- stp_mxml_node_t *node = stp_mxmlFindElement(inkgroup, inkgroup,
- "escp2InkGroup", NULL,
- NULL, STP_MXML_DESCEND);
- if (node)
- {
- stp_mxml_node_t *child = node->child;
- igl = stp_zalloc(sizeof(inkgroup_t));
- while (child)
- {
- if (child->type == STP_MXML_ELEMENT &&
- !strcmp(child->value.element.name, "InkList"))
- count++;
- child = child->next;
- }
- igl->n_inklists = count;
- if (stp_mxmlElementGetAttr(node, "name"))
- igl->name = stp_strdup(stp_mxmlElementGetAttr(node, "name"));
- else
- igl->name = stp_strdup(name);
- igl->inklists = stp_zalloc(sizeof(inklist_t) * count);
- child = node->child;
- count = 0;
- while (child)
- {
- if (child->type == STP_MXML_ELEMENT &&
- !strcmp(child->value.element.name, "InkList"))
- load_inklist(child, node, &(igl->inklists[count++]));
- child = child->next;
- }
- }
- stp_mxmlDelete(inkgroup);
- break;
+ if (child->type == STP_MXML_ELEMENT &&
+ !strcmp(child->value.element.name, "InkList"))
+ count++;
+ child = child->next;
+ }
+ igl->n_inklists = count;
+ if (stp_mxmlElementGetAttr(node, "name"))
+ igl->name = stp_strdup(stp_mxmlElementGetAttr(node, "name"));
+ else
+ igl->name = stp_strdup(name);
+ igl->inklists = stp_zalloc(sizeof(inklist_t) * count);
+ child = node->child;
+ count = 0;
+ while (child)
+ {
+ if (child->type == STP_MXML_ELEMENT &&
+ !strcmp(child->value.element.name, "InkList"))
+ load_inklist(child, node, &(igl->inklists[count++]));
+ child = child->next;
}
- item = stp_list_item_next(item);
+ stp_xml_free_parsed_file(node);
}
- stp_list_destroy(dirlist);
return igl;
}
int
-stp_escp2_load_inkgroup(const stp_vars_t *v, const char *name)
+stpi_escp2_load_inkgroup(const stp_vars_t *v, const char *name)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
inkgroup_t *igl = load_inkgroup(name);
- STPI_ASSERT(igl, v);
printdef->inkgroup = igl;
- return (igl != NULL);
+ return 1;
}
const inkname_t *
diff --git a/src/main/escp2-driver.c b/src/main/escp2-driver.c
index f3c8d51..13c39e7 100644
--- a/src/main/escp2-driver.c
+++ b/src/main/escp2-driver.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
diff --git a/src/main/escp2-papers.c b/src/main/escp2-papers.c
index 5eebc49..19d1b98 100644
--- a/src/main/escp2-papers.c
+++ b/src/main/escp2-papers.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -32,42 +31,23 @@
static stp_mxml_node_t *
get_media_size_xml(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->media_sizes;
}
int
-stp_escp2_load_media_sizes(const stp_vars_t *v, const char *name)
+stpi_escp2_load_media_sizes(const stp_vars_t *v, const char *name)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
- stp_list_t *dirlist = stpi_data_path();
- stp_list_item_t *item;
- int found = 0;
- item = stp_list_get_start(dirlist);
- while (item)
- {
- const char *dn = (const char *) stp_list_item_get_data(item);
- char *ffn = stpi_path_merge(dn, name);
- stp_mxml_node_t *sizes =
- stp_mxmlLoadFromFile(NULL, ffn, STP_MXML_NO_CALLBACK);
- stp_free(ffn);
- if (sizes)
- {
- stp_mxml_node_t **xnode =
- (stp_mxml_node_t **) &(printdef->media_sizes);
- *xnode = sizes;
- found = 1;
- break;
- }
- item = stp_list_item_next(item);
- }
- stp_list_destroy(dirlist);
- STPI_ASSERT(found, v);
- return found;
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
+ stp_mxml_node_t *node =
+ stp_xml_parse_file_from_path_safe(name, "escp2MediaSizes", NULL);
+ stp_mxml_node_t **xnode = (stp_mxml_node_t **) &(printdef->media_sizes);
+ *xnode = node;
+ return 1;
}
void
-stp_escp2_set_media_size(stp_vars_t *v, const stp_vars_t *src)
+stpi_escp2_set_media_size(stp_vars_t *v, const stp_vars_t *src)
{
const char *name = stp_get_string_parameter(src, "PageSize");
if (name)
@@ -98,74 +78,59 @@ paper_namefunc(const void *item)
}
int
-stp_escp2_load_media(const stp_vars_t *v, const char *name)
+stpi_escp2_load_media(const stp_vars_t *v, const char *name)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
- stp_list_t *dirlist = stpi_data_path();
- stp_list_item_t *item;
- int found = 0;
- item = stp_list_get_start(dirlist);
- while (item)
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
+ stp_mxml_node_t *node =
+ stp_xml_parse_file_from_path_safe(name, "escp2Papers", NULL);
+ stp_mxml_node_t **xnode = (stp_mxml_node_t **) &(printdef->media);
+ stp_list_t **xcache = (stp_list_t **) &(printdef->media_cache);
+ stp_string_list_t **xpapers = (stp_string_list_t **) &(printdef->papers);
+ static const char *xcache_cache = "escp2Papers_xcache";
+ static const char *xpapers_cache = "escp2Papers_xpapers";
+ *xnode = node->parent;
+ *xcache = (stp_list_t *) stp_refcache_find_item(xcache_cache, name);
+ if (! *xcache)
{
- const char *dn = (const char *) stp_list_item_get_data(item);
- char *ffn = stpi_path_merge(dn, name);
- stp_mxml_node_t *media =
- stp_mxmlLoadFromFile(NULL, ffn, STP_MXML_NO_CALLBACK);
- stp_free(ffn);
- if (media)
+ *xcache = stp_list_create();
+ stp_list_set_namefunc(*xcache, paper_namefunc);
+ stp_refcache_add_item(xcache_cache, name, *xcache);
+ }
+ *xpapers = (stp_string_list_t *) stp_refcache_find_item(xpapers_cache, name);
+ if (! *xpapers)
+ {
+ *xpapers = stp_string_list_create();
+ stp_refcache_add_item(xpapers_cache, name, *xpapers);
+ node = node->child;
+ while (node)
{
- stp_mxml_node_t **xnode =
- (stp_mxml_node_t **) &(printdef->media);
- stp_list_t **xlist =
- (stp_list_t **) &(printdef->media_cache);
- stp_string_list_t **xpapers =
- (stp_string_list_t **) &(printdef->papers);
- stp_mxml_node_t *node = stp_mxmlFindElement(media, media,
- "escp2Papers", NULL,
- NULL, STP_MXML_DESCEND);
- *xnode = media;
- *xlist = stp_list_create();
- stp_list_set_namefunc(*xlist, paper_namefunc);
- *xpapers = stp_string_list_create();
- if (node)
- {
- node = node->child;
- while (node)
- {
- if (node->type == STP_MXML_ELEMENT &&
- strcmp(node->value.element.name, "paper") == 0)
- stp_string_list_add_string(*xpapers,
- stp_mxmlElementGetAttr(node, "name"),
- stp_mxmlElementGetAttr(node, "text"));
- node = node->next;
- }
- }
- found = 1;
- break;
+ if (node->type == STP_MXML_ELEMENT &&
+ strcmp(node->value.element.name, "paper") == 0)
+ stp_string_list_add_string(*xpapers,
+ stp_mxmlElementGetAttr(node, "name"),
+ stp_mxmlElementGetAttr(node, "text"));
+ node = node->next;
}
- item = stp_list_item_next(item);
}
- stp_list_destroy(dirlist);
- STPI_ASSERT(found, v);
- return found;
+ return 1;
}
static stp_mxml_node_t *
get_media_xml(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->media;
}
static stp_list_t *
get_media_cache(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->media_cache;
}
int
-stp_escp2_has_media_feature(const stp_vars_t *v, const char *name)
+stpi_escp2_has_media_feature(const stp_vars_t *v, const char *name)
{
stp_mxml_node_t *doc = get_media_xml(v);
if (doc)
@@ -246,10 +211,10 @@ get_media_type_named(const stp_vars_t *v, const char *name,
{
paper_t *answer = NULL;
int i;
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
const stp_string_list_t *p = printdef->papers;
- const res_t *res = ignore_res ? NULL : stp_escp2_find_resolution(v);
- const inklist_t *inklist = stp_escp2_inklist(v);
+ const res_t *res = ignore_res ? NULL : stpi_escp2_find_resolution(v);
+ const inklist_t *inklist = stpi_escp2_inklist(v);
char *media_id = build_media_id(name, inklist, res);
stp_list_t *cache = get_media_cache(v);
stp_list_item_t *li = stp_list_get_item_by_name(cache, media_id);
@@ -265,15 +230,9 @@ get_media_type_named(const stp_vars_t *v, const char *name,
{
if (!strcmp(name, stp_string_list_param(p, i)->name))
{
-#ifdef HAVE_LOCALE_H
- char *locale = stp_strdup(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, "C");
-#endif
+ stp_xml_init();
answer = build_media_type(v, name, inklist, res);
-#ifdef HAVE_LOCALE_H
- setlocale(LC_ALL, locale);
- stp_free(locale);
-#endif
+ stp_xml_exit();
break;
}
}
@@ -287,9 +246,9 @@ get_media_type_named(const stp_vars_t *v, const char *name,
}
const paper_t *
-stp_escp2_get_media_type(const stp_vars_t *v, int ignore_res)
+stpi_escp2_get_media_type(const stp_vars_t *v, int ignore_res)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
const stp_string_list_t *p = printdef->papers;
if (p)
{
@@ -301,9 +260,9 @@ stp_escp2_get_media_type(const stp_vars_t *v, int ignore_res)
}
const paper_t *
-stp_escp2_get_default_media_type(const stp_vars_t *v)
+stpi_escp2_get_default_media_type(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
const stp_string_list_t *p = printdef->papers;
if (p)
{
@@ -323,69 +282,56 @@ slots_namefunc(const void *item)
}
int
-stp_escp2_load_input_slots(const stp_vars_t *v, const char *name)
+stpi_escp2_load_input_slots(const stp_vars_t *v, const char *name)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
- stp_list_t *dirlist = stpi_data_path();
- stp_list_item_t *item;
- int found = 0;
- item = stp_list_get_start(dirlist);
- while (item)
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
+ stp_mxml_node_t *node =
+ stp_xml_parse_file_from_path_safe(name, "escp2InputSlots", NULL);
+ stp_mxml_node_t **xnode = (stp_mxml_node_t **) &(printdef->slots);
+ stp_list_t **xcache = (stp_list_t **) &(printdef->slots_cache);
+ stp_string_list_t **xslots = (stp_string_list_t **) &(printdef->input_slots);
+ static const char *xcache_cache = "escp2InputSlots_xcache";
+ static const char *xslots_cache = "escp2InputSlots_slots";
+
+ *xnode = node->parent;
+ *xcache = (stp_list_t *) stp_refcache_find_item(xcache_cache, name);
+ if (! *xcache)
+ {
+ *xcache = stp_list_create();
+ stp_list_set_namefunc(*xcache, slots_namefunc);
+ stp_refcache_add_item(xcache_cache, name, *xcache);
+ }
+
+ *xslots = (stp_string_list_t *) stp_refcache_find_item(xslots_cache, name);
+ if (! *xslots)
{
- const char *dn = (const char *) stp_list_item_get_data(item);
- char *ffn = stpi_path_merge(dn, name);
- stp_mxml_node_t *slots =
- stp_mxmlLoadFromFile(NULL, ffn, STP_MXML_NO_CALLBACK);
- stp_free(ffn);
- if (slots)
+ *xslots = stp_string_list_create();
+ stp_refcache_add_item(xslots_cache, name, *xslots);
+ node = node->child;
+ while (node)
{
- stp_mxml_node_t **xnode =
- (stp_mxml_node_t **) &(printdef->slots);
- stp_list_t **xlist =
- (stp_list_t **) &(printdef->slots_cache);
- stp_string_list_t **xslots =
- (stp_string_list_t **) &(printdef->input_slots);
- stp_mxml_node_t *node = stp_mxmlFindElement(slots, slots,
- "escp2InputSlots", NULL,
- NULL, STP_MXML_DESCEND);
- *xnode = slots;
- *xlist = stp_list_create();
- stp_list_set_namefunc(*xlist, slots_namefunc);
- *xslots = stp_string_list_create();
- if (node)
- {
- node = node->child;
- while (node)
- {
- if (node->type == STP_MXML_ELEMENT &&
- strcmp(node->value.element.name, "slot") == 0)
- stp_string_list_add_string(*xslots,
- stp_mxmlElementGetAttr(node, "name"),
- stp_mxmlElementGetAttr(node, "text"));
- node = node->next;
- }
- }
- found = 1;
- break;
+ if (node->type == STP_MXML_ELEMENT &&
+ strcmp(node->value.element.name, "slot") == 0)
+ stp_string_list_add_string(*xslots,
+ stp_mxmlElementGetAttr(node, "name"),
+ stp_mxmlElementGetAttr(node, "text"));
+ node = node->next;
}
- item = stp_list_item_next(item);
}
- stp_list_destroy(dirlist);
- STPI_ASSERT(found, v);
- return found;
+ return 1;
}
static stp_mxml_node_t *
get_slots_xml(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->slots;
}
static stp_list_t *
get_slots_cache(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->slots_cache;
}
@@ -403,65 +349,65 @@ build_input_slot(const stp_vars_t *v, const char *name)
answer = stp_zalloc(sizeof(input_slot_t));
answer->name = stp_mxmlElementGetAttr(node, "name");
answer->text = gettext(stp_mxmlElementGetAttr(node, "text"));
- n1 = stp_mxmlFindElement(node, node, "CD", NULL, NULL, STP_MXML_DESCEND);
+ n1 = stp_xml_get_node(node, "CD", NULL);
if (n1)
answer->is_cd = 1;
- n1 = stp_mxmlFindElement(node, node, "RollFeed", NULL, NULL, STP_MXML_DESCEND);
+ n1 = stp_xml_get_node(node, "RollFeed", NULL);
if (n1)
{
answer->is_roll_feed = 1;
- if (stp_mxmlFindElement(n1, n1, "CutAll", NULL, NULL, STP_MXML_DESCEND))
+ if (stp_xml_get_node(n1, "CutAll", NULL))
answer->roll_feed_cut_flags |= ROLL_FEED_CUT_ALL;
- if (stp_mxmlFindElement(n1, n1, "CutLast", NULL, NULL, STP_MXML_DESCEND))
+ if (stp_xml_get_node(n1, "CutLast", NULL))
answer->roll_feed_cut_flags |= ROLL_FEED_CUT_LAST;
- if (stp_mxmlFindElement(n1, n1, "DontEject", NULL, NULL, STP_MXML_DESCEND))
+ if (stp_xml_get_node(n1, "DontEject", NULL))
answer->roll_feed_cut_flags |= ROLL_FEED_DONT_EJECT;
}
- n1 = stp_mxmlFindElement(node, node, "Duplex", NULL, NULL, STP_MXML_DESCEND);
+ n1 = stp_xml_get_node(node, "Duplex", NULL);
if (n1)
{
- if (stp_mxmlFindElement(n1, n1, "Tumble", NULL, NULL, STP_MXML_DESCEND))
+ if (stp_xml_get_node(n1, "Tumble", NULL))
answer->duplex |= DUPLEX_TUMBLE;
- if (stp_mxmlFindElement(n1, n1, "NoTumble", NULL, NULL, STP_MXML_DESCEND))
+ if (stp_xml_get_node(n1, "NoTumble", NULL))
answer->duplex |= DUPLEX_NO_TUMBLE;
}
- n1 = stp_mxmlFindElement(node, node, "InitSequence", NULL, NULL, STP_MXML_DESCEND);
+ n1 = stp_xml_get_node(node, "InitSequence", NULL);
if (n1 && n1->child && n1->child->type == STP_MXML_TEXT)
answer->init_sequence = stp_xmlstrtoraw(n1->child->value.text.string);
- n1 = stp_mxmlFindElement(node, node, "DeinitSequence", NULL, NULL, STP_MXML_DESCEND);
+ n1 = stp_xml_get_node(node, "DeinitSequence", NULL);
if (n1 && n1->child && n1->child->type == STP_MXML_TEXT)
answer->deinit_sequence = stp_xmlstrtoraw(n1->child->value.text.string);
- n1 = stp_mxmlFindElement(node, node, "ExtraHeight", NULL, NULL, STP_MXML_DESCEND);
+ n1 = stp_xml_get_node(node, "ExtraHeight", NULL);
if (n1 && n1->child && n1->child->type == STP_MXML_TEXT)
answer->extra_height = stp_xmlstrtoul(n1->child->value.text.string);
return answer;
}
int
-stp_escp2_printer_supports_rollfeed(const stp_vars_t *v)
+stpi_escp2_printer_supports_rollfeed(const stp_vars_t *v)
{
stp_mxml_node_t *node = get_slots_xml(v);
- if (stp_mxmlFindElement(node, node, "RollFeed", NULL, NULL, STP_MXML_DESCEND))
+ if (stp_xml_get_node(node, "RollFeed", NULL))
return 1;
else
return 0;
}
int
-stp_escp2_printer_supports_print_to_cd(const stp_vars_t *v)
+stpi_escp2_printer_supports_print_to_cd(const stp_vars_t *v)
{
stp_mxml_node_t *node = get_slots_xml(v);
- if (stp_mxmlFindElement(node, node, "CD", NULL, NULL, STP_MXML_DESCEND))
+ if (stp_xml_get_node(node, "CD", NULL))
return 1;
else
return 0;
}
int
-stp_escp2_printer_supports_duplex(const stp_vars_t *v)
+stpi_escp2_printer_supports_duplex(const stp_vars_t *v)
{
stp_mxml_node_t *node = get_slots_xml(v);
- if (stp_mxmlFindElement(node, node, "Duplex", NULL, NULL, STP_MXML_DESCEND))
+ if (stp_xml_get_node(node, "Duplex", NULL))
return 1;
else
return 0;
@@ -472,7 +418,7 @@ get_input_slot_named(const stp_vars_t *v, const char *name)
{
input_slot_t *answer = NULL;
int i;
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
const stp_string_list_t *p = printdef->input_slots;
stp_list_t *cache = get_slots_cache(v);
stp_list_item_t *li = stp_list_get_item_by_name(cache, name);
@@ -485,15 +431,9 @@ get_input_slot_named(const stp_vars_t *v, const char *name)
{
if (!strcmp(name, stp_string_list_param(p, i)->name))
{
-#ifdef HAVE_LOCALE_H
- char *locale = stp_strdup(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, "C");
-#endif
+ stp_xml_init();
answer = build_input_slot(v, name);
-#ifdef HAVE_LOCALE_H
- setlocale(LC_ALL, locale);
- stp_free(locale);
-#endif
+ stp_xml_exit();
break;
}
}
@@ -504,9 +444,9 @@ get_input_slot_named(const stp_vars_t *v, const char *name)
}
const input_slot_t *
-stp_escp2_get_input_slot(const stp_vars_t *v)
+stpi_escp2_get_input_slot(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
const stp_string_list_t *p = printdef->input_slots;
if (p)
{
diff --git a/src/main/escp2-resolutions.c b/src/main/escp2-resolutions.c
index 27798e4..f099907 100644
--- a/src/main/escp2-resolutions.c
+++ b/src/main/escp2-resolutions.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -29,11 +28,9 @@
#include "print-escp2.h"
-int
-stp_escp2_load_printer_weaves_from_xml(const stp_vars_t *v,
- stp_mxml_node_t *node)
+static printer_weave_list_t *
+stpi_escp2_load_printer_weaves_from_xml(stp_mxml_node_t *node)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
printer_weave_list_t *xpw = stp_malloc(sizeof(printer_weave_list_t));
int count = 0;
stp_mxml_node_t *child = node->child;
@@ -44,7 +41,6 @@ stp_escp2_load_printer_weaves_from_xml(const stp_vars_t *v,
count++;
child = child->next;
}
- printdef->printer_weaves = xpw;
if (stp_mxmlElementGetAttr(node, "name"))
xpw->name = stp_strdup(stp_mxmlElementGetAttr(node, "name"));
xpw->n_printer_weaves = count;
@@ -69,45 +65,35 @@ stp_escp2_load_printer_weaves_from_xml(const stp_vars_t *v,
}
child = child->next;
}
- return 1;
+ return xpw;
}
int
-stp_escp2_load_printer_weaves(const stp_vars_t *v, const char *name)
+stpi_escp2_load_printer_weaves(const stp_vars_t *v, const char *name)
{
- stp_list_t *dirlist = stpi_data_path();
- stp_list_item_t *item;
- int found = 0;
- item = stp_list_get_start(dirlist);
- while (item)
+ static const char *weave_cache = "escp2PrinterWeaves";
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
+ printer_weave_list_t *pw =
+ (printer_weave_list_t *) stp_refcache_find_item(weave_cache, name);
+ if(! pw)
{
- const char *dn = (const char *) stp_list_item_get_data(item);
- char *ffn = stpi_path_merge(dn, name);
- stp_mxml_node_t *weaves =
- stp_mxmlLoadFromFile(NULL, ffn, STP_MXML_NO_CALLBACK);
- stp_free(ffn);
- if (weaves)
- {
- stp_mxml_node_t *node = stp_mxmlFindElement(weaves, weaves,
- "escp2PrinterWeaves", NULL,
- NULL, STP_MXML_DESCEND);
- if (node)
- stp_escp2_load_printer_weaves_from_xml(v, node);
- stp_mxmlDelete(weaves);
- found = 1;
- break;
- }
- item = stp_list_item_next(item);
+ stp_mxml_node_t *node =
+ stp_xml_parse_file_from_path_uncached_safe(name, "escp2PrinterWeaves", NULL);
+ stp_dprintf(STP_DBG_ESCP2_XML, v,
+ ">>>Loading printer weave data from %s (%p)...", name, (void *) node);
+ stp_xml_init();
+ pw = stpi_escp2_load_printer_weaves_from_xml(node);
+ stp_xml_exit();
+ stp_refcache_add_item(weave_cache, name, pw);
+ stp_xml_free_parsed_file(node);
}
- stp_list_destroy(dirlist);
- STPI_ASSERT(found, v);
- return found;
+ printdef->printer_weaves = pw;
+ return 1;
}
-int
-stp_escp2_load_resolutions_from_xml(const stp_vars_t *v, stp_mxml_node_t *node)
+static resolution_list_t *
+stpi_escp2_load_resolutions_from_xml(stp_mxml_node_t *node)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
resolution_list_t *xrs = stp_malloc(sizeof(resolution_list_t));
int count = 0;
stp_mxml_node_t *child = node->child;
@@ -115,10 +101,11 @@ stp_escp2_load_resolutions_from_xml(const stp_vars_t *v, stp_mxml_node_t *node)
{
if (child->type == STP_MXML_ELEMENT &&
!strcmp(child->value.element.name, "resolution"))
- count++;
+ {
+ count++;
+ }
child = child->next;
}
- printdef->resolutions = xrs;
if (stp_mxmlElementGetAttr(node, "name"))
xrs->name = stp_strdup(stp_mxmlElementGetAttr(node, "name"));
xrs->n_resolutions = count;
@@ -184,45 +171,54 @@ stp_escp2_load_resolutions_from_xml(const stp_vars_t *v, stp_mxml_node_t *node)
}
child = child->next;
}
- return 1;
+ return xrs;
}
int
-stp_escp2_load_resolutions(const stp_vars_t *v, const char *name)
+stpi_escp2_load_resolutions(const stp_vars_t *v, const char *name,
+ stp_mxml_node_t *node)
{
- stp_list_t *dirlist = stpi_data_path();
- stp_list_item_t *item;
+ stp_dprintf(STP_DBG_ESCP2_XML, v,
+ ">>>Loading resolutions from %s (%p)...", name, (void *) node);
+ static const char *res_cache = "escp2Resolutions";
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
+ resolution_list_t *pr =
+ (resolution_list_t *) stp_refcache_find_item(res_cache, name);
int found = 0;
- item = stp_list_get_start(dirlist);
- while (item)
+ if (pr)
+ stp_dprintf(STP_DBG_ESCP2_XML, v, "cached!");
+ if(! pr)
{
- const char *dn = (const char *) stp_list_item_get_data(item);
- char *ffn = stpi_path_merge(dn, name);
- stp_mxml_node_t *resolutions =
- stp_mxmlLoadFromFile(NULL, ffn, STP_MXML_NO_CALLBACK);
- stp_free(ffn);
- if (resolutions)
+ stp_mxml_node_t *parent = NULL;
+ if (! node)
{
- stp_mxml_node_t *node = stp_mxmlFindElement(resolutions, resolutions,
- "escp2Resolutions", NULL,
- NULL, STP_MXML_DESCEND);
- if (node)
- stp_escp2_load_resolutions_from_xml(v, node);
- stp_mxmlDelete(resolutions);
- found = 1;
- break;
+ parent = stp_xml_parse_file_from_path_uncached_safe(name, "escp2Resolutions", NULL);
+ node = parent->child;
}
- item = stp_list_item_next(item);
+ while (node)
+ {
+ if (node->type == STP_MXML_ELEMENT &&
+ !strcmp(node->value.element.name, "resolutions"))
+ {
+ stp_xml_init();
+ pr = stpi_escp2_load_resolutions_from_xml(node);
+ stp_refcache_add_item(res_cache, name, pr);
+ stp_xml_exit();
+ found = 1;
+ break;
+ }
+ node = node->next;
+ }
+ stp_xml_free_parsed_file(parent);
}
- stp_list_destroy(dirlist);
- STPI_ASSERT(found, v);
+ printdef->resolutions = pr;
+ stp_dprintf(STP_DBG_ESCP2_XML, v, "(%p) done!", (void *) pr);
return found;
}
-int
-stp_escp2_load_quality_presets_from_xml(const stp_vars_t *v, stp_mxml_node_t *node)
+static quality_list_t *
+stpi_escp2_load_quality_presets_from_xml(stp_mxml_node_t *node)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
quality_list_t *qpw = stp_malloc(sizeof(quality_list_t));
int count = 0;
stp_mxml_node_t *child = node->child;
@@ -233,7 +229,6 @@ stp_escp2_load_quality_presets_from_xml(const stp_vars_t *v, stp_mxml_node_t *no
count++;
child = child->next;
}
- printdef->quality_list = qpw;
if (stp_mxmlElementGetAttr(node, "name"))
qpw->name = stp_strdup(stp_mxmlElementGetAttr(node, "name"));
qpw->n_quals = count;
@@ -286,37 +281,31 @@ stp_escp2_load_quality_presets_from_xml(const stp_vars_t *v, stp_mxml_node_t *no
}
child = child->next;
}
- return 1;
+ return qpw;
}
int
-stp_escp2_load_quality_presets(const stp_vars_t *v, const char *name)
+stpi_escp2_load_quality_presets(const stp_vars_t *v, const char *name)
{
- stp_list_t *dirlist = stpi_data_path();
- stp_list_item_t *item;
- int found = 0;
- item = stp_list_get_start(dirlist);
- while (item)
+ stp_dprintf(STP_DBG_ESCP2_XML, v,
+ ">>>Loading quality presets from %s...", name);
+ static const char *quality_cache = "escp2QualityPresets";
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
+ quality_list_t *qpw =
+ (quality_list_t *) stp_refcache_find_item(quality_cache, name);
+ if (qpw)
+ stp_dprintf(STP_DBG_ESCP2_XML, v, "cached!");
+ if(! qpw)
{
- const char *dn = (const char *) stp_list_item_get_data(item);
- char *ffn = stpi_path_merge(dn, name);
- stp_mxml_node_t *qualities =
- stp_mxmlLoadFromFile(NULL, ffn, STP_MXML_NO_CALLBACK);
- stp_free(ffn);
- if (qualities)
- {
- stp_mxml_node_t *node = stp_mxmlFindElement(qualities, qualities,
- "escp2QualityPresets", NULL,
- NULL, STP_MXML_DESCEND);
- if (node)
- stp_escp2_load_quality_presets_from_xml(v, node);
- stp_mxmlDelete(qualities);
- found = 1;
- break;
- }
- item = stp_list_item_next(item);
+ stp_mxml_node_t *node =
+ stp_xml_parse_file_from_path_uncached_safe(name, "escp2QualityPresets", NULL);
+ stp_xml_init();
+ qpw = stpi_escp2_load_quality_presets_from_xml(node);
+ stp_refcache_add_item(quality_cache, name, qpw);
+ stp_xml_free_parsed_file(node);
+ stp_xml_exit();
}
- stp_list_destroy(dirlist);
- STPI_ASSERT(found, v);
- return found;
+ printdef->quality_list = qpw;
+ stp_dprintf(STP_DBG_ESCP2_XML, v, "(%p) done!", (void *) qpw);
+ return 1;
}
diff --git a/src/main/generic-options.c b/src/main/generic-options.c
index f87d23d..054ba55 100644
--- a/src/main/generic-options.c
+++ b/src/main/generic-options.c
@@ -13,8 +13,7 @@
* 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 02111STP_CHANNEL_NONE307, USA.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
diff --git a/src/main/generic-options.h b/src/main/generic-options.h
index 7782b7f..6149fbb 100644
--- a/src/main/generic-options.h
+++ b/src/main/generic-options.h
@@ -13,8 +13,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GUTENPRINT_INTERNAL_GENERIC_OPTIONS_H
diff --git a/src/main/gutenprint-internal.h b/src/main/gutenprint-internal.h
index 5460213..ce45910 100644
--- a/src/main/gutenprint-internal.h
+++ b/src/main/gutenprint-internal.h
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
@@ -40,6 +39,7 @@ extern "C" {
#endif
#include <gutenprint/gutenprint-module.h>
+#include <time.h>
/**
* Utility functions (internal).
@@ -51,7 +51,6 @@ extern "C" {
extern void stpi_init_paper(void);
extern void stpi_init_dither(void);
extern void stpi_init_printer(void);
-extern void stpi_vars_print_error(const stp_vars_t *v, const char *prefix);
#define BUFFER_FLAG_FLIP_X 0x1
#define BUFFER_FLAG_FLIP_Y 0x2
extern stp_image_t* stpi_buffer_image(stp_image_t* image, unsigned int flags);
@@ -67,13 +66,188 @@ do \
stp_erprintf("\nERROR: ***Gutenprint %s assertion %s failed!" \
" file %s, line %d. %s\n", PACKAGE_VERSION, \
#x, __FILE__, __LINE__, "Please report this bug!"); \
- if ((v)) stpi_vars_print_error((v), "ERROR"); \
+ if ((v)) stp_vars_print_error((v), "ERROR"); \
stp_abort(); \
} \
} while (0)
/** @} */
+/* Internal printer stuff, moved from printers.h */
+typedef struct
+{
+ stp_parameter_list_t (*list_parameters)(const stp_vars_t *v);
+ void (*parameters)(const stp_vars_t *v, const char *name,
+ stp_parameter_t *);
+ void (*media_size)(const stp_vars_t *v, stp_dimension_t *width,
+ stp_dimension_t *height);
+ void (*imageable_area)(const stp_vars_t *v, stp_dimension_t *left,
+ stp_dimension_t *right, stp_dimension_t *bottom,
+ stp_dimension_t *top);
+ void (*maximum_imageable_area)(const stp_vars_t *v, stp_dimension_t *left,
+ stp_dimension_t *right, stp_dimension_t *bottom,
+ stp_dimension_t *top);
+ void (*limit)(const stp_vars_t *v, stp_dimension_t *max_width,
+ stp_dimension_t *max_height, stp_dimension_t *min_width,
+ stp_dimension_t *min_height);
+ int (*print)(const stp_vars_t *v, stp_image_t *image);
+ void (*describe_resolution)(const stp_vars_t *v, stp_resolution_t *x,
+ stp_resolution_t *y);
+ const char *(*describe_output)(const stp_vars_t *v);
+ int (*verify)(stp_vars_t *v);
+ int (*start_job)(const stp_vars_t *v, stp_image_t *image);
+ int (*end_job)(const stp_vars_t *v, stp_image_t *image);
+ stp_string_list_t *(*get_external_options)(const stp_vars_t *v);
+ const stp_papersize_t *(*describe_papersize)(const stp_vars_t *v,
+ const char *name);
+} stp_printfuncs_t;
+
+typedef struct stp_family
+{
+ const stp_printfuncs_t *printfuncs; /* printfuncs for the printer */
+ stp_list_t *printer_list; /* list of printers */
+} stp_family_t;
+
+extern int stpi_family_register(stp_list_t *family);
+extern int stpi_family_unregister(stp_list_t *family);
+
+
+/*
+ * Paper size functions
+ */
+
+typedef stp_list_t stp_papersize_list_t;
+typedef stp_list_item_t stp_papersize_list_item_t;
+#define stpi_papersize_list_get_start stp_list_get_start
+#define stpi_papersize_list_get_end stp_list_get_end
+#define stpi_paperlist_item_next stp_list_item_next
+#define stpi_paperlist_item_prev stp_list_item_prev
+#define stpi_paperlist_item_get_data(item) (stp_papersize_t *) (stp_list_item_get_data((item)))
+
+/**
+ * Get a named list of paper sizes
+ * @param name the list of paper sizes to find
+ * @param file name of the file to load (relative to $STP_XML_PATH)
+ * if the list does not exist. Empty filename indicates that the system
+ * should identify the file; NULL indicates that the list should not be
+ * created if it does not exist.
+ * @returns a static pointer to the papersize list, or NULL on failure
+ */
+extern const stp_papersize_list_t *stpi_get_papersize_list_named(const char *name,
+ const char *file);
+
+/**
+ * Create a new list of paper sizes without loading from a file.
+ * @param name the list of paper sizes to create
+ * @returns a static pointer to the (mutable) papersize list,
+ * or NULL if the list already exists
+ */
+extern stp_papersize_list_t *stpi_new_papersize_list(const char *name);
+
+/**
+ * Find an existing papersize list, if it exists
+ * @param name the list of paper sizes to find
+ * @returns a static pointer to the (mutable) papersize list,
+ * or NULL if the list does not exist
+ */
+extern stp_papersize_list_t *stpi_find_papersize_list_named(const char *name);
+
+/**
+ * Get the standard papersize list.
+ * @returns a static const pointer to the standard paper list.
+ */
+extern const stp_papersize_list_t *stpi_get_standard_papersize_list(void);
+
+/**
+ * Create and return a new paper list
+ * @returns a pointer to the new paper list
+ */
+extern stp_papersize_list_t *stpi_create_papersize_list(void);
+
+/**
+ * Get a papersize by its name from a list of papersizes Paper sizes
+ * @param list the list of papers to search
+ * @param name the name of the paper to search for
+ * @returns a static pointer to the papersize, or NULL on failure.
+ */
+extern const stp_papersize_t *stpi_get_papersize_by_name(const stp_papersize_list_t *list,
+ const char *name);
+
+/**
+ * Dispatch to printer-specific call to describe paper size
+ * @param v the Gutenprint vars object
+ * @param name the name of the paper size
+ * @returns a static pointer to the papersize, or NULL on failure.
+ */
+extern const stp_papersize_t *stpi_printer_describe_papersize(const stp_vars_t *v,
+ const char *name);
+
+
+/**
+ * Get a papersize by its name from the standard list of papersizes
+ * @param v the Gutenprint vars object
+ * @param name the name of the paper size
+ * @returns a static pointer to the papersize, or NULL on failure.
+ */
+extern const stp_papersize_t *stpi_standard_describe_papersize(const stp_vars_t *v,
+ const char *name);
+
+/**
+ * Add a new papersize to a list
+ * @param list the name of the list to search
+ * @param papersize the stp_papersize_t to add
+ * @returns 1 on success, 0 on failure (e. g. already exists)
+ */
+extern int stpi_papersize_create(stp_papersize_list_t *list,
+ stp_papersize_t *p);
+
+/**
+ * Get a papersize by its name from a list
+ * @param list the name of the list to search
+ * @param name the name of the paper size
+ * @returns a static pointer to the papersize, or NULL on failure.
+ */
+extern const stp_papersize_t *stpi_get_listed_papersize(const char *list,
+ const char *name);
+
+/**
+ * Get the number of available papersizes.
+ * @param list the paper size list
+ * @returns the number of papersizes.
+ */
+extern int stpi_papersize_count(const stp_list_t *paper_size_list);
+
+/**
+ * Get a papersize by size.
+ * The nearest available size to the size requested will be found.
+ * Only paper sizes within 5 points of width and height will be considered.
+ * @param v the Gutenprint vars object
+ * @param length the length of the paper.
+ * @param width the width of the paper
+ * @returns a static pointer to the papersize, or NULL on failure.
+ */
+extern const stp_papersize_t *stpi_get_papersize_by_size(const stp_papersize_list_t *l,
+ stp_dimension_t length,
+ stp_dimension_t width);
+
+/**
+ * Get a papersize by size if an exact match is found.
+ * @param v the Gutenprint vars object
+ * @param length the length of the paper.
+ * @param width the width of the paper
+ * @returns a static pointer to the papersize, or NULL on failure.
+ */
+extern const stp_papersize_t *stpi_get_papersize_by_size_exact(const stp_papersize_list_t *l,
+ stp_dimension_t length,
+ stp_dimension_t width);
+
+/**
+ * Check for duplicate printers. Abort if any duplicates are found.
+ */
+extern void stpi_find_duplicate_printers(void);
+
+extern time_t stpi_time(time_t *t);
+
#define CAST_IS_SAFE GCC_DIAG_OFF(cast-qual)
#define CAST_IS_UNSAFE GCC_DIAG_ON(cast-qual)
diff --git a/src/main/image.c b/src/main/image.c
index 3033da9..885ef6b 100644
--- a/src/main/image.c
+++ b/src/main/image.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
diff --git a/src/main/libgutenprint.sym b/src/main/libgutenprint.sym
index 702349a..31bb143 100644
--- a/src/main/libgutenprint.sym
+++ b/src/main/libgutenprint.sym
@@ -3,6 +3,7 @@ stp_allocate_component_data
stp_array_copy
stp_array_create
stp_array_create_copy
+stp_array_create_from_file
stp_array_create_from_xmltree
stp_array_destroy
stp_array_get_data
@@ -12,34 +13,55 @@ stp_array_get_size
stp_array_set_data
stp_array_set_point
stp_array_set_size
+stp_array_write
+stp_array_write_string
stp_asprintf
+stp_binary_age
stp_catprintf
stp_channel_add
stp_channel_convert
+stp_channel_get_black_channel
+stp_channel_get_curve
+stp_channel_get_cutoff_adjustment
+stp_channel_get_density_adjustment
+stp_channel_get_gcr_curve
+stp_channel_get_gloss_channel
+stp_channel_get_gloss_limit
+stp_channel_get_ink_limit
stp_channel_get_input
stp_channel_get_output
+stp_channel_get_output_8bit
+stp_channel_get_value
stp_channel_initialize
stp_channel_reset
stp_channel_reset_channel
stp_channel_set_black_channel
+stp_channel_set_curve
stp_channel_set_cutoff_adjustment
stp_channel_set_density_adjustment
+stp_channel_set_gcr_curve
+stp_channel_set_gloss_channel
+stp_channel_set_gloss_limit
stp_channel_set_ink_limit
stp_check_array_parameter
stp_check_boolean_parameter
stp_check_curve_parameter
+stp_check_dimension_parameter
stp_check_file_parameter
stp_check_float_parameter
stp_check_int_parameter
+stp_check_parameter
stp_check_raw_parameter
stp_check_string_parameter
stp_check_version
stp_clear_array_parameter
stp_clear_boolean_parameter
stp_clear_curve_parameter
+stp_clear_dimension_parameter
stp_clear_file_parameter
stp_clear_float_parameter
stp_clear_int_parameter
+stp_clear_parameter
stp_clear_raw_parameter
stp_clear_string_parameter
stp_color_count
@@ -53,6 +75,8 @@ stp_color_register
stp_color_unregister
stp_compute_tiff_linewidth
stp_compute_uncompressed_linewidth
+stp_copy_vars_from
+stp_current_interface
stp_curve_cache_copy
stp_curve_cache_curve_data
stp_curve_cache_curve_invalidate
@@ -71,6 +95,7 @@ stp_curve_create_from_file
stp_curve_create_from_stream
stp_curve_create_from_string
stp_curve_create_from_xmltree
+stp_curve_create_reverse
stp_curve_destroy
stp_curve_free_curve_cache
stp_curve_get_bounds
@@ -94,6 +119,7 @@ stp_curve_interpolate_value
stp_curve_is_piecewise
stp_curve_resample
stp_curve_rescale
+stp_curve_reverse
stp_curve_set_bounds
stp_curve_set_data
stp_curve_set_data_points
@@ -110,10 +136,12 @@ stp_curve_set_ulong_data
stp_curve_set_ushort_data
stp_curve_write
stp_curve_write_string
+stp_data_path
stp_default_media_size
stp_default_settings
stp_deprintf
stp_describe_output
+stp_describe_papersize
stp_describe_parameter
stp_describe_resolution
stp_destroy_component_data
@@ -152,8 +180,6 @@ stp_end_job
stp_eprintf
stp_erprintf
stp_erputc
-stp_family_register
-stp_family_unregister
stp_fill_parameter_settings
stp_fill_tiff
stp_fill_uncompressed
@@ -161,7 +187,12 @@ stp_find_standard_dither_array
stp_flush_all
stp_flush_debug_messages
stp_fold
+stp_fold_3bit
+stp_fold_3bit_323
+stp_fold_4bit
+stp_fold_8bit
stp_free
+stp_generate_path
stp_get_array_parameter
stp_get_array_parameter_active
stp_get_boolean_parameter
@@ -174,9 +205,12 @@ stp_get_component_data
stp_get_curve_parameter
stp_get_curve_parameter_active
stp_get_debug_level
+stp_get_dimension_parameter
+stp_get_dimension_parameter_active
stp_get_driver
stp_get_errdata
stp_get_errfunc
+stp_get_external_options
stp_get_file_parameter
stp_get_file_parameter_active
stp_get_float_parameter
@@ -190,29 +224,31 @@ stp_get_lineactive_by_pass
stp_get_linebases_by_pass
stp_get_linecount_by_pass
stp_get_lineoffsets_by_pass
+stp_get_maximum_imageable_area
stp_get_media_size
stp_get_model_id
stp_get_outdata
stp_get_outfunc
stp_get_page_height
stp_get_page_width
-stp_get_papersize_by_index
-stp_get_papersize_by_name
-stp_get_papersize_by_size
+stp_get_parameter_active
stp_get_parameter_list
stp_get_pass_by_pass
stp_get_printer
+stp_get_printer_by_device_id
stp_get_printer_by_driver
stp_get_printer_by_index
stp_get_printer_by_long_name
stp_get_printer_index_by_driver
stp_get_raw_parameter
stp_get_raw_parameter_active
+stp_get_release_version
stp_get_size_limit
stp_get_string_parameter
stp_get_string_parameter_active
stp_get_top
stp_get_verified
+stp_get_version
stp_get_width
stp_image_conclude
stp_image_get_appname
@@ -225,10 +261,16 @@ stp_init
stp_init_debug_messages
stp_initialize_printer_defaults
stp_initialize_weave
-stp_known_papersizes
+stp_interface_age
+stp_list_array_parameters
+stp_list_boolean_parameters
stp_list_copy
stp_list_create
+stp_list_curve_parameters
stp_list_destroy
+stp_list_dimension_parameters
+stp_list_file_parameters
+stp_list_float_parameters
stp_list_generic_parameters
stp_list_get_copyfunc
stp_list_get_end
@@ -241,6 +283,7 @@ stp_list_get_long_namefunc
stp_list_get_namefunc
stp_list_get_sortfunc
stp_list_get_start
+stp_list_int_parameters
stp_list_item_create
stp_list_item_destroy
stp_list_item_get_data
@@ -248,14 +291,20 @@ stp_list_item_next
stp_list_item_prev
stp_list_item_set_data
stp_list_node_free_data
+stp_list_parameters
+stp_list_raw_parameters
stp_list_set_copyfunc
stp_list_set_freefunc
stp_list_set_long_namefunc
stp_list_set_namefunc
stp_list_set_sortfunc
+stp_list_string_parameters
+stp_major_version
stp_malloc
stp_malloc_func
stp_merge_printvars
+stp_micro_version
+stp_minor_version
stp_module_close
stp_module_exit
stp_module_get_class
@@ -268,16 +317,20 @@ stp_mxmlElementGetAttr
stp_mxmlElementSetAttr
stp_mxmlFindElement
stp_mxmlLoadFile
+stp_mxmlLoadFromFile
stp_mxmlLoadString
+stp_mxmlNewDimension
stp_mxmlNewElement
stp_mxmlNewInteger
stp_mxmlNewOpaque
stp_mxmlNewReal
stp_mxmlNewText
+stp_mxmlParent
stp_mxmlRemove
stp_mxmlSaveAllocString
stp_mxmlSaveFile
stp_mxmlSaveString
+stp_mxmlSaveToFile
stp_mxmlWalkNext
stp_mxmlWalkPrev
stp_pack_tiff
@@ -285,6 +338,9 @@ stp_pack_uncompressed
stp_parameter_description_destroy
stp_parameter_find
stp_parameter_find_in_settings
+stp_parameter_get_categories
+stp_parameter_get_category
+stp_parameter_has_category_value
stp_parameter_list_add_param
stp_parameter_list_append
stp_parameter_list_copy
@@ -292,11 +348,14 @@ stp_parameter_list_count
stp_parameter_list_create
stp_parameter_list_destroy
stp_parameter_list_param
+stp_path_find_file
stp_path_search
stp_path_split
stp_print
stp_printer_describe_parameter
+stp_printer_get_comment
stp_printer_get_defaults
+stp_printer_get_device_id
stp_printer_get_driver
stp_printer_get_family
stp_printer_get_long_name
@@ -304,15 +363,26 @@ stp_printer_get_manufacturer
stp_printer_get_model
stp_printer_list_parameters
stp_printer_model_count
+stp_prtraw
stp_prune_inactive_options
stp_put16_be
stp_put16_le
stp_put32_be
stp_put32_le
stp_putc
+stp_putraw
stp_puts
+stp_rawtoxmlstr
stp_read_and_compose_curves
stp_realloc
+stp_refcache_add_item
+stp_refcache_create
+stp_refcache_destroy
+stp_refcache_find_item
+stp_refcache_list_cache_items
+stp_refcache_list_caches
+stp_refcache_remove_item
+stp_refcache_replace_item
stp_register_xml_parser
stp_register_xml_preload
stp_scale_float_parameter
@@ -321,6 +391,7 @@ stp_sequence_copy
stp_sequence_create
stp_sequence_create_copy
stp_sequence_create_from_xmltree
+stp_sequence_create_reverse
stp_sequence_destroy
stp_sequence_get_bounds
stp_sequence_get_data
@@ -334,6 +405,7 @@ stp_sequence_get_size
stp_sequence_get_uint_data
stp_sequence_get_ulong_data
stp_sequence_get_ushort_data
+stp_sequence_reverse
stp_sequence_set_bounds
stp_sequence_set_data
stp_sequence_set_float_data
@@ -357,6 +429,7 @@ stp_set_curve_parameter_active
stp_set_default_array_parameter
stp_set_default_boolean_parameter
stp_set_default_curve_parameter
+stp_set_default_dimension_parameter
stp_set_default_file_parameter
stp_set_default_file_parameter_n
stp_set_default_float_parameter
@@ -364,6 +437,8 @@ stp_set_default_int_parameter
stp_set_default_raw_parameter
stp_set_default_string_parameter
stp_set_default_string_parameter_n
+stp_set_dimension_parameter
+stp_set_dimension_parameter_active
stp_set_driver
stp_set_driver_n
stp_set_errdata
@@ -382,7 +457,9 @@ stp_set_outfunc
stp_set_output_codeset
stp_set_page_height
stp_set_page_width
+stp_set_parameter_active
stp_set_printer_defaults
+stp_set_printer_defaults_soft
stp_set_raw_parameter
stp_set_raw_parameter_active
stp_set_string_parameter
@@ -391,11 +468,13 @@ stp_set_string_parameter_n
stp_set_top
stp_set_verified
stp_set_width
+stp_split
stp_split_2
stp_split_4
stp_start_job
stp_strdup
stp_string_list_add_string
+stp_string_list_add_string_unsafe
stp_string_list_count
stp_string_list_create
stp_string_list_create_copy
@@ -407,6 +486,9 @@ stp_string_list_param
stp_string_list_remove_string
stp_strlen
stp_strndup
+stp_strtoxmlstr
+stp_unpack
+stp_unpack_16
stp_unpack_2
stp_unpack_4
stp_unpack_8
@@ -415,26 +497,40 @@ stp_unregister_xml_preload
stp_vars_copy
stp_vars_create
stp_vars_create_copy
+stp_vars_create_from_xmltree
+stp_vars_create_from_xmltree_ref
stp_vars_destroy
+stp_vars_fill_from_xmltree
+stp_vars_fill_from_xmltree_ref
+stp_vars_print_error
stp_verify
stp_verify_parameter
stp_verify_printer_params
stp_weave_parameters_by_row
+stp_write_raw
stp_write_weave
stp_xml_exit
+stp_xml_free_parsed_file
stp_xml_get_node
stp_xml_init
stp_xml_init_defaults
stp_xml_parse_file
+stp_xml_parse_file_from_path
+stp_xml_parse_file_from_path_safe
+stp_xml_parse_file_from_path_uncached
+stp_xml_parse_file_from_path_uncached_safe
stp_xml_parse_file_named
stp_xml_preinit
stp_xmldoc_create_generic
stp_xmlstrtod
+stp_xmlstrtodim
stp_xmlstrtol
+stp_xmlstrtoraw
stp_xmlstrtoul
stp_xmltree_create_from_array
stp_xmltree_create_from_curve
stp_xmltree_create_from_sequence
+stp_xmltree_create_from_vars
stp_zalloc
stp_zfwrite
stp_zprintf
diff --git a/src/main/module.c b/src/main/module.c
index 5d223bf..89f395a 100644
--- a/src/main/module.c
+++ b/src/main/module.c
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -31,6 +30,7 @@
#include <libgen.h>
#include <errno.h>
#include <unistd.h>
+#include <sys/param.h>
typedef struct stpi_internal_module_class
@@ -46,10 +46,13 @@ static int stp_module_register(stp_module_t *module);
static void *stp_dlsym(void *handle, const char *symbol, const char *modulename);
#endif
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-const-variable"
+#ifdef __GNUC__
+#define UNUSED __attribute__ ((unused))
+#else
+#define UNUSED
+#endif
-static const stpi_internal_module_class_t module_classes[] =
+static const stpi_internal_module_class_t UNUSED module_classes[] =
{
{STP_MODULE_CLASS_MISC, N_("Miscellaneous (unclassified)")},
{STP_MODULE_CLASS_FAMILY, N_("Family driver")},
@@ -57,7 +60,6 @@ static const stpi_internal_module_class_t module_classes[] =
{STP_MODULE_CLASS_DITHER, N_("Dither algorithm")},
{STP_MODULE_CLASS_INVALID, NULL} /* Must be last */
};
-#pragma GCC diagnostic pop
#if !defined(MODULE)
extern stp_module_t print_canon_LTX_stp_module_data;
@@ -317,6 +319,13 @@ static int stp_module_register(stp_module_t *module /* Module to register */)
if (stp_list_item_create(module_list, NULL, module))
return 1;
+ if (module->class == STP_MODULE_CLASS_FAMILY)
+ {
+ char buf[MAXPATHLEN+1];
+ (void) snprintf(buf, MAXPATHLEN, "printers/%s.xml", module->name);
+ stp_deprintf(STP_DBG_MODULE, "stp-module: attempting to load: %s\n", buf);
+ stp_xml_parse_file_named(buf);
+ }
stp_deprintf(STP_DBG_MODULE, "stp-module: register: %s\n", module->name);
return 0;
}
@@ -347,6 +356,7 @@ int stp_module_init(void)
}
module_item = stp_list_item_next(module_item);
}
+ stpi_find_duplicate_printers();
return 0;
}
diff --git a/src/main/mxml-node.c b/src/main/mxml-node.c
index b050fe2..176c2e0 100644
--- a/src/main/mxml-node.c
+++ b/src/main/mxml-node.c
@@ -240,6 +240,15 @@ stp_mxmlDelete(stp_mxml_node_t *node) /* I - Node to delete */
free(node);
}
+/*
+ * 'stp_mxmlParent()' - Return the parent of a node or NULL if none.
+ */
+
+stp_mxml_node_t *
+stp_mxmlParent(stp_mxml_node_t *node) /* I - node to return parent from */
+{
+ return node->parent;
+}
/*
* 'stp_mxmlNewElement()' - Create a new element node.
diff --git a/src/main/path.c b/src/main/path.c
index 817874c..8a0ec1b 100644
--- a/src/main/path.c
+++ b/src/main/path.c
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <gutenprint/gutenprint.h>
@@ -148,23 +147,29 @@ stpi_path_check(const struct dirent *module, /* File to check */
}
stp_list_t *
-stpi_data_path(void)
+stp_generate_path(const char *path)
{
stp_list_t *dir_list; /* List of directories to scan */
if (!(dir_list = stp_list_create()))
return NULL;
stp_list_set_freefunc(dir_list, stp_list_node_free_data);
+ stp_path_split(dir_list, path);
+ return dir_list;
+}
+
+stp_list_t *
+stp_data_path(void)
+{
if (getenv("STP_DATA_PATH"))
- stp_path_split(dir_list, getenv("STP_DATA_PATH"));
+ return stp_generate_path(getenv("STP_DATA_PATH"));
else
- stp_path_split(dir_list, PKGXMLDATADIR);
- return dir_list;
+ return stp_generate_path(PKGXMLDATADIR);
}
stp_list_t *
stpi_list_files_on_data_path(const char *name)
{
- stp_list_t *dir_list = stpi_data_path(); /* List of directories to scan */
+ stp_list_t *dir_list = stp_data_path(); /* List of directories to scan */
stp_list_t *file_list = stp_path_search(dir_list, name);
stp_list_destroy(dir_list);
return file_list;
@@ -175,7 +180,7 @@ stpi_list_files_on_data_path(const char *name)
*/
char *
stpi_path_merge(const char *path, /* Path */
- const char *file) /* Filename */
+ const char *file) /* Filename */
{
char *filename; /* Filename to return */
int namelen = strlen(path) + strlen(file) + 2;
@@ -187,6 +192,38 @@ stpi_path_merge(const char *path, /* Path */
return filename;
}
+/*
+ * Find the first occurrence of <file> on <path>.
+ * File must be a plain file and readable.
+ * Return value must be freed
+ */
+char *
+stp_path_find_file(const char *path, /* Path, or NULL for STP_DATA_PATH */
+ const char *file) /* File/relative pathname */
+{
+ stp_list_t *path_to_search;
+ stp_list_item_t *dir;
+ if (path)
+ path_to_search = stp_generate_path(path);
+ else
+ path_to_search = stp_data_path();
+ dir = stp_list_get_start(path_to_search);
+ while (dir)
+ {
+ struct stat modstat; /* stat() output */
+ const char *check_path = (const char *) stp_list_item_get_data(dir);
+ char *filename = stpi_path_merge(check_path, file);
+ if (!stat(filename, &modstat) && S_ISREG(modstat.st_mode))
+ {
+ stp_list_destroy(path_to_search);
+ return filename;
+ }
+ stp_free(filename);
+ dir = stp_list_item_next(dir);
+ }
+ stp_list_destroy(path_to_search);
+ return NULL;
+}
/*
* Split a PATH-type string (colon-delimited) into separate
diff --git a/src/main/print-canon.c b/src/main/print-canon.c
index 4405fae..6ba401a 100644
--- a/src/main/print-canon.c
+++ b/src/main/print-canon.c
@@ -19,8 +19,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -259,18 +258,18 @@ typedef struct
double cd_outer_radius;
} canon_privdata_t;
-const canon_modeuse_t* select_media_modes(stp_vars_t *v, const canon_paper_t* media_type,const canon_modeuselist_t* mlist);
-int compare_mode_valid(stp_vars_t *v,const canon_mode_t* mode,const canon_modeuse_t* muse, const canon_modeuselist_t* mlist);
-const canon_mode_t* suitable_mode_monochrome(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,int quality,const char *duplex_mode);
-const canon_mode_t* find_first_matching_mode_monochrome(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,const char *duplex_mode);
-const canon_mode_t* find_first_matching_mode(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,const char *duplex_mode);
-const canon_mode_t* suitable_mode_color(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,int quality,const char *duplex_mode);
-const canon_mode_t* find_first_matching_mode_color(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,const char *duplex_mode);
-const canon_mode_t* suitable_mode_photo(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,int quality,const char *duplex_mode);
-const canon_mode_t* find_first_matching_mode_photo(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,const char *duplex_mode);
-const canon_mode_t* suitable_mode_general(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,int quality,const char *duplex_mode);
-const char* find_ink_type(stp_vars_t *v,const canon_mode_t* mode,const char *printing_mode);
-const canon_mode_t* canon_check_current_mode(stp_vars_t *v);
+static const canon_modeuse_t* select_media_modes(stp_vars_t *v, const canon_paper_t* media_type,const canon_modeuselist_t* mlist);
+static int compare_mode_valid(stp_vars_t *v,const canon_mode_t* mode,const canon_modeuse_t* muse, const canon_modeuselist_t* mlist);
+static const canon_mode_t* suitable_mode_monochrome(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,int quality,const char *duplex_mode);
+static const canon_mode_t* find_first_matching_mode_monochrome(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,const char *duplex_mode);
+static const canon_mode_t* find_first_matching_mode(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,const char *duplex_mode);
+static const canon_mode_t* suitable_mode_color(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,int quality,const char *duplex_mode);
+static const canon_mode_t* find_first_matching_mode_color(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,const char *duplex_mode);
+static const canon_mode_t* suitable_mode_photo(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,int quality,const char *duplex_mode);
+static const canon_mode_t* find_first_matching_mode_photo(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,const char *duplex_mode);
+static const canon_mode_t* suitable_mode_general(stp_vars_t *v,const canon_modeuse_t* muse,const canon_cap_t *caps,int quality,const char *duplex_mode);
+static const char* find_ink_type(stp_vars_t *v,const canon_mode_t* mode,const char *printing_mode);
+static const canon_mode_t* canon_check_current_mode(stp_vars_t *v);
static void canon_write_line(stp_vars_t *v);
@@ -547,6 +546,8 @@ static const char* canon_families[] = {
"PIXMA MPC", /* 16 */
"PIXMA G", /* 17 */
"PIXMA TS", /* 18 */
+ "PIXMA TR", /* 19 */
+ "PIXMA XK", /* 20 */
};
/* canon model ids look like the following
@@ -2555,15 +2556,17 @@ canon_printhead_colors(const stp_vars_t*v)
static unsigned char
canon_size_type(const stp_vars_t *v, const canon_cap_t * caps)
{
- const stp_papersize_t *pp = stp_get_papersize_by_size(stp_get_page_height(v),
+ const stp_papersize_list_t *list = stpi_get_standard_papersize_list();
+ const stp_papersize_t *pp = stpi_get_papersize_by_size(list,
+ stp_get_page_height(v),
stp_get_page_width(v));
- stp_deprintf(STP_DBG_CANON,"canon: entered canon_size_type\n");
+ stp_dprintf(STP_DBG_CANON, v,"canon: entered canon_size_type\n");
if (pp)
{
const char *name = pp->name;
- stp_deprintf(STP_DBG_CANON,"canon: in canon_size_type is pp->name: '%s'\n",name);
+ stp_dprintf(STP_DBG_CANON, v,"canon: in canon_size_type is pp->name: '%s'\n",name);
/* used internally: do not translate */
/* built ins: Japanese driver notation */
if (!strcmp(name,"A5")) return 0x01;
@@ -2664,9 +2667,9 @@ canon_size_type(const stp_vars_t *v, const canon_cap_t * caps)
/* custom */
- stp_deprintf(STP_DBG_CANON,"canon: Unknown paper size '%s' - using custom\n",name);
+ stp_dprintf(STP_DBG_CANON, v,"canon: Unknown paper size '%s' - using custom\n",name);
} else {
- stp_deprintf(STP_DBG_CANON,"canon: Couldn't look up paper size %fx%f - "
+ stp_dprintf(STP_DBG_CANON, v,"canon: Couldn't look up paper size %fx%f - "
"using custom\n",stp_get_page_height(v), stp_get_page_width(v));
}
return 0;
@@ -2861,7 +2864,6 @@ canon_parameters(const stp_vars_t *v, const char *name,
{
const char* input_slot = stp_get_string_parameter(v, "InputSlot");
unsigned int height_limit, width_limit;
- int papersizes = stp_known_papersizes();
description->bounds.str = stp_string_list_create();
width_limit = caps->max_width;
@@ -2875,17 +2877,23 @@ canon_parameters(const stp_vars_t *v, const char *name,
stp_string_list_add_string
(description->bounds.str, "CDCustom", _("CD - Custom"));
}else{
- for (i = 0; i < papersizes; i++) {
- const stp_papersize_t *pt = stp_get_papersize_by_index(i);
- if (pt->paper_size_type != PAPERSIZE_TYPE_STANDARD &&
- pt->paper_size_type != PAPERSIZE_TYPE_ENVELOPE)
- continue;
- if (strlen(pt->name) > 0 &&
- pt->width <= width_limit && pt->height <= height_limit){
- stp_string_list_add_string(description->bounds.str,
- pt->name, gettext(pt->text));
- }
- }
+ const stp_papersize_list_t *paper_sizes =
+ stpi_get_standard_papersize_list();
+ const stp_papersize_list_item_t *ptli =
+ stpi_papersize_list_get_start(paper_sizes);
+ while (ptli)
+ {
+ const stp_papersize_t *pt = stpi_paperlist_item_get_data(ptli);
+ if (pt->paper_size_type == PAPERSIZE_TYPE_STANDARD ||
+ pt->paper_size_type == PAPERSIZE_TYPE_ENVELOPE) {
+ if (strlen(pt->name) > 0 &&
+ pt->width <= width_limit && pt->height <= height_limit){
+ stp_string_list_add_string(description->bounds.str,
+ pt->name, gettext(pt->text));
+ }
+ }
+ ptli = stpi_paperlist_item_next(ptli);
+ }
}
description->deflt.str =
stp_string_list_param(description->bounds.str, 0)->name;
@@ -2959,7 +2967,7 @@ canon_parameters(const stp_vars_t *v, const char *name,
#endif
stp_string_list_add_string(description->bounds.str,
caps->modelist->modes[i].name, gettext(caps->modelist->modes[i].text));
- stp_deprintf(STP_DBG_CANON,"supports mode '%s'\n",
+ stp_dprintf(STP_DBG_CANON, v,"supports mode '%s'\n",
caps->modelist->modes[i].name);
if(i == caps->modelist->default_mode)
description->deflt.str=caps->modelist->modes[i].name;
@@ -3310,7 +3318,7 @@ internal_imageable_area(const stp_vars_t *v, /* I */
const canon_cap_t * caps= canon_get_model_capabilities(v);
if (media_size)
- pt = stp_get_papersize_by_name(media_size);
+ pt = stp_describe_papersize(v, media_size);
if(input_slot && !strcmp(input_slot,"CD"))
cd = 1;
@@ -3473,7 +3481,7 @@ canon_cmd(const stp_vars_t *v, /* I - the printer */
stp_free(buffer);
}
-#define PUT(WHAT,VAL,RES) stp_deprintf(STP_DBG_CANON,"canon: "WHAT\
+#define PUT(V,WHAT,VAL,RES) stp_dprintf(STP_DBG_CANON,V,"canon: "WHAT \
" is %04x =% 5d = %f\" = %f mm\n",(VAL),(VAL),(VAL)/(1.*RES),(VAL)/(RES/25.4))
#define ESC28 "\033\050"
@@ -3573,10 +3581,24 @@ canon_init_setColor(const stp_vars_t *v, const canon_privdata_t *init)
if (init->used_inks == CANON_INK_K)
arg_63[0]|= 0x01; /* PRINT_COLOUR */
- arg_63[1] = ((init->pt ? init->pt->media_code_c : 0) << 4) /* PRINT_MEDIA */
- + 1; /* hardcode to High quality for now */ /* PRINT_QUALITY */
- canon_cmd(v,ESC28,0x63, 2, arg_63[0], arg_63[1]);
+// if ( (!strcmp(init->caps->name,"85")) || (!strcmp(init->caps->name,"1000")) ) /* BJC-85, BJC-1000 */
+// arg_63[1] = (init->pt) ? init->pt->media_code_c : 0; /* print media type */
+// else /* original, not sure which models follow this at all */
+ arg_63[1] = ((init->pt ? init->pt->media_code_c : 0) << 4) /* PRINT_MEDIA */
+ + 1; /* hardcode to High quality for now */ /* PRINT_QUALITY */
+
+ if (!strcmp(init->caps->name,"2100")) { /* BJC-2100: ESC (c command length is 3 */
+ if (!strcmp(init->mode->name,"720x360dpi"))
+ arg_63[1] = 0x00;
+ else if (!strcmp(init->mode->name,"360x360dpi_draft"))
+ arg_63[1] = 0x00;
+ else if (!strcmp(init->mode->name,"180x180dpi"))
+ arg_63[1] = 0x02;
+ /* else keep at 01 hard-coded as above - logic unknown */
+ canon_cmd(v,ESC28,0x63, 3, arg_63[0], arg_63[1], 0x00);
+ } else /* length 2 in legacy code */
+ canon_cmd(v,ESC28,0x63, 2, arg_63[0], arg_63[1]);
break;
case 2: /* are any models using this? */
@@ -3694,7 +3716,19 @@ canon_init_setTray(const stp_vars_t *v, const canon_privdata_t *init)
if ( (!strcmp(init->caps->name,"PIXMA MP710")) || (!strcmp(init->caps->name,"PIXMA MP740")) )
arg_6c_3 = 0x10;
- if (init->pt) arg_6c_2 = init->pt->media_code_l;
+ switch ( init->caps->model_id ) {
+ case 0:
+ break;
+ case 1:
+ if (init->pt) arg_6c_2 = ((init->pt ? init->pt->media_code_l : 0) << 4); /* PRINT_MEDIA */
+ break;
+ case 2:
+ break;
+ case 3:
+ if (init->pt) arg_6c_2 = init->pt->media_code_l; /* PRINT_MEDIA */
+ break;
+ }
+
/* select between length 2 and 3 byte variations of command */
/*if(init->caps->model_id >= 3)*/
if(init->caps->ESC_l_len == 3)
@@ -4426,7 +4460,7 @@ canon_init_setESC_P(const stp_vars_t *v, const canon_privdata_t *init)
return;
/* if (media_size)
- pt = stp_get_papersize_by_name(media_size); */
+ pt = stp_describe_papersize(v, media_size); */
stp_default_media_size(v, &width, &length);
if (tray_upper || tray_lower)
tray_user_select=1;
@@ -4440,7 +4474,7 @@ canon_init_setESC_P(const stp_vars_t *v, const canon_privdata_t *init)
user_ESCP_9=0x00; /* fall-through setting, but this value is not used */
arg_ESCP_1 = (init->pt) ? canon_size_type(v,init->caps): 0x03; /* media size: set to A4 size as default */
- stp_deprintf(STP_DBG_CANON,"canon: ESCP (P code read paper size, resulting arg_ESCP_1: '%x'\n",arg_ESCP_1);
+ stp_dprintf(STP_DBG_CANON, v,"canon: ESCP (P code read paper size, resulting arg_ESCP_1: '%x'\n",arg_ESCP_1);
arg_ESCP_2 = (init->pt) ? init->pt->media_code_P: 0x00; /* media type: set to plain as default */
arg_ESCP_5 = 0x01; /* default for portrait orientation */
arg_ESCP_6 = 0x00; /* default for portrait orientation */
@@ -4589,7 +4623,7 @@ canon_init_setESC_P(const stp_vars_t *v, const canon_privdata_t *init)
if ( !(strcmp(init->caps->name,"PIXMA TS8000")) ) {
arg_ESCP_1 = 0xbc;
}
-
+
}
}
/* 850i: CD Tray custom: none --- no ESC (P */
@@ -4876,7 +4910,7 @@ canon_init_setESC_P(const stp_vars_t *v, const canon_privdata_t *init)
canon_cmd( v,ESC28,0x50,2,0x00,arg_ESCP_1 );
}
else /* error in definition */
- stp_deprintf(STP_DBG_CANON,"SEVERE BUG IN print-canon.c::canon_init_setESC_P() "
+ stp_dprintf(STP_DBG_CANON, v,"SEVERE BUG IN print-canon.c::canon_init_setESC_P() "
"ESC_P_len=%d!!\n",init->caps->ESC_P_len);
}
@@ -5054,7 +5088,7 @@ canon_init_setX72(const stp_vars_t *v, const canon_privdata_t *init)
canon_cmd(v,ESC28,0x72, 3, 0x63, 1, 0); /* whatever for - S200 needs it */
/* probably to set the print direction of the head */
}
- else if ( !(strcmp(init->caps->name,"S820")) || !(strcmp(init->caps->name,"S900")) || !(strcmp(init->caps->name,"i950")) || !(strcmp(init->caps->name,"i960")) || !(strcmp(init->caps->name,"i9100")) || !(strcmp(init->caps->name,"i9900")) || !(strcmp(init->caps->name,"PIXMA iP7100")) || !(strcmp(init->caps->name,"PIXMA iP8100")) || !(strcmp(init->caps->name,"PIXMA iP8500")) || !(strcmp(init->caps->name,"PIXMA iP8600")) || !(strcmp(init->caps->name,"PIXMA iP9910")) || !(strcmp(init->caps->name,"PIXMA MP900")) || !(strcmp(init->caps->name,"PIXMA Pro9000")) || !(strcmp(init->caps->name,"PIXMA Pro9002")) || !(strcmp(init->caps->name,"PIXMA Pro9500")) || !(strcmp(init->caps->name,"PIXMA Pro9502")) ) {
+ else if ( !(strcmp(init->caps->name,"S820")) || !(strcmp(init->caps->name,"S900")) || !(strcmp(init->caps->name,"S9000")) || !(strcmp(init->caps->name,"i950")) || !(strcmp(init->caps->name,"i960")) || !(strcmp(init->caps->name,"i9100")) || !(strcmp(init->caps->name,"i9900")) || !(strcmp(init->caps->name,"PIXMA iP7100")) || !(strcmp(init->caps->name,"PIXMA iP8100")) || !(strcmp(init->caps->name,"PIXMA iP8500")) || !(strcmp(init->caps->name,"PIXMA iP8600")) || !(strcmp(init->caps->name,"PIXMA iP9910")) || !(strcmp(init->caps->name,"PIXMA MP900")) || !(strcmp(init->caps->name,"PIXMA Pro9000")) || !(strcmp(init->caps->name,"PIXMA Pro9002")) || !(strcmp(init->caps->name,"PIXMA Pro9500")) || !(strcmp(init->caps->name,"PIXMA Pro9502")) ) {
canon_cmd(v,ESC28,0x72, 2, 0x62, 0); /* 2 bytes */
}
/* CD mode only */
@@ -5705,7 +5739,8 @@ static void setup_page(stp_vars_t* v,canon_privdata_t* privdata){
#if 0
/* needed in workaround for Oufuku Hagaki */
- const stp_papersize_t *pp = stp_get_papersize_by_size(stp_get_page_height(v),
+ const stp_papersize_t *pp = stpi_get_papersize_by_size(v,
+ stp_get_page_height(v),
stp_get_page_width(v));
if (pp)
@@ -5745,8 +5780,8 @@ static void setup_page(stp_vars_t* v,canon_privdata_t* privdata){
privdata->out_width = stp_get_width(v); /* check Epson: page_true_width */
privdata->out_height = stp_get_height(v); /* check Epson: page_true_height */
- stp_deprintf(STP_DBG_CANON,"stp_get_width: privdata->out_width is %i\n",privdata->out_width);
- stp_deprintf(STP_DBG_CANON,"stp_get_height: privdata->out_height is %i\n",privdata->out_height);
+ stp_dprintf(STP_DBG_CANON, v,"stp_get_width: privdata->out_width is %i\n",privdata->out_width);
+ stp_dprintf(STP_DBG_CANON, v,"stp_get_height: privdata->out_height is %i\n",privdata->out_height);
/* Don't use full bleed mode if the paper itself has a margin */
if (privdata->left > 0 || privdata->top > 0)
@@ -6017,21 +6052,21 @@ canon_do_print(stp_vars_t *v, stp_image_t *image)
* Convert image size to printer resolution...
*/
#if 0
- stp_deprintf(STP_DBG_CANON,"canon_do_print: unused image_width is %i pts(?)\n",image_width);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: unused image_width is %i pts(?)\n",image_width);
#endif
- stp_deprintf(STP_DBG_CANON,"canon_do_print: privdata.out_width is %i pts\n",privdata.out_width);
- stp_deprintf(STP_DBG_CANON,"canon_do_print: privdata.out_height is %i pts\n",privdata.out_height);
- stp_deprintf(STP_DBG_CANON,"canon_do_print: privdata.left is %i pts\n",privdata.left);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: privdata.out_width is %i pts\n",privdata.out_width);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: privdata.out_height is %i pts\n",privdata.out_height);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: privdata.left is %i pts\n",privdata.left);
privdata.out_width = privdata.mode->xdpi * privdata.out_width / 72;
privdata.out_height = privdata.mode->ydpi * privdata.out_height / 72;
privdata.left = privdata.mode->xdpi * privdata.left / 72;
- stp_deprintf(STP_DBG_CANON,"canon_do_print: privdata.out_width is %i dots\n",privdata.out_width);
- stp_deprintf(STP_DBG_CANON,"canon_do_print: privdata.out_height is %i dots\n",privdata.out_height);
- stp_deprintf(STP_DBG_CANON,"canon_do_print: privdata.left is %i dots\n",privdata.left);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: privdata.out_width is %i dots\n",privdata.out_width);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: privdata.out_height is %i dots\n",privdata.out_height);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: privdata.left is %i dots\n",privdata.left);
- stp_deprintf(STP_DBG_CANON,"density is %f\n",
+ stp_dprintf(STP_DBG_CANON, v,"density is %f\n",
stp_get_float_parameter(v, "Density"));
/*
@@ -6055,7 +6090,7 @@ canon_do_print(stp_vars_t *v, stp_image_t *image)
stp_scale_float_parameter(v, "Gamma", 1.25);
stp_scale_float_parameter( v, "Gamma", privdata.mode->gamma );
- stp_deprintf(STP_DBG_CANON,"density is %f\n",
+ stp_dprintf(STP_DBG_CANON, v,"density is %f\n",
stp_get_float_parameter(v, "Density"));
if(privdata.used_inks & CANON_INK_CMYK_MASK)
@@ -6070,23 +6105,23 @@ canon_do_print(stp_vars_t *v, stp_image_t *image)
privdata.length = (privdata.out_width + 7) / 8;
- stp_deprintf(STP_DBG_CANON,"privdata.length is %i\n",privdata.length);
- stp_deprintf(STP_DBG_CANON,"canon_do_print: privdata.num_channels is %i\n",privdata.num_channels);
+ stp_dprintf(STP_DBG_CANON, v,"privdata.length is %i\n",privdata.length);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: privdata.num_channels is %i\n",privdata.num_channels);
stp_dither_init(v, image, privdata.out_width, privdata.mode->xdpi, privdata.mode->ydpi);
- stp_deprintf(STP_DBG_CANON,"privdata.out_width is %i (after stp_dither_init)\n",privdata.out_width);
- stp_deprintf(STP_DBG_CANON,"privdata.length is %i (after stp_dither_init)\n",privdata.length);
- stp_deprintf(STP_DBG_CANON,"canon_do_print: privdata.num_channels is %i (after stp_dither_init)\n",privdata.num_channels);
+ stp_dprintf(STP_DBG_CANON, v,"privdata.out_width is %i (after stp_dither_init)\n",privdata.out_width);
+ stp_dprintf(STP_DBG_CANON, v,"privdata.length is %i (after stp_dither_init)\n",privdata.length);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: privdata.num_channels is %i (after stp_dither_init)\n",privdata.num_channels);
canon_setup_channels(v,&privdata);
- stp_deprintf(STP_DBG_CANON,"privdata.out_width is %i (after canon_setup_channels)\n",privdata.out_width);
- stp_deprintf(STP_DBG_CANON,"privdata.length is %i (after canon_setup_channels)\n",privdata.length);
- stp_deprintf(STP_DBG_CANON,"canon_do_print: privdata.num_channels is %i (after canon_setup_channels)\n",privdata.num_channels);
+ stp_dprintf(STP_DBG_CANON, v,"privdata.out_width is %i (after canon_setup_channels)\n",privdata.out_width);
+ stp_dprintf(STP_DBG_CANON, v,"privdata.length is %i (after canon_setup_channels)\n",privdata.length);
+ stp_dprintf(STP_DBG_CANON, v,"canon_do_print: privdata.num_channels is %i (after canon_setup_channels)\n",privdata.num_channels);
- stp_deprintf(STP_DBG_CANON,
+ stp_dprintf(STP_DBG_CANON, v,
"canon: driver will use colors %s\n",privdata.channel_order);
/* Allocate compression buffer */
@@ -6134,9 +6169,9 @@ canon_do_print(stp_vars_t *v, stp_image_t *image)
else
privdata.physical_xdpi = 720;
- stp_deprintf(STP_DBG_CANON,"canon: adjust leftskip: old=%d,\n", privdata.left);
+ stp_dprintf(STP_DBG_CANON, v,"canon: adjust leftskip: old=%d,\n", privdata.left);
privdata.left = (int)( (float)privdata.left * (float)privdata.physical_xdpi / (float)privdata.mode->xdpi ); /* adjust left margin */
- stp_deprintf(STP_DBG_CANON,"canon: adjust leftskip: new=%d,\n", privdata.left);
+ stp_dprintf(STP_DBG_CANON, v,"canon: adjust leftskip: new=%d,\n", privdata.left);
privdata.ncolors = 4;
privdata.head_offset = stp_zalloc(sizeof(int) * privdata.ncolors);
@@ -6180,7 +6215,7 @@ canon_do_print(stp_vars_t *v, stp_image_t *image)
privdata.bidirectional = 1; /* 1: bidirectional; 0: unidirectional printing */
privdata.direction = 1;
stp_allocate_component_data(v, "Driver", NULL, NULL, &privdata);
- stp_deprintf(STP_DBG_CANON,"canon: initializing weaving: nozzles=%d, nozzle_separation=%d,\n"
+ stp_dprintf(STP_DBG_CANON, v,"canon: initializing weaving: nozzles=%d, nozzle_separation=%d,\n"
"horizontal_passes=%d, vertical_passes=%d,vertical_oversample=%d,\n"
"ncolors=%d, out_width=%d, out_height=%d\n"
"weave_top=%d, weave_page_height=%d \n"
@@ -6205,7 +6240,7 @@ canon_do_print(stp_vars_t *v, stp_image_t *image)
canon_flush_pass,
stp_fill_uncompressed,
stp_pack_uncompressed,
- stp_compute_uncompressed_linewidth);
+ stp_compute_tiff_linewidth);
privdata.last_pass_offset = 0;
if (stp_get_debug_level() & STP_DBG_CANON) {
@@ -6327,7 +6362,7 @@ canon_do_print(stp_vars_t *v, stp_image_t *image)
*/
if (privdata.delay_max) {
- stp_deprintf(STP_DBG_CANON,"\ncanon: flushing %d possibly delayed buffers\n",
+ stp_dprintf(STP_DBG_CANON, v,"\ncanon: flushing %d possibly delayed buffers\n",
privdata.delay_max);
for (y= 0; y<privdata.delay_max; y++) {
@@ -6377,7 +6412,6 @@ canon_print(const stp_vars_t *v, stp_image_t *image)
{
int status;
stp_vars_t *nv = stp_vars_create_copy(v);
- stp_prune_inactive_options(nv);
status = canon_do_print(nv, image);
stp_vars_destroy(nv);
return status;
@@ -6397,7 +6431,8 @@ static const stp_printfuncs_t print_canon_printfuncs =
stp_verify_printer_params,
canon_start_job,
canon_end_job,
- NULL
+ NULL,
+ stpi_standard_describe_papersize
};
static void
@@ -6506,7 +6541,7 @@ static int canon_compress(stp_vars_t *v, canon_privdata_t *pd, unsigned char* li
in_ptr[0] = 0;
}
else
- stp_deprintf(STP_DBG_CANON,"SEVERE BUG IN print-canon.c::canon_write() "
+ stp_dprintf(STP_DBG_CANON, v,"SEVERE BUG IN print-canon.c::canon_write() "
"bitoffset=%d!!\n",bitoffset);
}
@@ -6661,7 +6696,7 @@ canon_advance_paper(stp_vars_t *v, int advance)
if ( advance > 0 )
{
int a0, a1, a2, a3;
- stp_deprintf(STP_DBG_CANON," --advance paper %d\n", advance);
+ stp_dprintf(STP_DBG_CANON, v," --advance paper %d\n", advance);
a0 = advance & 0xff;
a1 = (advance >> 8) & 0xff;
a2 = (advance >> 16) & 0xff;
@@ -6684,7 +6719,7 @@ canon_flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
int color, line, written = 0, linelength = 0, lines = 0;
int idx[4]={3, 0, 1, 2}; /* color numbering is different between canon_write and weaving */
- stp_deprintf(STP_DBG_CANON,"canon_flush_pass: ----pass=%d,---- \n", passno);
+ stp_dprintf(STP_DBG_CANON, v,"canon_flush_pass: ----pass=%d,---- \n", passno);
(pd->emptylines) = 0;
for ( color = 0; color < pd->ncolors; color++ ) /* find max. linecount */
@@ -6695,7 +6730,7 @@ canon_flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
for ( line = 0; line < lines; line++ ) /* go through each nozzle f that pass */
{
- stp_deprintf(STP_DBG_CANON," --line=%d\n", line);
+ stp_dprintf(STP_DBG_CANON, v," --line=%d\n", line);
if ( written > 0 )
canon_cmd(v,ESC28,0x65, 2, 0, 1); /* go to next nozzle*/
@@ -6709,7 +6744,7 @@ canon_flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
if ( lineactive[0].v[color] > 0 )
{
linelength = lineoffs[0].v[color] / linecount[0].v[color];
-/* stp_deprintf(STP_DBG_CANON,"canon_flush_pass: linelength=%d, bufs[0].v[color]=%p,"
+/* stp_dprintf(STP_DBG_CANON, v,"canon_flush_pass: linelength=%d, bufs[0].v[color]=%p,"
"bufs[0].v[color]+line * linelength=%p, empty=%d \n", linelength, bufs[0].v[color],
bufs[0].v[color] + line * linelength, (pd->emptylines));
*/
@@ -6721,7 +6756,7 @@ canon_flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
{
pd->direction = (pd->direction +1) & 1;
canon_set_X72(v, pd->direction);
- stp_deprintf(STP_DBG_CANON," --set direction %d\n", pd->direction);
+ stp_dprintf(STP_DBG_CANON, v," --set direction %d\n", pd->direction);
}
}
@@ -6730,7 +6765,7 @@ canon_flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
linelength, idx[color],
&(pd->emptylines), pd->out_width,
pd->left, pd->weave_bits[color],0);
- if (written) stp_deprintf(STP_DBG_CANON," --written color %d,\n", color);
+ if (written) stp_dprintf(STP_DBG_CANON, v," --written color %d,\n", color);
}
}
@@ -6745,7 +6780,7 @@ canon_flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
lineoffs[0].v[color] = 0;
linecount[0].v[color] = 0;
}
- stp_deprintf(STP_DBG_CANON," --ended-- with empty=%d \n", (pd->emptylines));
+ stp_dprintf(STP_DBG_CANON, v," --ended-- with empty=%d \n", (pd->emptylines));
}
static stp_family_t print_canon_module_data =
@@ -6758,14 +6793,14 @@ static stp_family_t print_canon_module_data =
static int
print_canon_module_init(void)
{
- return stp_family_register(print_canon_module_data.printer_list);
+ return stpi_family_register(print_canon_module_data.printer_list);
}
static int
print_canon_module_exit(void)
{
- return stp_family_unregister(print_canon_module_data.printer_list);
+ return stpi_family_unregister(print_canon_module_data.printer_list);
}
diff --git a/src/main/print-canon.h b/src/main/print-canon.h
index 0382446..b282991 100644
--- a/src/main/print-canon.h
+++ b/src/main/print-canon.h
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GUTENPRINT_INTERNAL_CANON_H
@@ -666,8 +665,8 @@ static const unsigned char twelve2eight2[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-const char* prexml_iP2700 ="<?xml version=\"1.0\" encoding=\"utf-8\" ?><cmd xmlns:ivec=\"http://www.canon.com/ns/cmd/2008/07/common/\"><ivec:contents><ivec:operation>StartJob</ivec:operation><ivec:param_set servicetype=\"print\"><ivec:jobID>00000001</ivec:jobID><ivec:bidi>0</ivec:bidi></ivec:param_set></ivec:contents></cmd><?xml version=\"1.0\" encoding=\"utf-8\" ?><cmd xmlns:ivec=\"http://www.canon.com/ns/cmd/2008/07/common/\" xmlns:vcn=\"http://www.canon.com/ns/cmd/2008/07/canon/\"><ivec:contents><ivec:operation>VendorCmd</ivec:operation><ivec:param_set servicetype=\"print\"><vcn:ijoperation>ModeShift</vcn:ijoperation><vcn:ijmode>1</vcn:ijmode><ivec:jobID>00000001</ivec:jobID></ivec:param_set></ivec:contents></cmd>";
+static const char* prexml_iP2700 ="<?xml version=\"1.0\" encoding=\"utf-8\" ?><cmd xmlns:ivec=\"http://www.canon.com/ns/cmd/2008/07/common/\"><ivec:contents><ivec:operation>StartJob</ivec:operation><ivec:param_set servicetype=\"print\"><ivec:jobID>00000001</ivec:jobID><ivec:bidi>0</ivec:bidi></ivec:param_set></ivec:contents></cmd><?xml version=\"1.0\" encoding=\"utf-8\" ?><cmd xmlns:ivec=\"http://www.canon.com/ns/cmd/2008/07/common/\" xmlns:vcn=\"http://www.canon.com/ns/cmd/2008/07/canon/\"><ivec:contents><ivec:operation>VendorCmd</ivec:operation><ivec:param_set servicetype=\"print\"><vcn:ijoperation>ModeShift</vcn:ijoperation><vcn:ijmode>1</vcn:ijmode><ivec:jobID>00000001</ivec:jobID></ivec:param_set></ivec:contents></cmd>";
-const char* postxml_iP2700 ="<?xml version=\"1.0\" encoding=\"utf-8\" ?><cmd xmlns:ivec=\"http://www.canon.com/ns/cmd/2008/07/common/\"><ivec:contents><ivec:operation>EndJob</ivec:operation><ivec:param_set servicetype=\"print\"><ivec:jobID>00000001</ivec:jobID></ivec:param_set></ivec:contents></cmd>";
+static const char* postxml_iP2700 ="<?xml version=\"1.0\" encoding=\"utf-8\" ?><cmd xmlns:ivec=\"http://www.canon.com/ns/cmd/2008/07/common/\"><ivec:contents><ivec:operation>EndJob</ivec:operation><ivec:param_set servicetype=\"print\"><ivec:jobID>00000001</ivec:jobID></ivec:param_set></ivec:contents></cmd>";
#endif
diff --git a/src/main/print-color.c b/src/main/print-color.c
index 23ff8cb..793b402 100644
--- a/src/main/print-color.c
+++ b/src/main/print-color.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -887,6 +886,8 @@ compute_gcr_curve(const stp_vars_t *vars)
k_lower = stp_get_float_parameter(vars, "GCRLower");
if (stp_check_float_parameter(vars, "BlackTrans", STP_PARAMETER_DEFAULTED))
k_trans = stp_get_float_parameter(vars, "BlackTrans");
+ if (k_lower >= 1)
+ return NULL;
k_upper *= lut->steps;
k_lower *= lut->steps;
stp_dprintf(STP_DBG_LUT, vars, " k_lower %.3f\n", k_lower);
@@ -1392,6 +1393,7 @@ stpi_compute_lut(stp_vars_t *v)
{
int i;
lut_t *lut = (lut_t *)(stp_get_component_data(v, "Color"));
+ double app_gamma_scale = 4.0;
stp_curve_t *curve;
stp_dprintf(STP_DBG_LUT, v, "stpi_compute_lut\n");
@@ -1422,9 +1424,11 @@ stpi_compute_lut(stp_vars_t *v)
if (stp_check_float_parameter(v, "AppGamma", STP_PARAMETER_ACTIVE))
lut->app_gamma = stp_get_float_parameter(v, "AppGamma");
+ if (stp_check_float_parameter(v, "AppGammaScale", STP_PARAMETER_ACTIVE))
+ app_gamma_scale = stp_get_float_parameter(v, "AppGammaScale");
if (stp_check_boolean_parameter(v, "SimpleGamma", STP_PARAMETER_ACTIVE))
lut->simple_gamma_correction = stp_get_boolean_parameter(v, "SimpleGamma");
- lut->screen_gamma = lut->app_gamma / 4.0; /* "Empirical" */
+ lut->screen_gamma = lut->app_gamma / app_gamma_scale; /* "Empirical" */
curve = stp_curve_create_copy(color_curve_bounds);
stp_curve_rescale(curve, 65535.0, STP_CURVE_COMPOSE_MULTIPLY,
STP_CURVE_BOUNDS_RESCALE);
@@ -1507,9 +1511,17 @@ stpi_color_traditional_init(stp_vars_t *v,
size_t total_channel_bits;
if (steps != 256 && steps != 65536)
- return -1;
+ {
+ stp_eprintf(v,
+ "stpi_color_traditional_init: Invalid color steps %lu (must be 256 or 65536)\n",
+ (unsigned long) steps);
+ return -1;
+ }
if (!channel_depth)
- return -1;
+ {
+ stp_eprintf(v, "stpi_color_traditional_init: ChannelBitDepth not set\n");
+ return -1;
+ }
lut = allocate_lut();
lut->input_color_description =
@@ -1519,6 +1531,7 @@ stpi_color_traditional_init(stp_vars_t *v,
if (!lut->input_color_description || !lut->output_color_description)
{
+ stp_eprintf(v, "stpi_color_traditional_init: input/output types not specified\n");
free_lut(lut);
return -1;
}
@@ -1527,6 +1540,7 @@ stpi_color_traditional_init(stp_vars_t *v,
{
if (stp_verify_parameter(v, "STPIRawChannels", 1) != PARAMETER_OK)
{
+ stp_eprintf(v, "stpi_color_traditional_init: raw printing requested but STPIRawChannels not set\n");
free_lut(lut);
return -1;
}
diff --git a/src/main/print-dither-matrices.c b/src/main/print-dither-matrices.c
index 021fa70..7047f5e 100644
--- a/src/main/print-dither-matrices.c
+++ b/src/main/print-dither-matrices.c
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Revision History:
*
@@ -33,6 +32,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "dither-impl.h"
+#include <sys/param.h>
#ifdef __GNUC__
#define inline __inline__
@@ -580,7 +580,7 @@ stpi_dither_array_create_from_xmltree(stp_mxml_node_t *dm, int x, int y) /* Dith
}
/* Now read in the array */
- child = stp_mxmlFindElement(dm, dm, "array", NULL, NULL, STP_MXML_DESCEND);
+ child = stp_xml_get_node(dm, "array", NULL);
if (child)
return stp_array_create_from_xmltree(child);
else
@@ -665,8 +665,8 @@ stp_xml_get_dither_array(int x, int y)
if (!cachedval)
{
- char buf[1024];
- (void) sprintf(buf, "dither-matrix-%dx%d.xml", x, y);
+ char buf[MAXPATHLEN+1];
+ (void) snprintf(buf, MAXPATHLEN, "dither/matrix-%dx%d.xml", x, y);
stp_xml_parse_file_named(buf);
cachedval = stp_xml_dither_cache_get(x, y);
if (cachedval == NULL || cachedval->filename == NULL)
diff --git a/src/main/print-dpl.c b/src/main/print-dpl.c
index e8f27e8..d4fe616 100644
--- a/src/main/print-dpl.c
+++ b/src/main/print-dpl.c
@@ -19,8 +19,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -567,7 +566,8 @@ static const int float_parameter_count =
*/
static const char *
-dpl_val_to_string (int code, /* I: Code */
+dpl_val_to_string (const stp_vars_t *v,
+ int code, /* I: Code */
const dpl_t * options, /* I: Options */
int num_options) /* I: Num options */
{
@@ -588,13 +588,14 @@ dpl_val_to_string (int code, /* I: Code */
}
}
- stp_deprintf (STP_DBG_DPL, "Code: %d, String: %s\n", code, string);
+ stp_dprintf (STP_DBG_DPL, v, "Code: %d, String: %s\n", code, string);
return (string);
}
static const char *
-dpl_val_to_text (int code, /* I: Code */
+dpl_val_to_text (const stp_vars_t *v,
+ int code, /* I: Code */
const dpl_t * options, /* I: Options */
int num_options) /* I: Num options */
{
@@ -615,7 +616,7 @@ dpl_val_to_text (int code, /* I: Code */
}
}
- stp_deprintf (STP_DBG_DPL, "Code: %d, String: %s\n", code, string);
+ stp_dprintf (STP_DBG_DPL, v, "Code: %d, String: %s\n", code, string);
return (string);
}
@@ -625,9 +626,10 @@ dpl_val_to_text (int code, /* I: Code */
*/
static const dpl_cap_t * /* O: Capabilities */
-dpl_get_model_capabilities (int model) /* I: Model */
+dpl_get_model_capabilities (const stp_vars_t *v) /* I: Model */
{
int i;
+ int model = stp_get_model_id(v);
int models = sizeof (dpl_model_capabilities) / sizeof (dpl_cap_t);
for (i = 0; i < models; i++)
{
@@ -636,7 +638,7 @@ dpl_get_model_capabilities (int model) /* I: Model */
return &(dpl_model_capabilities[i]);
}
}
- stp_erprintf ("dpl: model %d not found in capabilities list.\n", model);
+ stp_eprintf (v, "dpl: model %d not found in capabilities list.\n", model);
return &(dpl_model_capabilities[0]);
}
@@ -679,8 +681,7 @@ dpl_get_multiplier (const stp_vars_t * v)
int multiplier;
int i;
int max_dpi;
- int model = stp_get_model_id (v);
- const dpl_cap_t *caps = dpl_get_model_capabilities (model);
+ const dpl_cap_t *caps = dpl_get_model_capabilities (v);
for (i = 0; i < NUM_RESOLUTIONS; i++)
{
@@ -737,9 +738,9 @@ static const stp_param_string_t label_separator_types[] = {
*/
static int
-dpl_papersize_valid (const stp_papersize_t * pt, int model)
+dpl_papersize_valid (const stp_vars_t *v, const stp_papersize_t * pt)
{
- const dpl_cap_t *caps = dpl_get_model_capabilities (model);
+ const dpl_cap_t *caps = dpl_get_model_capabilities (v);
unsigned int pwidth = pt->width;
unsigned int pheight = pt->height;
@@ -807,16 +808,16 @@ dpl_parameters (const stp_vars_t * v, const char *name,
if (name == NULL)
return;
- stp_deprintf (STP_DBG_DPL, "dpl_parameters(): Name = %s\n", name);
+ stp_dprintf (STP_DBG_DPL, v, "dpl_parameters(): Name = %s\n", name);
- caps = dpl_get_model_capabilities (model);
+ caps = dpl_get_model_capabilities (v);
- stp_deprintf (STP_DBG_DPL, "Printer model = %d\n", model);
- stp_deprintf (STP_DBG_DPL, "PageWidth = %d, PageHeight = %d\n",
+ stp_dprintf (STP_DBG_DPL, v, "Printer model = %d\n", model);
+ stp_dprintf (STP_DBG_DPL, v, "PageWidth = %d, PageHeight = %d\n",
caps->custom_max_width, caps->custom_max_height);
- stp_deprintf (STP_DBG_DPL, "MinPageWidth = %d, MinPageHeight = %d\n",
+ stp_dprintf (STP_DBG_DPL, v, "MinPageWidth = %d, MinPageHeight = %d\n",
caps->custom_min_width, caps->custom_min_height);
- stp_deprintf (STP_DBG_DPL, "Resolutions: %d\n", caps->resolutions);
+ stp_dprintf (STP_DBG_DPL, v, "Resolutions: %d\n", caps->resolutions);
for (i = 0; i < the_parameter_count; i++)
if (strcmp (name, the_parameters[i].name) == 0)
@@ -839,14 +840,18 @@ dpl_parameters (const stp_vars_t * v, const char *name,
if (strcmp (name, "PageSize") == 0)
{
- int papersizes = stp_known_papersizes ();
+ const stp_papersize_list_t *paper_sizes =
+ stpi_get_papersize_list_named("labels", "");
+ const stp_papersize_list_item_t *ptli =
+ stpi_papersize_list_get_start(paper_sizes);
description->bounds.str = stp_string_list_create ();
- for (i = 0; i < papersizes; i++)
+ while (ptli)
{
- const stp_papersize_t *pt = stp_get_papersize_by_index (i);
- if (strlen (pt->name) > 0 && dpl_papersize_valid (pt, model))
- stp_string_list_add_string (description->bounds.str,
- pt->name, gettext (pt->text));
+ const stp_papersize_t *pt = stpi_paperlist_item_get_data(ptli);
+ if (strlen (pt->name) > 0 && dpl_papersize_valid (v, pt))
+ stp_string_list_add_string(description->bounds.str,
+ pt->name, gettext(pt->text));
+ ptli = stpi_paperlist_item_next(ptli);
}
description->deflt.str =
stp_string_list_param (description->bounds.str, 0)->name;
@@ -855,16 +860,16 @@ dpl_parameters (const stp_vars_t * v, const char *name,
{
description->bounds.str = stp_string_list_create ();
description->deflt.str =
- dpl_val_to_string (caps->max_resolution, dpl_resolutions,
+ dpl_val_to_string (v, caps->max_resolution, dpl_resolutions,
NUM_RESOLUTIONS);
for (i = 0; i < NUM_RESOLUTIONS; i++)
if (caps->resolutions & dpl_resolutions[i].dpl_code)
{
stp_string_list_add_string
(description->bounds.str,
- dpl_val_to_string (dpl_resolutions[i].dpl_code,
+ dpl_val_to_string (v, dpl_resolutions[i].dpl_code,
dpl_resolutions, NUM_RESOLUTIONS),
- dpl_val_to_text (dpl_resolutions[i].dpl_code,
+ dpl_val_to_text (v, dpl_resolutions[i].dpl_code,
dpl_resolutions, NUM_RESOLUTIONS));
}
}
@@ -965,7 +970,7 @@ static void
dpl_limit (const stp_vars_t * v, /* I */
stp_dimension_t *width, stp_dimension_t *height, stp_dimension_t *min_width, stp_dimension_t *min_height)
{
- const dpl_cap_t *caps = dpl_get_model_capabilities (stp_get_model_id (v));
+ const dpl_cap_t *caps = dpl_get_model_capabilities (v);
*width = caps->custom_max_width;
*height = caps->custom_max_height;
*min_width = caps->custom_min_width;
@@ -978,6 +983,12 @@ dpl_describe_output (const stp_vars_t * v)
return "Grayscale";
}
+static const stp_papersize_t *
+dpl_describe_papersize(const stp_vars_t *v, const char *name)
+{
+ return stpi_get_listed_papersize(name, "labels");
+}
+
static void
pcx_header (stp_vars_t * v, stp_image_t * image)
{
@@ -1092,8 +1103,7 @@ dpl_do_print (stp_vars_t * v, stp_image_t * image)
unsigned zero_mask;
int image_height;
int image_width;
- int model = stp_get_model_id (v);
- const dpl_cap_t *caps = dpl_get_model_capabilities (model);
+ const dpl_cap_t *caps = dpl_get_model_capabilities (v);
const char *speed = stp_get_string_parameter(v, "Speed");
if (!stp_verify (v))
@@ -1120,7 +1130,7 @@ dpl_do_print (stp_vars_t * v, stp_image_t * image)
dpl_describe_resolution (v, &xdpi, &ydpi);
- stp_deprintf (STP_DBG_DPL, "dpl: resolution=%dx%d\n", (int) xdpi, (int) ydpi);
+ stp_dprintf (STP_DBG_DPL, v, "dpl: resolution=%dx%d\n", (int) xdpi, (int) ydpi);
if (xdpi <= 0 || ydpi <= 0)
{
stp_eprintf (v, "No resolution found; cannot print.\n");
@@ -1260,7 +1270,7 @@ dpl_do_print (stp_vars_t * v, stp_image_t * image)
pcx_header (v, image);
- stp_deprintf (STP_DBG_DPL, "Normal init\n");
+ stp_dprintf (STP_DBG_DPL, v, "Normal init\n");
/*
* Allocate memory for the raster data...
@@ -1348,7 +1358,8 @@ static const stp_printfuncs_t print_dpl_printfuncs = {
stp_verify_printer_params,
NULL,
NULL,
- NULL
+ NULL,
+ dpl_describe_papersize
};
@@ -1366,8 +1377,7 @@ dpl_pcx (stp_vars_t * v, /* I - Print file or command */
int in = 0;
int out = 0;
stp_resolution_t xdpi, ydpi;
- int model = stp_get_model_id (v);
- const dpl_cap_t *caps = dpl_get_model_capabilities (model);
+ const dpl_cap_t *caps = dpl_get_model_capabilities (v);
int i;
int max_dpi;
int dpi_adjust;
@@ -1447,14 +1457,14 @@ static stp_family_t print_dpl_module_data = {
static int
print_dpl_module_init (void)
{
- return stp_family_register (print_dpl_module_data.printer_list);
+ return stpi_family_register (print_dpl_module_data.printer_list);
}
static int
print_dpl_module_exit (void)
{
- return stp_family_unregister (print_dpl_module_data.printer_list);
+ return stpi_family_unregister (print_dpl_module_data.printer_list);
}
diff --git a/src/main/print-olympus.c b/src/main/print-dyesub.c
index 26ce9c8..70fcc39 100644
--- a/src/main/print-olympus.c
+++ b/src/main/print-dyesub.c
@@ -4,7 +4,7 @@
*
* Copyright 2003-2006 Michael Mraka (Michael.Mraka@linux.cz)
*
- * Copyright 2007-2017 Solomon Peachy (pizza@shaftnet.org)
+ * Copyright 2007-2018 Solomon Peachy (pizza@shaftnet.org)
*
* The plug-in is based on the code of the RAW plugin for the GIMP of
* Michael Sweet (mike@easysw.com) and Robert Krawitz (rlk@alum.mit.edu)
@@ -20,8 +20,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -42,9 +41,7 @@
#define inline __inline__
#endif
-#define MITSU70X_8BPP
//#define S6145_YMC
-//#define CANONSELPHYNEO_CMY
#define DYESUB_FEATURE_NONE 0x00000000
#define DYESUB_FEATURE_FULL_WIDTH 0x00000001
@@ -55,18 +52,17 @@
#define DYESUB_FEATURE_PLANE_INTERLACE 0x00000020
#define DYESUB_FEATURE_PLANE_LEFTTORIGHT 0x00000040
#define DYESUB_FEATURE_ROW_INTERLACE 0x00000080
-#define DYESUB_FEATURE_12BPP 0x00000100
-#define DYESUB_FEATURE_16BPP 0x00000200
-#define DYESUB_FEATURE_BIGENDIAN 0x00000400
#define DYESUB_FEATURE_DUPLEX 0x00000800
#define DYESUB_FEATURE_MONOCHROME 0x00001000
-#ifndef CANONSELPHYNEO_CMY
-#define DYESUB_FEATURE_RGBtoYCBCR 0x00002000
-#endif
+#define DYESUB_FEATURE_NATIVECOPIES 0x00002000
#define DYESUB_PORTRAIT 0
#define DYESUB_LANDSCAPE 1
+#define OP_JOB_START 1
+#define OP_JOB_PRINT 2
+#define OP_JOB_END 4
+
#ifndef MIN
# define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif /* !MIN */
@@ -83,18 +79,11 @@
}
#define MAX_INK_CHANNELS 3
-#define MAX_BYTES_PER_CHANNEL 2
#define SIZE_THRESHOLD 6
/*
* Random implementation from POSIX.1-2001 to yield reproducible results.
*/
-static int xrand(unsigned long *seed)
-{
- *seed = *seed * 1103515245ul + 12345ul;
- return ((unsigned) (*seed / 65536ul) % 32768ul);
-}
-
typedef struct
{
const char *output_type;
@@ -120,17 +109,30 @@ typedef struct {
} dyesub_resolution_list_t;
typedef struct {
- const char* name;
- const char* text;
- stp_dimension_t width_pt;
- stp_dimension_t height_pt;
- stp_dimension_t border_pt_left;
- stp_dimension_t border_pt_right;
- stp_dimension_t border_pt_top;
- stp_dimension_t border_pt_bottom;
+ stp_papersize_t psize;
int print_mode;
} dyesub_pagesize_t;
+#define DEFINE_PAPER(__n, __t, __w, __h, __bl, __br, __bt, __bb, __pm) \
+ { \
+ .psize = { \
+ .name = __n, \
+ .text = N_(__t), \
+ .width = __w, \
+ .height = __h, \
+ .top = __bt, \
+ .left = __bl, \
+ .bottom = __bb, \
+ .right = __br, \
+ .paper_unit = PAPERSIZE_ENGLISH_STANDARD, \
+ .paper_size_type = PAPERSIZE_TYPE_STANDARD, \
+ }, \
+ .print_mode = __pm, \
+ }
+
+#define DEFINE_PAPER_SIMPLE(__n, __t, __w, __h, __pm) \
+ DEFINE_PAPER(__n, __t, __w, __h, 0, 0, 0, 0, __pm)
+
typedef struct {
const dyesub_pagesize_t *item;
size_t n_items;
@@ -152,12 +154,12 @@ typedef struct {
const char *name;
const char *text;
const stp_raw_t seq;
-} laminate_t;
+} overcoat_t;
typedef struct {
- const laminate_t *item;
+ const overcoat_t *item;
size_t n_items;
-} laminate_list_t;
+} overcoat_list_t;
typedef struct {
const char* name;
@@ -184,6 +186,7 @@ typedef struct {
typedef struct
{
int multicut;
+ int nocutwaste;
const char *print_speed; /* DS820 only */
} dnp_privdata_t;
@@ -197,10 +200,11 @@ typedef struct
typedef struct
{
int quality;
- int laminate_offset;
+ int overcoat_offset;
int use_lut;
int sharpen;
int delay;
+ int deck;
} mitsu70x_privdata_t;
typedef struct
@@ -234,6 +238,31 @@ typedef struct
char commentbuf[19]; /* With one extra byte for null termination */
} mitsu_p95d_privdata_t;
+typedef struct
+{
+ int resin_k;
+ int reject;
+ int colorsure;
+ int holokote;
+ int holokote_custom;
+ int holopatch;
+ int overcoat;
+ int overcoat_dpx;
+ const char *overcoat_hole; /* XXX TODO: add custom option? */
+ const char *overcoat_hole_dpx; /* XXX TODO: add custom option? */
+ int align_start;
+ int align_end;
+ int power_color;
+ int power_resin;
+ int power_overcoat;
+ int gamma;
+ int duplex;
+ char mag1[79]; /* Mag stripe row 1, 78 alphanumeric */
+ char mag2[40]; /* Mag stripe row 2, 39 numeric */
+ char mag3[107]; /* Mag stripe row 3, 106 numeric */
+ int mag_coer; /* 1 = high, 0 = low */
+} magicard_privdata_t;
+
/* Private data for dyesub driver as a whole */
typedef struct
{
@@ -243,14 +272,14 @@ typedef struct
int block_min_w, block_min_h;
int block_max_w, block_max_h;
const char* pagesize;
- const laminate_t* laminate;
+ const overcoat_t* overcoat;
const dyesub_media_t* media;
const char* slot;
int print_mode;
- int bpp;
const char* duplex_mode;
int page_number;
int copies;
+ int horiz_offset;
union {
dnp_privdata_t dnp;
mitsu9550_privdata_t m9550;
@@ -259,6 +288,7 @@ typedef struct
kodak8500_privdata_t k8500;
shinko1245_privdata_t s1245;
mitsu_p95d_privdata_t m95d;
+ magicard_privdata_t magicard;
} privdata;
} dyesub_privdata_t;
@@ -266,8 +296,6 @@ typedef struct {
int out_channels;
int ink_channels;
const char *ink_order;
- int bytes_per_ink_channel;
- int bits_per_ink_channel;
int byteswap;
int plane_interlacing;
int row_interlacing;
@@ -297,7 +325,7 @@ typedef struct /* printer specific parameters */
void (*block_init_func)(stp_vars_t *);
void (*block_end_func)(stp_vars_t *);
void (*adjust_curves)(stp_vars_t *);
- const laminate_list_t *laminate;
+ const overcoat_list_t *overcoat;
const dyesub_media_list_t *media;
void (*job_start_func)(stp_vars_t *);
void (*job_end_func)(stp_vars_t *);
@@ -308,8 +336,9 @@ typedef struct /* printer specific parameters */
} dyesub_cap_t;
-static const dyesub_cap_t* dyesub_get_model_capabilities(int model);
-static const laminate_t* dyesub_get_laminate_pattern(stp_vars_t *v);
+static int dyesub_feature(const dyesub_cap_t *caps, int feature);
+static const dyesub_cap_t* dyesub_get_model_capabilities(const stp_vars_t *v, int model);
+static const overcoat_t* dyesub_get_overcoat_pattern(stp_vars_t *v);
static const dyesub_media_t* dyesub_get_mediatype(stp_vars_t *v);
static void dyesub_nputc(stp_vars_t *v, char byte, int count);
static void dyesub_adjust_curve(stp_vars_t *v,
@@ -367,8 +396,8 @@ LIST(dyesub_resolution_list_t, res_310dpi_list, dyesub_resolution_t, res_310dpi)
static const dyesub_pagesize_t p10_page[] =
{
- { "w288h432", "4x6", 298, 430, 0, 0, 0, 0, DYESUB_PORTRAIT}, /* 4x6" */
- { "B7", "3.5x5", 266, 370, 0, 0, 0, 0, DYESUB_PORTRAIT}, /* 3.5x5" */
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1280,310), PT1(1848,310), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1144,310), PT1(1591,310), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, p10_page_list, dyesub_pagesize_t, p10_page);
@@ -386,7 +415,7 @@ static void p10_printer_init_func(stp_vars_t *v)
dyesub_privdata_t *pd = get_privdata(v);
stp_zfwrite("\033R\033M\033S\2\033N\1\033D\1\033Y", 1, 15, v);
- stp_write_raw(&(pd->laminate->seq), v); /* laminate */
+ stp_write_raw(&(pd->overcoat->seq), v); /* overcoat */
stp_zfwrite("\033Z\0", 1, 3, v);
}
@@ -406,13 +435,13 @@ static void p10_block_init_func(stp_vars_t *v)
stp_put16_le(pd->block_max_h + 1, v);
}
-static const laminate_t p10_laminate[] =
+static const overcoat_t p10_overcoat[] =
{
{"Coated", N_("Coated"), {1, "\x00"}},
{"None", N_("None"), {1, "\x02"}},
};
-LIST(laminate_list_t, p10_laminate_list, laminate_t, p10_laminate);
+LIST(overcoat_list_t, p10_overcoat_list, overcoat_t, p10_overcoat);
/* Olympus P-200 series */
@@ -425,7 +454,7 @@ LIST(dyesub_resolution_list_t, res_320dpi_list, dyesub_resolution_t, res_320dpi)
static const dyesub_pagesize_t p200_page[] =
{
- { "ISOB7", "80x125mm", -1, -1, 16, 17, 33, 33, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "ISOB7", "80x125mm", PT(960,320), PT(1280,320), 16, 17, 33, 33, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, p200_page_list, dyesub_pagesize_t, p200_page);
@@ -487,7 +516,7 @@ LIST(dyesub_resolution_list_t, p300_res_list, dyesub_resolution_t, p300_res);
static const dyesub_pagesize_t p300_page[] =
{
- { "A6", "A6", -1, -1, 28, 28, 48, 48, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "A6", "A6", PT1(1024,306), PT1(1376,306), 28, 28, 48, 48, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, p300_page_list, dyesub_pagesize_t, p300_page);
@@ -516,7 +545,7 @@ static void p300_plane_end_func(stp_vars_t *v)
dyesub_privdata_t *pd = get_privdata(v);
stp_zprintf(v, "\033\033\033P%cS", c[pd->plane-1]);
- stp_deprintf(STP_DBG_DYESUB, "dyesub: p300_plane_end_func: %c\n",
+ stp_dprintf(STP_DBG_DYESUB, v, "dyesub: p300_plane_end_func: %c\n",
c[pd->plane-1]);
}
@@ -531,7 +560,7 @@ static void p300_block_init_func(stp_vars_t *v)
stp_put16_be(pd->block_max_h, v);
stp_put16_be(pd->block_max_w, v);
- stp_deprintf(STP_DBG_DYESUB, "dyesub: p300_block_init_func: %d-%dx%d-%d\n",
+ stp_dprintf(STP_DBG_DYESUB, v, "dyesub: p300_block_init_func: %d-%dx%d-%d\n",
pd->block_min_w, pd->block_max_w,
pd->block_min_h, pd->block_max_h);
}
@@ -592,9 +621,9 @@ LIST(dyesub_resolution_list_t, res_314dpi_list, dyesub_resolution_t, res_314dpi)
static const dyesub_pagesize_t p400_page[] =
{
- { "A4", "A4", -1, -1, 22, 22, 54, 54, DYESUB_PORTRAIT},
- { "c8x10", "A5 wide", -1, -1, 58, 59, 84, 85, DYESUB_PORTRAIT},
- { "C6", "2 Postcards (A4)", -1, -1, 9, 9, 9, 9, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "A4", "A4", PT1(2400,314), PT1(3200,314), 22, 22, 54, 54, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10", "A5 wide", PT1(2000,314), PT1(2400,314), 58, 59, 84, 85, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "C6", "2 Postcards (A4)", PT1(1328,314), PT1(1920,314), 9, 9, 9, 9, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, p400_page_list, dyesub_pagesize_t, p400_page);
@@ -716,10 +745,10 @@ static void p400_adjust_curves(stp_vars_t *v)
/* Olympus P-440 series */
static const dyesub_pagesize_t p440_page[] =
{
- { "A4", "A4", -1, -1, 10, 9, 54, 54, DYESUB_PORTRAIT},
- { "c8x10", "A5 wide", -1, -1, 58, 59, 72, 72, DYESUB_PORTRAIT},
- { "C6", "2 Postcards (A4)", -1, -1, 9, 9, 9, 9, DYESUB_PORTRAIT},
- { "w255h581", "A6 wide", -1, -1, 25, 25, 25, 24, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "A4", "A4", PT1(2508,314), PT1(3200,314), 10, 9, 54, 54, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10", "A5 wide", PT1(2000,314), PT1(2508,314), 58, 59, 72, 72, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "C6", "2 Postcards (A4)", PT1(1328,314), PT1(1920,314), 9, 9, 9, 9, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w255h581", "A6 wide", PT1(892,314), PT1(2320,314), 25, 25, 25, 24, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, p440_page_list, dyesub_pagesize_t, p440_page);
@@ -741,7 +770,7 @@ static void p440_printer_init_func(stp_vars_t *v)
stp_zprintf(v, "\033FP"); dyesub_nputc(v, '\0', 61);
stp_zprintf(v, "\033Y");
- stp_write_raw(&(pd->laminate->seq), v); /* laminate */
+ stp_write_raw(&(pd->overcoat->seq), v); /* overcoat */
dyesub_nputc(v, '\0', 61);
stp_zprintf(v, "\033FC"); dyesub_nputc(v, '\0', 61);
stp_zprintf(v, "\033ZF");
@@ -798,11 +827,11 @@ static void p440_block_end_func(stp_vars_t *v)
dyesub_privdata_t *pd = get_privdata(v);
int pad = (64 - (((pd->block_max_w - pd->block_min_w + 1)
* (pd->block_max_h - pd->block_min_h + 1) * 3) % 64)) % 64;
- stp_deprintf(STP_DBG_DYESUB,
+ stp_dprintf(STP_DBG_DYESUB, v,
"dyesub: max_x %d min_x %d max_y %d min_y %d\n",
pd->block_max_w, pd->block_min_w,
pd->block_max_h, pd->block_min_h);
- stp_deprintf(STP_DBG_DYESUB, "dyesub: olympus-p440 padding=%d\n", pad);
+ stp_dprintf(STP_DBG_DYESUB, v, "dyesub: olympus-p440 padding=%d\n", pad);
dyesub_nputc(v, '\0', pad);
}
@@ -810,8 +839,8 @@ static void p440_block_end_func(stp_vars_t *v)
/* Olympus P-S100 */
static const dyesub_pagesize_t ps100_page[] =
{
- { "w288h432", "4x6", 296, 426, 0, 0, 0, 0, DYESUB_PORTRAIT},/* 4x6" */
- { "B7", "3.5x5", 264, 366, 0, 0, 0, 0, DYESUB_PORTRAIT}, /* 3.5x5" */
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1254,306), PT1(1808,306), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1120,306), PT1(1554,306), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, ps100_page_list, dyesub_pagesize_t, ps100_page);
@@ -858,11 +887,11 @@ static void ps100_printer_end_func(stp_vars_t *v)
dyesub_privdata_t *pd = get_privdata(v);
int pad = (64 - (((pd->block_max_w - pd->block_min_w + 1)
* (pd->block_max_h - pd->block_min_h + 1) * 3) % 64)) % 64;
- stp_deprintf(STP_DBG_DYESUB,
+ stp_dprintf(STP_DBG_DYESUB, v,
"dyesub: max_x %d min_x %d max_y %d min_y %d\n",
pd->block_max_w, pd->block_min_w,
pd->block_max_h, pd->block_min_h);
- stp_deprintf(STP_DBG_DYESUB, "dyesub: olympus-ps100 padding=%d\n", pad);
+ stp_dprintf(STP_DBG_DYESUB, v, "dyesub: olympus-ps100 padding=%d\n", pad);
dyesub_nputc(v, '\0', pad); /* padding to 64B blocks */
stp_zprintf(v, "\033PY"); dyesub_nputc(v, '\0', 61);
@@ -880,7 +909,7 @@ LIST(dyesub_resolution_list_t, res_300dpi_list, dyesub_resolution_t, res_300dpi)
static const dyesub_pagesize_t cp10_page[] =
{
- { "w155h244", "Card 54x86mm", 159, 250, 6, 6, 29, 29, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "w155h244", "Card 54x86mm", PT1(662,300), PT1(1040,300), 6, 6, 29, 29, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, cp10_page_list, dyesub_pagesize_t, cp10_page);
@@ -895,9 +924,9 @@ LIST(dyesub_printsize_list_t, cp10_printsize_list, dyesub_printsize_t, cp10_prin
/* Canon CP-100 series */
static const dyesub_pagesize_t cpx00_page[] =
{
- { "Postcard", "Postcard 100x148mm", 296, 434, 13, 13, 16, 19, DYESUB_PORTRAIT},
- { "w253h337", "CP_L 89x119mm", 264, 350, 13, 13, 15, 15, DYESUB_PORTRAIT},
- { "w155h244", "Card 54x86mm", 162, 250, 13, 13, 15, 15, DYESUB_LANDSCAPE},
+ DEFINE_PAPER( "Postcard", "Postcard 100x148mm", PT1(1232,300), PT1(1808,300), 13, 13, 16, 19, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w253h337", "CP_L 89x119mm", PT1(1100,300), PT1(1456,300), 13, 13, 15, 15, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w155h244", "Card 54x86mm", PT1(672,300), PT1(1040,300), 13, 13, 15, 15, DYESUB_LANDSCAPE),
};
LIST(dyesub_pagesize_list_t, cpx00_page_list, dyesub_pagesize_t, cpx00_page);
@@ -995,10 +1024,10 @@ static void cpx00_adjust_curves(stp_vars_t *v)
/* Canon CP-220 series */
static const dyesub_pagesize_t cp220_page[] =
{
- { "Postcard", "Postcard 100x148mm", 296, 434, 13, 13, 16, 19, DYESUB_PORTRAIT},
- { "w253h337", "CP_L 89x119mm", 264, 350, 13, 13, 15, 15, DYESUB_PORTRAIT},
- { "w155h244", "Card 54x86mm", 162, 250, 13, 13, 15, 15, DYESUB_LANDSCAPE},
- { "w283h566", "Wide 100x200mm", 296, 580, 13, 13, 20, 20, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "Postcard", "Postcard 100x148mm", PT1(1232,300), PT1(1808,300), 13, 13, 16, 19, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w253h337", "CP_L 89x119mm", PT1(1100,300), PT1(1456,300), 13, 13, 15, 15, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w155h244", "Card 54x86mm", PT1(672,300), PT1(1040,300), 13, 13, 15, 15, DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w283h566", "Wide 100x200mm", PT1(1232,300), PT1(2416,300), 13, 13, 20, 20, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, cp220_page_list, dyesub_pagesize_t, cp220_page);
@@ -1156,9 +1185,9 @@ static void cp900_printer_end_func(stp_vars_t *v)
/* Canon CP820/CP910/CP1000/CP1200 and beynod */
static const dyesub_pagesize_t cp910_page[] =
{
- { "Postcard", "Postcard 100x148mm", PT1(1248,300), PT1(1872,300), 13, 13, 16, 19, DYESUB_PORTRAIT},
- { "w253h337", "CP_L 89x119mm", PT1(1152,300), PT1(1472,300), 13, 13, 15, 15, DYESUB_PORTRAIT},
- { "w155h244", "Card 54x86mm", PT1(668,300), PT1(1088,300), 13, 13, 15, 15, DYESUB_LANDSCAPE},
+ DEFINE_PAPER( "Postcard", "Postcard 100x148mm", PT1(1248,300), PT1(1872,300), 13, 13, 16, 19, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w253h337", "CP_L 89x119mm", PT1(1152,300), PT1(1472,300), 13, 13, 15, 15, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w155h244", "Card 54x86mm", PT1(668,300), PT1(1088,300), 13, 13, 15, 15, DYESUB_LANDSCAPE),
};
LIST(dyesub_pagesize_list_t, cp910_page_list, dyesub_pagesize_t, cp910_page);
@@ -1190,11 +1219,7 @@ static void cp910_printer_init_func(stp_vars_t *v)
stp_putc(pg, v);
dyesub_nputc(v, '\0', 4);
-#ifdef CANONSELPHYNEO_CMY
stp_putc(0x01, v);
-#else
- stp_putc(0x00, v);
-#endif
stp_put32_le(pd->w_size, v);
stp_put32_le(pd->h_size, v);
@@ -1211,8 +1236,7 @@ LIST(dyesub_resolution_list_t, res_403dpi_list, dyesub_resolution_t, res_403dpi)
/* only Postcard pagesize is supported */
static const dyesub_pagesize_t dppex5_page[] =
{
- { "w288h432", "Postcard", PT1(1664,403), PT1(2466,403), 13, 14, 18, 17,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER( "w288h432", "Postcard", PT1(1664,403), PT1(2466,403), 13, 14, 18, 17, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, dppex5_page_list, dyesub_pagesize_t, dppex5_page);
@@ -1246,8 +1270,8 @@ static void dppex5_printer_init(stp_vars_t *v)
dyesub_nputc(v, '\0', 19);
stp_zprintf(v, "5EPD");
dyesub_nputc(v, '\0', 4);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /*laminate pattern*/
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /*overcoat pattern*/
stp_zfwrite("\0d\0d\0d", 1, 6, v);
dyesub_nputc(v, '\0', 21);
}
@@ -1267,20 +1291,20 @@ static void dppex5_printer_end(stp_vars_t *v)
stp_zfwrite("DPEX\0\0\0\x81", 1, 8, v);
}
-static const laminate_t dppex5_laminate[] =
+static const overcoat_t dppex5_overcoat[] =
{
{"Glossy", N_("Glossy"), {1, "\x00"}},
{"Texture", N_("Texture"), {1, "\x01"}},
};
-LIST(laminate_list_t, dppex5_laminate_list, laminate_t, dppex5_laminate);
+LIST(overcoat_list_t, dppex5_overcoat_list, overcoat_t, dppex5_overcoat);
/* Sony UP-DP10 */
static const dyesub_pagesize_t updp10_page[] =
{
- { "w288h432", "UPC-10P23 (4x6)", -1, -1, 12, 12, 18, 18, DYESUB_LANDSCAPE},
- { "w288h387", "UPC-10P34 (4x5)", -1, 384, 12, 12, 16, 16, DYESUB_LANDSCAPE},
+ DEFINE_PAPER( "w288h432", "UPC-10P23 (4x6)", PT(1200,300), PT(1800,300), 12, 12, 18, 18, DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w288h387", "UPC-10P34 (4x5)", PT(1200,300), PT(1600,300), 12, 12, 16, 16, DYESUB_LANDSCAPE),
};
LIST(dyesub_pagesize_list_t, updp10_page_list, dyesub_pagesize_t, updp10_page);
@@ -1302,8 +1326,8 @@ static void updp10_printer_init_func(stp_vars_t *v)
"\x00\x02\x00\x00\x01\x12\x00\x00"
"\x00\x1b\xe1\x00\x00\x00\x0b\x00"
"\x00\x04", 1, 34, v);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /*laminate pattern*/
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /*overcoat pattern*/
stp_zfwrite("\x00\x00\x00\x00", 1, 4, v);
stp_put16_be(pd->w_size, v);
stp_put16_be(pd->h_size, v);
@@ -1326,14 +1350,14 @@ static void updp10_printer_end_func(stp_vars_t *v)
, 1, 23, v);
}
-static const laminate_t updp10_laminate[] =
+static const overcoat_t updp10_overcoat[] =
{
{"Glossy", N_("Glossy"), {1, "\x00"}},
{"Texture", N_("Texture"), {1, "\x08"}},
{"Matte", N_("Matte"), {1, "\x0c"}},
};
-LIST(laminate_list_t, updp10_laminate_list, laminate_t, updp10_laminate);
+LIST(overcoat_list_t, updp10_overcoat_list, overcoat_t, updp10_overcoat);
static const char updp10_adj_cyan[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
@@ -1387,10 +1411,10 @@ static void updp10_adjust_curves(stp_vars_t *v)
/* Sony UP-DR100 */
static const dyesub_pagesize_t updr100_page[] =
{
- { "w288h432", "4x6", 298, 442, 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "B7", "3.5x5", 261, 369, 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w360h504", "5x7", 369, 514, 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w432h576", "6x8", 442, 588, 0, 0, 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1382,334), PT1(2048,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1210,334), PT1(1710,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1710,334), PT1(2380,334), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(2048,334), PT1(2724,334), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, updr100_page_list, dyesub_pagesize_t, updr100_page);
@@ -1413,7 +1437,7 @@ static void updr100_printer_init_func(stp_vars_t *v)
stp_put32_le(pd->w_size, v);
stp_put32_le(pd->h_size, v);
stp_zfwrite("\x1e\x00\x03\x00\x01\x00\x4e\x01\x00\x00", 1, 10, v);
- stp_write_raw(&(pd->laminate->seq), v); /* laminate pattern */
+ stp_write_raw(&(pd->overcoat->seq), v); /* overcoat pattern */
dyesub_nputc(v, '\0', 13);
stp_zfwrite("\x01\x00\x01\x00\x03", 1, 5, v);
dyesub_nputc(v, '\0', 19);
@@ -1430,14 +1454,14 @@ static void updr100_printer_end_func(stp_vars_t *v)
, 1, 34, v);
}
-static const laminate_t updr100_laminate[] =
+static const overcoat_t updr100_overcoat[] =
{
{"Glossy", N_("Glossy"), {1, "\x01"}},
{"Texture", N_("Texture"), {1, "\x03"}},
{"Matte", N_("Matte"), {1, "\x04"}},
};
-LIST(laminate_list_t, updr100_laminate_list, laminate_t, updr100_laminate);
+LIST(overcoat_list_t, updr100_overcoat_list, overcoat_t, updr100_overcoat);
/* Sony UP-DR150 */
@@ -1450,10 +1474,10 @@ LIST(dyesub_resolution_list_t, res_334dpi_list, dyesub_resolution_t, res_334dpi)
static const dyesub_pagesize_t updr150_page[] =
{
- { "w288h432", "4x6", PT1(1382,334), PT1(2048,334), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "B7", "3.5x5", PT1(1210,334), PT1(1728,334), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1728,334), PT1(2380,334), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(2048,334), PT1(2724,334), 0, 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1382,334), PT1(2048,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1210,334), PT1(1728,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1728,334), PT1(2380,334), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(2048,334), PT1(2724,334), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, updr150_page_list, dyesub_pagesize_t, updr150_page);
@@ -1559,8 +1583,8 @@ static void updr150_200_printer_init_func(stp_vars_t *v, int updr200)
stp_zfwrite("\x07\x00\x00\x00"
"\x1b\xe1\x00\x00\x00\x0b\x00"
"\x0b\x00\x00\x00\x00\x80", 1, 17, v);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /*laminate pattern*/
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /*overcoat pattern*/
stp_zfwrite("\x00\x00\x00\x00", 1, 4, v);
stp_put16_be(pd->w_size, v);
@@ -1599,13 +1623,13 @@ static void updr150_printer_end_func(stp_vars_t *v)
/* Sony UP-DR200 */
static const dyesub_pagesize_t updr200_page[] =
{
- { "w288h432", "4x6", PT1(1382,334), PT1(2048,334), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1382,334), PT1(2048,334), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "B7", "3.5x5", PT1(1210,334), PT1(1728,334), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1728,334), PT1(2380,334), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w360h504-div2", "3.5x5*2", PT1(1728,334), PT1(2420,334), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(2048,334), PT1(2724,334), 0, 0, 0, DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(2048,334), PT1(2764,334), 0, 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1382,334), PT1(2048,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1382,334), PT1(2048,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1210,334), PT1(1728,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1728,334), PT1(2380,334), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w360h504-div2", "3.5x5*2", PT1(1728,334), PT1(2420,334), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(2048,334), PT1(2724,334), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT1(2048,334), PT1(2764,334), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, updr200_page_list, dyesub_pagesize_t, updr200_page);
@@ -1623,7 +1647,7 @@ static const dyesub_printsize_t updr200_printsize[] =
LIST(dyesub_printsize_list_t, updr200_printsize_list, dyesub_printsize_t, updr200_printsize);
-static const laminate_t updr200_laminate[] =
+static const overcoat_t updr200_overcoat[] =
{
{"Glossy", N_("Glossy"), {1, "\x00"}},
{"Matte", N_("Matte"), {1, "\x0c"}},
@@ -1631,7 +1655,7 @@ static const laminate_t updr200_laminate[] =
{"Matte_NoCorr", N_("Matte_NoCorr"), {1, "\x1c"}},
};
-LIST(laminate_list_t, updr200_laminate_list, laminate_t, updr200_laminate);
+LIST(overcoat_list_t, updr200_overcoat_list, overcoat_t, updr200_overcoat);
static void updr200_printer_init_func(stp_vars_t *v)
{
@@ -1641,9 +1665,9 @@ static void updr200_printer_init_func(stp_vars_t *v)
/* Sony UP-CR10L / DNP SL10 */
static const dyesub_pagesize_t upcr10_page[] =
{
- { "w288h432", "4x6", PT1(1248,300), PT1(1848,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "B7", "3.5x5", PT1(1100,300), PT1(1536,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1536,300), PT1(2148,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1248,300), PT1(1848,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1100,300), PT1(1536,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1536,300), PT1(2148,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, upcr10_page_list, dyesub_pagesize_t, upcr10_page);
@@ -1705,9 +1729,9 @@ static void upcr10_printer_end_func(stp_vars_t *v)
/* Fujifilm CX-400 */
static const dyesub_pagesize_t cx400_page[] =
{
- { "w288h432", "4x6", 295, 428, 24, 24, 23, 22, DYESUB_PORTRAIT},
- { "w288h387", "4x5 3/8", 295, 386, 24, 24, 23, 23, DYESUB_PORTRAIT},
- { "w288h504", "4x7", 295, 513, 24, 24, 23, 22, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "w288h432", "4x6", PT1(1268,310), PT1(1658,310), 24, 24, 23, 22, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w288h387", "4x5 3/8", PT1(1268,310), PT1(1842,310), 24, 24, 23, 23, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w288h504", "4x7", PT1(1268,310), PT1(2208,310), 24, 24, 23, 22, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, cx400_page_list, dyesub_pagesize_t, cx400_page);
@@ -1728,7 +1752,7 @@ static void cx400_printer_init_func(stp_vars_t *v)
char pg = '\0';
const char *pname = "XXXXXX";
- stp_deprintf(STP_DBG_DYESUB,
+ stp_dprintf(STP_DBG_DYESUB, v,
"dyesub: fuji driver %s\n", stp_get_driver(v));
if (strcmp(stp_get_driver(v),"fujifilm-cx400") == 0)
pname = "NX1000";
@@ -1754,7 +1778,6 @@ static void cx400_printer_init_func(stp_vars_t *v)
stp_putc('\1', v);
}
-
/* Fujifilm NX-500 */
static const dyesub_resolution_t res_306dpi[] =
{
@@ -1765,7 +1788,7 @@ LIST(dyesub_resolution_list_t, res_306dpi_list, dyesub_resolution_t, res_306dpi)
static const dyesub_pagesize_t nx500_page[] =
{
- { "Postcard", "Postcard", -1, -1, 21, 21, 29, 29, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "Postcard", "Postcard", PT1(1024,306), PT1(1518,306), 21, 21, 29, 29, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, nx500_page_list, dyesub_pagesize_t, nx500_page);
@@ -1797,8 +1820,7 @@ static void nx500_printer_init_func(stp_vars_t *v)
/* Kodak Easyshare Dock family */
static const dyesub_pagesize_t kodak_dock_page[] =
{
- { "w288h432", "4x6", PT1(1248,300), PT1(1856,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT}, /* 4x6 */
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1248,300), PT1(1856,300), DYESUB_PORTRAIT), /* 4x6 */
};
LIST(dyesub_pagesize_list_t, kodak_dock_page_list, dyesub_pagesize_t, kodak_dock_page);
@@ -1829,10 +1851,8 @@ static void kodak_dock_plane_init(stp_vars_t *v)
/* Kodak 6800 */
static const dyesub_pagesize_t kodak_6800_page[] =
{
- { "w288h432", "4x6", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE}, /* 4x6 */
- { "w432h576", "6x8", PT1(1844,300), PT1(2434,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT}, /* 6x8 */
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE), /* 4x6 */
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1844,300), PT1(2434,300), DYESUB_PORTRAIT), /* 6x8 */
};
LIST(dyesub_pagesize_list_t, kodak_6800_page_list, dyesub_pagesize_t, kodak_6800_page);
@@ -1845,23 +1865,20 @@ static const dyesub_printsize_t kodak_6800_printsize[] =
LIST(dyesub_printsize_list_t, kodak_6800_printsize_list, dyesub_printsize_t, kodak_6800_printsize);
-static const laminate_t kodak_6800_laminate[] =
+static const overcoat_t kodak_6800_overcoat[] =
{
{"Coated", N_("Coated"), {1, "\x01"}},
{"None", N_("None"), {1, "\x00"}},
};
-LIST(laminate_list_t, kodak_6800_laminate_list, laminate_t, kodak_6800_laminate);
+LIST(overcoat_list_t, kodak_6800_overcoat_list, overcoat_t, kodak_6800_overcoat);
/* Kodak 6850 */
static const dyesub_pagesize_t kodak_6850_page[] =
{
- { "w288h432", "4x6", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE}, /* 4x6 */
- { "w360h504", "5x7", PT1(1548,300), PT1(2140,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT}, /* 5x7 */
- { "w432h576", "6x8", PT1(1844,300), PT1(2434,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT}, /* 6x8 */
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE), /* 4x6 */
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1548,300), PT1(2140,300), DYESUB_PORTRAIT), /* 5x7 */
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1844,300), PT1(2434,300), DYESUB_PORTRAIT), /* 6x8 */
};
LIST(dyesub_pagesize_list_t, kodak_6850_page_list, dyesub_pagesize_t, kodak_6850_page);
@@ -1914,20 +1931,17 @@ static void kodak_68xx_printer_init(stp_vars_t *v)
else
stp_putc(0x00, v); /* Just in case */
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v);
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v);
stp_putc(0x00, v);
}
/* Kodak 605 */
static const dyesub_pagesize_t kodak_605_page[] =
{
- { "w288h432", "4x6", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE}, /* 4x6 */
- { "w360h504", "5x7", PT1(1500,300), PT1(2100,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT}, /* 5x7 */
- { "w432h576", "6x8", PT1(1844,300), PT1(2434,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT}, /* 6x8 */
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE), /* 4x6 */
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1500,300), PT1(2100,300), DYESUB_PORTRAIT), /* 5x7 */
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1844,300), PT1(2434,300), DYESUB_PORTRAIT), /* 6x8 */
};
LIST(dyesub_pagesize_list_t, kodak_605_page_list, dyesub_pagesize_t, kodak_605_page);
@@ -1960,18 +1974,18 @@ static void kodak_605_printer_init(stp_vars_t *v)
else
stp_putc(0x01, v);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v);
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v);
stp_putc(0x00, v);
}
-static const laminate_t kodak_605_laminate[] =
+static const overcoat_t kodak_605_overcoat[] =
{
{"Coated", N_("Coated"), {1, "\x02"}},
{"None", N_("None"), {1, "\x01"}},
};
-LIST(laminate_list_t, kodak_605_laminate_list, laminate_t, kodak_605_laminate);
+LIST(overcoat_list_t, kodak_605_overcoat_list, overcoat_t, kodak_605_overcoat);
/* Kodak 1400 */
static const dyesub_resolution_t res_301dpi[] =
@@ -1993,9 +2007,9 @@ static const dyesub_pagesize_t kodak_1400_page[] =
The printer can technically print a little wider but these dimensions are
defined by the lamination area, which is fixed.
*/
- { "w612h864", "8.5x12", PT1(2560,301), PT(3010,301)+72*2, PT1(76,301), PT(76,301), 72, 72, DYESUB_PORTRAIT}, /* 8x12 */
- { "Legal", "8.5x14", PT1(2560,301), PT(3612,301)+72*2, PT1(35,301), PT1(35,301), 72, 72, DYESUB_PORTRAIT}, /* 8x14 */
- { "A4", "A4", PT1(2560,301), PT(3010,301)+72*2, PT1(76,301), PT(76,301), 0, 0, DYESUB_PORTRAIT}, /* A4, identical to 8x12 */
+ DEFINE_PAPER( "w612h864", "8.5x12", PT1(2560,301), PT(3010,301)+72*2, PT1(76,301), PT(76,301), 72, 72, DYESUB_PORTRAIT), /* 8x12 */
+ DEFINE_PAPER( "Legal", "8.5x14", PT1(2560,301), PT(3612,301)+72*2, PT1(35,301), PT1(35,301), 72, 72, DYESUB_PORTRAIT), /* 8x14 */
+ DEFINE_PAPER( "A4", "A4", PT1(2560,301), PT(3010,301)+72*2, PT1(76,301), PT(76,301), 0, 0, DYESUB_PORTRAIT), /* A4, identical to 8x12 */
};
LIST(dyesub_pagesize_list_t, kodak_1400_page_list, dyesub_pagesize_t, kodak_1400_page);
@@ -2038,8 +2052,8 @@ static void kodak_1400_printer_init(stp_vars_t *v)
stp_put32_le(pd->h_size*pd->w_size, v);
dyesub_nputc(v, 0x00, 4);
stp_zfwrite((pd->media->seq).data, 1, 1, v); /* Matte or Glossy? */
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v);
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v);
stp_putc(0x01, v);
stp_zfwrite((const char*)((pd->media->seq).data) + 1, 1, 1, v); /* Lamination intensity */
dyesub_nputc(v, 0x00, 12);
@@ -2050,8 +2064,8 @@ static const dyesub_pagesize_t kodak_805_page[] =
{
/* Identical to the Kodak 1400 except for the lack of A4 support.
See the 1400 comments for explanations of this. */
- { "w612h864", "8.5x12", PT1(2560,301), PT(3010,301)+72*2, PT1(76,301), PT(76,301), 72, 72, DYESUB_PORTRAIT}, /* 8x12 */
- { "Legal", "8.5x14", PT1(2560,301), PT(3612,301)+72*2, PT1(35,301), PT1(35,301), 72, 72, DYESUB_PORTRAIT}, /* 8x14 */
+ DEFINE_PAPER( "w612h864", "8.5x12", PT1(2560,301), PT(3010,301)+72*2, PT1(76,301), PT(76,301), 72, 72, DYESUB_PORTRAIT), /* 8x12 */
+ DEFINE_PAPER( "Legal", "8.5x14", PT1(2560,301), PT(3612,301)+72*2, PT1(35,301), PT1(35,301), 72, 72, DYESUB_PORTRAIT), /* 8x14 */
};
LIST(dyesub_pagesize_list_t, kodak_805_page_list, dyesub_pagesize_t, kodak_805_page);
@@ -2075,8 +2089,8 @@ static void kodak_805_printer_init(stp_vars_t *v)
dyesub_nputc(v, 0x00, 2);
stp_put32_le(pd->h_size*pd->w_size, v);
dyesub_nputc(v, 0x00, 5);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v);
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v);
stp_putc(0x01, v);
stp_putc(0x3c, v); /* Lamination intensity; fixed on glossy media */
dyesub_nputc(v, 0x00, 12);
@@ -2085,8 +2099,8 @@ static void kodak_805_printer_init(stp_vars_t *v)
/* Kodak 9810 / 8800 */
static const dyesub_pagesize_t kodak_9810_page[] =
{
- { "c8x10", "8x10", PT1(2464,300), PT1(3024,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w576h864", "8x12", PT1(2464,300), PT1(3624,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT1(2464,300), PT1(3024,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT1(2464,300), PT1(3624,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, kodak_9810_page_list, dyesub_pagesize_t, kodak_9810_page);
@@ -2098,13 +2112,13 @@ static const dyesub_printsize_t kodak_9810_printsize[] =
LIST(dyesub_printsize_list_t, kodak_9810_printsize_list, dyesub_printsize_t, kodak_9810_printsize);
-static const laminate_t kodak_9810_laminate[] =
+static const overcoat_t kodak_9810_overcoat[] =
{
{"Coated", N_("Coated"), {3, "\x4f\x6e\x20"}},
{"None", N_("None"), {3, "\x4f\x66\x66"}},
};
-LIST(laminate_list_t, kodak_9810_laminate_list, laminate_t, kodak_9810_laminate);
+LIST(overcoat_list_t, kodak_9810_overcoat_list, overcoat_t, kodak_9810_overcoat);
static const stp_parameter_t kodak_9810_parameters[] =
{
@@ -2122,7 +2136,7 @@ kodak_9810_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -2207,8 +2221,8 @@ static void kodak_9810_printer_init(stp_vars_t *v)
/* Lamination */
stp_putc(0x1b, v);
stp_zfwrite("FlsJbLam ", 1, 11, v);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v);
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v);
dyesub_nputc(v, 0x20, 5);
dyesub_nputc(v, 0x00, 4);
stp_put32_be(0, v);
@@ -2341,10 +2355,10 @@ static void kodak_9810_plane_init(stp_vars_t *v)
/* Kodak 8810 */
static const dyesub_pagesize_t kodak_8810_page[] =
{
- { "w288h576", "8x4", PT1(1208,300), PT1(2464,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "c8x10", "8x10", PT1(2464,300), PT1(3024,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "A4", "203x297mm", PT1(2464,300), PT1(3531,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w576h864", "8x12", PT1(2464,300), PT1(3624,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h576", "8x4", PT1(1208,300), PT1(2464,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT1(2464,300), PT1(3024,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "A4", "203x297mm", PT1(2464,300), PT1(3531,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT1(2464,300), PT1(3624,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, kodak_8810_page_list, dyesub_pagesize_t, kodak_8810_page);
@@ -2358,14 +2372,14 @@ static const dyesub_printsize_t kodak_8810_printsize[] =
LIST(dyesub_printsize_list_t, kodak_8810_printsize_list, dyesub_printsize_t, kodak_8810_printsize);
-static const laminate_t kodak_8810_laminate[] =
+static const overcoat_t kodak_8810_overcoat[] =
{
{"Glossy", N_("Glossy"), {1, "\x03"}},
{"Satin", N_("Satin"), {1, "\x02"}},
{"None", N_("None"), {1, "\x01"}},
};
-LIST(laminate_list_t, kodak_8810_laminate_list, laminate_t, kodak_8810_laminate);
+LIST(overcoat_list_t, kodak_8810_overcoat_list, overcoat_t, kodak_8810_overcoat);
static void kodak_8810_printer_init(stp_vars_t *v)
{
@@ -2382,8 +2396,8 @@ static void kodak_8810_printer_init(stp_vars_t *v)
stp_put16_le(pd->w_size, v);
stp_put16_le(pd->h_size, v);
dyesub_nputc(v, 0, 4);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v);
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v);
stp_putc(0x00, v); /* Method -- 00 is normal, 02 is x2, 03 is x3 */
stp_putc(0x00, v); /* Reserved */
}
@@ -2391,10 +2405,8 @@ static void kodak_8810_printer_init(stp_vars_t *v)
/* Kodak 7000/7010 */
static const dyesub_pagesize_t kodak_7000_page[] =
{
- { "w288h432", "4x6", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE}, /* 4x6 */
- { "w432h576", "6x8", PT1(1844,300), PT1(2434,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT}, /* 6x8 */
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE), /* 4x6 */
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1844,300), PT1(2434,300), DYESUB_PORTRAIT), /* 6x8 */
};
LIST(dyesub_pagesize_list_t, kodak_7000_page_list, dyesub_pagesize_t, kodak_7000_page);
@@ -2406,13 +2418,13 @@ static const dyesub_printsize_t kodak_7000_printsize[] =
};
LIST(dyesub_printsize_list_t, kodak_7000_printsize_list, dyesub_printsize_t, kodak_7000_printsize);
-static const laminate_t kodak_7000_laminate[] =
+static const overcoat_t kodak_7000_overcoat[] =
{
{"Glossy", N_("Glossy"), {1, "\x02"}},
{"Satin", N_("Satin"), {1, "\x03"}},
};
-LIST(laminate_list_t, kodak_7000_laminate_list, laminate_t, kodak_7000_laminate);
+LIST(overcoat_list_t, kodak_7000_overcoat_list, overcoat_t, kodak_7000_overcoat);
static void kodak_70xx_printer_init(stp_vars_t *v)
{
@@ -2432,16 +2444,15 @@ static void kodak_70xx_printer_init(stp_vars_t *v)
else
stp_putc(0x01, v);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v);
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v);
stp_putc(0x00, v);
}
-/* Kodak 7015/7015 */
+/* Kodak 7015 */
static const dyesub_pagesize_t kodak_7015_page[] =
{
- { "w360h504", "5x7", PT1(1548,300), PT1(2140,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT}, /* 5x7 */
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1548,300), PT1(2140,300), DYESUB_PORTRAIT), /* 5x7 */
};
LIST(dyesub_pagesize_list_t, kodak_7015_page_list, dyesub_pagesize_t, kodak_7015_page);
@@ -2456,8 +2467,8 @@ LIST(dyesub_printsize_list_t, kodak_7015_printsize_list, dyesub_printsize_t, kod
/* Kodak Professional 8500 */
static const dyesub_pagesize_t kodak_8500_page[] =
{
- { "w612h864", "8.5x12", PT1(2508,314), PT1(3134,314), 0, 0, 0, 0, DYESUB_PORTRAIT}, /* 8.5x12 & A4 */
- { "Letter", "8.5x11", PT1(2508,314), PT1(2954,314), 0, 0, 0, 0, DYESUB_PORTRAIT}, /* Letter */
+ DEFINE_PAPER_SIMPLE( "w612h864", "8.5x12", PT1(2508,314), PT1(3134,314), DYESUB_PORTRAIT), /* 8.5x12 & A4 */
+ DEFINE_PAPER_SIMPLE( "Letter", "8.5x11", PT1(2508,314), PT1(2954,314), DYESUB_PORTRAIT), /* Letter */
};
LIST(dyesub_pagesize_list_t, kodak_8500_page_list, dyesub_pagesize_t, kodak_8500_page);
@@ -2477,13 +2488,13 @@ static const dyesub_media_t kodak_8500_media[] =
};
LIST(dyesub_media_list_t, kodak_8500_media_list, dyesub_media_t, kodak_8500_media);
-static const laminate_t kodak_8500_laminate[] =
+static const overcoat_t kodak_8500_overcoat[] =
{
{"Coated", N_("Coated"), {1, "\x00"}},
{"None", N_("None"), {1, "\x02"}},
};
-LIST(laminate_list_t, kodak_8500_laminate_list, laminate_t, kodak_8500_laminate);
+LIST(overcoat_list_t, kodak_8500_overcoat_list, overcoat_t, kodak_8500_overcoat);
static const stp_parameter_t kodak_8500_parameters[] =
{
@@ -2507,7 +2518,7 @@ kodak_8500_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -2589,7 +2600,7 @@ static void kodak_8500_printer_init(stp_vars_t *v)
/* Lamination */
stp_putc(0x1b, v);
stp_putc(0x59, v);
- if (*((const char*)((pd->laminate->seq).data)) == 0x02) { /* No lamination */
+ if (*((const char*)((pd->overcoat->seq).data)) == 0x02) { /* No lamination */
stp_putc(0x02, v);
stp_putc(0x00, v);
} else {
@@ -2648,19 +2659,13 @@ LIST(dyesub_resolution_list_t, res_325dpi_list, dyesub_resolution_t, res_325dpi)
/* All are "custom" page sizes.. bleh.. */
static const dyesub_pagesize_t mitsu_p95d_page[] =
{
- { "w213h284", "1280x960", PT1(960,325), PT1(1280,325), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w227h284", "1280x1024", PT1(1024,325), PT1(1280,325), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w284h284", "1280x1280", PT1(1280,325), PT1(1280,325), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w284h426", "1280x1920", PT1(1280,325), PT1(1920,325), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w284h1277", "1280x5760", PT1(1280,325), PT1(5760,325), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w213h284", "1280x960", PT1(960,325), PT1(1280,325), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w227h284", "1280x1024", PT1(1024,325), PT1(1280,325), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w284h284", "1280x1280", PT1(1280,325), PT1(1280,325), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w284h426", "1280x1920", PT1(1280,325), PT1(1920,325), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w284h1277", "1280x5760", PT1(1280,325), PT1(5760,325), DYESUB_PORTRAIT),
/* A true "custom" size, printer will cut at the image boundary */
- { "Custom", NULL, PT1(1280,325), -1, 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "Custom", "Custom", PT1(1280,325), -1, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, mitsu_p95d_page_list, dyesub_pagesize_t, mitsu_p95d_page);
@@ -2791,7 +2796,7 @@ mitsu_p95d_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -2958,14 +2963,14 @@ static int mitsu_p95d_parse_parameters(stp_vars_t *v)
} else if (!strcmp(comment, "Date")) {
struct tm tmp;
time_t t;
- t = time(NULL);
+ t = stpi_time(NULL);
localtime_r(&t, &tmp);
strftime(pd->privdata.m95d.commentbuf, sizeof(pd->privdata.m95d.commentbuf), " %F", &tmp);
pd->privdata.m95d.comment = 2;
} else if (!strcmp(comment, "DateTime")) {
struct tm tmp;
time_t t;
- t = time(NULL);
+ t = stpi_time(NULL);
localtime_r(&t, &tmp);
strftime(pd->privdata.m95d.commentbuf, sizeof(pd->privdata.m95d.commentbuf), " %F %R", &tmp);
pd->privdata.m95d.comment = 3;
@@ -3197,7 +3202,7 @@ mitsu_p93d_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -3346,14 +3351,14 @@ static int mitsu_p93d_parse_parameters(stp_vars_t *v)
} else if (!strcmp(comment, "Date")) {
struct tm tmp;
time_t t;
- t = time(NULL);
+ t = stpi_time(NULL);
localtime_r(&t, &tmp);
strftime(pd->privdata.m95d.commentbuf, sizeof(pd->privdata.m95d.commentbuf), " %F", &tmp);
pd->privdata.m95d.comment = 2;
} else if (!strcmp(comment, "DateTime")) {
struct tm tmp;
time_t t;
- t = time(NULL);
+ t = stpi_time(NULL);
localtime_r(&t, &tmp);
strftime(pd->privdata.m95d.commentbuf, sizeof(pd->privdata.m95d.commentbuf), " %F %R", &tmp);
pd->privdata.m95d.comment = 3;
@@ -3466,8 +3471,8 @@ static void mitsu_p93d_printer_init(stp_vars_t *v)
/* Mitsubishi CP3020D/DU/DE */
static const dyesub_pagesize_t mitsu_cp3020d_page[] =
{
- { "A4", "A4", PT1(2508,314), PT1(3134,314), 0, 0, 0, 0, DYESUB_PORTRAIT}, /* A4 */
- { "Legal", "Letter Long", PT1(2508,314), PT1(3762,314), 0, 0, 0, 0, DYESUB_PORTRAIT}, /* Letter */
+ DEFINE_PAPER_SIMPLE( "A4", "A4", PT1(2508,314), PT1(3134,314), DYESUB_PORTRAIT), /* A4 */
+ DEFINE_PAPER_SIMPLE( "Legal", "Letter Long", PT1(2508,314), PT1(3762,314), DYESUB_PORTRAIT), /* Letter */
};
LIST(dyesub_pagesize_list_t, mitsu_cp3020d_page_list, dyesub_pagesize_t, mitsu_cp3020d_page);
@@ -3633,8 +3638,8 @@ static void mitsu_cp3020da_plane_init(stp_vars_t *v)
stp_putc(0x1b, v);
stp_putc(0x5a, v);
stp_putc(0x54, v);
- stp_putc((pd->bpp > 8) ? 0x10: 0x00, v);
- dyesub_nputc(v, 0x00, 2);
+ stp_putc(0x00, v);
+ stp_put16_be(0, v); /* Starting column for this block */
stp_put16_be(0, v); /* Starting row for this block */
stp_put16_be(pd->w_size, v);
stp_put16_be(pd->h_size, v); /* Number of rows in this block */
@@ -3651,16 +3656,11 @@ LIST(dyesub_resolution_list_t, res_m9500_list, dyesub_resolution_t, res_m9500);
static const dyesub_pagesize_t mitsu_cp9500_page[] =
{
- { "B7", "3.5x5", PT1(1240,346), PT1(1812,346), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1416,346), PT1(2152,346), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1812,346), PT1(2452,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(2152,346), PT1(2792,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(2152,346), PT1(3146,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1240,346), PT1(1812,346), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1416,346), PT1(2152,346), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1812,346), PT1(2452,346), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(2152,346), PT1(2792,346), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(2152,346), PT1(3146,346), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, mitsu_cp9500_page_list, dyesub_pagesize_t, mitsu_cp9500_page);
@@ -3767,7 +3767,7 @@ mitsu9500_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -3829,20 +3829,13 @@ LIST(dyesub_resolution_list_t, res_346dpi_list, dyesub_resolution_t, res_346dpi)
static const dyesub_pagesize_t mitsu_cp9550_page[] =
{
- { "B7", "3.5x5", PT1(1240,346), PT1(1812,346), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1416,346), PT1(2152,346), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1416,346), PT1(2152,346), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1812,346), PT1(2452,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(2152,346), PT1(2792,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h612", "6x8.5", PT1(2152,346), PT1(2956,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(2152,346), PT1(3146,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1240,346), PT1(1812,346), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1416,346), PT1(2152,346), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1416,346), PT1(2152,346), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1812,346), PT1(2452,346), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(2152,346), PT1(2792,346), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT1(2152,346), PT1(2956,346), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(2152,346), PT1(3146,346), DYESUB_PORTRAIT),
/* XXX also 3.3x6 and 3.5x6!
XXX also 4x6*2, 4.4*6*2, 3x6*3, 2x6*4! (Built on 6x9 media) */
};
@@ -3886,7 +3879,7 @@ mitsu9550_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -4016,18 +4009,12 @@ static void mitsu_cp9550_printer_end(stp_vars_t *v)
static const dyesub_pagesize_t mitsu_cp9550s_page[] =
{
- { "w288h432", "4x6", PT1(1416,346), PT1(2152,346), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1416,346), PT1(2152,346), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1812,346), PT1(2452,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(2152,346), PT1(2792,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h612", "6x8.5", PT1(2152,346), PT1(2956,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(2152,346), PT1(3146,346), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1416,346), PT1(2152,346), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1416,346), PT1(2152,346), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1812,346), PT1(2452,346), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(2152,346), PT1(2792,346), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT1(2152,346), PT1(2956,346), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(2152,346), PT1(3146,346), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, mitsu_cp9550s_page_list, dyesub_pagesize_t, mitsu_cp9550s_page);
@@ -4064,18 +4051,12 @@ LIST(dyesub_resolution_list_t, res_mitsu9600_dpi_list, dyesub_resolution_t, res_
static const dyesub_pagesize_t mitsu_cp9600_page[] =
{
- { "B7", "3.5x5", PT1(1076,300), PT1(1572,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1228,300), PT1(1868,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1572,300), PT1(2128,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(1868,300), PT1(2442,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h612", "6x8.5", PT1(1868,300), PT1(2564,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1868,300), PT1(2730,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1076,300), PT1(1572,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1228,300), PT1(1868,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1572,300), PT1(2128,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1868,300), PT1(2442,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT1(1868,300), PT1(2564,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(1868,300), PT1(2730,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, mitsu_cp9600_page_list, dyesub_pagesize_t, mitsu_cp9600_page);
@@ -4153,18 +4134,12 @@ static void mitsu_cp9600_printer_end(stp_vars_t *v)
/* Mitsubishi 9810D/DW */
static const dyesub_pagesize_t mitsu_cp9810_page[] =
{
- { "B7", "3.5x5", PT1(1076,300), PT1(1572,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1228,300), PT1(1868,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1572,300), PT1(2128,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(1868,300), PT1(2442,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h612", "6x8.5", PT1(1868,300), PT1(2564,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1868,300), PT1(2730,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1076,300), PT1(1572,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1228,300), PT1(1868,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1572,300), PT1(2128,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1868,300), PT1(2442,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT1(1868,300), PT1(2564,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(1868,300), PT1(2730,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, mitsu_cp9810_page_list, dyesub_pagesize_t, mitsu_cp9810_page);
@@ -4181,27 +4156,45 @@ static const dyesub_printsize_t mitsu_cp9810_printsize[] =
LIST(dyesub_printsize_list_t, mitsu_cp9810_printsize_list, dyesub_printsize_t, mitsu_cp9810_printsize);
-static const laminate_t mitsu_cp9810_laminate[] =
+static const overcoat_t mitsu_cp9810_overcoat[] =
{
- {"Matte", N_("Matte"), {1, "\x01"}},
{"Glossy", N_("Glossy"), {1, "\x00"}},
+ {"Matte", N_("Matte"), {1, "\x01"}},
};
-LIST(laminate_list_t, mitsu_cp9810_laminate_list, laminate_t, mitsu_cp9810_laminate);
+LIST(overcoat_list_t, mitsu_cp9810_overcoat_list, overcoat_t, mitsu_cp9810_overcoat);
static const dyesub_stringitem_t mitsu9810_qualities[] =
{
- { "Fine", N_ ("Fine") },
+ { "Fine", N_ ("Fine (Standard Media") },
+ { "FineHG", N_ ("Fine (High Grade Media)") },
{ "SuperFine", N_ ("Super Fine") },
};
LIST(dyesub_stringlist_t, mitsu9810_quality_list, dyesub_stringitem_t, mitsu9810_qualities);
+static const stp_parameter_t mitsu98xx_parameters[] =
+{
+ {
+ "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
+ N_("Print Speed"),
+ STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
+ N_("Use Internal Color Correction"),
+ STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+};
+#define mitsu98xx_parameter_count (sizeof(mitsu98xx_parameters) / sizeof(const stp_parameter_t))
+
static int
-mitsu9810_load_parameters(const stp_vars_t *v, const char *name,
+mitsu98xx_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -4228,6 +4221,11 @@ mitsu9810_load_parameters(const stp_vars_t *v, const char *name,
description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
description->is_active = 1;
}
+ else if (strcmp(name, "UseLUT") == 0)
+ {
+ description->deflt.boolean = 0;
+ description->is_active = 1;
+ }
else
{
return 0;
@@ -4235,12 +4233,12 @@ mitsu9810_load_parameters(const stp_vars_t *v, const char *name,
return 1;
}
-static int mitsu9810_parse_parameters(stp_vars_t *v)
+static int mitsu98xx_parse_parameters(stp_vars_t *v)
{
const char *quality = stp_get_string_parameter(v, "PrintSpeed");
dyesub_privdata_t *pd = get_privdata(v);
- const laminate_t *laminate = NULL;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const overcoat_t *overcoat = NULL;
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
/* No need to set global params if there's no privdata yet */
@@ -4252,14 +4250,18 @@ static int mitsu9810_parse_parameters(stp_vars_t *v)
/* Parse options */
if (strcmp(quality, "SuperFine") == 0) {
pd->privdata.m9550.quality = 0x80;
+ } else if (strcmp(quality, "FineHG") == 0) {
+ pd->privdata.m9550.quality = 0x11; /* Extension, backend corrects */
} else if (strcmp(quality, "Fine") == 0) {
- pd->privdata.m9550.finedeep = 0x10;
+ pd->privdata.m9550.quality = 0x10;
}
+ pd->privdata.m70x.use_lut = stp_get_boolean_parameter(v, "UseLUT");
+
/* Matte lamination forces SuperFine mode */
- if (caps->laminate) {
- laminate = dyesub_get_laminate_pattern(v);
- if (*((const char*)((laminate->seq).data)) != 0x00) {
+ if (caps->overcoat) {
+ overcoat = dyesub_get_overcoat_pattern(v);
+ if (*((const char*)((overcoat->seq).data)) != 0x00) {
pd->privdata.m9550.quality = 0x80;
}
}
@@ -4267,7 +4269,6 @@ static int mitsu9810_parse_parameters(stp_vars_t *v)
return 1;
}
-
static void mitsu_cp98xx_printer_init(stp_vars_t *v, int model)
{
dyesub_privdata_t *pd = get_privdata(v);
@@ -4284,12 +4285,13 @@ static void mitsu_cp98xx_printer_init(stp_vars_t *v, int model)
stp_put16_be(pd->w_size, v);
stp_put16_be(pd->h_size, v);
if (model == 0x90) {
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /* Lamination */
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /* Lamination */
} else {
stp_putc(0x00, v);
}
dyesub_nputc(v, 0x00, 31);
+
/* Parameters 1 */
stp_putc(0x1b, v);
stp_putc(0x57, v);
@@ -4305,8 +4307,10 @@ static void mitsu_cp98xx_printer_init(stp_vars_t *v, int model)
stp_put16_be(pd->copies, v);
dyesub_nputc(v, 0x00, 8);
stp_putc(pd->privdata.m9550.quality, v);
- dyesub_nputc(v, 0x00, 10);
+ dyesub_nputc(v, 0x00, 9);
+ stp_putc(pd->privdata.m70x.use_lut, v); /* Use LUT? EXTENSION! */
stp_putc(0x01, v);
+
/* Unknown */
stp_putc(0x1b, v);
stp_putc(0x57, v);
@@ -4318,6 +4322,16 @@ static void mitsu_cp98xx_printer_init(stp_vars_t *v, int model)
stp_putc(0x01, v);
stp_putc(0x01, v);
dyesub_nputc(v, 0x00, 36);
+
+ /* Put out a single plane header */
+ stp_putc(0x1b, v);
+ stp_putc(0x5a, v);
+ stp_putc(0x54, v);
+ stp_putc(0x80, v); /* special flag to say this is 8bpp packed BGR */
+ stp_put16_be(0, v); /* Starting column for this block */
+ stp_put16_be(0, v); /* Starting row for this block */
+ stp_put16_be(pd->w_size, v);
+ stp_put16_be(pd->h_size, v); /* Number of rows in this block */
}
static void mitsu_cp9810_printer_init(stp_vars_t *v)
@@ -4332,77 +4346,31 @@ static void mitsu_cp9800_printer_init(stp_vars_t *v)
static void mitsu_cp9810_printer_end(stp_vars_t *v)
{
- dyesub_privdata_t *pd = get_privdata(v);
-
/* Job Footer */
stp_putc(0x1b, v);
stp_putc(0x50, v);
stp_putc(0x4c, v); /* XXX 9800DW-S uses 0x4e, backend corrects */
stp_putc(0x00, v);
-
- if (pd->laminate &&
- *((const char*)((pd->laminate->seq).data)) == 0x01) {
-
- /* Generate a full plane of lamination data */
-
- /* The Windows drivers generate a lamination pattern consisting of
- four values: 0x0202, 0x01f1, 0x0808, 0x0737 in roughly a 16:10:4:1
- ratio.
-
- There seem to be some patterns but more analysis is needed.
- */
-
- int r, c;
- unsigned long seed = 1;
-
- mitsu_cp3020da_plane_init(v); /* First generate plane header */
-
- /* Now generate lamination pattern */
- for (c = 0 ; c < pd->w_size ; c++) {
- for (r = 0 ; r < pd->h_size ; r++) {
- int i = xrand(&seed) & 0x1f;
- if (i < 16)
- stp_put16_be(0x0202, v);
- else if (i < 26)
- stp_put16_be(0x01f1, v);
- else if (i < 30)
- stp_put16_be(0x0808, v);
- else
- stp_put16_be(0x0737, v);
- }
- }
-
- /* Lamination Footer */
- stp_putc(0x1b, v);
- stp_putc(0x50, v);
- stp_putc(0x56, v);
- stp_putc(0x00, v);
- }
}
/* Mitsubishi CP-D70D/CP-D707 */
static const dyesub_pagesize_t mitsu_cpd70x_page[] =
{
- { "B7", "3.5x5", PT1(1076,300), PT1(1568,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1228,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1228,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1568,300), PT1(2128,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w360h504-div2", "3.5x5*2", PT1(1568,300), PT1(2128,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h432", "6x6", PT1(1820,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w432h576", "6x8", PT1(1864,300), PT1(2422,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h612", "6x8.5", PT1(1864,300), PT1(2564,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1864,300), PT1(2730,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1864,300), PT1(2730,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1076,300), PT1(1568,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1228,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1228,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1568,300), PT1(2128,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w360h504-div2", "3.5x5*2", PT1(1568,300), PT1(2128,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT1(1820,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1864,300), PT1(2422,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT1(1864,300), PT1(2564,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(1864,300), PT1(2730,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div2", "4x6*2", PT1(1864,300), PT1(2730,300), 0, 0, PT1(236,300), 0, DYESUB_PORTRAIT),
+#if 0 /* Theoretically supported, no way to test */
+ DEFINE_PAPER_SIMPLE( "w432h576-div4", "2x6*4", PT1(1864,300), PT1(2730,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648-div3", "3x6*3", PT1(1864,300), PT1(2730,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648-div2", "4.4x6*2", PT1(1864,300), PT1(2730,300), DYESUB_PORTRAIT),
+#endif
};
LIST(dyesub_pagesize_list_t, mitsu_cpd70x_page_list, dyesub_pagesize_t, mitsu_cpd70x_page);
@@ -4419,17 +4387,22 @@ static const dyesub_printsize_t mitsu_cpd70x_printsize[] =
{ "300x300", "w432h612", 1864, 2564},
{ "300x300", "w432h648", 1864, 2730},
{ "300x300", "w432h576-div2", 1864, 2730},
+#if 0
+ { "300x300", "w432h576-div4", 1864, 2730},
+ { "300x300", "w432h648-div3", 1864, 2730},
+ { "300x300", "w432h648-div2", 1864, 2730},
+#endif
};
LIST(dyesub_printsize_list_t, mitsu_cpd70x_printsize_list, dyesub_printsize_t, mitsu_cpd70x_printsize);
-static const laminate_t mitsu_cpd70x_laminate[] =
+static const overcoat_t mitsu_cpd70x_overcoat[] =
{
{"Glossy", N_("Glossy"), {1, "\x00"}},
{"Matte", N_("Matte"), {1, "\x02"}},
};
-LIST(laminate_list_t, mitsu_cpd70x_laminate_list, laminate_t, mitsu_cpd70x_laminate);
+LIST(overcoat_list_t, mitsu_cpd70x_overcoat_list, overcoat_t, mitsu_cpd70x_overcoat);
static const dyesub_stringitem_t mitsu70x_qualities[] =
{
@@ -4447,7 +4420,6 @@ static const stp_parameter_t mitsu70x_parameters[] =
STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
},
-#ifdef MITSU70X_8BPP
{
"UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
N_("Use Internal Color Correction"),
@@ -4460,16 +4432,52 @@ static const stp_parameter_t mitsu70x_parameters[] =
STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
},
-#endif
};
#define mitsu70x_parameter_count (sizeof(mitsu70x_parameters) / sizeof(const stp_parameter_t))
+static const dyesub_stringitem_t mitsu707_decks[] =
+{
+ { "Auto", N_ ("Automatic") },
+ { "Lower", N_ ("Lower Deck") },
+ { "Upper", N_ ("Upper Deck") }
+};
+LIST(dyesub_stringlist_t, mitsu707_deck_list, dyesub_stringitem_t, mitsu707_decks);
+
+static const stp_parameter_t mitsu707_parameters[] =
+{
+ {
+ "PrintSpeed", N_("Print Speed"), "Color=No,Category=Advanced Printer Setup",
+ N_("Print Speed"),
+ STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "UseLUT", N_("Internal Color Correction"), "Color=Yes,Category=Advanced Printer Setup",
+ N_("Use Internal Color Correction"),
+ STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "Sharpen", N_("Image Sharpening"), "Color=No,Category=Advanced Printer Setup",
+ N_("Sharpening to apply to image (0 is off, 1 is min, 9 is max"),
+ STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "Deck", N_("Printer Deck"), "Color=No,Category=Advanced Printer Setup",
+ N_("Printer Deck"),
+ STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+};
+#define mitsu707_parameter_count (sizeof(mitsu707_parameters) / sizeof(const stp_parameter_t))
+
static int
mitsu70x_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -4496,7 +4504,6 @@ mitsu70x_load_parameters(const stp_vars_t *v, const char *name,
description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
description->is_active = 1;
}
-#ifdef MITSU70X_8BPP
else if (strcmp(name, "UseLUT") == 0)
{
description->deflt.boolean = 0;
@@ -4509,7 +4516,71 @@ mitsu70x_load_parameters(const stp_vars_t *v, const char *name,
description->bounds.integer.upper = 9;
description->is_active = 1;
}
-#endif
+ else
+ {
+ return 0;
+ }
+ return 1;
+}
+
+static int
+mitsu707_load_parameters(const stp_vars_t *v, const char *name,
+ stp_parameter_t *description)
+{
+ int i;
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
+ stp_get_model_id(v));
+
+ if (caps->parameter_count && caps->parameters)
+ {
+ for (i = 0; i < caps->parameter_count; i++)
+ if (strcmp(name, caps->parameters[i].name) == 0)
+ {
+ stp_fill_parameter_settings(description, &(caps->parameters[i]));
+ break;
+ }
+ }
+
+ if (strcmp(name, "PrintSpeed") == 0)
+ {
+ description->bounds.str = stp_string_list_create();
+
+ const dyesub_stringlist_t *mlist = &mitsu70x_quality_list;
+ for (i = 0; i < mlist->n_items; i++)
+ {
+ const dyesub_stringitem_t *m = &(mlist->item[i]);
+ stp_string_list_add_string(description->bounds.str,
+ m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
+ }
+ description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "UseLUT") == 0)
+ {
+ description->deflt.boolean = 0;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "Sharpen") == 0)
+ {
+ description->deflt.integer = 4;
+ description->bounds.integer.lower = 0;
+ description->bounds.integer.upper = 9;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "Deck") == 0)
+ {
+ description->bounds.str = stp_string_list_create();
+
+ const dyesub_stringlist_t *mlist = &mitsu707_deck_list;
+ for (i = 0; i < mlist->n_items; i++)
+ {
+ const dyesub_stringitem_t *m = &(mlist->item[i]);
+ stp_string_list_add_string(description->bounds.str,
+ m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
+ }
+ description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
+ description->is_active = 1;
+ }
else
{
return 0;
@@ -4537,49 +4608,62 @@ static int mitsu70x_parse_parameters(stp_vars_t *v)
pd->privdata.m70x.quality = 0;
}
-#ifdef MITSU70X_8BPP
+ /* For D707 only */
+ pd->privdata.m70x.deck = 0;
+ if (stp_check_string_parameter(v, "Deck", STP_PARAMETER_ACTIVE)) {
+ const char *deck = stp_get_string_parameter(v, "Deck");
+ if (strcmp(deck, "Auto") == 0)
+ pd->privdata.m70x.deck = 0;
+ else if (strcmp(deck, "Lower") == 0)
+ pd->privdata.m70x.deck = 1;
+ else if (strcmp(deck, "Upper") == 0)
+ pd->privdata.m70x.deck = 2;
+ }
+
pd->privdata.m70x.use_lut = stp_get_boolean_parameter(v, "UseLUT");
pd->privdata.m70x.sharpen = stp_get_int_parameter(v, "Sharpen");
-#endif
return 1;
}
-static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model)
+static void mitsu_cpd70k60_job_start(stp_vars_t *v)
{
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
- stp_get_model_id(v));
- dyesub_privdata_t *pd = get_privdata(v);
-
- /* Printer wakeup */
+ /* Printer wakeup, once per job. */
stp_putc(0x1b, v);
stp_putc(0x45, v);
stp_putc(0x57, v);
stp_putc(0x55, v);
dyesub_nputc(v, 0x00, 508);
+}
+
+static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model)
+{
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
+ stp_get_model_id(v));
+ dyesub_privdata_t *pd = get_privdata(v);
/* Each copy gets this.. */
stp_putc(0x1b, v);
stp_putc(0x5a, v);
stp_putc(0x54, v);
- stp_putc(model, v); /* k60 == x02, 305 == x90, d70x/d80 == x01 */
+ stp_putc(model, v); /* k60 == x00, EK305 == x90, d70x/d80 == x01, ask300 = 0x80 */
dyesub_nputc(v, 0x00, 12);
stp_put16_be(pd->w_size, v);
stp_put16_be(pd->h_size, v);
- if (caps->laminate && *((const char*)((pd->laminate->seq).data)) != 0x00) {
+ if (caps->overcoat && *((const char*)((pd->overcoat->seq).data)) != 0x00) {
stp_put16_be(pd->w_size, v);
if (model == 0x00 || model == 0x90) {
- pd->privdata.m70x.laminate_offset = 0;
+ pd->privdata.m70x.overcoat_offset = 0;
if (!pd->privdata.m70x.quality)
pd->privdata.m70x.quality = 4; /* Matte Lamination forces UltraFine on K60 or K305 */
} else {
- /* Laminate a slightly larger boundary in Matte mode */
- pd->privdata.m70x.laminate_offset = 12;
+ /* Overcoat a slightly larger boundary in Matte mode */
+ pd->privdata.m70x.overcoat_offset = 12;
if (!pd->privdata.m70x.quality)
pd->privdata.m70x.quality = 3; /* Matte Lamination forces Superfine (or UltraFine) */
}
- stp_put16_be(pd->h_size + pd->privdata.m70x.laminate_offset, v);
+ stp_put16_be(pd->h_size + pd->privdata.m70x.overcoat_offset, v);
} else {
/* Glossy lamination here */
stp_put16_be(0, v);
@@ -4589,7 +4673,7 @@ static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model)
dyesub_nputc(v, 0x00, 7);
if (model == 0x01) {
- stp_putc(0x00, v); /* D70x: 0x00 Auto deck selection, 0x01 for Lower, 0x02 for Upper. */
+ stp_putc(pd->privdata.m70x.deck, v); /* D70x: 0x00 Auto deck selection, 0x01 for Lower, 0x02 for Upper. */
} else {
stp_putc(0x01, v); /* All others have a single "lower" deck */
}
@@ -4597,9 +4681,9 @@ static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model)
stp_putc(0x00, v); /* Lamination always enabled */
- if (caps->laminate) {
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /* Lamination mode */
+ if (caps->overcoat) {
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /* Lamination mode */
} else {
stp_putc(0x00, v);
}
@@ -4608,6 +4692,14 @@ static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model)
/* Multi-cut control */
if (strcmp(pd->pagesize,"w432h576-div2") == 0) {
stp_putc(0x01, v);
+#if 0
+ } else if (strcmp(pd->pagesize,"w432h648-div2") == 0) {
+ stp_putc(0x02, v);
+ } else if (strcmp(pd->pagesize,"w432h648-div3") == 0) {
+ stp_putc(0x03, v);
+ } else if (strcmp(pd->pagesize,"w432h576-div4") == 0) {
+ stp_putc(0x04, v);
+#endif
} else if (strcmp(pd->pagesize,"w360h504-div2") == 0) {
stp_putc(0x01, v);
} else if (strcmp(pd->pagesize,"w288h432-div2") == 0) {
@@ -4615,15 +4707,13 @@ static void mitsu_cpd70k60_printer_init(stp_vars_t *v, unsigned char model)
} else {
stp_putc(0x00, v);
}
-#ifdef MITSU70X_8BPP
dyesub_nputc(v, 0x00, 12);
+ /* The next four bytes are EXTENSIONS, backend consumes! */
stp_putc(pd->privdata.m70x.sharpen, v);
stp_putc(0x01, v); /* Mark as 8bpp BGR rather than 16bpp YMC cooked */
stp_putc(pd->privdata.m70x.use_lut, v); /* Use LUT? */
stp_putc(0x01, v); /* Tell the backend the data's in the proper order */
-#else
- dyesub_nputc(v, 0x00, 16);
-#endif
+ /* end extension */
dyesub_nputc(v, 0x00, 447); /* Pad to 512-byte block */
}
@@ -4632,71 +4722,17 @@ static void mitsu_cpd70x_printer_init(stp_vars_t *v)
mitsu_cpd70k60_printer_init(v, 0x01);
}
-#ifndef MITSU70X_8BPP
-static void mitsu_cpd70x_printer_end(stp_vars_t *v)
-{
- dyesub_privdata_t *pd = get_privdata(v);
-
- /* If Matte lamination is enabled, generate a lamination plane */
- if (*((const char*)((pd->laminate->seq).data)) != 0x00) {
-
- int r, c;
- unsigned long seed = 1;
-
- /* Now generate lamination pattern */
- for (c = 0 ; c < pd->w_size ; c++) {
- for (r = 0 ; r < pd->h_size + pd->privdata.m70x.laminate_offset ; r++) {
- int i = xrand(&seed) & 0x3f;
- if (pd->privdata.m70x.laminate_offset) { /* D70x uses 0x384b, 0x286a, 0x6c22 */
- if (i < 42)
- stp_put16_be(0xe84b, v);
- else if (i < 62)
- stp_put16_be(0x286a, v);
- else
- stp_put16_be(0x6c22, v);
- } else { /* K60 and EK305 use 0x9d00, 0x6500, 0x2900 */
- if (i < 42)
- stp_put16_be(0x9d00, v);
- else if (i < 62)
- stp_put16_be(0x2900, v);
- else
- stp_put16_be(0x6500, v);
- }
- }
- }
- /* Pad up to a 512-byte block */
- dyesub_nputc(v, 0x00, 512 - ((pd->w_size * (pd->h_size + pd->privdata.m70x.laminate_offset) * 2) % 512));
- }
-}
-#endif
-
-static void mitsu_cpd70x_plane_end(stp_vars_t *v)
-{
-#ifndef MITSU70X_8BPP
- /* Pad up to a 512-byte block */
- dyesub_nputc(v, 0x00, 512 - ((pd->h_size * pd->w_size * 2) % 512));
-#endif
-}
-
/* Mitsubishi CP-K60D */
static const dyesub_pagesize_t mitsu_cpk60_page[] =
{
- { "B7", "3.5x5", PT1(1076,300), PT1(1568,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1218,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1218,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1568,300), PT1(2128,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w360h504-div2", "3.5x5*2", PT1(1568,300), PT1(2190,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h432", "6x6", PT1(1820,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w432h576", "6x8", PT1(1864,300), PT1(2422,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1864,300), PT1(2454,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1076,300), PT1(1568,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1218,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1218,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1568,300), PT1(2128,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w360h504-div2", "3.5x5*2", PT1(1568,300), PT1(2190,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT1(1820,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1864,300), PT1(2422,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT1(1864,300), PT1(2454,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, mitsu_cpk60_page_list, dyesub_pagesize_t, mitsu_cpk60_page);
@@ -4733,7 +4769,7 @@ mitsu_k60_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -4760,7 +4796,6 @@ mitsu_k60_load_parameters(const stp_vars_t *v, const char *name,
description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
description->is_active = 1;
}
-#ifdef MITSU70X_8BPP
else if (strcmp(name, "UseLUT") == 0)
{
description->deflt.boolean = 0;
@@ -4773,7 +4808,6 @@ mitsu_k60_load_parameters(const stp_vars_t *v, const char *name,
description->bounds.integer.upper = 9;
description->is_active = 1;
}
-#endif
else
{
return 0;
@@ -4783,20 +4817,13 @@ mitsu_k60_load_parameters(const stp_vars_t *v, const char *name,
static const dyesub_pagesize_t mitsu_cpd80_page[] =
{
- { "w288h432", "4x6", PT1(1228,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1228,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h360", "5x5", PT1(1524,300), PT1(1568,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1568,300), PT1(2128,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h432", "6x6", PT1(1864,300), PT1(1820,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(1864,300), PT1(2422,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1864,300), PT1(2730,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1228,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1228,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h360", "5x5", PT1(1524,300), PT1(1568,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1568,300), PT1(2128,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT1(1864,300), PT1(1820,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1864,300), PT1(2422,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div2", "4x6*2", PT1(1864,300), PT1(2730,300), 0, 0, PT1(236,300), 0, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, mitsu_cpd80_page_list, dyesub_pagesize_t, mitsu_cpd80_page);
@@ -4817,16 +4844,11 @@ LIST(dyesub_printsize_list_t, mitsu_cpd80_printsize_list, dyesub_printsize_t, mi
/* Kodak 305 */
static const dyesub_pagesize_t kodak305_page[] =
{
- { "w288h432", "4x6", PT1(1218,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1218,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w432h432", "6x6", PT1(1820,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w432h576", "6x8", PT1(1864,300), PT1(2422,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1864,300), PT1(2454,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1218,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1218,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT1(1820,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1864,300), PT1(2422,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT1(1864,300), PT1(2454,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, kodak305_page_list, dyesub_pagesize_t, kodak305_page);
@@ -4850,28 +4872,21 @@ static void kodak305_printer_init(stp_vars_t *v)
/* Mitsubishi CP-D90D */
static const dyesub_pagesize_t mitsu_cpd90_page[] =
{
- { "w144h432", "2x6", PT1(625,300), PT1(1852,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "B7", "3.5x5", PT1(1076,300), PT1(1550,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1226,300), PT1(1852,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1226,300), PT1(1852,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1550,300), PT1(2128,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w360h360", "5x5", PT1(1527,300), PT1(1550,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w432h432", "6x6", PT1(1827,300), PT1(1852,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w432h576", "6x8", PT1(1852,300), PT1(2428,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1852,300), PT1(2488,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h612", "6x8.5", PT1(1852,300), PT1(2568,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1852,300), PT1(2729,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT1(625,300), PT1(1852,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1076,300), PT1(1550,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1226,300), PT1(1852,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1226,300), PT1(1852,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1550,300), PT1(2128,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w360h360", "5x5", PT1(1527,300), PT1(1550,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT1(1827,300), PT1(1852,300), DYESUB_LANDSCAPE),
+ // XXX add 6x6+2x6!
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1852,300), PT1(2428,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT1(1852,300), PT1(2488,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h612", "6x8.5", PT1(1852,300), PT1(2568,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(1852,300), PT1(2729,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648-div2", "4.4x6*2", PT1(1852,300), PT1(2728,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648-div3", "3x6*2", PT1(1852,300), PT1(2724,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648-div4", "2x6*4", PT1(1852,300), PT1(2628,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, mitsu_cpd90_page_list, dyesub_pagesize_t, mitsu_cpd90_page);
@@ -4885,12 +4900,15 @@ static const dyesub_printsize_t mitsu_cpd90_printsize[] =
{ "300x300", "w360h360", 1527, 1550},
{ "300x300", "w360h504", 1550, 2128},
{ "300x300", "w432h432", 1827, 1852},
+ // XXX add 6x6+2x6!
{ "300x300", "w432h576", 1852, 2428},
{ "300x300", "w432h576-div2", 1852, 2488},
{ "300x300", "w432h612", 1852, 2568},
{ "300x300", "w432h648", 1852, 2729},
+ { "300x300", "w432h648-div2", 1852, 2728},
+ { "300x300", "w432h648-div3", 1852, 2724},
+ { "300x300", "w432h648-div4", 1852, 2628},
};
-
LIST(dyesub_printsize_list_t, mitsu_cpd90_printsize_list, dyesub_printsize_t, mitsu_cpd90_printsize);
static const dyesub_stringitem_t mitsu_d90_qualities[] =
@@ -4935,7 +4953,7 @@ mitsu_d90_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -5031,44 +5049,56 @@ static void mitsu_cpd90_printer_init(stp_vars_t *v)
stp_putc(0x00, v);
stp_putc(0x01, v);
stp_putc(0x00, v);
- if (strcmp(pd->pagesize,"w432h576-div2") == 0)
- stp_putc(0x01, v);
- else
- stp_putc(0x00, v);
if (strcmp(pd->pagesize,"w432h576-div2") == 0) {
+ stp_putc(0x01, v);
stp_putc(0x04, v);
stp_putc(0xbe, v);
- dyesub_nputc(v, 0x00, 14);
+ dyesub_nputc(v, 0x00, 6);
} else if (strcmp(pd->pagesize,"w288h432-div2") == 0) {
+ stp_putc(0x00, v);
stp_putc(0x02, v);
stp_putc(0x65, v);
+ dyesub_nputc(v, 0x00, 6);
+ } else if (strcmp(pd->pagesize,"w432h648-div2") == 0) {
stp_putc(0x01, v);
+ stp_putc(0x05, v);
+ stp_putc(0x36, v);
+ dyesub_nputc(v, 0x00, 6);
+ } else if (strcmp(pd->pagesize,"w432h648-div3") == 0) {
stp_putc(0x00, v);
+ stp_putc(0x03, v);
+ stp_putc(0x90, v);
stp_putc(0x00, v);
- stp_putc(0x01, v);
- dyesub_nputc(v, 0x00, 10);
+ stp_putc(0x07, v);
+ stp_putc(0x14, v);
+ dyesub_nputc(v, 0x00, 3);
+ } else if (strcmp(pd->pagesize,"w432h648-div4") == 0) {
+ stp_putc(0x00, v);
+ stp_putc(0x02, v);
+ stp_putc(0x97, v);
+ stp_putc(0x00, v);
+ stp_putc(0x05, v);
+ stp_putc(0x22, v);
+ stp_putc(0x00, v);
+ stp_putc(0x07, v);
+ stp_putc(0xad, v);
} else {
- dyesub_nputc(v, 0x00, 16);
+ dyesub_nputc(v, 0x00, 9);
}
+ dyesub_nputc(v, 0x00, 24);
- dyesub_nputc(v, 0x00, 16);
-
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /* Lamination mode */
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /* Lamination mode */
stp_putc(pd->privdata.m70x.quality, v);
-#ifdef MITSU70X_8BPP
stp_putc(pd->privdata.m70x.use_lut, v);
-#else
- stp_putc(0x00, v); /* ie use printer's built in LUT */
-#endif
stp_putc(pd->privdata.m70x.sharpen, v); /* Horizontal */
stp_putc(pd->privdata.m70x.sharpen, v); /* Vertical */
dyesub_nputc(v, 0x00, 11);
dyesub_nputc(v, 0x00, 512 - 64);
- /* Second header block */
+ /* Data Plane header */
stp_putc(0x1b, v);
stp_putc(0x5a, v);
stp_putc(0x54, v);
@@ -5080,12 +5110,16 @@ static void mitsu_cpd90_printer_init(stp_vars_t *v)
stp_put16_be(pd->h_size, v); /* Rows */
dyesub_nputc(v, 0x00, 2);
- dyesub_nputc(v, 0x00, 512 - 32);
+ dyesub_nputc(v, 0x00, 512 - 16);
}
-static void mitsu_cpd90_printer_end(stp_vars_t *v)
+static void mitsu_cpd90_job_end(stp_vars_t *v)
{
- dyesub_privdata_t *pd = get_privdata(v);
+ int delay;
+ if (stp_check_int_parameter(v, "ComboWait", STP_PARAMETER_ACTIVE))
+ delay = stp_get_int_parameter(v, "ComboWait");
+ else
+ delay = 5;
/* Wrap it up */
stp_putc(0x1b, v);
@@ -5093,24 +5127,20 @@ static void mitsu_cpd90_printer_end(stp_vars_t *v)
stp_putc(0x51, v);
stp_putc(0x31, v);
stp_putc(0x00, v);
- stp_putc(pd->privdata.m70x.delay, v);
+ stp_putc(delay, v);
}
/* Fujifilm ASK-300 */
static const dyesub_pagesize_t fuji_ask300_page[] =
{
- { "B7", "3.5x5", PT1(1076,300), PT1(1568,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1228,300), PT1(1864,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1568,300), PT1(2128,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w360h504-div2", "3.5x5*2", PT1(1568,300), PT1(2128,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(1864,300), PT1(2422,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1864,300), PT1(2730,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1076,300), PT1(1568,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1228,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1228,300), PT1(1864,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1568,300), PT1(2128,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w360h504-div2", "3.5x5*2", PT1(1568,300), PT1(2128,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1864,300), PT1(2422,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(1864,300), PT1(2730,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div2", "4x6*2", PT1(1864,300), PT1(2730,300), 0, 0, PT1(236,300), 0, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, fuji_ask300_page_list, dyesub_pagesize_t, fuji_ask300_page);
@@ -5119,10 +5149,12 @@ static const dyesub_printsize_t fuji_ask300_printsize[] =
{
{ "300x300", "B7", 1076, 1568},
{ "300x300", "w288h432", 1228, 1864},
+ { "300x300", "w288h432-div2", 1228, 1864},
{ "300x300", "w360h504", 1568, 2128},
{ "300x300", "w360h504-div2", 1568, 2128},
{ "300x300", "w432h576", 1864, 2422},
{ "300x300", "w432h648", 1864, 2730},
+ { "300x300", "w432h576-div2", 1864, 2730},
};
LIST(dyesub_printsize_list_t, fuji_ask300_printsize_list, dyesub_printsize_t, fuji_ask300_printsize);
@@ -5132,19 +5164,102 @@ static void fuji_ask300_printer_init(stp_vars_t *v)
mitsu_cpd70k60_printer_init(v, 0x80);
}
+/* Fujifilm ASK-2000/2500 */
+static const dyesub_pagesize_t fuji_ask2000_page[] =
+{
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1074,300), PT1(1536,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1228,300), PT1(1832,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1568,300), PT1(2130,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1832,300), PT1(2432,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div2", "4x6*2", PT1(1832,300), PT1(2732,300), 0, 0, PT1(236,300), 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(1832,300), PT1(2748,300), DYESUB_PORTRAIT),
+};
+
+LIST(dyesub_pagesize_list_t, fuji_ask2000_page_list, dyesub_pagesize_t, fuji_ask2000_page);
+
+static const dyesub_printsize_t fuji_ask2000_printsize[] =
+{
+ { "300x300", "B7", 1074, 1536},
+ { "300x300", "w288h432", 1228, 1832},
+ { "300x300", "w360h504", 1536, 2130},
+ { "300x300", "w432h576", 1864, 2432},
+ { "300x300", "w432h576-div2", 1864, 2732},
+ { "300x300", "w432h648", 1864, 2748},
+};
+
+LIST(dyesub_printsize_list_t, fuji_ask2000_printsize_list, dyesub_printsize_t, fuji_ask2000_printsize);
+
+static void fuji_ask2000_printer_init(stp_vars_t *v)
+{
+ dyesub_privdata_t *pd = get_privdata(v);
+
+ stp_zfwrite("\x1b\x23\x00\x00\x00\x04\x00\xff\xff\xff\xff", 1, 11, v);
+ stp_zfwrite("\x1b\x1e\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 1, 19, v);
+ stp_zfwrite("\x1b\xee\x00\x00\x00\x02\x00", 1, 7, v);
+ stp_put16_be(pd->copies, v);
+ stp_zfwrite("\x1b\xe1\x00\x00\x00\x0b\x00\x00\x04\x0c\x00\x00\x00\x00", 1, 14, v);
+ stp_put16_be(pd->w_size, v);
+ stp_put16_be(pd->h_size, v);
+ stp_zfwrite("\x1b\x15\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x60\x00\x00\x00\x00", 1, 16, v);
+ stp_put16_be(pd->w_size, v);
+ stp_put16_be(pd->h_size, v);
+ stp_zfwrite("\x1b\xea\x00\x00\x00\x00", 1, 6, v);
+ stp_put32_be(pd->w_size * pd->h_size * 3, v); /* Data length */
+ stp_putc(0x00, v);
+}
+
+static void fuji_ask2000_printer_end(stp_vars_t *v)
+{
+ stp_zfwrite("\x1b\x23\x00\x00\x00\x04\x00\xff\xff\xff\xff", 1, 11, v);
+ stp_zfwrite("\x1b\x0a\x00\x00\x00\x00\x00", 1, 7, v);
+ stp_zfwrite("\x1b\x23\x00\x00\x00\x04\x00\xff\xff\xff\xff", 1, 11, v);
+}
+
+/* Fujifilm ASK-4000 */
+static const dyesub_pagesize_t fuji_ask4000_page[] =
+{
+ DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT1(2444,300), PT1(3044,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT1(2444,300), PT1(3644,300), DYESUB_PORTRAIT),
+};
+
+LIST(dyesub_pagesize_list_t, fuji_ask4000_page_list, dyesub_pagesize_t, fuji_ask4000_page);
+
+static const dyesub_printsize_t fuji_ask4000_printsize[] =
+{
+ { "300x300", "c8x10", 2444, 3044},
+ { "300x300", "w576h864", 2444, 3644},
+};
+
+LIST(dyesub_printsize_list_t, fuji_ask4000_printsize_list, dyesub_printsize_t, fuji_ask4000_printsize);
+
+static void fuji_ask4000_printer_init(stp_vars_t *v)
+{
+ dyesub_privdata_t *pd = get_privdata(v);
+
+ stp_zfwrite("\x1b\x1e\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 1, 19, v);
+ stp_zfwrite("\x1b\xee\x00\x00\x00\x02\x00", 1, 7, v);
+ stp_put16_be(pd->copies, v);
+ stp_zfwrite("\x1b\xe1\x00\x00\x00\x0b\x00\x00\x04\x0c\x00\x00\x00\x00", 1, 14, v);
+ stp_put16_be(pd->w_size, v);
+ stp_put16_be(pd->h_size, v);
+ stp_zfwrite("\x1b\xea\x00\x00\x00\x00", 1, 6, v);
+ stp_put32_be(pd->w_size * pd->h_size * 3, v); /* Data length */
+ stp_putc(0x00, v);
+}
+
+static void fuji_ask4000_printer_end(stp_vars_t *v)
+{
+ stp_zfwrite("\x1b\x0a\x00\x00\x00\x00\x00", 1, 7, v);
+}
+
/* Shinko CHC-S9045 (experimental) */
static const dyesub_pagesize_t shinko_chcs9045_page[] =
{
- { "w288h432", "4x6", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "B7", "3.5x5", PT1(1088,300), PT1(1548,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1548,300), PT1(2140,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1844,300), PT1(2740,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w283h425", "Sticker paper", PT1(1092,300), PT1(1726,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "B7","3.5x5", PT1(1088,300), PT1(1548,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1548,300), PT1(2140,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(1844,300), PT1(2740,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w283h425", "Sticker paper", PT1(1092,300), PT1(1726,300), DYESUB_LANDSCAPE),
};
LIST(dyesub_pagesize_list_t, shinko_chcs9045_page_list, dyesub_pagesize_t, shinko_chcs9045_page);
@@ -5189,22 +5304,14 @@ static void shinko_chcs9045_printer_init(stp_vars_t *v)
/* Shinko CHC-S2145 */
static const dyesub_pagesize_t shinko_chcs2145_page[] =
{
- { "w144h432", "2x6", PT1(634,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "B7", "3.5x5", PT1(1088,300), PT1(1548,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1548,300), PT1(2140,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(1844,300), PT1(2434,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1844,300), PT1(2492,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1844,300), PT1(2740,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT1(634,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "B7", "3.5x5", PT1(1088,300), PT1(1548,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1548,300), PT1(2140,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1844,300), PT1(2434,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT1(1844,300), PT1(2492,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(1844,300), PT1(2740,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, shinko_chcs2145_page_list, dyesub_pagesize_t, shinko_chcs2145_page);
@@ -5223,7 +5330,7 @@ static const dyesub_printsize_t shinko_chcs2145_printsize[] =
LIST(dyesub_printsize_list_t, shinko_chcs2145_printsize_list, dyesub_printsize_t, shinko_chcs2145_printsize);
-static const laminate_t shinko_chcs2145_laminate[] =
+static const overcoat_t shinko_chcs2145_overcoat[] =
{
{"PrinterDefault", N_("Printer Default"), {4, "\x01\0\0\0"}},
{"Glossy", N_("Glossy"), {4, "\x02\0\0\0"}},
@@ -5234,7 +5341,7 @@ static const laminate_t shinko_chcs2145_laminate[] =
{"ExtraGlossyFine", N_("Extra Glossy Fine"), {4, "\x07\0\0\0"}},
};
-LIST(laminate_list_t, shinko_chcs2145_laminate_list, laminate_t, shinko_chcs2145_laminate);
+LIST(overcoat_list_t, shinko_chcs2145_overcoat_list, overcoat_t, shinko_chcs2145_overcoat);
static void shinko_chcs2145_printer_init(stp_vars_t *v)
{
@@ -5277,8 +5384,8 @@ static void shinko_chcs2145_printer_init(stp_vars_t *v)
stp_put32_le(0x00, v); /* Print Method */
}
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /* Print Mode */
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /* Print Mode */
stp_put32_le(0x00, v);
stp_put32_le(0x00, v);
@@ -5316,17 +5423,17 @@ static void shinko_chcs2145_printer_end(stp_vars_t *v)
/* Shinko CHC-S1245 */
static const dyesub_pagesize_t shinko_chcs1245_page[] =
{
- { "w288h576", "8x4", PT1(1229,300), PT1(2446,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w360h576", "8x5", PT1(1530,300), PT1(2446,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w432h576", "8x6", PT1(1831,300), PT1(2446,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w576h576", "8x8", PT1(2436,300), PT1(2446,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w576h576-div2", "8x4*2", PT1(2446,300), PT1(2468,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "c8x10", "8x10", PT1(2446,300), PT1(3036,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "c8x10-w576h432_w576h288", "8x6+8x4", PT1(2446,300), PT1(3070,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "c8x10-div2", "8x5*2", PT1(2446,300), PT1(3070,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w576h864", "8x12", PT1(2446,300), PT1(3636,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div2", "8x6*2", PT1(2446,300), PT1(3672,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div3", "8x4*3", PT1(2446,300), PT1(3707,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h576", "8x4", PT1(1229,300), PT1(2446,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h576", "8x5", PT1(1530,300), PT1(2446,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w432h576", "8x6", PT1(1831,300), PT1(2446,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w576h576", "8x8", PT1(2436,300), PT1(2446,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w576h576-div2", "8x4*2", PT1(2446,300), PT1(2468,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT1(2446,300), PT1(3036,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "c8x10-w576h432_w576h288", "8x6+8x4", PT1(2446,300), PT1(3070,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "c8x10-div2", "8x5*2", PT1(2446,300), PT1(3070,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT1(2446,300), PT1(3636,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w576h864-div2", "8x6*2", PT1(2446,300), PT1(3672,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w576h864-div3", "8x4*3", PT1(2446,300), PT1(3707,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, shinko_chcs1245_page_list, dyesub_pagesize_t, shinko_chcs1245_page);
@@ -5348,16 +5455,16 @@ static const dyesub_printsize_t shinko_chcs1245_printsize[] =
LIST(dyesub_printsize_list_t, shinko_chcs1245_printsize_list, dyesub_printsize_t, shinko_chcs1245_printsize);
-static const laminate_t shinko_chcs1245_laminate[] =
+static const overcoat_t shinko_chcs1245_overcoat[] =
{
- {"PrinterDefault", N_("Printer Default"), {1, "\x01"}},
- {"Glossy", N_("Glossy"), {1, "\x02"}},
- {"GlossyFine", N_("Glossy Fine"), {1, "\x03"}},
- {"Matte", N_("Matte"), {1, "\x04"}},
- {"MatteFine", N_("Matte Fine"), {1, "\x05"}},
+ {"PrinterDefault", N_("Printer Default"), {4, "\x01\x00\x00\x00"}},
+ {"Glossy", N_("Glossy"), {4, "\x02\x00\x00\x00"}},
+ {"GlossyFine", N_("Glossy Fine"), {4, "\x03\x00\x00\x00"}},
+ {"Matte", N_("Matte"), {4, "\x04\x00\x00\x00"}},
+ {"MatteFine", N_("Matte Fine"), {4, "\x05\x00\x00\x00"}},
};
-LIST(laminate_list_t, shinko_chcs1245_laminate_list, laminate_t, shinko_chcs1245_laminate);
+LIST(overcoat_list_t, shinko_chcs1245_overcoat_list, overcoat_t, shinko_chcs1245_overcoat);
static const dyesub_stringitem_t shinko_chcs1245_dusts[] =
{
@@ -5389,7 +5496,7 @@ shinko_chcs1245_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -5496,11 +5603,11 @@ static void shinko_chcs1245_printer_init(stp_vars_t *v)
stp_put32_le(0x00, v);
stp_put32_le(media, v);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /* Print Mode */
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /* Print Mode */
stp_put32_le(0x00, v);
- if (((const unsigned char*)(pd->laminate->seq).data)[0] == 0x02 ||
- ((const unsigned char*)(pd->laminate->seq).data)[0] == 0x03) {
+ if (((const unsigned char*)(pd->overcoat->seq).data)[0] == 0x02 ||
+ ((const unsigned char*)(pd->overcoat->seq).data)[0] == 0x03) {
stp_put32_le(0x07fffffff, v); /* Glossy */
} else {
stp_put32_le(pd->privdata.s1245.matte_intensity, v); /* matte intensity */
@@ -5532,16 +5639,16 @@ static void shinko_chcs1245_printer_init(stp_vars_t *v)
/* Shinko CHC-S6245 */
static const dyesub_pagesize_t shinko_chcs6245_page[] =
{
- { "w288h576", "8x4", PT1(1236,300), PT1(2464,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w360h576", "8x5", PT1(1536,300), PT1(2464,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w432h576", "8x6", PT1(1836,300), PT1(2464,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w576h576", "8x8", PT1(2436,300), PT1(2464,300), 0, 0, 0, 0, DYESUB_LANDSCAPE},
- { "w576h576-div2", "8x4*2", PT1(2464,300), PT1(2494,300), 0, 0, PT(0,300), PT(0,300), DYESUB_PORTRAIT},
- { "c8x10", "8x10", PT1(2464,300), PT1(3036,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "c8x10-div2", "8x5*2", PT1(2464,300), PT1(3094,300), 0, 0, PT(0,300), PT(0,300), DYESUB_PORTRAIT},
- { "w576h864", "8x12", PT1(2464,300), PT1(3636,300), 0, 0, 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div2", "8x6*2", PT1(2464,300), PT1(3694,300), 0, 0, PT(0,300), PT(0,300), DYESUB_PORTRAIT},
- { "w576h864-div3", "8x4*3", PT1(2464,300), PT1(3742,300), 0, 0, PT(0,300), PT(0,300), DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w288h576", "8x4", PT1(1236,300), PT1(2464,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h576", "8x5", PT1(1536,300), PT1(2464,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w432h576", "8x6", PT1(1836,300), PT1(2464,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w576h576", "8x8", PT1(2436,300), PT1(2464,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w576h576-div2", "8x4*2", PT1(2464,300), PT1(2494,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "c8x10", "8x10", PT1(2464,300), PT1(3036,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "c8x10-div2", "8x5*2", PT1(2464,300), PT1(3094,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w576h864", "8x12", PT1(2464,300), PT1(3636,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w576h864-div2", "8x6*2", PT1(2464,300), PT1(3694,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w576h864-div3", "8x4*3", PT1(2464,300), PT1(3742,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, shinko_chcs6245_page_list, dyesub_pagesize_t, shinko_chcs6245_page);
@@ -5562,14 +5669,14 @@ static const dyesub_printsize_t shinko_chcs6245_printsize[] =
LIST(dyesub_printsize_list_t, shinko_chcs6245_printsize_list, dyesub_printsize_t, shinko_chcs6245_printsize);
-static const laminate_t shinko_chcs6245_laminate[] =
+static const overcoat_t shinko_chcs6245_overcoat[] =
{
{"Glossy", N_("Glossy"), {4, "\x03\x00\x00\x00"}},
{"Matte", N_("Matte"), {4, "\x02\x00\x00\x00"}},
{"None", N_("None"), {4, "\x01\x00\x00\x00"}},
};
-LIST(laminate_list_t, shinko_chcs6245_laminate_list, laminate_t, shinko_chcs6245_laminate);
+LIST(overcoat_list_t, shinko_chcs6245_overcoat_list, overcoat_t, shinko_chcs6245_overcoat);
static void shinko_chcs6245_printer_init(stp_vars_t *v)
{
@@ -5609,8 +5716,8 @@ static void shinko_chcs6245_printer_init(stp_vars_t *v)
stp_put32_le(0x00, v);
stp_put32_le(0x00, v);
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /* Lamination */
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /* Lamination */
stp_put32_le(0x00, v);
stp_put32_le(0x00, v);
@@ -5639,26 +5746,16 @@ static void shinko_chcs6245_printer_init(stp_vars_t *v)
/* Shinko CHC-S6145 */
static const dyesub_pagesize_t shinko_chcs6145_page[] =
{
- { "w144h432", "2x6", PT1(634,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h360", "5x5", PT1(1536,300), PT1(1548,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1548,300), PT1(2140,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h432", "6x6", PT1(1832,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w432h576", "6x8", PT1(1844,300), PT1(2434,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576-w432h432_w432h144", "6x6+2x6", PT1(1844,300), PT1(2434,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1844,300), PT1(2492,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1844,300), PT1(2740,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT1(634,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h360", "5x5", PT1(1536,300), PT1(1548,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1548,300), PT1(2140,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h432", "6x6", PT1(1832,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1844,300), PT1(2434,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576-w432h432_w432h144", "6x6+2x6", PT1(1844,300), PT1(2434,300),DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT1(1844,300), PT1(2492,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h648", "6x9", PT1(1844,300), PT1(2740,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, shinko_chcs6145_page_list, dyesub_pagesize_t, shinko_chcs6145_page);
@@ -5679,7 +5776,7 @@ static const dyesub_printsize_t shinko_chcs6145_printsize[] =
LIST(dyesub_printsize_list_t, shinko_chcs6145_printsize_list, dyesub_printsize_t, shinko_chcs6145_printsize);
-static const laminate_t shinko_chcs6145_laminate[] =
+static const overcoat_t shinko_chcs6145_overcoat[] =
{
{"PrinterDefault", N_("Printer Default"), {4, "\0\0\0\0"}},
{"None", N_("None"), {4, "\x01\0\0\0"}},
@@ -5687,7 +5784,7 @@ static const laminate_t shinko_chcs6145_laminate[] =
{"Matte", N_("Matte"), {4, "\x03\0\0\0"}},
};
-LIST(laminate_list_t, shinko_chcs6145_laminate_list, laminate_t, shinko_chcs6145_laminate);
+LIST(overcoat_list_t, shinko_chcs6145_overcoat_list, overcoat_t, shinko_chcs6145_overcoat);
static void shinko_chcs6145_printer_init(stp_vars_t *v)
{
@@ -5740,8 +5837,8 @@ static void shinko_chcs6145_printer_init(stp_vars_t *v)
stp_put32_le(0x00, v);
}
stp_put32_le(0x00, v); /* XXX quality; 00 == default, 0x01 == std */
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /* Lamination */
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /* Lamination */
stp_put32_le(0x00, v);
stp_put32_le(0x00, v);
@@ -5774,18 +5871,12 @@ static void shinko_chcs6145_printer_init(stp_vars_t *v)
/* Ciaat Brava 21 */
static const dyesub_pagesize_t ciaat_brava21_page[] =
{
- { "w144h432", "2x6", PT1(634,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1844,300), 0, 0, 0, 0,
- DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1548,300), PT1(2140,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(1844,300), PT1(2434,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1844,300), PT1(2492,300), 0, 0, 0, 0,
- DYESUB_PORTRAIT},
+ DEFINE_PAPER_SIMPLE( "w144h432", "2x6", PT1(634,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432", "4x6", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1844,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER_SIMPLE( "w360h504", "5x7", PT1(1548,300), PT1(2140,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576", "6x8", PT1(1844,300), PT1(2434,300), DYESUB_PORTRAIT),
+ DEFINE_PAPER_SIMPLE( "w432h576-div2", "4x6*2", PT1(1844,300), PT1(2492,300), DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, ciaat_brava21_page_list, dyesub_pagesize_t, ciaat_brava21_page);
@@ -5814,15 +5905,17 @@ LIST(dyesub_resolution_list_t, res_dnpds40_dpi_list, dyesub_resolution_t, res_dn
/* Imaging area is wider than print size, we always must supply the printer with the full imaging width. */
static const dyesub_pagesize_t dnpds40_page[] =
{
- { "B7", "3.5x5", PT1(1088,300), PT1(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1920,300), PT1(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT},
- { "w360h504-div2", "3.5x5*2", PT1(1920,300), PT1(2176,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h576-div4", "2x6*4", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1920,300), PT1(2498,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1920,300), PT1(2740,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "B7", "3.5x5", PT1(1088,300), PT1(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w288h432", "4x6", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w360h504", "5x7", PT1(1920,300), PT1(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT1(1920,300), PT1(2176,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h432", "6x6", PT1(1836,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w432h576", "6x8", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div4", "2x6*4", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div2", "4x6*2", PT1(1920,300), PT1(2498,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-w432h432_w432h144", "6x6+2x6", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h648", "6x9", PT1(1920,300), PT1(2740,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, dnpds40_page_list, dyesub_pagesize_t, dnpds40_page);
@@ -5839,26 +5932,85 @@ static const dyesub_printsize_t dnpds40_printsize[] =
{ "300x600", "w360h504", 1920, 4276},
{ "300x300", "w360h504-div2", 1920, 2176},
{ "300x600", "w360h504-div2", 1920, 4352},
+ { "300x300", "w432h432", 1836, 1920},
+ { "300x600", "w432h432", 3672, 1920},
{ "300x300", "w432h576", 1920, 2436},
{ "300x600", "w432h576", 1920, 4872},
{ "300x300", "w432h576-div4", 1920, 2436},
{ "300x600", "w432h576-div4", 1920, 4872},
{ "300x300", "w432h576-div2", 1920, 2498},
{ "300x600", "w432h576-div2", 1920, 4996},
+ { "300x300", "w432h576-w432h432_w432h144", 1920, 2436},
+ { "300x600", "w432h576-w432h432_w432h144", 1920, 4872},
{ "300x300", "w432h648", 1920, 2740},
{ "300x600", "w432h648", 1920, 5480},
};
LIST(dyesub_printsize_list_t, dnpds40_printsize_list, dyesub_printsize_t, dnpds40_printsize);
-static const laminate_t dnpds40_laminate[] =
+static const overcoat_t dnpds40_overcoat[] =
{
{"Glossy", N_("Glossy"), {3, "000"}},
{"Matte", N_("Matte"), {3, "001"}},
};
-LIST(laminate_list_t, dnpds40_laminate_list, laminate_t, dnpds40_laminate);
+LIST(overcoat_list_t, dnpds40_overcoat_list, overcoat_t, dnpds40_overcoat);
+
+static const stp_parameter_t ds40_parameters[] =
+{
+ {
+ "NoCutWaste", N_("No Cut-Paper Waste"), "Color=No,Category=Advanced Printer Setup",
+ N_("No Cut-Paper Waste"),
+ STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
+ },
+};
+
+#define ds40_parameter_count (sizeof(ds40_parameters) / sizeof(const stp_parameter_t))
+
+static int
+ds40_load_parameters(const stp_vars_t *v, const char *name,
+ stp_parameter_t *description)
+{
+ int i;
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
+ stp_get_model_id(v));
+
+ if (caps->parameter_count && caps->parameters)
+ {
+ for (i = 0; i < caps->parameter_count; i++)
+ if (strcmp(name, caps->parameters[i].name) == 0)
+ {
+ stp_fill_parameter_settings(description, &(caps->parameters[i]));
+ break;
+ }
+ }
+ if (strcmp(name, "NoCutWaste") == 0)
+ {
+ description->is_active = 1;
+ description->deflt.boolean = 0;
+ }
+ else
+ {
+ return 0;
+ }
+
+ return 1;
+}
+
+static int ds40_parse_parameters(stp_vars_t *v)
+{
+ dyesub_privdata_t *pd = get_privdata(v);
+
+ int nocutwaste = stp_get_boolean_parameter(v, "NoCutWaste");
+
+ if (pd) {
+ pd->privdata.dnp.nocutwaste = nocutwaste;
+ }
+
+ return 1;
+}
static void dnp_printer_start_common(stp_vars_t *v)
{
@@ -5866,8 +6018,8 @@ static void dnp_printer_start_common(stp_vars_t *v)
/* Configure Lamination */
stp_zprintf(v, "\033PCNTRL OVERCOAT 0000000800000");
- stp_zfwrite((pd->laminate->seq).data, 1,
- (pd->laminate->seq).bytes, v); /* Lamination mode */
+ stp_zfwrite((pd->overcoat->seq).data, 1,
+ (pd->overcoat->seq).bytes, v); /* Lamination mode */
/* Set quantity.. Backend overrides as needed. */
stp_zprintf(v, "\033PCNTRL QTY 00000008%07d\r", pd->copies);
@@ -5881,13 +6033,19 @@ static void dnpds40_printer_start(stp_vars_t *v)
dnp_printer_start_common(v);
/* Set cutter option to "normal" */
- stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000");
- if (!strcmp(pd->pagesize, "w288h432-div2")) {
- stp_zprintf(v, "120");
- } else if (!strcmp(pd->pagesize, "w432h576-div4")) {
- stp_zprintf(v, "120");
+ if (!strcmp(pd->pagesize, "w432h576-w432h432_w432h144")) {
+ stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000016");
+ stp_zprintf(v, "060020000000000\r");
+ } else if (!strcmp(pd->pagesize, "w288h432-div2") ||
+ !strcmp(pd->pagesize, "w432h576-div4")) {
+ stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
+ stp_zprintf(v, "00000120");
+ } else if (pd->privdata.dnp.nocutwaste) {
+ stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
+ stp_zprintf(v, "00000001");
} else {
- stp_zprintf(v, "000");
+ stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
+ stp_zprintf(v, "00000000");
}
/* Configure multi-cut/page size */
@@ -5901,8 +6059,12 @@ static void dnpds40_printer_start(stp_vars_t *v)
stp_zprintf(v, "03");
} else if (!strcmp(pd->pagesize, "w360h504-div2")) {
stp_zprintf(v, "22");
+ } else if (!strcmp(pd->pagesize, "w432h432")) {
+ stp_zprintf(v, "27");
} else if (!strcmp(pd->pagesize, "w432h576")) {
stp_zprintf(v, "04");
+ } else if (!strcmp(pd->pagesize, "w432h576-w432h432_w432h144")) {
+ stp_zprintf(v, "04");
} else if (!strcmp(pd->pagesize, "w432h648")) {
stp_zprintf(v, "05");
} else if (!strcmp(pd->pagesize, "w432h576-div2")) {
@@ -5953,6 +6115,8 @@ static void dnpds40_plane_init(stp_vars_t *v)
stp_put32_le(11808, v); /* horizontal pixels per meter, fixed at 300dpi */
if (pd->h_dpi == 600)
stp_put32_le(23615, v); /* vertical pixels per meter @ 600dpi */
+ else if (pd->h_dpi == 334)
+ stp_put32_le(13146, v); /* vertical pixels per meter @ 334dpi */
else
stp_put32_le(11808, v); /* vertical pixels per meter @ 300dpi */
stp_put32_le(256, v); /* entries in color table */
@@ -5967,21 +6131,21 @@ static void dnpds40_plane_init(stp_vars_t *v)
printer with the full imaging width. */
static const dyesub_pagesize_t dnpds80_page[] =
{
- { "w288h576", "8x4", PT1(1236,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w360h576", "8x5", PT1(1536,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w432h576", "8x6", PT1(1836,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w576h576", "8x8", PT1(2436,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w576h576-div2", "8x4*2", PT1(2502,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w576h648-w576h360_w576h288", "8x5+8x4", PT1(2560,300), PT1(2802,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "c8x10", "8x10", PT1(2560,300), PT1(3036,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "c8x10-div2", "8x5*2", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "c8x10-w576h432_w576h288", "8x6+8x4", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h792-w576h432_w576h360", "8x6+8x5", PT1(2560,300), PT1(3402,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h842", "8x11.7", PT1(2560,300), PT1(3544,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864", "8x12", PT1(2560,300), PT1(3636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div2", "8x6*2", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-w576h576_w576h288", "8x8+8x4", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div3", "8x4*3", PT1(2560,300), PT1(3768,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "w288h576", "8x4", PT1(1236,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w360h576", "8x5", PT1(1536,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w432h576", "8x6", PT1(1836,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w576h576", "8x8", PT1(2436,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w576h576-div2", "8x4*2", PT1(2502,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w576h648-w576h360_w576h288", "8x5+8x4", PT1(2560,300), PT1(2802,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10", "8x10", PT1(2560,300), PT1(3036,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10-div2", "8x5*2", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10-w576h432_w576h288", "8x6+8x4", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h792-w576h432_w576h360", "8x6+8x5", PT1(2560,300), PT1(3402,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h842", "8x11.7", PT1(2560,300), PT1(3544,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864", "8x12", PT1(2560,300), PT1(3636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-div2", "8x6*2", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-w576h576_w576h288", "8x8+8x4", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-div3", "8x4*3", PT1(2560,300), PT1(3768,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, dnpds80_page_list, dyesub_pagesize_t, dnpds80_page);
@@ -6027,6 +6191,7 @@ static int dnpds80_parse_parameters(stp_vars_t *v)
const char *pagesize = stp_get_string_parameter(v, "PageSize");
dyesub_privdata_t *pd = get_privdata(v);
int multicut = 0;
+ int nocutwaste = stp_get_boolean_parameter(v, "NoCutWaste");
if (!strcmp(pagesize, "c8x10")) {
multicut = 6;
@@ -6064,8 +6229,10 @@ static int dnpds80_parse_parameters(stp_vars_t *v)
}
/* No need to set global params if there's no privdata yet */
- if (pd)
+ if (pd) {
pd->privdata.dnp.multicut = multicut;
+ pd->privdata.dnp.nocutwaste = nocutwaste;
+ }
return 1;
}
@@ -6078,7 +6245,11 @@ static void dnpds80_printer_start(stp_vars_t *v)
dnp_printer_start_common(v);
/* Set cutter option to "normal" */
- stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000000");
+ stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
+ if (pd->privdata.dnp.nocutwaste)
+ stp_zprintf(v, "00000001");
+ else
+ stp_zprintf(v, "00000000");
/* Configure multi-cut/page size */
stp_zprintf(v, "\033PIMAGE MULTICUT 00000008%08d", pd->privdata.dnp.multicut);
@@ -6100,10 +6271,12 @@ static int dnpds80dx_parse_parameters(stp_vars_t *v)
const char* duplex_mode;
dyesub_privdata_t *pd = get_privdata(v);
int multicut = 0;
+ int nocutwaste;
pagesize = stp_get_string_parameter(v, "PageSize");
duplex_mode = stp_get_string_parameter(v, "Duplex");
media = dyesub_get_mediatype(v);
+ nocutwaste = stp_get_boolean_parameter(v, "NoCutWaste");
if (!strcmp(media->name, "Roll")) {
if (strcmp(duplex_mode, "None") && strcmp(duplex_mode, "Standard")) {
@@ -6158,6 +6331,7 @@ static int dnpds80dx_parse_parameters(stp_vars_t *v)
multicut += 200; /* Duplex, front */
pd->privdata.dnp.multicut = multicut;
+ pd->privdata.dnp.nocutwaste = nocutwaste;
return 1;
}
@@ -6172,24 +6346,24 @@ static int dnpds80dx_parse_parameters(stp_vars_t *v)
static const dyesub_pagesize_t dnpds80dx_page[] =
{
- { "w288h576", "8x4", PT1(1236,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w360h576", "8x5", PT1(1536,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w432h576", "8x6", PT1(1836,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w576h576", "8x8", PT1(2436,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w576h576-div2", "8x4*2", PT1(2502,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w576h648-w576h360_w576h288", "8x5+8x4", PT1(2560,300), PT1(2802,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "c8x10", "8x10", PT1(2560,300), PT1(3036,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "c8x10-div2", "8x5*2", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "c8x10-w576h432_w576h288", "8x6+8x4", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h774-w576h756", "8x10.5", PT1(2560,300), PT1(3186,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h774", "8x10.75", PT1(2560,300), PT1(3186,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h792-w576h432_w576h360", "8x6+8x5", PT1(2560,300), PT1(3402,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h842", "8x11.7", PT1(2560,300), PT1(3544,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864", "8x12", PT1(2560,300), PT1(3636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div2", "8x6*2", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-w576h576_w576h288", "8x8+8x4", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div3", "8x4*3", PT1(2560,300), PT1(3768,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div3sheet", "8x4*3 SHEET", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "w288h576", "8x4", PT1(1236,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w360h576", "8x5", PT1(1536,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w432h576", "8x6", PT1(1836,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w576h576", "8x8", PT1(2436,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w576h576-div2", "8x4*2", PT1(2502,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w576h648-w576h360_w576h288", "8x5+8x4", PT1(2560,300), PT1(2802,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10", "8x10", PT1(2560,300), PT1(3036,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10-div2", "8x5*2", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10-w576h432_w576h288", "8x6+8x4", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h774-w576h756", "8x10.5", PT1(2560,300), PT1(3186,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h774", "8x10.75", PT1(2560,300), PT1(3186,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h792-w576h432_w576h360", "8x6+8x5", PT1(2560,300), PT1(3402,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h842", "8x11.7", PT1(2560,300), PT1(3544,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864", "8x12", PT1(2560,300), PT1(3636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-div2", "8x6*2", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-w576h576_w576h288", "8x8+8x4", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-div3", "8x4*3", PT1(2560,300), PT1(3768,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-div3sheet", "8x4*3 SHEET", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, dnpds80dx_page_list, dyesub_pagesize_t, dnpds80dx_page);
@@ -6241,14 +6415,17 @@ LIST(dyesub_printsize_list_t, dnpds80dx_printsize_list, dyesub_printsize_t, dnpd
printer with the full imaging width. */
static const dyesub_pagesize_t dnpsrx1_page[] =
{
- { "B7", "3.5x5", PT1(1088,300), PT1(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1920,300), PT1(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT},
- { "w360h504-div2", "3.5x5*2", PT1(1920,300), PT1(2176,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h576-div4", "2x6*4", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1920,300), PT1(2498,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "B7", "3.5x5", PT1(1088,300), PT1(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w288h432", "4x6", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w360h360","5x5", PT1(1540,300), PT1(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w360h504", "5x7", PT1(1920,300), PT1(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT1(1920,300), PT1(2176,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h432", "6x6", PT1(1836,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w432h576", "6x8", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div4", "2x6*4", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div2", "4x6*2", PT1(1920,300), PT1(2498,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+
};
LIST(dyesub_pagesize_list_t, dnpsrx1_page_list, dyesub_pagesize_t, dnpsrx1_page);
@@ -6261,10 +6438,14 @@ static const dyesub_printsize_t dnpsrx1_printsize[] =
{ "300x600", "w288h432", 2480, 1920},
{ "300x300", "w288h432-div2", 1240, 1920},
{ "300x600", "w288h432-div2", 2480, 1920},
+ { "300x300", "w360h360", 1540, 1920},
+ { "300x600", "w360h360", 3080, 1920},
{ "300x300", "w360h504", 1920, 2138},
{ "300x600", "w360h504", 1920, 4276},
{ "300x300", "w360h504-div2", 1920, 2176},
{ "300x600", "w360h504-div2", 1920, 4352},
+ { "300x300", "w432h432", 1836, 1920},
+ { "300x600", "w432h432", 3672, 1920},
{ "300x300", "w432h576", 1920, 2436},
{ "300x600", "w432h576", 1920, 4872},
{ "300x300", "w432h576-div4", 1920, 2436},
@@ -6283,13 +6464,15 @@ static void dnpdsrx1_printer_start(stp_vars_t *v)
dnp_printer_start_common(v);
/* Set cutter option to "normal" */
- stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000");
+ stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
if (!strcmp(pd->pagesize, "w288h432-div2")) {
- stp_zprintf(v, "120");
+ stp_zprintf(v, "00000120");
} else if (!strcmp(pd->pagesize, "w432h576-div4")) {
- stp_zprintf(v, "120");
+ stp_zprintf(v, "00000120");
+ } else if (pd->privdata.dnp.nocutwaste) {
+ stp_zprintf(v, "00000001");
} else {
- stp_zprintf(v, "000");
+ stp_zprintf(v, "00000000");
}
/* Configure multi-cut/page size */
@@ -6299,10 +6482,14 @@ static void dnpdsrx1_printer_start(stp_vars_t *v)
stp_zprintf(v, "01");
} else if (!strcmp(pd->pagesize, "w288h432")) {
stp_zprintf(v, "02");
+ } else if (!strcmp(pd->pagesize, "w360h360")) {
+ stp_zprintf(v, "29");
} else if (!strcmp(pd->pagesize, "w360h504")) {
stp_zprintf(v, "03");
} else if (!strcmp(pd->pagesize, "w360h504-div2")) {
stp_zprintf(v, "22");
+ } else if (!strcmp(pd->pagesize, "w432h432")) {
+ stp_zprintf(v, "27");
} else if (!strcmp(pd->pagesize, "w432h576")) {
stp_zprintf(v, "04");
} else if (!strcmp(pd->pagesize, "w432h576-div2")) {
@@ -6317,7 +6504,7 @@ static void dnpdsrx1_printer_start(stp_vars_t *v)
}
/* Dai Nippon Printing DS620 */
-static const laminate_t dnpds620_laminate[] =
+static const overcoat_t dnpds620_overcoat[] =
{
{"Glossy", N_("Glossy"), {3, "000"}},
{"Matte", N_("Matte"), {3, "001"}},
@@ -6325,26 +6512,27 @@ static const laminate_t dnpds620_laminate[] =
{"MatteLuster", N_("Matte Luster"), {3, "022"}},
};
-LIST(laminate_list_t, dnpds620_laminate_list, laminate_t, dnpds620_laminate);
+LIST(overcoat_list_t, dnpds620_overcoat_list, overcoat_t, dnpds620_overcoat);
/* Imaging area is wider than print size, we always must supply the
printer with the full imaging width. */
static const dyesub_pagesize_t dnpds620_page[] =
{
- { "B7", "3.5x5", PT1(1088,300), PT1(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE},
- { "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE},
- { "w324h432", "4.5x6", PT1(1386,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE},
- { "w360h360", "5x5", PT1(1540,300), PT1(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE},
- { "w360h504", "5x7", PT1(1920,300), PT1(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT},
- { "w360h504-div2", "3.5x5*2", PT1(1920,300), PT1(2176,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h432", "6x6", PT1(1836,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE},
- { "w432h576", "6x8", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h576-w432h432_w432h144", "6x6+2x6", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h576-div4", "2x6*4", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h576-div2", "4x6*2", PT1(1920,300), PT1(2498,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(1920,300), PT1(2740,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
- { "w432h648-div2", "4.5x6*2", PT1(1920,300), PT1(2802,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "B7", "3.5x5", PT1(1088,300), PT1(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w288h432", "4x6", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w288h432-div2", "2x6*2", PT1(1240,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w324h432", "4.5x6", PT1(1386,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w360h360", "5x5", PT1(1540,300), PT1(1920,300), 0, 0, PT(186,300), PT(186,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w360h504", "5x7", PT1(1920,300), PT1(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w360h504-div2", "3.5x5*2", PT1(1920,300), PT1(2176,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w360h504-w360h360_w360h144", "5x5+2x5", PT1(1920,300), PT1(2138,300), PT(186,300), PT(186,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h432", "6x6", PT1(1836,300), PT1(1920,300), 0, 0, PT(38,300), PT(38,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w432h576", "6x8", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-w432h432_w432h144", "6x6+2x6", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div4", "2x6*4", PT1(1920,300), PT1(2436,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576-div2", "4x6*2", PT1(1920,300), PT1(2498,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h648", "6x9", PT1(1920,300), PT1(2740,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h648-div2", "4.5x6*2", PT1(1920,300), PT1(2802,300), PT(38,300), PT(38,300), 0, 0, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, dnpds620_page_list, dyesub_pagesize_t, dnpds620_page);
@@ -6363,6 +6551,8 @@ static const dyesub_printsize_t dnpds620_printsize[] =
{ "300x600", "w360h360", 3080, 1920},
{ "300x300", "w360h504", 1920, 2138},
{ "300x600", "w360h504", 1920, 4276},
+ { "300x300", "w360h504-w360h360_w360h144", 1920, 2138},
+ { "300x600", "w360h504-w360h360_w360h144", 1920, 4276},
{ "300x300", "w360h504-div2", 1920, 2176},
{ "300x600", "w360h504-div2", 1920, 4352},
{ "300x300", "w432h432", 1836, 1920},
@@ -6401,9 +6591,18 @@ static void dnpds620_printer_start(stp_vars_t *v)
} else if (!strcmp(pd->pagesize, "w432h576-w432h432_w432h144")) {
stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000016");
stp_zprintf(v, "0600200000000000");
+ } else if (!strcmp(pd->pagesize, "w360h504-w360h360_w360h144")) {
+ stp_zprintf(v, "\033PCNTRL FULL_CUTTER_SET 00000016");
+ stp_zprintf(v, "050020000000000\r");
} else if (!strcmp(pd->pagesize, "w288h432-div2")) {
stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
stp_zprintf(v, "00000120");
+ } else if (pd->privdata.dnp.nocutwaste) {
+ stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
+ stp_zprintf(v, "00000001");
+ } else {
+ stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
+ stp_zprintf(v, "00000000");
}
/* Configure multi-cut/page size */
@@ -6420,6 +6619,8 @@ static void dnpds620_printer_start(stp_vars_t *v)
stp_zprintf(v, "29");
} else if (!strcmp(pd->pagesize, "w360h504")) {
stp_zprintf(v, "03");
+ } else if (!strcmp(pd->pagesize, "w360h504-w360h360_w360h144")) {
+ stp_zprintf(v, "03");
} else if (!strcmp(pd->pagesize, "w360h504-div2")) {
stp_zprintf(v, "22");
} else if (!strcmp(pd->pagesize, "w432h432")) {
@@ -6447,33 +6648,32 @@ static void dnpds620_printer_start(stp_vars_t *v)
printer with the full imaging width. */
static const dyesub_pagesize_t dnpds820_page[] =
{
- { "w288h576", "8x4", PT1(1236,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w360h576", "8x5", PT1(1536,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w432h576", "8x6", PT1(1836,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w504h576", "8x7", PT1(2136,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w576h576", "8x8", PT1(2436,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w576h576-div2", "8x4*2", PT1(2502,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE},
- { "w576h648", "8x9", PT1(2560,300), PT1(2736,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h648-w576h360_w576h288", "8x5+8x4", PT1(2560,300), PT1(2802,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "c8x10", "8x10", PT1(2560,300), PT1(3036,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "c8x10-div2", "8x5*2", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "c8x10-w576h432_w576h288", "8x6+8x4", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h792-w576h432_w576h360", "8x6+8x5", PT1(2560,300), PT1(3402,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h842", "8x11.7", PT1(2560,300), PT1(3544,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864", "8x12", PT1(2560,300), PT1(3636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div2", "8x6*2", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-w576h576_w576h288", "8x8+8x4", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
- { "w576h864-div3", "8x4*3", PT1(2560,300), PT1(3768,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT},
-
- { "A4x4inch", "A4x4inch", PT1(1236,300), PT1(2560,300), PT(16,300), PT(16,300), 0, 0, DYESUB_LANDSCAPE},
- { "A4x5inch", "A4x5inch", PT1(1536,300), PT1(2560,300), PT(16,300), PT(16,300), 0, 0, DYESUB_LANDSCAPE},
- { "A5", "A5", PT1(1784,300), PT1(2560,300), PT(16,300), PT(16,300), 0, 0, DYESUB_LANDSCAPE},
- { "A4x6inch", "A4x6inch", PT1(1836,300), PT1(2560,300), PT(16,300), PT(16,300), 0, 0, DYESUB_LANDSCAPE},
- { "A4x8inch", "A4x8inch", PT1(2436,300), PT1(2560,300), PT(16,300), PT(16,300), 0, 0, DYESUB_LANDSCAPE},
- { "A4x10inch", "A4x10inch", PT1(2560,300), PT1(3036,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT},
- { "A4x10inch-div2", "A4x5inch*2", PT1(2560,300), PT1(3102,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT},
- { "A4", "A4", PT1(2560,300), PT1(3544,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT},
- { "A4-div2", "A5*2", PT1(2560,300), PT1(3598,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "w288h576", "8x4", PT1(1236,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w360h576", "8x5", PT1(1536,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w432h576", "8x6", PT1(1836,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w504h576", "8x7", PT1(2136,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w576h576", "8x8", PT1(2436,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w576h576-div2", "8x4*2", PT1(2502,300), PT1(2560,300), 0, 0, PT(56,300), PT(56,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w576h648", "8x9", PT1(2560,300), PT1(2736,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h648-w576h360_w576h288", "8x5+8x4", PT1(2560,300), PT1(2802,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10", "8x10", PT1(2560,300), PT1(3036,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10-div2", "8x5*2", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "c8x10-w576h432_w576h288", "8x6+8x4", PT1(2560,300), PT1(3102,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h792-w576h432_w576h360", "8x6+8x5", PT1(2560,300), PT1(3402,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h842", "8x11.7", PT1(2560,300), PT1(3544,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864", "8x12", PT1(2560,300), PT1(3636,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-div2", "8x6*2", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-w576h576_w576h288", "8x8+8x4", PT1(2560,300), PT1(3702,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w576h864-div3", "8x4*3", PT1(2560,300), PT1(3768,300), PT(56,300), PT(56,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "A4x4inch", "A4x4inch", PT1(1236,300), PT1(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "A4x5inch", "A4x5inch", PT1(1536,300), PT1(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "A5", "A5", PT1(1784,300), PT1(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "A4x6inch", "A4x6inch", PT1(1836,300), PT1(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "A4x8inch", "A4x8inch", PT1(2436,300), PT1(2560,300), 0, 0, PT(16,300), PT(16,300), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "A4x10inch", "A4x10inch", PT1(2560,300), PT1(3036,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "A4x10inch-div2", "A4x5inch*2", PT1(2560,300), PT1(3102,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "A4", "A4", PT1(2560,300), PT1(3544,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "A4-div2", "A5*2", PT1(2560,300), PT1(3598,300), PT(16,300), PT(16,300), 0, 0, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, dnpds820_page_list, dyesub_pagesize_t, dnpds820_page);
@@ -6514,17 +6714,16 @@ static const dyesub_printsize_t dnpds820_printsize[] =
{ "300x600", "w576h864-w576h576_w576h288", 2560, 7404},
{ "300x300", "w576h864-div3", 2560, 3768},
{ "300x600", "w576h864-div3", 2560, 7536},
-
- { "300x300", "A4x4inch", 2560, 1236},
- { "300x600", "A4x4inch", 2560, 2472},
- { "300x300", "A4x5inch", 2560, 1536},
- { "300x600", "A4x5inch", 2560, 3072},
- { "300x300", "A5", 2560, 1784},
- { "300x600", "A5", 2560, 3568},
- { "300x300", "A4x6inch", 2560, 1836},
- { "300x600", "A4x6inch", 2560, 3672},
- { "300x300", "A4x8inch", 2560, 2436},
- { "300x600", "A4x8inch", 2560, 4872},
+ { "300x300", "A4x4inch", 1236, 2560},
+ { "300x600", "A4x4inch", 2472, 2560},
+ { "300x300", "A4x5inch", 1536, 2560},
+ { "300x600", "A4x5inch", 3072, 2560},
+ { "300x300", "A5", 1784, 2560},
+ { "300x600", "A5", 3568, 2560},
+ { "300x300", "A4x6inch", 1836, 2560},
+ { "300x600", "A4x6inch", 3672, 2560},
+ { "300x300", "A4x8inch", 2436, 2560},
+ { "300x600", "A4x8inch", 4872, 2560},
{ "300x300", "A4x10inch", 2560, 3036},
{ "300x600", "A4x10inch", 2560, 6072},
{ "300x300", "A4x10inch-div2", 2560, 3102},
@@ -6544,6 +6743,15 @@ static void dnpds820_printer_start(stp_vars_t *v)
/* Common code */
dnp_printer_start_common(v);
+ /* No-cut waste */
+ if (pd->privdata.dnp.nocutwaste) {
+ stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
+ stp_zprintf(v, "00000001");
+ } else {
+ stp_zprintf(v, "\033PCNTRL CUTTER 00000008");
+ stp_zprintf(v, "00000000");
+ }
+
/* Configure multi-cut/page size */
stp_zprintf(v, "\033PIMAGE MULTICUT 00000008000000");
@@ -6598,7 +6806,7 @@ static void dnpds820_printer_start(stp_vars_t *v)
} else if (!strcmp(pd->pagesize, "A4")) {
stp_zprintf(v, "41");
} else if (!strcmp(pd->pagesize, "A4-div2")) {
- stp_zprintf(v, "43");
+ stp_zprintf(v, "35");
} else {
stp_zprintf(v, "00"); /* should not be possible */
}
@@ -6626,6 +6834,12 @@ static const stp_parameter_t ds820_parameters[] =
STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
},
+ {
+ "NoCutWaste", N_("No Cut-Paper Waste"), "Color=No,Category=Advanced Printer Setup",
+ N_("No Cut-Paper Waste"),
+ STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
+ },
};
#define ds820_parameter_count (sizeof(ds820_parameters) / sizeof(const stp_parameter_t))
@@ -6634,7 +6848,7 @@ ds820_load_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
if (caps->parameter_count && caps->parameters)
@@ -6661,6 +6875,11 @@ ds820_load_parameters(const stp_vars_t *v, const char *name,
description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
description->is_active = 1;
}
+ else if (strcmp(name, "NoCutWaste") == 0)
+ {
+ description->is_active = 1;
+ description->deflt.boolean = 0;
+ }
else
{
return 0;
@@ -6671,12 +6890,12 @@ ds820_load_parameters(const stp_vars_t *v, const char *name,
static int ds820_parse_parameters(stp_vars_t *v)
{
dyesub_privdata_t *pd = get_privdata(v);
- const char *print_speed;
-
- print_speed = stp_get_string_parameter(v, "PrintSpeed");
+ const char *print_speed = stp_get_string_parameter(v, "PrintSpeed");
+ int nocutwaste = stp_get_boolean_parameter(v, "NoCutWaste");
if (pd) {
pd->privdata.dnp.print_speed = print_speed;
+ pd->privdata.dnp.nocutwaste = nocutwaste;
}
return 1;
@@ -6693,13 +6912,13 @@ LIST(dyesub_resolution_list_t, res_citizen_cw01_dpi_list, dyesub_resolution_t,re
static const dyesub_pagesize_t citizen_cw01_page[] =
{
- { "w252h338", "3.5x4.7", PT1(1210,334), PT1(2048,334), 0, 0, PT(225,334), PT(225,334), DYESUB_LANDSCAPE},
- { "B7", "3.5x5", PT1(1210,334), PT1(2048,334), 0, 0, PT(169,334), PT(169,334), DYESUB_LANDSCAPE},
- { "w288h432", "4x6", PT1(1380,334), PT1(2048,334), 0, 0, PT(5,334), PT(5,334), DYESUB_LANDSCAPE},
- { "w338h504", "4.7x7", PT1(2048,334), PT1(2380,334), PT(225,334), PT(225,334), 0, 0, DYESUB_PORTRAIT},
- { "w360h504", "5x7", PT1(2048,334), PT1(2380,334), PT(169,334), PT(169,334), 0, 0, DYESUB_PORTRAIT},
- { "w432h576", "6x8", PT1(2048,334), PT1(2710,300), PT(5,334), PT(5,334), 0, 0, DYESUB_PORTRAIT},
- { "w432h648", "6x9", PT1(2048,334), PT1(3050,334), PT(5,334), PT(5,334), 0, 0, DYESUB_PORTRAIT},
+ DEFINE_PAPER( "w252h338", "3.5x4.7", PT1(1210,334), PT1(2048,334), 0, 0, PT(225,334), PT(225,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "B7", "3.5x5", PT1(1210,334), PT1(2048,334), 0, 0, PT(169,334), PT(169,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w288h432", "4x6", PT1(1380,334), PT1(2048,334), 0, 0, PT(5,334), PT(5,334), DYESUB_LANDSCAPE),
+ DEFINE_PAPER( "w338h504", "4.7x7", PT1(2048,334), PT1(2380,334), PT(225,334), PT(225,334), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w360h504", "5x7", PT1(2048,334), PT1(2380,334), PT(169,334), PT(169,334), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h576", "6x8", PT1(2048,334), PT1(2710,300), PT(5,334), PT(5,334), 0, 0, DYESUB_PORTRAIT),
+ DEFINE_PAPER( "w432h648", "6x9", PT1(2048,334), PT1(3050,334), PT(5,334), PT(5,334), 0, 0, DYESUB_PORTRAIT),
};
LIST(dyesub_pagesize_list_t, citizen_cw01_page_list, dyesub_pagesize_t, citizen_cw01_page);
@@ -6727,68 +6946,703 @@ LIST(dyesub_printsize_list_t, citizen_cw01_printsize_list, dyesub_printsize_t, c
static void citizen_cw01_printer_start(stp_vars_t *v)
{
dyesub_privdata_t *pd = get_privdata(v);
+ /* Set quantity.. Backend overrides as needed. */
+ stp_zprintf(v, "\033PCNTRL QTY 00000008%07d\r", pd->copies);
+ /* Set cutter, nothing fancy */
+ stp_zprintf(v, "\033PCNTRL CUTTER 0000000800000000");
- int media = 0;
+ /* CW-01 has no other smarts. No multicut, no matte. */
+}
- if (strcmp(pd->pagesize,"w252h338") == 0)
- media = 0x00;
- else if (strcmp(pd->pagesize,"B7") == 0)
- media = 0x01;
- else if (strcmp(pd->pagesize,"w288h432") == 0)
- media = 0x02;
- else if (strcmp(pd->pagesize,"w338h504") == 0)
- media = 0x03;
- else if (strcmp(pd->pagesize,"w360h504") == 0)
- media = 0x04;
- else if (strcmp(pd->pagesize,"w432h576") == 0)
- media = 0x05;
- else if (strcmp(pd->pagesize,"w432h576") == 0)
- media = 0x06;
+/* Magicard Series */
+static const dyesub_pagesize_t magicard_page[] =
+{
+ DEFINE_PAPER( "w155h244", "ID-1/CR80", PT1(672,300), PT1(1016,300), PT1(15, 300), PT1(15,300), 0, 0, DYESUB_PORTRAIT),
+};
- stp_putc(media, v);
- if (pd->h_dpi == 600) {
- stp_putc(0x01, v);
+LIST(dyesub_pagesize_list_t, magicard_page_list, dyesub_pagesize_t, magicard_page);
+
+static const dyesub_printsize_t magicard_printsize[] =
+{
+ { "300x300", "w155h244", 672, 1016},
+};
+
+LIST(dyesub_printsize_list_t, magicard_printsize_list, dyesub_printsize_t, magicard_printsize);
+
+static const overcoat_t magicard_overcoat[] =
+{
+ {"Off", N_("Off"), {3, "OFF"}},
+ {"On", N_("On"), {2, "ON"}},
+};
+
+LIST(overcoat_list_t, magicard_overcoat_list, overcoat_t, magicard_overcoat);
+
+static void magicard_printer_init(stp_vars_t *v)
+{
+ dyesub_privdata_t *pd = get_privdata(v);
+
+ dyesub_nputc(v, 0x05, 64); /* ATTN/Clear */
+ stp_putc(0x01, v); /* Start command sequence */
+ stp_zprintf(v, ",NOC1");
+ stp_zprintf(v, ",VER%d.%d.%d", STP_MAJOR_VERSION, STP_MINOR_VERSION, STP_MICRO_VERSION); // XXX include "pre" or other tag.
+ stp_zprintf(v, ",LANENG"); // Dunno about other options.
+ stp_zprintf(v, ",TDT%08X", (unsigned int)stpi_time(NULL)); /* Some sort of timestamp. Unknown epoch. */
+// stp_zprintf(v, ",LC%d", 1); // Force media type. LC1/LC3/LC6/LC8 for YMCKO/MONO/KO/YMCKOK
+ stp_zprintf(v, ",REJ%s", pd->privdata.magicard.reject ? "ON" : "OFF"); /* Faulty card rejection. */
+ stp_zprintf(v, ",ESS%d", pd->copies); /* Number of copies */
+ stp_zprintf(v, ",KEE,RT2");
+ if (pd->duplex_mode &&
+ strcmp(pd->duplex_mode, "None") &&
+ strcmp(pd->duplex_mode, "Standard")) /* Duplex enabled? */
+ {
+ stp_zprintf(v, ",DPXON,PAG%d", 1 + (pd->page_number & 1));
+ if (!(pd->page_number & 1))
+ {
+ /* Color format of BACk side -- eg CKO or KO or C or CO or K. We don't support K/KO-only! */
+ stp_zprintf(v, ",BAC%s%s",
+ pd->privdata.magicard.resin_k ? "CK" : "C",
+ pd->privdata.magicard.overcoat ? "O" : "");
+ }
+ }
+ else
+ {
+ stp_zprintf(v, ",DPXOFF,PAG1");
+ }
+ stp_zprintf(v, ",SLW%s", pd->privdata.magicard.colorsure ? "ON" : "OFF"); /* "Colorsure printing" */
+ stp_zprintf(v, ",IMF%s", "BGR"); /* Image format -- as opposed to K, BGRK and others. */
+ stp_zprintf(v, ",XCO0,YCO0"); // ??
+ stp_zprintf(v, ",WID%u,HGT%u", (unsigned int)pd->h_size, (unsigned int)pd->w_size - 30); /* Width & Height */
+
+ /* Overcoat options are unique per-side */
+ if (!(pd->page_number & 1))
+ {
+ stp_zprintf(v, ",OVR%s", pd->privdata.magicard.overcoat ? "ON" : "OFF" );
+ if (pd->privdata.magicard.overcoat && pd->privdata.magicard.overcoat_hole)
+ {
+ if (!strcmp("SmartCard", pd->privdata.magicard.overcoat_hole))
+ stp_zprintf(v, ",NCT%d,%d,%d,%d", 90, 295, 260, 450);
+ else if (!strcmp("SmartCardLarge", pd->privdata.magicard.overcoat_hole))
+ stp_zprintf(v, ",NCT%d,%d,%d,%d", 75, 275, 280, 470);
+ else if (!strcmp("MagStripe", pd->privdata.magicard.overcoat_hole))
+ stp_zprintf(v, ",NCT%d,%d,%d,%d", 0, 420, 1025, 590);
+ else if (!strcmp("MagStripeLarge", pd->privdata.magicard.overcoat_hole))
+ stp_zprintf(v, ",NCT%d,%d,%d,%d", 0, 400, 1025, 610);
+ /* XXX TODO: Add ability to specify custom hole sizes */
+ }
} else {
- stp_putc(0x00, v);
+ stp_zprintf(v, ",OVR%s", pd->privdata.magicard.overcoat_dpx ? "ON" : "OFF" );
+ if (pd->privdata.magicard.overcoat_dpx && pd->privdata.magicard.overcoat_hole_dpx)
+ {
+ if (!strcmp("SmartCard", pd->privdata.magicard.overcoat_hole_dpx))
+ stp_zprintf(v, ",NCT%d,%d,%d,%d", 90, 295, 260, 450);
+ else if (!strcmp("SmartCardLarge", pd->privdata.magicard.overcoat_hole_dpx))
+ stp_zprintf(v, ",NCT%d,%d,%d,%d", 75, 275, 280, 470);
+ else if (!strcmp("MagStripe", pd->privdata.magicard.overcoat_hole_dpx))
+ stp_zprintf(v, ",NCT%d,%d,%d,%d", 0, 420, 1025, 590);
+ else if (!strcmp("MagStripeLarge", pd->privdata.magicard.overcoat_hole_dpx))
+ stp_zprintf(v, ",NCT%d,%d,%d,%d", 0, 400, 1025, 610);
+ /* XXX TODO: Add ability to specify custom hole sizes */
+ }
}
- stp_putc(pd->copies, v);
- stp_putc(0x00, v);
+ stp_zprintf(v, ",NNNOFF"); // ??
+ if (!(pd->page_number & 1))
+ {
+ stp_zprintf(v, ",USF%s", pd->privdata.magicard.holokote ? "ON" : "OFF"); /* Disable Holokote. */
+ if (pd->privdata.magicard.holokote)
+ {
+ stp_zprintf(v, ",HKT%d", pd->privdata.magicard.holokote);
+ stp_zprintf(v, ",CKI%s", pd->privdata.magicard.holokote_custom? "ON" : "OFF");
+ stp_zprintf(v, ",HKMFFFFFF,TRO0"); // HKM == area. each bit is a separate area, 1-24. Not sure about TRO
+ }
- /* Compute plane size */
- media = (pd->w_size * pd->h_size) + 1024 + 40;
+ if (pd->privdata.magicard.holopatch)
+ {
+ stp_zprintf(v, ",HPHON,PAT%d", pd->privdata.magicard.holopatch);
+ }
+ } else {
+ stp_zprintf(v, ",USFOFF"); /* Disable Holokote on duplex side. */
+ }
- stp_put32_le(media, v);
- stp_put32_le(0x0, v);
+ /* Magnetic stripe. Only program on the FRONT side. */
+ if (!(pd->page_number & 1))
+ {
+ if (pd->privdata.magicard.mag1[0]) {
+ stp_zprintf(v, ",MAG1,BPI210,MPC7,COE%c,%s",
+ pd->privdata.magicard.mag_coer ? 'H': 'L',
+ pd->privdata.magicard.mag1);
+ }
+ if (pd->privdata.magicard.mag2[0]) {
+ stp_zprintf(v, ",MAG2,BPI75,MPC5,COE%c,%s",
+ pd->privdata.magicard.mag_coer ? 'H': 'L',
+ pd->privdata.magicard.mag2);
+ }
+ if (pd->privdata.magicard.mag3[0]) {
+ stp_zprintf(v, ",MAG3,BPI210,MPC7,COE%c,%s",
+ pd->privdata.magicard.mag_coer ? 'H': 'L',
+ pd->privdata.magicard.mag3);
+ }
+ }
+
+ stp_zprintf(v, ",PCT%d,%d,%d,%d", 0, 0, 1025, 641); // print area? (seen 1025/1015/999,641)
+ stp_zprintf(v, ",ICC%d", pd->privdata.magicard.gamma); /* Gamma curve. 0-2 */
+ if (pd->privdata.magicard.power_color != 50)
+ stp_zprintf(v, ",CPW%d", pd->privdata.magicard.power_color); /* RGB/Color power. 0-100 */
+ if (pd->privdata.magicard.power_overcoat != 50)
+ stp_zprintf(v, ",OPW%d", pd->privdata.magicard.power_overcoat); /* Overcoat power. 0-100 */
+ if (pd->privdata.magicard.power_resin != 50)
+ stp_zprintf(v, ",KPW%d", pd->privdata.magicard.power_resin); /* Black/Resin power. 0-100 */
+ if (pd->privdata.magicard.align_start != 50)
+ stp_zprintf(v, ",SOI%d", pd->privdata.magicard.align_start); /* Card Start alignment, 0-100 */
+ if (pd->privdata.magicard.align_end != 50)
+ stp_zprintf(v, ",EOI%d", pd->privdata.magicard.align_end); /* Card End alignment, 0-100 */
+ stp_zprintf(v, ",DDD50"); // ??
+ stp_zprintf(v, ",X-GP-8"); /* GP extension, tells backend data is 8bpp */
+ if (pd->privdata.magicard.resin_k)
+ stp_zprintf(v, ",X-GP-RK"); /* GP extension, tells backend to extract resin-K layer */
+ stp_zprintf(v, ",SZB%d", (int)(pd->w_size * pd->h_size)); /* 8bpp, needs to be 6bpp */
+ stp_zprintf(v, ",SZG%d", (int)(pd->w_size * pd->h_size));
+ stp_zprintf(v, ",SZR%d", (int)(pd->w_size * pd->h_size));
+// stp_zprintf(v, ",SZK%d", (int)(pd->w_size * pd->h_size)); /* 8bpp, needs to be 1bpp */
+ stp_putc(0x1c, v); /* Terminate command data */
+}
+
+static void magicard_printer_end(stp_vars_t *v)
+{
+ stp_putc(0x03, v); /* Terminate the command sequence */
}
-static void citizen_cw01_plane_init(stp_vars_t *v)
+static void magicard_plane_end(stp_vars_t *v)
{
dyesub_privdata_t *pd = get_privdata(v);
- int i;
+ stp_putc(0x1c, v); /* Terminate the image data */
+ switch (pd->plane)
+ {
+ case 3:
+ stp_putc(0x42, v); /* Blue */
+ break;
+ case 2:
+ stp_putc(0x47, v); /* Green */
+ break;
+ case 1:
+ stp_putc(0x52, v); /* Red */
+ break;
+ default:
+// stp_putc(0x4b, v); /* Black/Resin */
+ break;
+ }
+ stp_putc(0x3a, v);
+}
- stp_put32_le(0x28, v);
- stp_put32_le(0x0800, v);
- stp_put16_le(pd->h_size, v); /* number of rows */
- stp_put16_le(0x0, v);
- stp_put32_le(0x080001, v);
- stp_put32_le(0x00, v);
- stp_put32_le(0x00, v);
- stp_put32_le(0x335a, v);
- if (pd->h_dpi == 600) {
- stp_put32_le(0x5c40, v);
- } else {
- stp_put32_le(0x335a, v);
+static const dyesub_stringitem_t magicard_black_types[] =
+{
+ { "Composite", N_ ("Composite (CMY)") },
+ { "Resin", N_ ("Resin Black") },
+};
+LIST(dyesub_stringlist_t, magicard_black_types_list, dyesub_stringitem_t, magicard_black_types);
+
+static const dyesub_stringitem_t magicard_mag_coer[] =
+{
+ { "Low", N_ ("Low") },
+ { "High", N_ ("High") },
+};
+LIST(dyesub_stringlist_t, magicard_mag_coer_list, dyesub_stringitem_t, magicard_mag_coer);
+
+static const stp_parameter_t magicard_parameters[] =
+{
+ {
+ "BlackType", N_("Black Type"), "Color=No,Category=Advanced Printer Setup",
+ N_("Black Type"),
+ STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_BASIC, 1, 0, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "RejectBad", N_("Reject Bad Cards"), "Color=No,Category=Advanced Printer Setup",
+ N_("Reject Bad Cards"),
+ STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_BASIC, 1, 0, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "ColorSure", N_("Enable Colorsure"), "Color=No,Category=Advanced Printer Setup",
+ N_("Enable Colorsure"),
+ STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_BASIC, 1, 0, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "GammaCurve", N_("Printer Gamma Curve"), "Color=No,Category=Advanced Printer Setup",
+ N_("Internal Gamma Curve to apply (0 is none)"),
+ STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "PowerColor", N_("Color Power Level"), "Color=No,Category=Advanced Printer Setup",
+ N_("Power level for color passes"),
+ STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "PowerBlack", N_("Black Power Level"), "Color=No,Category=Advanced Printer Setup",
+ N_("Power level for black pass"),
+ STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "PowerOC", N_("Overcoat Power Level"), "Color=No,Category=Advanced Printer Setup",
+ N_("Power level for overcoat pass"),
+ STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "AlignStart", N_("Card Start Alignment"), "Color=No,Category=Advanced Printer Setup",
+ N_("Fine-tune card start position"),
+ STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "AlignEnd", N_("Card End Alignment"), "Color=No,Category=Advanced Printer Setup",
+ N_("Fine-tune card end position"),
+ STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "CardOffset", N_("Horizontal Card offset"), "Color=No,Category=Advanced Printer Setup",
+ N_("Fine-tune card horizontal centering"),
+ STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "Holokote", N_("Holokote"), "Color=No,Category=Advanced Printer Setup",
+ N_("Holokote option"),
+ STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "HolokoteCustom", N_("Custom Holokote Key"), "Color=No,Category=Advanced Printer Setup",
+ N_("Use an optional custom Holokote key"),
+ STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "Holopatch", N_("HoloPatch"), "Color=No,Category=Advanced Printer Setup",
+ N_("Position of the HoloPatch"),
+ STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "OvercoatHole", N_("Overcoat Hole"), "Color=No,Category=Advanced Printer Setup",
+ N_("Area to not cover with an overcoat layer"),
+ STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "OvercoatHoleDuplex", N_("Overcoat Hole Duplex"), "Color=No,Category=Advanced Printer Setup",
+ N_("Area to not cover with an overcoat layer"),
+ STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ { /* Note this is called "LaminateDuplex" rather than "OvercoatDuplex"
+ to align with the mis-named "Laminate" option.
+ */
+ "LaminateDuplex", N_("Overcoat Pattern Duplex"), "Color=No,Category=Advanced Printer Setup",
+ N_("Overcoat Pattern Duplex"),
+ STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 0, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "MagCoer", N_("Magnetic Stripe Coercivity"), "Color=No,Category=Advanced Printer Setup",
+ N_("Magnetic Stripe Coercivity Type"),
+ STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 1, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "MagStripe1", N_("Magnetic Stripe Row 1"), "Color=No,Category=Advanced Printer Setup",
+ N_("ISO 7811 alphanumeric data to be encoded in the first magnetic stripe row (0-79 characters)"),
+ STP_PARAMETER_TYPE_RAW, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 0, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "MagStripe2", N_("Magnetic Stripe Row 2"), "Color=No,Category=Advanced Printer Setup",
+ N_("ISO 7811 alphanumeric data to be encoded in the second magnetic stripe row (0-40 digits)"),
+ STP_PARAMETER_TYPE_RAW, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 0, 1, STP_CHANNEL_NONE, 1, 0
+ },
+ {
+ "MagStripe3", N_("Magnetic Stripe Row 3"), "Color=No,Category=Advanced Printer Setup",
+ N_("ISO 7811 alphanumeric data to be encoded in the third magnetic stripe row (0-107 digits)"),
+ STP_PARAMETER_TYPE_RAW, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_ADVANCED, 0, 1, STP_CHANNEL_NONE, 1, 0
+ },
+};
+#define magicard_parameter_count (sizeof(magicard_parameters) / sizeof(const stp_parameter_t))
+
+static const dyesub_stringitem_t magicard_holokotes[] =
+{
+ { "Off", N_ ("Off") },
+ { "UltraSecure", N_ ("Ultra Secure") },
+ { "Rings", N_ ("Interlocking Rings") },
+ { "Flex", N_ ("Flex") },
+};
+LIST(dyesub_stringlist_t, magicard_holokotes_list, dyesub_stringitem_t, magicard_holokotes);
+
+static const dyesub_stringitem_t magicard_overcoat_holes[] =
+{
+ { "None", N_ ("None") },
+ { "SmartCard", N_ ("Smart Card Chip") },
+ { "SmartCardLarge", N_ ("Smart Card Chip (Large)") },
+ { "MagStripe", N_ ("Magnetic Stripe") },
+ { "MagStripeLarge", N_ ("Magnetic Stripe (Large)") },
+};
+LIST(dyesub_stringlist_t, magicard_overcoat_holes_list, dyesub_stringitem_t, magicard_overcoat_holes);
+
+static int
+magicard_load_parameters(const stp_vars_t *v, const char *name,
+ stp_parameter_t *description)
+{
+ int i;
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
+ stp_get_model_id(v));
+
+ if (caps->parameter_count && caps->parameters)
+ {
+ for (i = 0; i < caps->parameter_count; i++)
+ if (strcmp(name, caps->parameters[i].name) == 0)
+ {
+ stp_fill_parameter_settings(description, &(caps->parameters[i]));
+ break;
+ }
+ }
+
+ if (strcmp(name, "BlackType") == 0)
+ {
+ description->bounds.str = stp_string_list_create();
+
+ const dyesub_stringlist_t *mlist = &magicard_black_types_list;
+ for (i = 0; i < mlist->n_items; i++)
+ {
+ const dyesub_stringitem_t *m = &(mlist->item[i]);
+ stp_string_list_add_string(description->bounds.str,
+ m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
+ }
+ description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "RejectBad") == 0)
+ {
+ description->deflt.boolean = 0;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "ColorSure") == 0)
+ {
+ description->deflt.boolean = 1;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "GammaCurve") == 0)
+ {
+ description->deflt.integer = 1;
+ description->bounds.integer.lower = 0;
+ description->bounds.integer.upper = 2;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "PowerColor") == 0)
+ {
+ description->deflt.integer = 0;
+ description->bounds.integer.lower = -50;
+ description->bounds.integer.upper = 50;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "PowerBlack") == 0)
+ {
+ description->deflt.integer = 0;
+ description->bounds.integer.lower = -50;
+ description->bounds.integer.upper = 50;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "PowerOC") == 0)
+ {
+ description->deflt.integer = 0;
+ description->bounds.integer.lower = -50;
+ description->bounds.integer.upper = 50;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "AlignStart") == 0)
+ {
+ description->deflt.integer = 0;
+ description->bounds.integer.lower = -50;
+ description->bounds.integer.upper = 50;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "AlignEnd") == 0)
+ {
+ description->deflt.integer = 0;
+ description->bounds.integer.lower = -50;
+ description->bounds.integer.upper = 50;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "CardOffset") == 0)
+ {
+ description->deflt.integer = 0;
+ description->bounds.integer.lower = -15;
+ description->bounds.integer.upper = 15;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "Holokote") == 0)
+ {
+ description->bounds.str = stp_string_list_create();
+
+ const dyesub_stringlist_t *mlist = &magicard_holokotes_list;
+ for (i = 0; i < mlist->n_items; i++)
+ {
+ const dyesub_stringitem_t *m = &(mlist->item[i]);
+ stp_string_list_add_string(description->bounds.str,
+ m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
+ }
+ description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "HolokoteCustom") == 0)
+ {
+ description->deflt.boolean = 0;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "Holopatch") == 0)
+ {
+ description->deflt.integer = 0;
+ description->bounds.integer.lower = 0;
+ description->bounds.integer.upper = 24;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "OvercoatHole") == 0)
+ {
+ description->bounds.str = stp_string_list_create();
+
+ const dyesub_stringlist_t *mlist = &magicard_overcoat_holes_list;
+ for (i = 0; i < mlist->n_items; i++)
+ {
+ const dyesub_stringitem_t *m = &(mlist->item[i]);
+ stp_string_list_add_string(description->bounds.str,
+ m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
+ }
+ description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "OvercoatHoleDuplex") == 0)
+ {
+ description->bounds.str = stp_string_list_create();
+
+ const dyesub_stringlist_t *mlist = &magicard_overcoat_holes_list;
+ for (i = 0; i < mlist->n_items; i++)
+ {
+ const dyesub_stringitem_t *m = &(mlist->item[i]);
+ stp_string_list_add_string(description->bounds.str,
+ m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
+ }
+ description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
+ /* This feature only applies if the printer is duplexing! */
+ if (dyesub_feature(caps, DYESUB_FEATURE_DUPLEX))
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "OvercoatDuplex") == 0)
+ {
+ description->bounds.str = stp_string_list_create();
+ if (caps->overcoat)
+ {
+ const overcoat_list_t *llist = caps->overcoat;
+
+ for (i = 0; i < llist->n_items; i++)
+ {
+ const overcoat_t *l = &(llist->item[i]);
+ stp_string_list_add_string(description->bounds.str,
+ l->name, gettext(l->text));
+ }
+ description->deflt.str =
+ stp_string_list_param(description->bounds.str, 0)->name;
+ /* This feature only applies if the printer is duplexing! */
+ if (dyesub_feature(caps, DYESUB_FEATURE_DUPLEX))
+ description->is_active = 1;
+ } else {
+ description->is_active = 0;
+ }
+ }
+ else if (strcmp(name, "MagCoer") == 0)
+ {
+ description->bounds.str = stp_string_list_create();
+
+ const dyesub_stringlist_t *mlist = &magicard_mag_coer_list;
+ for (i = 0; i < mlist->n_items; i++)
+ {
+ const dyesub_stringitem_t *m = &(mlist->item[i]);
+ stp_string_list_add_string(description->bounds.str,
+ m->name, m->text); /* Do *not* want this translated, otherwise use gettext(m->text) */
+ }
+ description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name;
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "MagStripe1") == 0)
+ {
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "MagStripe2") == 0)
+ {
+ description->is_active = 1;
+ }
+ else if (strcmp(name, "MagStripe3") == 0)
+ {
+ description->is_active = 1;
+ }
+ else
+ {
+ return 0;
+ }
+ return 1;
+}
+
+static int magicard_parse_parameters(stp_vars_t *v)
+{
+ dyesub_privdata_t *pd = get_privdata(v);
+
+ const char *lpar = stp_get_string_parameter(v, "Laminate");
+ const char *lpar_dpx = stp_get_string_parameter(v, "LaminateDuplex");
+ const char *mag_coer = stp_get_string_parameter(v, "MagCoer");
+ const char *holokote = stp_get_string_parameter(v, "Holokote");
+ int holopatch = stp_get_int_parameter(v, "Holopatch");
+ const char *overcoat_hole = stp_get_string_parameter(v, "OvercoatHole");
+ const char *overcoat_hole_dpx = stp_get_string_parameter(v, "OvercoatHoleDuplex");
+ int holokote_custom = stp_get_boolean_parameter(v, "HolokoteCustom");
+ const char *blacktype = stp_get_string_parameter(v, "BlackType");
+ const stp_raw_t *magstripe1 = NULL;
+ const stp_raw_t *magstripe2 = NULL;
+ const stp_raw_t *magstripe3 = NULL;
+
+ if (overcoat_hole && !strcmp("None", overcoat_hole))
+ overcoat_hole = NULL;
+
+ /* If overcoat is off, we can't use holokote or holopatch */
+ if (lpar && strcmp("On", lpar)) {
+ if ((holokote && strcmp(holokote, "Off")) || holopatch || overcoat_hole || holokote_custom) {
+ stp_eprintf(v, _("Holokote, Holopatch, and Overcoat hole features require Overcoat to be enabled!\n"));
+ return 0;
+ }
}
- stp_put32_le(0x0100, v);
- stp_put32_le(0x00, v);
- /* Write the color curve data. */
- for (i = 0xff; i >= 0 ; i--) {
- unsigned long tmp;
- tmp = i | (i << 8) | (i << 16);
- stp_put32_le(tmp, v);
+ /* Sanity check magstripe */
+ if (stp_check_raw_parameter(v, "MagStripe1", STP_PARAMETER_ACTIVE)) {
+ magstripe1 = stp_get_raw_parameter(v, "MagStripe1");
+ if (magstripe1->bytes >= 79) {
+ stp_eprintf(v, _("StpMagStripe1 must be between 0 and 78 bytes!\n"));
+ return 0;
+ }
}
+ if (stp_check_raw_parameter(v, "MagStripe2", STP_PARAMETER_ACTIVE)) {
+ magstripe2 = stp_get_raw_parameter(v, "MagStripe2");
+ if (magstripe2->bytes >= 40) {
+ stp_eprintf(v, _("StpMagStripe2 must be between 0 and 39 bytes!\n"));
+ return 0;
+ }
+ }
+ if (stp_check_raw_parameter(v, "MagStripe3", STP_PARAMETER_ACTIVE)) {
+ magstripe1 = stp_get_raw_parameter(v, "MagStripe3");
+ if (magstripe1->bytes >= 107) {
+ stp_eprintf(v, _("StpMagStripe3 must be between 0 and 106 bytes!\n"));
+ return 0;
+ }
+ }
+
+ /* No need to set global params if there's no privdata yet */
+ if (!pd)
+ return 1;
+
+ pd->privdata.magicard.overcoat = lpar && !strcmp("On", lpar);
+ pd->privdata.magicard.overcoat_dpx = lpar_dpx && !strcmp("On", lpar_dpx);
+ pd->privdata.magicard.resin_k = blacktype && !strcmp("Resin",blacktype);
+ pd->privdata.magicard.reject = stp_get_boolean_parameter(v, "RejectBad");
+ pd->privdata.magicard.colorsure = stp_get_boolean_parameter(v, "ColorSure");
+ pd->privdata.magicard.gamma = stp_get_int_parameter(v, "GammaCurve");
+ pd->privdata.magicard.power_color = stp_get_int_parameter(v, "PowerColor") + 50;
+ pd->privdata.magicard.power_resin = stp_get_int_parameter(v, "PowerBlack") + 50;
+ pd->privdata.magicard.power_overcoat = stp_get_int_parameter(v, "PowerOC") + 50;
+ pd->privdata.magicard.align_start = stp_get_int_parameter(v, "AlignStart") + 50;
+ pd->privdata.magicard.align_end = stp_get_int_parameter(v, "AlignEnd") + 50;
+ pd->privdata.magicard.holopatch = holopatch;
+ pd->privdata.magicard.overcoat_hole = overcoat_hole;
+ pd->privdata.magicard.overcoat_hole_dpx = overcoat_hole_dpx;
+
+ pd->horiz_offset = stp_get_int_parameter(v, "CardOffset");
+
+ pd->privdata.magicard.holokote = 0;
+ if (holokote) {
+ if (!strcmp(holokote, "UltraSecure")) {
+ pd->privdata.magicard.holokote = 1;
+ } else if (!strcmp(holokote, "InterlockingRings")) {
+ pd->privdata.magicard.holokote = 2;
+ } else if (!strcmp(holokote, "Flex")) {
+ pd->privdata.magicard.holokote = 3;
+ }
+ }
+ pd->privdata.magicard.holokote_custom = holokote_custom;
+
+ pd->privdata.magicard.mag_coer = mag_coer && !strcmp("High", mag_coer);
+
+ if (magstripe1 && magstripe1->bytes) {
+ int i;
+ memcpy(pd->privdata.magicard.mag1, magstripe1->data, magstripe1->bytes);
+ pd->privdata.magicard.mag1[magstripe1->bytes] = 0;
+ for (i = 0 ; i < magstripe1->bytes ; i++) {
+ if (pd->privdata.magicard.mag1[i] < 0x20 ||
+ pd->privdata.magicard.mag1[i] > 0x5f) {
+ stp_eprintf(v, _("Illegal Alphanumeric in Magstripe, 0x20->0x5F ASCII only\n"));
+ return 0;
+ }
+ }
+ if (pd->privdata.magicard.mag1[0] != '%') {
+ stp_eprintf(v, _("Magstripe alphanumeric data must start with '%%'\n"));
+ return 0;
+ }
+ if (pd->privdata.magicard.mag1[magstripe1->bytes - 1] != '?') {
+ stp_eprintf(v, _("Magstripe string must end with '?'\n"));
+ return 0;
+ }
+ }
+ if (magstripe2 && magstripe2->bytes) {
+ int i;
+ memcpy(pd->privdata.magicard.mag2, magstripe2->data, magstripe2->bytes);
+ pd->privdata.magicard.mag2[magstripe2->bytes] = 0;
+ for (i = 0 ; i < magstripe2->bytes ; i++) {
+ if (pd->privdata.magicard.mag2[i] < 0x30 ||
+ pd->privdata.magicard.mag2[i] > 0x3f) {
+ stp_eprintf(v, _("Illegal Numeric in Magstripe, 0x30->0x3F ASCII only\n"));
+ return 0;
+ }
+ }
+ if (pd->privdata.magicard.mag2[0] != ';') {
+ stp_eprintf(v, _("Magstripe numeric data must start with ';'\n"));
+ return 0;
+ }
+ if (pd->privdata.magicard.mag2[magstripe2->bytes - 1] != '?') {
+ stp_eprintf(v, _("Magstripe data must end with '?'\n"));
+ return 0;
+ }
+ }
+ if (magstripe3 && magstripe3->bytes) {
+ int i;
+ memcpy(pd->privdata.magicard.mag3, magstripe3->data, magstripe3->bytes);
+ pd->privdata.magicard.mag3[magstripe3->bytes] = 0;
+ for (i = 0 ; i < magstripe3->bytes ; i++) {
+ if (pd->privdata.magicard.mag3[i] < 0x30 ||
+ pd->privdata.magicard.mag3[i] > 0x3f) {
+ stp_eprintf(v, _("Illegal Numeric in Magstripe, 0x30->0x3F ASCII only\n"));
+ return 0;
+ }
+ }
+ if (pd->privdata.magicard.mag3[0] != ';') {
+ stp_eprintf(v, _("Magstripe numeric data must start with ';'\n"));
+ return 0;
+ }
+ if (pd->privdata.magicard.mag3[magstripe3->bytes - 1] != '?') {
+ stp_eprintf(v, _("Magstripe data must end with '?'\n"));
+ return 0;
+ }
+ }
+ return 1;
}
/* Model capabilities */
@@ -6808,7 +7662,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
NULL, NULL,
&p10_block_init_func, NULL,
NULL,
- &p10_laminate_list, NULL,
+ &p10_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -6875,7 +7729,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
NULL, NULL,
&p440_block_init_func, &p440_block_end_func,
NULL,
- &p10_laminate_list, NULL,
+ &p10_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -6886,7 +7740,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&ps100_page_list,
&ps100_printsize_list,
1808,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&ps100_printer_init_func, &ps100_printer_end_func,
NULL, NULL,
NULL, NULL,
@@ -6904,7 +7758,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&cp10_printer_init_func, NULL,
&cpx00_plane_init_func, NULL,
NULL, NULL,
@@ -6922,7 +7776,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&cpx00_printer_init_func, NULL,
&cpx00_plane_init_func, NULL,
NULL, NULL,
@@ -6943,7 +7797,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&cpx00_printer_init_func, NULL,
&cpx00_plane_init_func, NULL,
NULL, NULL,
@@ -6961,7 +7815,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&es1_printer_init_func, NULL,
&es1_plane_init_func, NULL,
NULL, NULL,
@@ -6979,7 +7833,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&es2_printer_init_func, NULL,
&es2_plane_init_func, NULL,
NULL, NULL,
@@ -6997,7 +7851,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&es3_printer_init_func, &es3_printer_end_func,
&es2_plane_init_func, NULL,
NULL, NULL,
@@ -7015,7 +7869,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&es40_printer_init_func, &es3_printer_end_func,
&es2_plane_init_func, NULL,
NULL, NULL,
@@ -7033,7 +7887,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&cp790_printer_init_func, &es3_printer_end_func,
&es2_plane_init_func, NULL,
NULL, NULL,
@@ -7051,7 +7905,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&cpx00_printer_init_func, NULL,
&cpx00_plane_init_func, NULL,
NULL, NULL,
@@ -7069,7 +7923,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&cpx00_printer_init_func, &cp900_printer_end_func,
&cpx00_plane_init_func, NULL,
NULL, NULL,
@@ -7080,32 +7934,18 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
},
{ /* Canon CP820, CP910, CP1000, CP1200 */
1011,
-#ifdef CANONSELPHYNEO_CMY
&cmy_ink_list,
-#else
- &rgb_ink_list,
-#endif
&res_300dpi_list,
&cp910_page_list,
&cp910_printsize_list,
SHRT_MAX,
-#ifdef CANONSELPHYNEO_CMY
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE,
-#else
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
| DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_RGBtoYCBCR,
-#endif
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&cp910_printer_init_func, NULL,
NULL, NULL,
NULL, NULL,
-#ifdef CANONSELPHYNEO_CMY
cpx00_adjust_curves,
-#else
- NULL,
-#endif
NULL, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
@@ -7123,7 +7963,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
NULL, NULL,
NULL, NULL,
updp10_adjust_curves,
- &updp10_laminate_list, NULL,
+ &updp10_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7134,12 +7974,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&updr150_page_list,
&updr150_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&updr150_printer_init_func, &updr150_printer_end_func,
NULL, NULL,
NULL, NULL,
NULL,
- &updp10_laminate_list, NULL,
+ &updp10_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7156,7 +7996,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
NULL, NULL,
&dppex5_block_init, NULL,
NULL,
- &dppex5_laminate_list, NULL,
+ &dppex5_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7172,7 +8012,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
NULL, NULL,
NULL, NULL,
NULL,
- &updr100_laminate_list, NULL,
+ &updr100_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7183,12 +8023,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&updr200_page_list,
&updr200_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&updr200_printer_init_func, &updr150_printer_end_func,
NULL, NULL,
NULL, NULL,
NULL,
- &updr200_laminate_list, NULL,
+ &updr200_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7199,7 +8039,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&upcr10_page_list,
&upcr10_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&upcr10_printer_init_func, &upcr10_printer_end_func,
NULL, NULL,
NULL, NULL,
@@ -7282,12 +8122,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&kodak_6800_page_list,
&kodak_6800_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&kodak_68xx_printer_init, NULL,
NULL, NULL, /* No plane funcs */
NULL, NULL, /* No block funcs */
NULL,
- &kodak_6800_laminate_list, NULL,
+ &kodak_6800_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7298,12 +8138,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&kodak_6850_page_list,
&kodak_6850_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&kodak_68xx_printer_init, NULL,
NULL, NULL, /* No plane funcs */
NULL, NULL, /* No block funcs */
NULL,
- &kodak_6800_laminate_list, NULL,
+ &kodak_6800_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7314,12 +8154,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&kodak_605_page_list,
&kodak_605_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&kodak_605_printer_init, NULL,
NULL, NULL, /* No plane funcs */
NULL, NULL, /* No block funcs */
NULL,
- &kodak_605_laminate_list, NULL,
+ &kodak_605_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7332,12 +8172,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH
| DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_ROW_INTERLACE,
+ | DYESUB_FEATURE_ROW_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&kodak_1400_printer_init, NULL,
NULL, NULL,
NULL, NULL,
NULL,
- &kodak_6800_laminate_list, &kodak_1400_media_list,
+ &kodak_6800_overcoat_list, &kodak_1400_media_list,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7350,12 +8190,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH
| DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_ROW_INTERLACE,
+ | DYESUB_FEATURE_ROW_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&kodak_805_printer_init, NULL,
NULL, NULL, /* No plane funcs */
NULL, NULL, /* No block funcs */
NULL,
- &kodak_6800_laminate_list, NULL,
+ &kodak_6800_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7367,12 +8207,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&kodak_9810_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&kodak_9810_printer_init, &kodak_9810_printer_end,
&kodak_9810_plane_init, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &kodak_9810_laminate_list, NULL,
+ &kodak_9810_overcoat_list, NULL,
NULL, NULL,
kodak_9810_parameters,
kodak_9810_parameter_count,
@@ -7387,12 +8227,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&kodak_8810_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&kodak_8810_printer_init, NULL,
NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &kodak_8810_laminate_list, NULL,
+ &kodak_8810_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7404,12 +8244,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&kodak_7000_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&kodak_70xx_printer_init, NULL,
NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &kodak_7000_laminate_list, NULL,
+ &kodak_7000_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7421,12 +8261,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&kodak_7015_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&kodak_70xx_printer_init, NULL,
NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &kodak_7000_laminate_list, NULL,
+ &kodak_7000_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7437,12 +8277,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&kodak_8500_page_list,
&kodak_8500_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&kodak_8500_printer_init, &kodak_8500_printer_end,
NULL, NULL, /* No plane funcs */
NULL, NULL, /* No block funcs */
NULL,
- &kodak_8500_laminate_list, &kodak_8500_media_list,
+ &kodak_8500_overcoat_list, &kodak_8500_media_list,
NULL, NULL,
kodak_8500_parameters,
kodak_8500_parameter_count,
@@ -7457,7 +8297,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&mitsu_cp3020d_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cp3020d_printer_init, &mitsu_cp3020d_printer_end,
&mitsu_cp3020d_plane_init, &mitsu_cp3020d_plane_end,
NULL, NULL, /* No block funcs */
@@ -7474,7 +8314,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&mitsu_cp3020d_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cp3020da_printer_init, &mitsu_cp3020da_printer_end,
&mitsu_cp3020da_plane_init, NULL,
NULL, NULL, /* No block funcs */
@@ -7491,7 +8331,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&mitsu_cp9550_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cp9550_printer_init, &mitsu_cp9550_printer_end,
&mitsu_cp3020da_plane_init, NULL,
NULL, NULL, /* No block funcs */
@@ -7505,50 +8345,38 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
},
{ /* Mitsubishi CP9810D */
4104,
- &ymc_ink_list,
+ &bgr_ink_list,
&res_300dpi_list,
&mitsu_cp9810_page_list,
&mitsu_cp9810_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_12BPP
- | DYESUB_FEATURE_BIGENDIAN,
+ | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cp9810_printer_init, &mitsu_cp9810_printer_end,
- &mitsu_cp3020da_plane_init, NULL,
+ NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &mitsu_cp9810_laminate_list, NULL,
+ &mitsu_cp9810_overcoat_list, NULL,
NULL, NULL,
- mitsu9550_parameters,
- mitsu9550_parameter_count,
- mitsu9810_load_parameters,
- mitsu9810_parse_parameters,
+ mitsu98xx_parameters,
+ mitsu98xx_parameter_count,
+ mitsu98xx_load_parameters,
+ mitsu98xx_parse_parameters,
},
- { /* Mitsubishi CPD70D/CPD707D */
+ { /* Mitsubishi CPD70D */
4105,
-#ifdef MITSU70X_8BPP
&bgr_ink_list,
-#else
- &ymc_ink_list,
-#endif
&res_300dpi_list,
&mitsu_cpd70x_page_list,
&mitsu_cpd70x_printsize_list,
SHRT_MAX,
-#ifdef MITSU70X_8BPP
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_WHITE_BORDER | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cpd70x_printer_init, NULL,
-#else
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP
- | DYESUB_FEATURE_BIGENDIAN,
- &mitsu_cpd70x_printer_init, &mitsu_cpd70x_printer_end,
-#endif
- NULL, &mitsu_cpd70x_plane_end,
+ NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &mitsu_cpd70x_laminate_list, NULL,
- NULL, NULL,
+ &mitsu_cpd70x_overcoat_list, NULL,
+ mitsu_cpd70k60_job_start, NULL,
mitsu70x_parameters,
mitsu70x_parameter_count,
mitsu70x_load_parameters,
@@ -7556,29 +8384,18 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
},
{ /* Mitsubishi CPK60D */
4106,
-#ifdef MITSU70X_8BPP
&bgr_ink_list,
-#else
- &ymc_ink_list,
-#endif
&res_300dpi_list,
&mitsu_cpk60_page_list,
&mitsu_cpk60_printsize_list,
SHRT_MAX,
-#ifdef MITSU70X_8BPP
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cpk60_printer_init, NULL,
-#else
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP
- | DYESUB_FEATURE_BIGENDIAN,
- &mitsu_cpk60_printer_init, &mitsu_cpd70x_printer_end,
-#endif
- NULL, &mitsu_cpd70x_plane_end,
+ NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &mitsu_cpd70x_laminate_list, NULL,
- NULL, NULL,
+ &mitsu_cpd70x_overcoat_list, NULL,
+ mitsu_cpd70k60_job_start, NULL,
mitsu70x_parameters,
mitsu70x_parameter_count,
mitsu_k60_load_parameters,
@@ -7586,29 +8403,18 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
},
{ /* Mitsubishi CPD80D */
4107,
-#ifdef MITSU70X_8BPP
&bgr_ink_list,
-#else
- &ymc_ink_list,
-#endif
&res_300dpi_list,
&mitsu_cpd80_page_list,
&mitsu_cpd80_printsize_list,
SHRT_MAX,
-#ifdef MITSU70X_8BPP
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_WHITE_BORDER | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cpd70x_printer_init, NULL,
-#else
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP
- | DYESUB_FEATURE_BIGENDIAN,
- &mitsu_cpd70x_printer_init, &mitsu_cpd70x_printer_end,
-#endif
- NULL, &mitsu_cpd70x_plane_end,
+ NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &mitsu_cpd70x_laminate_list, NULL,
- NULL, NULL,
+ &mitsu_cpd70x_overcoat_list, NULL,
+ mitsu_cpd70k60_job_start, NULL,
mitsu70x_parameters,
mitsu70x_parameter_count,
mitsu70x_load_parameters,
@@ -7616,29 +8422,18 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
},
{ /* Kodak 305 */
4108,
-#ifdef MITSU70X_8BPP
&bgr_ink_list,
-#else
- &ymc_ink_list,
-#endif
&res_300dpi_list,
&kodak305_page_list,
&kodak305_printsize_list,
SHRT_MAX,
-#ifdef MITSU70X_8BPP
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES,
&kodak305_printer_init, NULL,
-#else
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP
- | DYESUB_FEATURE_BIGENDIAN,
- &kodak305_printer_init, &mitsu_cpd70x_printer_end,
-#endif
- NULL, &mitsu_cpd70x_plane_end,
+ NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &mitsu_cpd70x_laminate_list, NULL,
- NULL, NULL,
+ &mitsu_cpd70x_overcoat_list, NULL,
+ mitsu_cpd70k60_job_start, NULL,
mitsu70x_parameters,
mitsu70x_parameter_count,
mitsu_k60_load_parameters,
@@ -7651,13 +8446,13 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&mitsu_cpd90_page_list,
&mitsu_cpd90_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
- &mitsu_cpd90_printer_init, &mitsu_cpd90_printer_end,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
+ &mitsu_cpd90_printer_init, NULL,
NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- &mitsu_cpd70x_laminate_list, NULL,
- NULL, NULL,
+ &mitsu_cpd70x_overcoat_list, NULL,
+ NULL, mitsu_cpd90_job_end,
mitsu_d90_parameters,
mitsu_d90_parameter_count,
mitsu_d90_load_parameters,
@@ -7671,7 +8466,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&mitsu_cp9600_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cp9600_printer_init, &mitsu_cp9600_printer_end,
&mitsu_cp3020da_plane_init, NULL,
NULL, NULL, /* No block funcs */
@@ -7688,7 +8483,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&mitsu_cp9550s_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cp9550_printer_init, &mitsu_cp9550s_printer_end,
&mitsu_cp3020da_plane_init, NULL,
NULL, NULL, /* No block funcs */
@@ -7702,29 +8497,18 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
},
{ /* Fujifilm ASK-300 */
4112,
-#ifdef MITSU70X_8BPP
&bgr_ink_list,
-#else
- &ymc_ink_list,
-#endif
&res_300dpi_list,
&fuji_ask300_page_list,
&fuji_ask300_printsize_list,
SHRT_MAX,
-#ifdef MITSU70X_8BPP
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_WHITE_BORDER | DYESUB_FEATURE_NATIVECOPIES,
&fuji_ask300_printer_init, NULL,
-#else
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_16BPP
- | DYESUB_FEATURE_BIGENDIAN,
- &fuji_ask300_printer_init, &mitsu_cpd70x_printer_end,
-#endif
- NULL, &mitsu_cpd70x_plane_end,
+ NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
- NULL, NULL,
- NULL, NULL,
+ &mitsu_cpd70x_overcoat_list, NULL,
+ mitsu_cpd70k60_job_start, NULL,
mitsu70x_parameters,
mitsu70x_parameter_count,
mitsu_k60_load_parameters,
@@ -7732,24 +8516,23 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
},
{ /* Mitsubishi CP9800D */
4113,
- &ymc_ink_list,
+ &bgr_ink_list,
&res_300dpi_list,
&mitsu_cp9810_page_list,
&mitsu_cp9810_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_12BPP
- | DYESUB_FEATURE_BIGENDIAN,
+ | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cp9800_printer_init, &mitsu_cp9810_printer_end,
- &mitsu_cp3020da_plane_init, NULL,
+ NULL, NULL,
NULL, NULL, /* No block funcs */
NULL,
NULL, NULL,
NULL, NULL,
- mitsu9550_parameters,
- mitsu9550_parameter_count,
- mitsu9810_load_parameters,
- mitsu9810_parse_parameters,
+ mitsu98xx_parameters,
+ mitsu98xx_parameter_count,
+ mitsu98xx_load_parameters,
+ mitsu98xx_parse_parameters,
},
{ /* Mitsubishi P95D/DW */
4114,
@@ -7759,7 +8542,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&mitsu_p95d_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_MONOCHROME,
+ | DYESUB_FEATURE_MONOCHROME | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_p95d_printer_init, &mitsu_p95d_printer_end,
&mitsu_p95d_plane_start, NULL,
NULL, NULL, /* No block funcs */
@@ -7779,7 +8562,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&mitsu_cp9500_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_PLANE_INTERLACE,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_cp9500_printer_init, &mitsu_cp9500_printer_end,
&mitsu_cp3020da_plane_init, NULL,
NULL, NULL, /* No block funcs */
@@ -7799,7 +8582,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&mitsu_p95d_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
- | DYESUB_FEATURE_MONOCHROME,
+ | DYESUB_FEATURE_MONOCHROME | DYESUB_FEATURE_NATIVECOPIES,
&mitsu_p93d_printer_init, &mitsu_p95d_printer_end,
&mitsu_p95d_plane_start, NULL,
NULL, NULL, /* No block funcs */
@@ -7811,6 +8594,57 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
mitsu_p93d_load_parameters,
mitsu_p93d_parse_parameters,
},
+ { /* Mitsubishi CPD707D */
+ 4117,
+ &bgr_ink_list,
+ &res_300dpi_list,
+ &mitsu_cpd70x_page_list,
+ &mitsu_cpd70x_printsize_list,
+ SHRT_MAX,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_WHITE_BORDER | DYESUB_FEATURE_NATIVECOPIES,
+ &mitsu_cpd70x_printer_init, NULL,
+ NULL, NULL,
+ NULL, NULL, /* No block funcs */
+ NULL,
+ &mitsu_cpd70x_overcoat_list, NULL,
+ mitsu_cpd70k60_job_start, NULL,
+ mitsu707_parameters,
+ mitsu707_parameter_count,
+ mitsu707_load_parameters,
+ mitsu70x_parse_parameters,
+ },
+ { /* Fujifilm ASK-2000/2500 */
+ 4200,
+ &bgr_ink_list,
+ &res_300dpi_list,
+ &fuji_ask2000_page_list,
+ &fuji_ask2000_printsize_list,
+ SHRT_MAX,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
+ &fuji_ask2000_printer_init, &fuji_ask2000_printer_end,
+ NULL, NULL,
+ NULL, NULL, /* No block funcs */
+ NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, 0, NULL, NULL,
+ },
+ { /* Fujifilm ASK-4000 */
+ 4201,
+ &bgr_ink_list,
+ &res_300dpi_list,
+ &fuji_ask4000_page_list,
+ &fuji_ask4000_printsize_list,
+ SHRT_MAX,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
+ &fuji_ask4000_printer_init, &fuji_ask4000_printer_end,
+ NULL, NULL,
+ NULL, NULL, /* No block funcs */
+ NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, 0, NULL, NULL,
+ },
{ /* Shinko CHC-S9045 (experimental) */
5000,
&rgb_ink_list,
@@ -7834,12 +8668,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&shinko_chcs2145_page_list,
&shinko_chcs2145_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&shinko_chcs2145_printer_init, &shinko_chcs2145_printer_end,
NULL, NULL, /* No planes */
NULL, NULL, /* No blocks */
NULL,
- &shinko_chcs2145_laminate_list, NULL,
+ &shinko_chcs2145_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7850,12 +8684,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&shinko_chcs1245_page_list,
&shinko_chcs1245_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&shinko_chcs1245_printer_init, &shinko_chcs2145_printer_end,
NULL, NULL, /* No planes */
NULL, NULL, /* No blocks */
NULL,
- &shinko_chcs1245_laminate_list, NULL,
+ &shinko_chcs1245_overcoat_list, NULL,
NULL, NULL,
shinko_chcs1245_parameters,
shinko_chcs1245_parameter_count,
@@ -7869,12 +8703,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&shinko_chcs6245_page_list,
&shinko_chcs6245_printsize_list,
SHRT_MAX,
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&shinko_chcs6245_printer_init, &shinko_chcs2145_printer_end,
NULL, NULL, /* No planes */
NULL, NULL, /* No blocks */
NULL,
- &shinko_chcs6245_laminate_list, NULL,
+ &shinko_chcs6245_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7892,12 +8726,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
#ifdef S6145_YMC
DYESUB_FEATURE_PLANE_INTERLACE |
#endif
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&shinko_chcs6145_printer_init, &shinko_chcs2145_printer_end,
NULL, NULL, /* No planes */
NULL, NULL, /* No blocks */
NULL,
- &shinko_chcs6145_laminate_list, NULL,
+ &shinko_chcs6145_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7915,12 +8749,12 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
#ifdef S6145_YMC
DYESUB_FEATURE_PLANE_INTERLACE |
#endif
- DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_NATIVECOPIES,
&shinko_chcs6145_printer_init, &shinko_chcs2145_printer_end,
NULL, NULL, /* No planes */
NULL, NULL, /* No blocks */
NULL,
- &shinko_chcs6145_laminate_list, NULL,
+ &shinko_chcs6145_overcoat_list, NULL,
NULL, NULL,
NULL, 0, NULL, NULL,
},
@@ -7932,14 +8766,17 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&dnpds40_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES,
&dnpds40_printer_start, &dnpds40_printer_end,
&dnpds40_plane_init, NULL,
NULL, NULL,
NULL,
- &dnpds40_laminate_list, NULL,
+ &dnpds40_overcoat_list, NULL,
NULL, NULL,
- NULL, 0, NULL, NULL,
+ ds40_parameters,
+ ds40_parameter_count,
+ ds40_load_parameters,
+ ds40_parse_parameters,
},
{ /* Dai Nippon Printing DS80 */
6001,
@@ -7949,14 +8786,17 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&dnpds80_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES,
&dnpds80_printer_start, &dnpds40_printer_end,
&dnpds40_plane_init, NULL,
NULL, NULL,
NULL,
- &dnpds40_laminate_list, NULL,
+ &dnpds40_overcoat_list, NULL,
NULL, NULL,
- NULL, 0, NULL, dnpds80_parse_parameters,
+ ds40_parameters,
+ ds40_parameter_count,
+ ds40_load_parameters,
+ dnpds80_parse_parameters,
},
{ /* Dai Nippon Printing DSRX1 */
6002,
@@ -7966,14 +8806,17 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&dnpsrx1_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES,
&dnpdsrx1_printer_start, &dnpds40_printer_end,
&dnpds40_plane_init, NULL,
NULL, NULL,
NULL,
- &dnpds40_laminate_list, NULL,
+ &dnpds40_overcoat_list, NULL,
NULL, NULL,
- NULL, 0, NULL, NULL,
+ ds40_parameters,
+ ds40_parameter_count,
+ ds40_load_parameters,
+ ds40_parse_parameters,
},
{ /* Dai Nippon Printing DS620 */
6003,
@@ -7983,14 +8826,17 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&dnpds620_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES,
&dnpds620_printer_start, &dnpds40_printer_end,
&dnpds40_plane_init, NULL,
NULL, NULL,
NULL,
- &dnpds620_laminate_list, NULL,
+ &dnpds620_overcoat_list, NULL,
NULL, NULL,
- NULL, 0, NULL, NULL,
+ ds40_parameters,
+ ds40_parameter_count,
+ ds40_load_parameters,
+ ds40_parse_parameters,
},
{ /* Citizen CW-01 */
6005,
@@ -8000,9 +8846,9 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&citizen_cw01_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
- &citizen_cw01_printer_start, NULL,
- &citizen_cw01_plane_init, NULL,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES,
+ &citizen_cw01_printer_start, &dnpds40_printer_end,
+ &dnpds40_plane_init, NULL,
NULL, NULL,
NULL,
NULL, NULL,
@@ -8017,14 +8863,17 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&dnpds80dx_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_DUPLEX,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_DUPLEX | DYESUB_FEATURE_NATIVECOPIES,
&dnpds80_printer_start, &dnpds40_printer_end,
&dnpds40_plane_init, NULL,
NULL, NULL,
NULL,
- &dnpds40_laminate_list, &dnpds80dx_media_list,
+ &dnpds40_overcoat_list, &dnpds80dx_media_list,
NULL, NULL,
- NULL, 0, NULL, dnpds80dx_parse_parameters,
+ ds40_parameters,
+ ds40_parameter_count,
+ ds40_load_parameters,
+ dnpds80dx_parse_parameters,
},
{ /* Dai Nippon Printing DS820 */
6007,
@@ -8034,18 +8883,58 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
&dnpds820_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
- | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT,
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_PLANE_LEFTTORIGHT | DYESUB_FEATURE_NATIVECOPIES ,
&dnpds820_printer_start, &dnpds40_printer_end,
&dnpds40_plane_init, NULL,
NULL, NULL,
NULL,
- &dnpds620_laminate_list, NULL,
+ &dnpds620_overcoat_list, NULL,
NULL, NULL,
ds820_parameters,
ds820_parameter_count,
ds820_load_parameters,
ds820_parse_parameters,
},
+ { /* Magicard Series w/ Duplex */
+ 7000,
+ &ymc_ink_list,
+ &res_300dpi_list,
+ &magicard_page_list,
+ &magicard_printsize_list,
+ SHRT_MAX,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_DUPLEX | DYESUB_FEATURE_NATIVECOPIES,
+ &magicard_printer_init, &magicard_printer_end,
+ NULL, magicard_plane_end,
+ NULL, NULL,
+ NULL,
+ &magicard_overcoat_list, NULL,
+ NULL, NULL,
+ magicard_parameters,
+ magicard_parameter_count,
+ magicard_load_parameters,
+ magicard_parse_parameters,
+ },
+ { /* Magicard Series w/o Duplex */
+ 7001,
+ &ymc_ink_list,
+ &res_300dpi_list,
+ &magicard_page_list,
+ &magicard_printsize_list,
+ SHRT_MAX,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT | DYESUB_FEATURE_WHITE_BORDER
+ | DYESUB_FEATURE_PLANE_INTERLACE | DYESUB_FEATURE_NATIVECOPIES,
+ &magicard_printer_init, &magicard_printer_end,
+ NULL, magicard_plane_end,
+ NULL, NULL,
+ NULL,
+ &magicard_overcoat_list, NULL,
+ NULL, NULL,
+ magicard_parameters,
+ magicard_parameter_count,
+ magicard_load_parameters,
+ magicard_parse_parameters,
+ },
};
static const stp_parameter_t the_parameters[] =
@@ -8080,13 +8969,16 @@ static const stp_parameter_t the_parameters[] =
STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0
},
- {
- /* TRANSLATORS: Some dye sublimation printers are able to achieve */
- /* better durability of output by covering it with transparent */
- /* laminate surface. This surface can be of different patterns: */
- /* common are matte, glossy or texture. */
- "Laminate", N_("Laminate Pattern"), "Color=No,Category=Advanced Printer Setup",
- N_("Laminate Pattern"),
+ { /* TRANSLATORS: Some dye sublimation printers are able to achieve
+ better durability of output by covering it with transparent
+ overcoat surface. This surface can be of different patterns:
+ common are matte, glossy or texture.
+
+ This is called "Laminate" instead of "Overcoat" for backwards
+ compatibility reasons.
+ */
+ "Laminate", N_("Overcoat Pattern"), "Color=No,Category=Advanced Printer Setup",
+ N_("Overcoat Pattern"),
STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
STP_PARAMETER_LEVEL_BASIC, 1, 0, STP_CHANNEL_NONE, 1, 0
},
@@ -8112,7 +9004,7 @@ static const stp_parameter_t the_parameters[] =
"NativeCopies", N_("Printer Generates Copies Natively"), "Color=No,Category=Job Mode",
N_("Printer Generates Copies"),
STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
- STP_PARAMETER_LEVEL_INTERNAL, 0, 0, STP_CHANNEL_NONE, 0, 1
+ STP_PARAMETER_LEVEL_INTERNAL, 1, 0, STP_CHANNEL_NONE, 0, 1
},
};
@@ -8181,7 +9073,7 @@ static const stp_param_string_t duplex_types[] =
};
#define NUM_DUPLEX (sizeof (duplex_types) / sizeof (stp_param_string_t))
-static const dyesub_cap_t* dyesub_get_model_capabilities(int model)
+static const dyesub_cap_t* dyesub_get_model_capabilities(const stp_vars_t *v, int model)
{
int i;
int models = sizeof(dyesub_model_capabilities) / sizeof(dyesub_cap_t);
@@ -8191,18 +9083,18 @@ static const dyesub_cap_t* dyesub_get_model_capabilities(int model)
if (dyesub_model_capabilities[i].model == model)
return &(dyesub_model_capabilities[i]);
}
- stp_deprintf(STP_DBG_DYESUB,
+ stp_dprintf(STP_DBG_DYESUB, v,
"dyesub: model %d not found in capabilities list.\n", model);
return &(dyesub_model_capabilities[0]);
}
-static const laminate_t* dyesub_get_laminate_pattern(stp_vars_t *v)
+static const overcoat_t* dyesub_get_overcoat_pattern(stp_vars_t *v)
{
const char *lpar = stp_get_string_parameter(v, "Laminate");
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
- const laminate_list_t *llist = caps->laminate;
- const laminate_t *l = NULL;
+ const overcoat_list_t *llist = caps->overcoat;
+ const overcoat_t *l = NULL;
int i;
for (i = 0; i < llist->n_items; i++)
@@ -8217,7 +9109,7 @@ static const laminate_t* dyesub_get_laminate_pattern(stp_vars_t *v)
static const dyesub_media_t* dyesub_get_mediatype(stp_vars_t *v)
{
const char *mpar = stp_get_string_parameter(v, "MediaType");
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
const dyesub_media_list_t *mlist = caps->media;
const dyesub_media_t *m = NULL;
@@ -8240,7 +9132,7 @@ dyesub_printsize(const stp_vars_t *v,
int i;
const char *page = stp_get_string_parameter(v, "PageSize");
const char *resolution = stp_get_string_parameter(v, "Resolution");
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
const dyesub_printsize_list_t *p = caps->printsize;
@@ -8254,7 +9146,7 @@ dyesub_printsize(const stp_vars_t *v,
return;
}
}
- stp_erprintf("dyesub_printsize: printsize not found (%s, %s)\n",
+ stp_eprintf(v, "dyesub_printsize: printsize not found (%s, %s)\n",
page, resolution);
}
@@ -8267,7 +9159,7 @@ dyesub_feature(const dyesub_cap_t *caps, int feature)
static stp_parameter_list_t
dyesub_list_parameters(const stp_vars_t *v)
{
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(stp_get_model_id(v));
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v, stp_get_model_id(v));
stp_parameter_list_t *ret = stp_parameter_list_create();
int i;
@@ -8288,7 +9180,7 @@ dyesub_parameters(const stp_vars_t *v, const char *name,
stp_parameter_t *description)
{
int i;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
description->p_type = STP_PARAMETER_TYPE_INVALID;
@@ -8322,20 +9214,19 @@ dyesub_parameters(const stp_vars_t *v, const char *name,
{
int default_specified = 0;
const dyesub_pagesize_list_t *p = caps->pages;
- const char* text;
description->bounds.str = stp_string_list_create();
+
+ /* Walk the list of pagesizes for the printer */
for (i = 0; i < p->n_items; i++)
{
- const stp_papersize_t *pt = stp_get_papersize_by_name(
- p->item[i].name);
-
- text = (p->item[i].text ? p->item[i].text : pt->text);
stp_string_list_add_string(description->bounds.str,
- p->item[i].name, gettext(text));
- if (! default_specified && pt && pt->width > 0 && pt->height > 0)
+ p->item[i].psize.name,
+ gettext(p->item[i].psize.text));
+ if (! default_specified &&
+ p->item[i].psize.width > 0 && p->item[i].psize.height > 0)
{
- description->deflt.str = p->item[i].name;
+ description->deflt.str = p->item[i].psize.name;
default_specified = 1;
}
}
@@ -8393,13 +9284,13 @@ dyesub_parameters(const stp_vars_t *v, const char *name,
else if (strcmp(name, "Laminate") == 0)
{
description->bounds.str = stp_string_list_create();
- if (caps->laminate)
+ if (caps->overcoat)
{
- const laminate_list_t *llist = caps->laminate;
+ const overcoat_list_t *llist = caps->overcoat;
for (i = 0; i < llist->n_items; i++)
{
- const laminate_t *l = &(llist->item[i]);
+ const overcoat_t *l = &(llist->item[i]);
stp_string_list_add_string(description->bounds.str,
l->name, gettext(l->text));
}
@@ -8457,41 +9348,63 @@ dyesub_parameters(const stp_vars_t *v, const char *name,
else
description->is_active = 0;
}
+ else if (strcmp(name, "NativeCopies") == 0)
+ {
+ description->deflt.boolean = dyesub_feature(caps, DYESUB_FEATURE_NATIVECOPIES);
+ description->is_active = 1;
+ }
else
description->is_active = 0;
}
static const dyesub_pagesize_t*
-dyesub_current_pagesize(const stp_vars_t *v)
+dyesub_get_pagesize(const stp_vars_t *v, const char *page)
{
- const char *page = stp_get_string_parameter(v, "PageSize");
- const stp_papersize_t *pt = stp_get_papersize_by_name(page);
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
const dyesub_pagesize_list_t *p = caps->pages;
int i;
+ if (page == NULL)
+ return NULL;
for (i = 0; i < p->n_items; i++)
{
- if (strcmp(p->item[i].name,pt->name) == 0)
+ if (strcmp(p->item[i].psize.name,page) == 0)
return &(p->item[i]);
}
return NULL;
}
+static const dyesub_pagesize_t*
+dyesub_current_pagesize(const stp_vars_t *v)
+{
+ const char *page = stp_get_string_parameter(v, "PageSize");
+ return dyesub_get_pagesize(v, page);
+}
+
+static const stp_papersize_t *
+dyesub_describe_papersize(const stp_vars_t *v, const char *name)
+{
+ const dyesub_pagesize_t *pagesize = dyesub_get_pagesize(v, name);
+ if (pagesize)
+ return &(pagesize->psize);
+ else
+ return NULL;
+}
+
static void
dyesub_media_size(const stp_vars_t *v,
stp_dimension_t *width,
stp_dimension_t *height)
{
- const dyesub_pagesize_t *p = dyesub_current_pagesize(v);
+ const dyesub_pagesize_t *pt = dyesub_current_pagesize(v);
stp_default_media_size(v, width, height);
- if (p && p->width_pt > 0)
- *width = p->width_pt;
- if (p && p->height_pt > 0)
- *height = p->height_pt;
+ if (pt && pt->psize.width > 0)
+ *width = pt->psize.width;
+ if (pt && pt->psize.height > 0)
+ *height = pt->psize.height;
}
static void
@@ -8504,15 +9417,15 @@ dyesub_imageable_area_internal(const stp_vars_t *v,
int *print_mode)
{
stp_dimension_t width, height;
- const dyesub_pagesize_t *p = dyesub_current_pagesize(v);
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_pagesize_t *pt = dyesub_current_pagesize(v);
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
dyesub_media_size(v, &width, &height);
if (use_maximum_area
|| (dyesub_feature(caps, DYESUB_FEATURE_BORDERLESS) &&
stp_get_boolean_parameter(v, "Borderless"))
- || !p)
+ || !pt)
{
*left = 0;
*top = 0;
@@ -8521,13 +9434,13 @@ dyesub_imageable_area_internal(const stp_vars_t *v,
}
else
{
- *left = p->border_pt_left;
- *top = p->border_pt_top;
- *right = width - p->border_pt_right;
- *bottom = height - p->border_pt_bottom;
+ *left = pt->psize.left;
+ *top = pt->psize.top;
+ *right = width - pt->psize.right;
+ *bottom = height - pt->psize.bottom;
}
- if (p)
- *print_mode = p->print_mode;
+ if (pt)
+ *print_mode = pt->print_mode;
else
*print_mode = DYESUB_PORTRAIT;
}
@@ -8552,7 +9465,7 @@ dyesub_maximum_imageable_area(const stp_vars_t *v,
{
int not_used;
const int model = stp_get_model_id(v);
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(model);
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v, model);
/* For printers that report FEATURE_WHITE_BORDER, we need to
respect the margins they define as that's the printable area.
@@ -8581,7 +9494,7 @@ dyesub_describe_resolution(const stp_vars_t *v,
stp_resolution_t *x, stp_resolution_t *y)
{
const char *resolution = stp_get_string_parameter(v, "Resolution");
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
const dyesub_resolution_list_t *r = caps->resolution;
int i;
@@ -8607,7 +9520,7 @@ static const char *
dyesub_describe_output_internal(const stp_vars_t *v, dyesub_print_vars_t *pv)
{
const char *ink_type = stp_get_string_parameter(v, "InkType");
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v,
stp_get_model_id(v));
const char *output_type;
int i;
@@ -8673,14 +9586,6 @@ dyesub_swap_ints(int *a, int *b)
}
static void
-dyesub_swap_doubles(double *a, double *b)
-{
- double t = *a;
- *a = *b;
- *b = t;
-}
-
-static void
dyesub_adjust_curve(stp_vars_t *v,
const char *color_adj,
const char *color_curve)
@@ -8704,7 +9609,7 @@ dyesub_exec(stp_vars_t *v,
{
if (func)
{
- stp_deprintf(STP_DBG_DYESUB, "dyesub: %s\n", debug_string);
+ stp_dprintf(STP_DBG_DYESUB, v, "dyesub: %s\n", debug_string);
(*func)(v);
}
}
@@ -8716,18 +9621,31 @@ dyesub_exec_check(stp_vars_t *v,
{
if (func)
{
- stp_deprintf(STP_DBG_DYESUB, "dyesub: %s\n", debug_string);
+ stp_dprintf(STP_DBG_DYESUB, v, "dyesub: %s\n", debug_string);
return (*func)(v);
}
return 1;
}
-/* FIXME: This function is badly named. It actually picks the best single
- "point" on the original image to use for the desired output pixel. */
-static double
-dyesub_interpolate(int oldval, int oldsize, int newsize)
+/* XXX FIXME: This is "point" interpolation. Be smarter!
+ eg: Average (average all pixels that touch this one)
+ BiLinear (scale based on linear interpolation)
+ BiCubic (scale based on weighted average, based on proximity)
+ Lanczos (awesome!! but slow)
+*/
+static int
+dyesub_interpolate(int point, int olddim, int newdim)
{
- return ((double)oldval * (double)newsize / (double)oldsize);
+#if 0
+ /* Perform arithematic rounding. Is there a point? */
+ int result = ((point * 2 * newdim / olddim) + 1) / 2;
+ if (result >= newdim)
+ result--;
+#else
+ int result = (point * newdim / olddim);
+#endif
+
+ return result;
}
static void
@@ -8765,7 +9683,7 @@ dyesub_read_image(stp_vars_t *v,
{
if (stp_color_get_row(v, image, i, &zero_mask))
{
- stp_deprintf(STP_DBG_DYESUB,
+ stp_dprintf(STP_DBG_DYESUB, v,
"dyesub_read_image: "
"stp_color_get_row(..., %d, ...) == 0\n", i);
dyesub_free_image(pv, image);
@@ -8775,7 +9693,7 @@ dyesub_read_image(stp_vars_t *v,
pv->image_rows = i+1;
if (!image_data[i])
{
- stp_deprintf(STP_DBG_DYESUB,
+ stp_dprintf(STP_DBG_DYESUB, v,
"dyesub_read_image: "
"(image_data[%d] = stp_malloc()) == NULL\n", i);
dyesub_free_image(pv, image);
@@ -8787,125 +9705,84 @@ dyesub_read_image(stp_vars_t *v,
}
static void
-dyesub_render_pixel(unsigned short *src, char *dest,
- dyesub_print_vars_t *pv,
- const dyesub_cap_t *caps,
- int plane)
+dyesub_render_pixel_u8(unsigned short *src, char *dest,
+ dyesub_print_vars_t *pv,
+ int plane)
{
- unsigned short ink[MAX_INK_CHANNELS]; /* What is sent to printer */
+ /* Scale down to output bit depth */
+#if 0
+ *dest = src[plane] >> 8; // XXX does this make more sense than division?
+#else
+ *dest = src[plane] / 257;
+#endif
+}
+static void
+dyesub_render_pixel_packed_u8(unsigned short *src, char *dest,
+ dyesub_print_vars_t *pv)
+{
int i;
- int start, end;
- /* Only compute one color at a time */
- if (pv->plane_interlacing || pv->row_interlacing)
- {
- start = plane;
- end = plane + 1;
- }
- else
+ /* copy out_channel (image) to equiv ink_channel (printer) */
+ for (i = 0; i < pv->ink_channels; i++)
{
- start = 0;
- end = pv->ink_channels;
+ dyesub_render_pixel_u8(src, dest + i, pv, pv->ink_order[i]-1);
}
+}
- /* copy out_channel (image) to equiv ink_channel (printer) */
- for (i = start; i < end; i++)
- {
-#ifndef CANONSELPHYNEO_CMY
- if (dyesub_feature(caps, DYESUB_FEATURE_RGBtoYCBCR))
- {
- /* Convert RGB -> YCbCr (JPEG YCbCr444 coefficients) */
- double R, G, B;
- R = src[0];
- G = src[1];
- B = src[2];
-
- if (i == 0) /* Y */
- ink[i] = R * 0.299 + G * 0.587 + B * 0.114;
- else if (i == 1) /* Cb */
- ink[i] = R * -0.168736 + G * -0.331264 + B * 0.5 + (1 << (16 -1)); // Math is 16bpp here.
- else if (i == 2) /* Cr */
- ink[i] = R * 0.5 + G * -0.418688 + B * -0.081312 + (1 << (16 -1)); // Math is 16bpp here.
- /* FIXME: Natively support YCbCr "inks" in the
- Gutenprint core and allow that as an input
- into the dyesub driver. */
- }
- else
-#endif
- {
- ink[i] = src[i];
- }
+static void
+dyesub_render_row_packed_u8(stp_vars_t *v,
+ dyesub_print_vars_t *pv,
+ const dyesub_cap_t *caps,
+ int in_row,
+ char *dest,
+ int bytes_per_pixel)
+{
+ int w;
+ unsigned short *src;
- /* Downscale 16bpp to output bpp */
- if (pv->bytes_per_ink_channel == 1)
- {
- unsigned char *ink_u8 = (unsigned char *) ink;
-#ifndef CANONSELPHYNEO_CMY
-#if 0
- /* FIXME: Do we want to round? */
- if (dyesub_feature(caps, DYESUB_FEATURE_RGBtoYCBCR))
- ink_u8[i] = ink[i] >> 8;
- else
-#endif
-#endif
- ink_u8[i] = ink[i] / 257;
+ for (w = 0; w < pv->outw_px; w++)
+ {
+ int row = in_row;
+ int col = dyesub_interpolate(w, pv->outw_px, pv->imgw_px);
+ if (pv->plane_lefttoright)
+ col = pv->imgw_px - col - 1;
+ if (pv->print_mode == DYESUB_LANDSCAPE)
+ { /* "rotate" image */
+ dyesub_swap_ints(&col, &row);
+ row = (pv->imgw_px - 1) - row;
}
- else /* ie 2 bytes per channel */
- {
- /* Scale down to output bits */
- if (pv->bits_per_ink_channel != 16)
- ink[i] = ink[i] >> (16 - pv->bits_per_ink_channel);
+ src = &(pv->image_data[row][col * pv->out_channels]);
- /* Byteswap if needed */
- if (pv->byteswap)
- ink[i] = ((ink[i] >> 8) & 0xff) | ((ink[i] & 0xff) << 8);
- }
+ dyesub_render_pixel_packed_u8(src, dest + w*bytes_per_pixel, pv);
}
-
- /* If we use plane or row interlacing, only write the plane's channel */
- if (pv->plane_interlacing || pv->row_interlacing)
- memcpy(dest, (char *) ink + (plane * pv->bytes_per_ink_channel),
- pv->bytes_per_ink_channel);
- else /* Otherwise, print the full set of inks, in order (eg RGB or BGR) */
- for (i = 0; i < pv->ink_channels; i++)
- memcpy(dest + i*pv->bytes_per_ink_channel,
- (char *) ink + (pv->bytes_per_ink_channel * (pv->ink_order[i]-1)),
- pv->bytes_per_ink_channel);
}
static void
-dyesub_render_row(stp_vars_t *v,
- dyesub_print_vars_t *pv,
- const dyesub_cap_t *caps,
- double in_row,
- char *dest,
- int bytes_per_pixel,
- int plane)
+dyesub_render_row_interlaced_u8(stp_vars_t *v,
+ dyesub_print_vars_t *pv,
+ const dyesub_cap_t *caps,
+ int in_row,
+ char *dest,
+ int plane)
{
int w;
unsigned short *src;
for (w = 0; w < pv->outw_px; w++)
{
- double row = in_row;
- double col = dyesub_interpolate(w, pv->outw_px, pv->imgw_px);
+ int row = in_row;
+ int col = dyesub_interpolate(w, pv->outw_px, pv->imgw_px);
if (pv->plane_lefttoright)
col = pv->imgw_px - col - 1;
if (pv->print_mode == DYESUB_LANDSCAPE)
{ /* "rotate" image */
- dyesub_swap_doubles(&col, &row);
+ dyesub_swap_ints(&col, &row);
row = (pv->imgw_px - 1) - row;
}
- // XXX FIXME: This is "point" interpolation. Be smarter!
- // eg: Average (average all pixels that touch this one)
- // BiLinear (scale based on linear interpolation)
- // BiCubic (scale based on weighted average, based on proximity)
- // Lanczos (awesome!! but slow)
- src = &(pv->image_data[(int)row][(int)col * pv->out_channels]);
+ src = &(pv->image_data[row][col * pv->out_channels]);
- dyesub_render_pixel(src, dest + w*bytes_per_pixel,
- pv, caps, plane);
+ dyesub_render_pixel_u8(src, dest + w, pv, plane);
}
}
@@ -8917,8 +9794,7 @@ dyesub_print_plane(stp_vars_t *v,
int plane)
{
int h;
- int bpp = ((pv->plane_interlacing || pv->row_interlacing) ? 1 : pv->ink_channels)
- * pv->bytes_per_ink_channel;
+ int bpp = ((pv->plane_interlacing || pv->row_interlacing) ? 1 : pv->ink_channels);
size_t rowlen = pv->prnw_px * bpp;
char *destrow = stp_malloc(rowlen); /* Allocate a buffer for the rendered rows */
if (!destrow)
@@ -8927,7 +9803,6 @@ dyesub_print_plane(stp_vars_t *v,
/* Pre-Fill in the blank bits of the row. */
if (dyesub_feature(caps, DYESUB_FEATURE_FULL_WIDTH))
{
- /* FIXME: This is broken for bpp != 1 and packed data -- but no such models exist. */
/* empty part left of image area */
if (pv->outl_px > 0)
{
@@ -8945,7 +9820,6 @@ dyesub_print_plane(stp_vars_t *v,
for (h = 0; h <= pv->prnb_px - pv->prnt_px; h++)
{
int p = pv->row_interlacing ? 0 : plane;
- double row;
do {
@@ -8964,18 +9838,24 @@ dyesub_print_plane(stp_vars_t *v,
if (h + pv->prnt_px < pv->outt_px || h + pv->prnt_px >= pv->outb_px)
{ /* empty part above or below image area */
memset(destrow, pv->empty_byte[plane], rowlen);
- /* FIXME: This is also broken for bpp != 1 and packed data */
- /* FIXME: Also this is inefficient; it won't change once generated.. */
+ /* FIXME: This is inefficient; it won't change once generated.. */
}
else
{
- row = dyesub_interpolate(h + pv->prnt_px - pv->outt_px,
- pv->outh_px, pv->imgh_px);
+ int srcrow = dyesub_interpolate(h + pv->prnt_px - pv->outt_px,
+ pv->outh_px, pv->imgh_px);
- stp_deprintf(STP_DBG_DYESUB,
- "dyesub_print_plane: h = %d, row = %f\n", h, row);
+ stp_dprintf(STP_DBG_DYESUB, v,
+ "dyesub_print_plane: h = %d, row = %d\n", h, srcrow);
- dyesub_render_row(v, pv, caps, row, destrow + bpp * pv->outl_px, bpp, p);
+ if (pv->plane_interlacing || pv->row_interlacing)
+ {
+ dyesub_render_row_interlaced_u8(v, pv, caps, srcrow,
+ destrow + bpp * pv->outl_px, p);
+ }
+ else
+ dyesub_render_row_packed_u8(v, pv, caps, srcrow,
+ destrow + bpp * pv->outl_px, bpp);
}
/* And send it out */
stp_zfwrite(destrow, rowlen, 1, v);
@@ -8996,7 +9876,7 @@ dyesub_print_plane(stp_vars_t *v,
* dyesub_print()
*/
static int
-dyesub_do_print(stp_vars_t *v, stp_image_t *image)
+dyesub_do_print(stp_vars_t *v, stp_image_t *image, int print_op)
{
int i;
dyesub_print_vars_t pv;
@@ -9004,7 +9884,7 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image)
const int model = stp_get_model_id(v);
const char *ink_type;
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(model);
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v, model);
int max_print_px_width = 0;
int max_print_px_height = 0;
int w_dpi, h_dpi;
@@ -9023,7 +9903,7 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image)
stp_dimension_t page_pt_right = 0;
stp_dimension_t page_pt_top = 0;
stp_dimension_t page_pt_bottom = 0;
- int page_mode;
+ int page_mode;
int pl;
@@ -9070,8 +9950,8 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image)
/* FIXME: What about Collation? Any special handling here? */
pd->pagesize = stp_get_string_parameter(v, "PageSize");
- if (caps->laminate)
- pd->laminate = dyesub_get_laminate_pattern(v);
+ if (caps->overcoat)
+ pd->overcoat = dyesub_get_overcoat_pattern(v);
if (caps->media)
pd->media = dyesub_get_mediatype(v);
@@ -9104,13 +9984,13 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image)
pv.outt_px = MIN(PX(out_pt_top - page_pt_top, h_dpi),
pv.prnh_px - pv.outh_px);
pv.outr_px = pv.outl_px + pv.outw_px;
- pv.outb_px = pv.outt_px + pv.outh_px;
+ pv.outb_px = pv.outt_px + pv.outh_px;
/* Swap back so that everything that follows will work. */
if (page_mode == DYESUB_LANDSCAPE)
dyesub_swap_ints(&w_dpi, &h_dpi);
- stp_deprintf(STP_DBG_DYESUB,
+ stp_dprintf(STP_DBG_DYESUB, v,
"paper (pt) %f x %f\n"
"image (px) %d x %d\n"
"image (pt) %f x %f\n"
@@ -9134,70 +10014,49 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image)
w_dpi, h_dpi
);
- /* FIXME: move this into print_init_drv */
ink_type = dyesub_describe_output_internal(v, &pv);
stp_set_string_parameter(v, "STPIOutputType", ink_type);
stp_channel_reset(v);
for (i = 0; i < pv.ink_channels; i++)
stp_channel_add(v, i, 0, 1.0);
- pv.out_channels = stp_color_init(v, image, 65536);
+
+ pv.out_channels = stp_color_init(v, image, 256);
+ stp_set_float_parameter(v, "AppGammaScale", 1.0);
/* If there's a mismatch in channels, that is ALWAYS a problem */
if (pv.out_channels != pv.ink_channels)
{
- stp_deprintf(STP_DBG_DYESUB,
+ stp_dprintf(STP_DBG_DYESUB, v,
"Input and output channel count mismatch! (%d vs %d)\n", pv.out_channels, pv.ink_channels);
stp_image_conclude(image);
stp_free(pd);
return 2;
}
- if (dyesub_feature(caps, DYESUB_FEATURE_12BPP)) {
- pv.bytes_per_ink_channel = 2;
- pv.bits_per_ink_channel = 12;
- } else if (dyesub_feature(caps, DYESUB_FEATURE_16BPP)) {
- pv.bytes_per_ink_channel = 2;
- pv.bits_per_ink_channel = 16;
- } else {
- pv.bytes_per_ink_channel = 1;
- pv.bits_per_ink_channel = 8;
- }
-
- if (pv.bytes_per_ink_channel > 1) {
-#if (__BYTE_ORDER == __LITTLE_ENDIAN)
- pv.byteswap = dyesub_feature(caps, DYESUB_FEATURE_BIGENDIAN);
-#elif (__BYTE_ORDER == __BIG_ENDIAN)
- pv.byteswap = !dyesub_feature(caps, DYESUB_FEATURE_BIGENDIAN);
-#else
-#error "Unable to determine endianness, aborting compilation!"
-#endif
- }
-
pv.image_data = dyesub_read_image(v, &pv, image);
- if (ink_type) {
-#ifndef CANONSELPHYNEO_CMY
- if (dyesub_feature(caps, DYESUB_FEATURE_RGBtoYCBCR)) {
- pv.empty_byte[0] = 0xff; /* Y */
- pv.empty_byte[1] = 0x80; /* Cb */
- pv.empty_byte[2] = 0x80; /* Cr */
- } else
-#endif
- if (strcmp(ink_type, "RGB") == 0 ||
- strcmp(ink_type, "BGR") == 0 ||
- strcmp(ink_type, "Whitescale") == 0) {
- pv.empty_byte[0] = 0xff;
- pv.empty_byte[1] = 0xff;
- pv.empty_byte[2] = 0xff;
- } else {
- pv.empty_byte[0] = 0x0;
- pv.empty_byte[1] = 0x0;
- pv.empty_byte[2] = 0x0;
- }
- } else {
+ if (ink_type)
+ {
+ if (strcmp(ink_type, "RGB") == 0 ||
+ strcmp(ink_type, "BGR") == 0 ||
+ strcmp(ink_type, "Whitescale") == 0)
+ {
+ pv.empty_byte[0] = 0xff;
+ pv.empty_byte[1] = 0xff;
+ pv.empty_byte[2] = 0xff;
+ }
+ else
+ {
pv.empty_byte[0] = 0x0;
pv.empty_byte[1] = 0x0;
pv.empty_byte[2] = 0x0;
- }
+ }
+ }
+ else
+ {
+ pv.empty_byte[0] = 0x0;
+ pv.empty_byte[1] = 0x0;
+ pv.empty_byte[2] = 0x0;
+ }
pv.plane_interlacing = dyesub_feature(caps, DYESUB_FEATURE_PLANE_INTERLACE);
pv.row_interlacing = dyesub_feature(caps, DYESUB_FEATURE_ROW_INTERLACE);
@@ -9209,11 +10068,6 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image)
stp_free(pd);
return 2;
}
- /* /FIXME */
-
- /* FIXME: Provide a way of disabling/altering these curves */
- /* XXX reuse 'UseLUT' from mitsu70x? or 'SimpleGamma' ? */
- dyesub_exec(v, caps->adjust_curves, "caps->adjust_curves");
if (dyesub_feature(caps, DYESUB_FEATURE_FULL_HEIGHT))
{
@@ -9258,13 +10112,32 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image)
dyesub_swap_ints(&pv.imgh_px, &pv.imgw_px);
}
+ /* Adjust margins if the driver asks, to fine-tune horizontal position. */
+ pv.outl_px += pd->horiz_offset;
+ pv.outr_px += pd->horiz_offset;
+ /* Make sure we're still legal */
+ if (pv.outl_px < 0)
+ pv.outl_px = 0;
+ if (pv.outr_px > pv.prnw_px)
+ pv.outr_px = pv.prnw_px;
+
+ /* By this point, we're finally DONE mangling the pv structure,
+ and can start calling into the bulk of the driver code. */
+
/* assign private data *after* swaping image dimensions */
pd->w_dpi = w_dpi;
pd->h_dpi = h_dpi;
pd->w_size = pv.prnw_px;
pd->h_size = pv.prnh_px;
pd->print_mode = pv.print_mode;
- pd->bpp = pv.bits_per_ink_channel;
+
+ /* FIXME: Provide a way of disabling/altering these curves */
+ /* XXX reuse 'UseLUT' from mitsu70x? or 'SimpleGamma' ? */
+ dyesub_exec(v, caps->adjust_curves, "caps->adjust_curves");
+
+ /* Send out job init if we're in page mode */
+ if (print_op & OP_JOB_START)
+ dyesub_exec(v, caps->job_start_func, "caps->job_start");
/* printer init */
dyesub_exec(v, caps->printer_init_func, "caps->printer_init");
@@ -9272,7 +10145,7 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image)
for (pl = 0; pl < (pv.plane_interlacing ? pv.ink_channels : 1); pl++)
{
pd->plane = pv.ink_order[pl];
- stp_deprintf(STP_DBG_DYESUB, "dyesub: plane %d\n", pd->plane);
+ stp_dprintf(STP_DBG_DYESUB, v, "dyesub: plane %d\n", pd->plane);
/* plane init */
dyesub_exec(v, caps->plane_init_func, "caps->plane_init");
@@ -9286,6 +10159,10 @@ dyesub_do_print(stp_vars_t *v, stp_image_t *image)
/* printer end */
dyesub_exec(v, caps->printer_end_func, "caps->printer_end");
+ /* Job end, if we're in page mode */
+ if (print_op & OP_JOB_END)
+ dyesub_exec(v, caps->job_end_func, "caps->job_end");
+
if (pv.image_data) {
dyesub_free_image(&pv, image);
}
@@ -9300,9 +10177,15 @@ static int
dyesub_print(const stp_vars_t *v, stp_image_t *image)
{
int status;
+ int op = OP_JOB_PRINT;
+
stp_vars_t *nv = stp_vars_create_copy(v);
- stp_prune_inactive_options(nv);
- status = dyesub_do_print(nv, image);
+
+ if (!stp_get_string_parameter(v, "JobMode") ||
+ strcmp(stp_get_string_parameter(v, "JobMode"), "Page") == 0)
+ op = OP_JOB_START | OP_JOB_PRINT | OP_JOB_END;
+
+ status = dyesub_do_print(nv, image, op);
stp_vars_destroy(nv);
return status;
}
@@ -9313,8 +10196,7 @@ dyesub_job_start(const stp_vars_t *v, stp_image_t *image)
const dyesub_cap_t *caps;
stp_vars_t *nv = stp_vars_create_copy(v);
- stp_prune_inactive_options(nv);
- caps = dyesub_get_model_capabilities(stp_get_model_id(nv));
+ caps = dyesub_get_model_capabilities(v, stp_get_model_id(nv));
if (caps->job_start_func)
caps->job_start_func(nv);
@@ -9329,8 +10211,7 @@ dyesub_job_end(const stp_vars_t *v, stp_image_t *image)
const dyesub_cap_t *caps;
stp_vars_t *nv = stp_vars_create_copy(v);
- stp_prune_inactive_options(nv);
- caps = dyesub_get_model_capabilities(stp_get_model_id(nv));
+ caps = dyesub_get_model_capabilities(v, stp_get_model_id(nv));
if (caps->job_end_func)
caps->job_end_func(nv);
@@ -9339,11 +10220,10 @@ dyesub_job_end(const stp_vars_t *v, stp_image_t *image)
return 1;
}
-
static int dyesub_verify_printer_params(stp_vars_t *v)
{
const int model = stp_get_model_id(v);
- const dyesub_cap_t *caps = dyesub_get_model_capabilities(model);
+ const dyesub_cap_t *caps = dyesub_get_model_capabilities(v, model);
int result;
result = stp_verify_printer_params(v);
if (result != 1)
@@ -9368,7 +10248,8 @@ static const stp_printfuncs_t print_dyesub_printfuncs =
dyesub_verify_printer_params,
dyesub_job_start,
dyesub_job_end,
- NULL
+ NULL,
+ dyesub_describe_papersize
};
static stp_family_t print_dyesub_module_data =
@@ -9380,14 +10261,14 @@ static stp_family_t print_dyesub_module_data =
static int
print_dyesub_module_init(void)
{
- return stp_family_register(print_dyesub_module_data.printer_list);
+ return stpi_family_register(print_dyesub_module_data.printer_list);
}
static int
print_dyesub_module_exit(void)
{
- return stp_family_unregister(print_dyesub_module_data.printer_list);
+ return stpi_family_unregister(print_dyesub_module_data.printer_list);
}
diff --git a/src/main/print-escp2-data.c b/src/main/print-escp2-data.c
index 870ec40..267855d 100644
--- a/src/main/print-escp2-data.c
+++ b/src/main/print-escp2-data.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -28,6 +27,7 @@
#include <gutenprint/gutenprint-intl-internal.h>
#include "print-escp2.h"
#include <limits.h>
+#include <sys/param.h>
typedef struct
{
@@ -54,20 +54,33 @@ static stpi_escp2_printer_t *escp2_model_capabilities;
static int escp2_model_count = 0;
-static void
-load_model_from_file(const stp_vars_t *v, stp_mxml_node_t *xmod, int model)
+static int
+load_model_from_file(const stp_vars_t *v, const char *filename, int depth)
{
+ int model = -1;
+ stp_mxml_node_t *xmod =
+ stp_xml_parse_file_from_path_uncached_safe(filename, "escp2Model", NULL);
+ const char *id = stp_mxmlElementGetAttr(xmod, "id");
stp_mxml_node_t *tmp = xmod->child;
- stpi_escp2_printer_t *p = stp_escp2_get_printer(v);
- int found_black_head_config = 0;
- int found_fast_head_config = 0;
- p->max_black_resolution = -1;
- p->cd_x_offset = -1;
- p->cd_y_offset = -1;
- p->duplex_left_margin = SHRT_MIN;
- p->duplex_right_margin = SHRT_MIN;
- p->duplex_top_margin = SHRT_MIN;
- p->duplex_bottom_margin = SHRT_MIN;
+ stpi_escp2_printer_t *p = stpi_escp2_get_printer(v);
+ const char *stmp = stp_mxmlElementGetAttr(xmod, "base");
+ if (id)
+ model = stp_xmlstrtol(id);
+ if (depth == 0)
+ {
+ p->max_black_resolution = -1;
+ p->cd_x_offset = -1;
+ p->cd_y_offset = -1;
+ p->duplex_left_margin = SHRT_MIN;
+ p->duplex_right_margin = SHRT_MIN;
+ p->duplex_top_margin = SHRT_MIN;
+ p->duplex_bottom_margin = SHRT_MIN;
+ }
+ /* Allow recursive definitions */
+ if (stmp)
+ {
+ load_model_from_file(v, stmp, depth + 1);
+ }
while (tmp)
{
if (tmp->type == STP_MXML_ELEMENT)
@@ -76,20 +89,21 @@ load_model_from_file(const stp_vars_t *v, stp_mxml_node_t *xmod, int model)
const char *target = stp_mxmlElementGetAttr(tmp, "src");
if (target)
{
+ /* FIXME need to allow override of these! */
if (!strcmp(name, "media"))
- stp_escp2_load_media(v, target);
+ stpi_escp2_load_media(v, target);
else if (!strcmp(name, "inputSlots"))
- stp_escp2_load_input_slots(v, target);
+ stpi_escp2_load_input_slots(v, target);
else if (!strcmp(name, "mediaSizes"))
- stp_escp2_load_media_sizes(v, target);
+ stpi_escp2_load_media_sizes(v, target);
else if (!strcmp(name, "printerWeaves"))
- stp_escp2_load_printer_weaves(v, target);
+ stpi_escp2_load_printer_weaves(v, target);
else if (!strcmp(name, "qualityPresets"))
- stp_escp2_load_quality_presets(v, target);
+ stpi_escp2_load_quality_presets(v, target);
else if (!strcmp(name, "resolutions"))
- stp_escp2_load_resolutions(v, target);
+ stpi_escp2_load_resolutions(v, target, NULL);
else if (!strcmp(name, "inkGroup"))
- stp_escp2_load_inkgroup(v, target);
+ stpi_escp2_load_inkgroup(v, target);
}
else if (tmp->child && tmp->child->type == STP_MXML_TEXT)
{
@@ -170,14 +184,14 @@ load_model_from_file(const stp_vars_t *v, stp_mxml_node_t *xmod, int model)
p->min_nozzles = data[1];
p->nozzle_start = data[2];
p->nozzle_separation = data[3];
- if (!found_black_head_config)
+ if (p->black_nozzles == 0)
{
p->black_nozzles = data[0];
p->min_black_nozzles = data[1];
p->black_nozzle_start = data[2];
p->black_nozzle_separation = data[3];
}
- if (!found_fast_head_config)
+ if (p->fast_nozzles == 0)
{
p->fast_nozzles = data[0];
p->min_fast_nozzles = data[1];
@@ -191,7 +205,6 @@ load_model_from_file(const stp_vars_t *v, stp_mxml_node_t *xmod, int model)
p->min_black_nozzles = data[1];
p->black_nozzle_start = data[2];
p->black_nozzle_separation = data[3];
- found_black_head_config = 1;
}
else if (!strcmp(htype, "fast"))
{
@@ -199,7 +212,6 @@ load_model_from_file(const stp_vars_t *v, stp_mxml_node_t *xmod, int model)
p->min_fast_nozzles = data[1];
p->fast_nozzle_start = data[2];
p->fast_nozzle_separation = data[3];
- found_fast_head_config = 1;
}
}
else if (!strcmp(name, "margins"))
@@ -359,7 +371,9 @@ load_model_from_file(const stp_vars_t *v, stp_mxml_node_t *xmod, int model)
}
}
else if (!strcmp(name, "resolutions"))
- stp_escp2_load_resolutions_from_xml(v, tmp);
+ {
+ stpi_escp2_load_resolutions(v, filename, tmp);
+ }
}
else
{
@@ -378,55 +392,28 @@ load_model_from_file(const stp_vars_t *v, stp_mxml_node_t *xmod, int model)
else if (!strcmp(name, "hasInterchangeableInkCartridges"))
p->flags |= MODEL_INTERCHANGEABLE_INK_YES;
else if (!strcmp(name, "resolutions"))
- stp_escp2_load_resolutions_from_xml(v, tmp);
+ stpi_escp2_load_resolutions(v, filename, tmp);
}
}
tmp = tmp->next;
}
+ stp_xml_free_parsed_file(xmod);
+ return model;
}
void
-stp_escp2_load_model(const stp_vars_t *v, int model)
+stpi_escp2_load_model(const stp_vars_t *v, int model)
{
- stp_list_t *dirlist = stpi_data_path();
- stp_list_item_t *item;
- char buf[1024];
- int found = 0;
-
+ char buf[MAXPATHLEN+1];
stp_xml_init();
- sprintf(buf, "escp2/model/model_%d.xml", model);
- item = stp_list_get_start(dirlist);
- while (item)
- {
- const char *dn = (const char *) stp_list_item_get_data(item);
- char *fn = stpi_path_merge(dn, buf);
- stp_mxml_node_t *doc = stp_mxmlLoadFromFile(NULL, fn, STP_MXML_NO_CALLBACK);
- stp_free(fn);
- if (doc)
- {
- stp_mxml_node_t *node =
- stp_mxmlFindElement(doc, doc, "escp2Model", NULL, NULL,
- STP_MXML_DESCEND);
- if (node)
- {
- const char *stmp = stp_mxmlElementGetAttr(node, "id");
- STPI_ASSERT(stmp && stp_xmlstrtol(stmp) == model, v);
- load_model_from_file(v, node, model);
- found = 1;
- }
- stp_mxmlDelete(doc);
- if (found)
- break;
- }
- item = stp_list_item_next(item);
- }
+ snprintf(buf, MAXPATHLEN, "escp2/model/model_%d.xml", model);
+ int model_id_from_file = load_model_from_file(v, buf, 0);
stp_xml_exit();
- stp_list_destroy(dirlist);
- STPI_ASSERT(found, v);
+ STPI_ASSERT(model_id_from_file == model, v);
}
stpi_escp2_printer_t *
-stp_escp2_get_printer(const stp_vars_t *v)
+stpi_escp2_get_printer(const stp_vars_t *v)
{
int model = stp_get_model_id(v);
STPI_ASSERT(model >= 0, v);
@@ -447,24 +434,18 @@ stp_escp2_get_printer(const stp_vars_t *v)
}
if (!(escp2_model_capabilities[model].active))
{
-#ifdef HAVE_LOCALE_H
- char *locale = stp_strdup(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, "C");
-#endif
+ stp_xml_init();
escp2_model_capabilities[model].active = 1;
- stp_escp2_load_model(v, model);
-#ifdef HAVE_LOCALE_H
- setlocale(LC_ALL, locale);
- stp_free(locale);
-#endif
+ stpi_escp2_load_model(v, model);
+ stp_xml_exit();
}
return &(escp2_model_capabilities[model]);
}
model_featureset_t
-stp_escp2_get_cap(const stp_vars_t *v, escp2_model_option_t feature)
+stpi_escp2_get_cap(const stp_vars_t *v, escp2_model_option_t feature)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ const stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
model_featureset_t featureset =
(((1ul << escp2_printer_attrs[feature].bit_width) - 1ul) <<
escp2_printer_attrs[feature].bit_shift);
@@ -472,10 +453,10 @@ stp_escp2_get_cap(const stp_vars_t *v, escp2_model_option_t feature)
}
int
-stp_escp2_has_cap(const stp_vars_t *v, escp2_model_option_t feature,
+stpi_escp2_has_cap(const stp_vars_t *v, escp2_model_option_t feature,
model_featureset_t class)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ const stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
model_featureset_t featureset =
(((1ul << escp2_printer_attrs[feature].bit_width) - 1ul) <<
escp2_printer_attrs[feature].bit_shift);
diff --git a/src/main/print-escp2.c b/src/main/print-escp2.c
index f4e90f1..6fe807a 100644
--- a/src/main/print-escp2.c
+++ b/src/main/print-escp2.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -1043,7 +1042,7 @@ escp2_##f(const stp_vars_t *v) \
return stp_get_int_parameter(v, "escp2_" #f); \
else \
{ \
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v); \
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v); \
return printdef->f; \
} \
}
@@ -1056,7 +1055,7 @@ escp2_##f(const stp_vars_t *v) \
return stp_get_dimension_parameter(v, "escp2_" #f); \
else \
{ \
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v); \
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v); \
return (stp_dimension_t) printdef->f; \
} \
}
@@ -1069,7 +1068,7 @@ escp2_##f(const stp_vars_t *v) \
return stp_get_raw_parameter(v, "escp2_" #f); \
else \
{ \
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v); \
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v); \
return printdef->f; \
} \
}
@@ -1082,8 +1081,8 @@ escp2_##f(const stp_vars_t *v, int rollfeed) \
return stp_get_dimension_parameter(v, "escp2_" #f); \
else \
{ \
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v); \
- const res_t *res = stp_escp2_find_resolution(v); \
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v); \
+ const res_t *res = stpi_escp2_find_resolution(v); \
if (res && res->command) \
{ \
if (rollfeed) \
@@ -1172,63 +1171,63 @@ froundto(double value, double numerator, double denominator)
static const resolution_list_t *
escp2_reslist(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->resolutions;
}
static inline const printer_weave_list_t *
escp2_printer_weaves(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->printer_weaves;
}
static inline const stp_string_list_t *
escp2_channel_names(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return (printdef->channel_names);
}
static inline const inkgroup_t *
escp2_inkgroup(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return (printdef->inkgroup);
}
static inline const quality_list_t *
escp2_quality_list(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->quality_list;
}
static short
escp2_duplex_left_margin(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->duplex_left_margin;
}
static short
escp2_duplex_right_margin(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->duplex_right_margin;
}
static short
escp2_duplex_top_margin(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->duplex_top_margin;
}
static short
escp2_duplex_bottom_margin(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->duplex_bottom_margin;
}
@@ -1267,7 +1266,7 @@ escp2_res_param(const stp_vars_t *v, const char *param, const res_t *res)
return stp_get_int_parameter(v, param);
else
{
- const res_t *res1 = stp_escp2_find_resolution(v);
+ const res_t *res1 = stpi_escp2_find_resolution(v);
if (res1->v &&
stp_check_int_parameter(res1->v, param, STP_PARAMETER_ACTIVE))
return stp_get_int_parameter(res1->v, param);
@@ -1288,7 +1287,7 @@ escp2_density(const stp_vars_t *v)
return stp_get_float_parameter(v, "escp2_density");
else
{
- const res_t *res1 = stp_escp2_find_resolution(v);
+ const res_t *res1 = stpi_escp2_find_resolution(v);
if (res1->v &&
stp_check_float_parameter(res1->v, "escp2_density", STP_PARAMETER_ACTIVE))
return stp_get_float_parameter(res1->v, "escp2_density");
@@ -1341,7 +1340,7 @@ escp2_base_res_by_res(const stp_vars_t *v, const res_t *res)
static escp2_dropsize_t *
escp2_copy_dropsizes(const stp_vars_t *v)
{
- const res_t *res = stp_escp2_find_resolution(v);
+ const res_t *res = stpi_escp2_find_resolution(v);
escp2_dropsize_t *ndrops;
if (!res || !(res->v))
return NULL;
@@ -1374,7 +1373,7 @@ escp2_free_dropsizes(escp2_dropsize_t *drops)
}
const inklist_t *
-stp_escp2_inklist(const stp_vars_t *v)
+stpi_escp2_inklist(const stp_vars_t *v)
{
int i;
const char *ink_list_name = NULL;
@@ -1397,7 +1396,7 @@ stp_escp2_inklist(const stp_vars_t *v)
static const shade_t *
escp2_shades(const stp_vars_t *v, int channel)
{
- const inklist_t *inklist = stp_escp2_inklist(v);
+ const inklist_t *inklist = stpi_escp2_inklist(v);
return &(inklist->shades[channel]);
}
@@ -1406,7 +1405,7 @@ escp2_copy_shades(const stp_vars_t *v, int channel)
{
int i;
shade_t *nshades;
- const inklist_t *inklist = stp_escp2_inklist(v);
+ const inklist_t *inklist = stpi_escp2_inklist(v);
if (!inklist)
return NULL;
nshades = stp_zalloc(sizeof(shade_t));
@@ -1431,24 +1430,24 @@ escp2_free_shades(shade_t *shades)
static const stp_string_list_t *
escp2_paperlist(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->papers;
}
static const stp_string_list_t *
escp2_slotlist(const stp_vars_t *v)
{
- stpi_escp2_printer_t *printdef = stp_escp2_get_printer(v);
+ stpi_escp2_printer_t *printdef = stpi_escp2_get_printer(v);
return printdef->input_slots;
}
static int
supports_borderless(const stp_vars_t *v)
{
- return (stp_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_YES) ||
- stp_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_FULL) ||
- stp_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_H_ONLY) ||
- stp_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_RESTR));
+ return (stpi_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_YES) ||
+ stpi_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_FULL) ||
+ stpi_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_H_ONLY) ||
+ stpi_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_RESTR));
}
static int
@@ -1470,7 +1469,7 @@ static const stp_raw_t *
get_printer_weave(const stp_vars_t *v)
{
int i;
- const res_t *res = stp_escp2_find_resolution(v);
+ const res_t *res = stpi_escp2_find_resolution(v);
const printer_weave_list_t *p = escp2_printer_weaves(v);
if (p)
{
@@ -1493,7 +1492,7 @@ get_printer_weave(const stp_vars_t *v)
static int
use_printer_weave(const stp_vars_t *v)
{
- const res_t *res = stp_escp2_find_resolution(v);
+ const res_t *res = stpi_escp2_find_resolution(v);
return (!res || res->command);
}
@@ -1502,7 +1501,7 @@ get_resolution_bounds_by_paper_type(const stp_vars_t *v,
unsigned *max_x, unsigned *max_y,
unsigned *min_x, unsigned *min_y)
{
- const paper_t *paper = stp_escp2_get_media_type(v, 1);
+ const paper_t *paper = stpi_escp2_get_media_type(v, 1);
*min_x = 0;
*min_y = 0;
*max_x = 0;
@@ -1514,36 +1513,36 @@ get_resolution_bounds_by_paper_type(const stp_vars_t *v,
case PAPER_PLAIN:
*min_x = 0;
*min_y = 0;
- *max_x = 1440;
- *max_y = 720;
+ *max_x = escp2_base_separation(v) * 4;
+ *max_y = escp2_base_separation(v) * 2;
break;
case PAPER_GOOD:
- *min_x = 360;
- *min_y = 360;
- *max_x = 1440;
- *max_y = 1440;
+ *min_x = escp2_base_separation(v);
+ *min_y = escp2_base_separation(v);
+ *max_x = escp2_base_separation(v) * 4;
+ *max_y = escp2_base_separation(v) * 4;
break;
case PAPER_PHOTO:
- *min_x = 720;
- *min_y = 360;
+ *min_x = escp2_base_separation(v) * 2;
+ *min_y = escp2_base_separation(v);
*max_x = 2880;
- *max_y = 1440;
+ *max_y = escp2_base_separation(v) * 4;
if (*min_x >= escp2_max_hres(v))
*min_x = escp2_max_hres(v);
break;
case PAPER_PREMIUM_PHOTO:
- *min_x = 720;
- *min_y = 720;
+ *min_x = escp2_base_separation(v) * 2;
+ *min_y = escp2_base_separation(v) * 2;
*max_x = 0;
*max_y = 0;
if (*min_x >= escp2_max_hres(v))
*min_x = escp2_max_hres(v);
break;
case PAPER_TRANSPARENCY:
- *min_x = 360;
- *min_y = 360;
- *max_x = 720;
- *max_y = 720;
+ *min_x = escp2_base_separation(v);
+ *min_y = escp2_base_separation(v);
+ *max_x = escp2_base_separation(v) * 2;
+ *max_y = escp2_base_separation(v) * 2;
break;
}
stp_dprintf(STP_DBG_ESCP2, v,
@@ -1651,7 +1650,7 @@ verify_papersize(const stp_vars_t *v, const stp_papersize_t *pt)
stp_dimension_t height_limit, width_limit;
stp_dimension_t min_height_limit, min_width_limit;
unsigned int envelope_landscape =
- stp_escp2_has_cap(v, MODEL_ENVELOPE_LANDSCAPE, MODEL_ENVELOPE_LANDSCAPE_YES);
+ stpi_escp2_has_cap(v, MODEL_ENVELOPE_LANDSCAPE, MODEL_ENVELOPE_LANDSCAPE_YES);
width_limit = escp2_max_paper_width(v);
height_limit = escp2_max_paper_height(v);
min_width_limit = escp2_min_paper_width(v);
@@ -1668,7 +1667,7 @@ verify_papersize(const stp_vars_t *v, const stp_papersize_t *pt)
(pt->height >= min_height_limit || pt->height == 0) &&
(pt->width >= min_width_limit || pt->width == 0) &&
(pt->width == 0 || pt->height > 0 ||
- stp_escp2_printer_supports_rollfeed(v)))
+ stpi_escp2_printer_supports_rollfeed(v)))
return 1;
else
return 0;
@@ -1686,21 +1685,22 @@ verify_inktype(const stp_vars_t *v, const inkname_t *inks)
static const char *
get_default_inktype(const stp_vars_t *v)
{
- const inklist_t *ink_list = stp_escp2_inklist(v);
+ const inklist_t *ink_list = stpi_escp2_inklist(v);
const paper_t *paper_type;
if (!ink_list)
return NULL;
- paper_type = stp_escp2_get_media_type(v, 0);
+ paper_type = stpi_escp2_get_media_type(v, 0);
if (!paper_type)
- paper_type = stp_escp2_get_default_media_type(v);
+ paper_type = stpi_escp2_get_default_media_type(v);
if (paper_type && paper_type->preferred_ink_type)
return paper_type->preferred_ink_type;
- else if (stp_escp2_has_cap(v, MODEL_FAST_360, MODEL_FAST_360_YES) &&
+ else if (stpi_escp2_has_cap(v, MODEL_FAST_360, MODEL_FAST_360_YES) &&
stp_check_string_parameter(v, "Resolution", STP_PARAMETER_ACTIVE))
{
- const res_t *res = stp_escp2_find_resolution(v);
+ const res_t *res = stpi_escp2_find_resolution(v);
if (res)
{
+ /* Hard-coded value for old printers */
if (res->vres == 360 && res->hres == escp2_base_res(v))
{
int i;
@@ -1718,7 +1718,7 @@ static const inkname_t *
get_inktype(const stp_vars_t *v)
{
const char *ink_type = stp_get_string_parameter(v, "InkType");
- const inklist_t *ink_list = stp_escp2_inklist(v);
+ const inklist_t *ink_list = stpi_escp2_inklist(v);
int i;
if (!ink_type || strcmp(ink_type, "None") == 0 ||
@@ -1789,7 +1789,7 @@ printer_supports_inkset(const stp_vars_t *v, inkset_id_t inkset)
static const stp_vars_t *
get_media_adjustment(const stp_vars_t *v)
{
- const paper_t *pt = stp_escp2_get_media_type(v, 0);
+ const paper_t *pt = stpi_escp2_get_media_type(v, 0);
if (pt)
return pt->v;
else
@@ -2208,7 +2208,7 @@ get_raw_inktype(const stp_vars_t *v)
{
if (strcmp(stp_get_string_parameter(v, "InputImageType"), "Raw") == 0)
{
- const inklist_t *inks = stp_escp2_inklist(v);
+ const inklist_t *inks = stpi_escp2_inklist(v);
int ninktypes = inks->n_inks;
int i;
const char *channel_name = stp_get_string_parameter(v, "RawChannels");
@@ -2233,6 +2233,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
{
int i;
description->p_type = STP_PARAMETER_TYPE_INVALID;
+ int found = 0;
if (name == NULL)
return;
@@ -2246,31 +2247,39 @@ escp2_parameters(const stp_vars_t *v, const char *name,
description->deflt.dbl = float_parameters[i].defval;
description->bounds.dbl.upper = float_parameters[i].max;
description->bounds.dbl.lower = float_parameters[i].min;
+ found = 1;
break;
}
- for (i = 0; i < int_parameter_count; i++)
- if (strcmp(name, int_parameters[i].param.name) == 0)
- {
- stp_fill_parameter_settings(description,
- &(int_parameters[i].param));
- description->deflt.integer = int_parameters[i].defval;
- description->bounds.integer.upper = int_parameters[i].max;
- description->bounds.integer.lower = int_parameters[i].min;
- break;
- }
+ if (!found)
+ {
+ for (i = 0; i < int_parameter_count; i++)
+ if (strcmp(name, int_parameters[i].param.name) == 0)
+ {
+ stp_fill_parameter_settings(description,
+ &(int_parameters[i].param));
+ description->deflt.integer = int_parameters[i].defval;
+ description->bounds.integer.upper = int_parameters[i].max;
+ description->bounds.integer.lower = int_parameters[i].min;
+ found = 1;
+ break;
+ }
+ }
- for (i = 0; i < the_parameter_count; i++)
- if (strcmp(name, the_parameters[i].name) == 0)
- {
- stp_fill_parameter_settings(description, &(the_parameters[i]));
- if (description->p_type == STP_PARAMETER_TYPE_INT)
+ if (!found)
+ {
+ for (i = 0; i < the_parameter_count; i++)
+ if (strcmp(name, the_parameters[i].name) == 0)
{
- description->deflt.integer = 0;
- description->bounds.integer.upper = INT_MAX;
- description->bounds.integer.lower = INT_MIN;
+ stp_fill_parameter_settings(description, &(the_parameters[i]));
+ if (description->p_type == STP_PARAMETER_TYPE_INT)
+ {
+ description->deflt.integer = 0;
+ description->bounds.integer.upper = INT_MAX;
+ description->bounds.integer.lower = INT_MIN;
+ }
+ break;
}
- break;
- }
+ }
if (strcmp(name, "AutoMode") == 0)
{
@@ -2283,8 +2292,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "PageSize") == 0)
{
- int papersizes = stp_known_papersizes();
- const input_slot_t *slot = stp_escp2_get_input_slot(v);
+ const input_slot_t *slot = stpi_escp2_get_input_slot(v);
description->bounds.str = stp_string_list_create();
if (slot && slot->is_cd &&
!stp_get_boolean_parameter(v, "CDAllowOtherMedia"))
@@ -2298,12 +2306,17 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else
{
- for (i = 0; i < papersizes; i++)
+ const stp_papersize_list_t *paper_sizes =
+ stpi_get_standard_papersize_list();
+ const stp_papersize_list_item_t *ptli =
+ stpi_papersize_list_get_start(paper_sizes);
+ while (ptli)
{
- const stp_papersize_t *pt = stp_get_papersize_by_index(i);
+ const stp_papersize_t *pt = stpi_paperlist_item_get_data(ptli);
if (verify_papersize(v, pt))
stp_string_list_add_string(description->bounds.str,
pt->name, gettext(pt->text));
+ ptli = stpi_paperlist_item_next(ptli);
}
}
description->deflt.str =
@@ -2311,8 +2324,8 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "CDAllowOtherMedia") == 0)
{
- const input_slot_t *slot = stp_escp2_get_input_slot(v);
- if (stp_escp2_printer_supports_print_to_cd(v) &&
+ const input_slot_t *slot = stpi_escp2_get_input_slot(v);
+ if (stpi_escp2_printer_supports_print_to_cd(v) &&
(!slot || slot->is_cd))
description->is_active = 1;
else
@@ -2320,9 +2333,9 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "CDInnerRadius") == 0 )
{
- const input_slot_t *slot = stp_escp2_get_input_slot(v);
+ const input_slot_t *slot = stpi_escp2_get_input_slot(v);
description->bounds.str = stp_string_list_create();
- if (stp_escp2_printer_supports_print_to_cd(v) &&
+ if (stpi_escp2_printer_supports_print_to_cd(v) &&
(!slot || slot->is_cd) &&
(!stp_get_string_parameter(v, "PageSize") ||
strcmp(stp_get_string_parameter(v, "PageSize"), "CDCustom") != 0))
@@ -2339,11 +2352,11 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "CDInnerDiameter") == 0 )
{
- const input_slot_t *slot = stp_escp2_get_input_slot(v);
+ const input_slot_t *slot = stpi_escp2_get_input_slot(v);
description->bounds.dimension.lower = 16 * 10 * 72 / 254;
description->bounds.dimension.upper = 43 * 10 * 72 / 254;
description->deflt.dimension = 43 * 10 * 72 / 254;
- if (stp_escp2_printer_supports_print_to_cd(v) &&
+ if (stpi_escp2_printer_supports_print_to_cd(v) &&
(!slot || slot->is_cd) &&
(!stp_get_string_parameter(v, "PageSize") ||
strcmp(stp_get_string_parameter(v, "PageSize"), "CDCustom") == 0))
@@ -2353,11 +2366,11 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "CDOuterDiameter") == 0 )
{
- const input_slot_t *slot = stp_escp2_get_input_slot(v);
+ const input_slot_t *slot = stpi_escp2_get_input_slot(v);
description->bounds.dimension.lower = 65 * 10 * 72 / 254;
description->bounds.dimension.upper = 120 * 10 * 72 / 254;
description->deflt.dimension = 329;
- if (stp_escp2_printer_supports_print_to_cd(v) &&
+ if (stpi_escp2_printer_supports_print_to_cd(v) &&
(!slot || slot->is_cd) &&
(!stp_get_string_parameter(v, "PageSize") ||
strcmp(stp_get_string_parameter(v, "PageSize"), "CDCustom") == 0))
@@ -2368,11 +2381,11 @@ escp2_parameters(const stp_vars_t *v, const char *name,
else if (strcmp(name, "CDXAdjustment") == 0 ||
strcmp(name, "CDYAdjustment") == 0)
{
- const input_slot_t *slot = stp_escp2_get_input_slot(v);
+ const input_slot_t *slot = stpi_escp2_get_input_slot(v);
description->bounds.dimension.lower = -30;
description->bounds.dimension.upper = 30;
description->deflt.dimension = 0;
- if (stp_escp2_printer_supports_print_to_cd(v) && (!slot || slot->is_cd))
+ if (stpi_escp2_printer_supports_print_to_cd(v) && (!slot || slot->is_cd))
description->is_active = 1;
else
description->is_active = 0;
@@ -2415,7 +2428,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "InkType") == 0)
{
- const inklist_t *inks = stp_escp2_inklist(v);
+ const inklist_t *inks = stpi_escp2_inklist(v);
int ninktypes = inks->n_inks;
int verified_inktypes = 0;
for (i = 0; i < ninktypes; i++)
@@ -2510,9 +2523,9 @@ escp2_parameters(const stp_vars_t *v, const char *name,
else if (strcmp(name, "Weave") == 0)
{
description->bounds.str = stp_string_list_create();
- if (stp_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_PRO))
+ if (stpi_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_PRO))
{
- const res_t *res = stp_escp2_find_resolution(v);
+ const res_t *res = stpi_escp2_find_resolution(v);
const printer_weave_list_t *printer_weaves = escp2_printer_weaves(v);
int nprinter_weaves = 0;
if (printer_weaves && use_printer_weave(v) && (!res || res->command))
@@ -2555,7 +2568,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "FullBleed") == 0)
{
- const input_slot_t *slot = stp_escp2_get_input_slot(v);
+ const input_slot_t *slot = stpi_escp2_get_input_slot(v);
if (slot && slot->is_cd)
description->is_active = 0;
else if (supports_borderless(v))
@@ -2565,9 +2578,9 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "Duplex") == 0)
{
- if (stp_escp2_printer_supports_duplex(v))
+ if (stpi_escp2_printer_supports_duplex(v))
{
- const input_slot_t *slot = stp_escp2_get_input_slot(v);
+ const input_slot_t *slot = stpi_escp2_get_input_slot(v);
if (slot && !slot->duplex)
description->is_active = 0;
else
@@ -2622,9 +2635,9 @@ escp2_parameters(const stp_vars_t *v, const char *name,
strcmp(name, "DropSize2") == 0 ||
strcmp(name, "DropSize3") == 0)
{
- if (stp_escp2_has_cap(v, MODEL_VARIABLE_DOT, MODEL_VARIABLE_YES))
+ if (stpi_escp2_has_cap(v, MODEL_VARIABLE_DOT, MODEL_VARIABLE_YES))
{
- const res_t *res = stp_escp2_find_resolution(v);
+ const res_t *res = stpi_escp2_find_resolution(v);
if (res && res->v &&
stp_check_float_parameter(v, name, STP_PARAMETER_ACTIVE))
description->deflt.dbl = stp_get_float_parameter(v, name);
@@ -2706,7 +2719,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
else if (strcmp(name, "SupportsInkChange") == 0)
{
description->deflt.integer =
- stp_escp2_has_cap(v, MODEL_SUPPORTS_INK_CHANGE,
+ stpi_escp2_has_cap(v, MODEL_SUPPORTS_INK_CHANGE,
MODEL_SUPPORTS_INK_CHANGE_YES);
}
else if (strcmp(name, "AlternateAlignmentPasses") == 0)
@@ -2736,7 +2749,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
else if (strcmp(name, "SupportsPacketMode") == 0)
{
description->deflt.boolean =
- stp_escp2_has_cap(v, MODEL_PACKET_MODE, MODEL_PACKET_MODE_YES);
+ stpi_escp2_has_cap(v, MODEL_PACKET_MODE, MODEL_PACKET_MODE_YES);
}
else if (strcmp(name, "PrintingMode") == 0)
{
@@ -2750,7 +2763,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "RawChannels") == 0)
{
- const inklist_t *inks = stp_escp2_inklist(v);
+ const inklist_t *inks = stpi_escp2_inklist(v);
int ninktypes = inks->n_inks;
description->bounds.str = stp_string_list_create();
if (ninktypes >= 1)
@@ -2826,9 +2839,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
strcmp(name, "PaperMediaSize") == 0 ||
strcmp(name, "PlatenGap") == 0)
{
- description->is_active = 0;
- if (stp_escp2_has_media_feature(v, name))
- description->is_active = 1;
+ description->is_active = stpi_escp2_has_media_feature(v, name);
}
else if (strcmp(name, "BandEnhancement") == 0)
{
@@ -2837,7 +2848,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
}
const res_t *
-stp_escp2_find_resolution(const stp_vars_t *v)
+stpi_escp2_find_resolution(const stp_vars_t *v)
{
const char *resolution = stp_get_string_parameter(v, "Resolution");
if (resolution)
@@ -2897,7 +2908,7 @@ escp2_media_size(const stp_vars_t *v, /* I */
const char *page_size = stp_get_string_parameter(v, "PageSize");
const stp_papersize_t *papersize = NULL;
if (page_size)
- papersize = stp_get_papersize_by_name(page_size);
+ papersize = stp_describe_papersize(v, page_size);
if (!papersize)
{
*width = 1;
@@ -2910,10 +2921,10 @@ escp2_media_size(const stp_vars_t *v, /* I */
}
if (*width == 0 || *height == 0)
{
- const input_slot_t *slot = stp_escp2_get_input_slot(v);
+ const input_slot_t *slot = stpi_escp2_get_input_slot(v);
if (slot && slot->is_cd)
{
- papersize = stp_get_papersize_by_name("CDCustom");
+ papersize = stp_describe_papersize(v, "CDCustom");
if (papersize)
{
if (*width == 0)
@@ -2924,11 +2935,13 @@ escp2_media_size(const stp_vars_t *v, /* I */
}
else
{
- int papersizes = stp_known_papersizes();
- int i;
- for (i = 0; i < papersizes; i++)
+ const stp_papersize_list_t *paper_sizes =
+ stpi_get_standard_papersize_list();
+ const stp_papersize_list_item_t *ptli =
+ stpi_papersize_list_get_start(paper_sizes);
+ while (ptli)
{
- papersize = stp_get_papersize_by_index(i);
+ papersize = stpi_paperlist_item_get_data(ptli);
if (verify_papersize(v, papersize))
{
if (*width == 0)
@@ -2937,9 +2950,11 @@ escp2_media_size(const stp_vars_t *v, /* I */
*height = papersize->height;
break;
}
+ ptli = stpi_paperlist_item_next(ptli);
}
}
}
+ /* FIXME When we support A4/letter */
if (*width == 0)
*width = 612;
if (*height == 0)
@@ -2966,9 +2981,9 @@ internal_imageable_area(const stp_vars_t *v, int use_paper_margins,
const input_slot_t *input_slot = NULL;
if (media_size)
- pt = stp_get_papersize_by_name(media_size);
+ pt = stp_describe_papersize(v, media_size);
- input_slot = stp_escp2_get_input_slot(v);
+ input_slot = stpi_escp2_get_input_slot(v);
if (input_slot)
{
cd = input_slot->is_cd;
@@ -3028,7 +3043,7 @@ internal_imageable_area(const stp_vars_t *v, int use_paper_margins,
right_margin = delta; /* positioned correctly */
if (width - right_margin - 3 > width_limit)
right_margin = width - width_limit - 3;
- if (! stp_escp2_has_cap(v, MODEL_ZEROMARGIN,
+ if (! stpi_escp2_has_cap(v, MODEL_ZEROMARGIN,
MODEL_ZEROMARGIN_H_ONLY))
{
top_margin = -7;
@@ -3039,7 +3054,7 @@ internal_imageable_area(const stp_vars_t *v, int use_paper_margins,
{
left_margin = 0;
right_margin = 0;
- if (! stp_escp2_has_cap(v, MODEL_ZEROMARGIN,
+ if (! stpi_escp2_has_cap(v, MODEL_ZEROMARGIN,
MODEL_ZEROMARGIN_H_ONLY))
{
top_margin = 0;
@@ -3105,7 +3120,7 @@ escp2_limit(const stp_vars_t *v, /* I */
static void
escp2_describe_resolution(const stp_vars_t *v, stp_resolution_t *x, stp_resolution_t *y)
{
- const res_t *res = stp_escp2_find_resolution(v);
+ const res_t *res = stpi_escp2_find_resolution(v);
if (res && verify_resolution(v, res))
{
*x = res->printed_hres;
@@ -3156,23 +3171,23 @@ escp2_describe_output(const stp_vars_t *v)
static int
escp2_has_advanced_command_set(const stp_vars_t *v)
{
- return (stp_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_PRO) ||
- stp_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_1999) ||
- stp_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_2000));
+ return (stpi_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_PRO) ||
+ stpi_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_1999) ||
+ stpi_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_2000));
}
static int
escp2_use_extended_commands(const stp_vars_t *v, int use_softweave)
{
- return (stp_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_PRO) ||
- (stp_escp2_has_cap(v, MODEL_VARIABLE_DOT, MODEL_VARIABLE_YES) &&
+ return (stpi_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_PRO) ||
+ (stpi_escp2_has_cap(v, MODEL_VARIABLE_DOT, MODEL_VARIABLE_YES) &&
use_softweave));
}
static int
set_raw_ink_type(stp_vars_t *v)
{
- const inklist_t *inks = stp_escp2_inklist(v);
+ const inklist_t *inks = stpi_escp2_inklist(v);
int ninktypes = inks->n_inks;
int i;
const char *channel_name = stp_get_string_parameter(v, "RawChannels");
@@ -3728,9 +3743,9 @@ setup_basic(stp_vars_t *v)
{
escp2_privdata_t *pd = get_privdata(v);
pd->advanced_command_set = escp2_has_advanced_command_set(v);
- pd->command_set = stp_escp2_get_cap(v, MODEL_COMMAND);
- pd->variable_dots = stp_escp2_has_cap(v, MODEL_VARIABLE_DOT, MODEL_VARIABLE_YES);
- pd->has_graymode = stp_escp2_has_cap(v, MODEL_GRAYMODE, MODEL_GRAYMODE_YES);
+ pd->command_set = stpi_escp2_get_cap(v, MODEL_COMMAND);
+ pd->variable_dots = stpi_escp2_has_cap(v, MODEL_VARIABLE_DOT, MODEL_VARIABLE_YES);
+ pd->has_graymode = stpi_escp2_has_cap(v, MODEL_GRAYMODE, MODEL_GRAYMODE_YES);
pd->preinit_sequence = escp2_preinit_sequence(v);
pd->preinit_remote_sequence = escp2_preinit_remote_sequence(v);
pd->deinit_remote_sequence = escp2_postinit_remote_sequence(v);
@@ -3743,11 +3758,11 @@ static void
setup_misc(stp_vars_t *v)
{
escp2_privdata_t *pd = get_privdata(v);
- pd->input_slot = stp_escp2_get_input_slot(v);
- pd->paper_type = stp_escp2_get_media_type(v, 0);
+ pd->input_slot = stpi_escp2_get_input_slot(v);
+ pd->paper_type = stpi_escp2_get_media_type(v, 0);
pd->ink_group = escp2_inkgroup(v);
pd->media_settings = stp_vars_create_copy(pd->paper_type->v);
- stp_escp2_set_media_size(pd->media_settings, v);
+ stpi_escp2_set_media_size(pd->media_settings, v);
if (stp_check_float_parameter(v, "PageDryTime", STP_PARAMETER_ACTIVE))
stp_set_float_parameter(pd->media_settings, "PageDryTime",
stp_get_float_parameter(v, "PageDryTime"));
@@ -3866,36 +3881,38 @@ lcm(unsigned a, unsigned b)
return a * b / gcd(a, b);
}
+/* XXX -- How do we handle 300 DPI base? */
static int
-adjusted_vertical_resolution(const res_t *res)
+adjusted_vertical_resolution(const stp_vars_t *v, const res_t *res)
{
- if (res->vres >= 720)
+ if (res->vres >= escp2_base_separation(v) * 2)
return res->vres;
- else if (res->hres >= 720) /* Special case 720x360 */
- return 720;
+ else if (res->hres >= escp2_base_separation(v) * 2) /* Special case 720x360 */
+ return escp2_base_separation(v) * 2;
else if (res->vres % 90 == 0)
return res->vres;
else
- return lcm(res->hres, res->vres);
+ return lcm(res->hres, res->vres); /* E. g. 360x240 => 720 */
}
static int
-adjusted_horizontal_resolution(const res_t *res)
+adjusted_horizontal_resolution(const stp_vars_t *v, const res_t *res)
{
+ /* XXX -- How do we handle 300 DPI base? */
if (res->vres % 90 == 0)
return res->hres;
else
- return lcm(res->hres, res->vres);
+ return lcm(res->hres, res->vres); /* E. g. 360x240 => 720 */
}
static void
setup_resolution(stp_vars_t *v)
{
escp2_privdata_t *pd = get_privdata(v);
- const res_t *res = stp_escp2_find_resolution(v);
+ const res_t *res = stpi_escp2_find_resolution(v);
- int vertical = adjusted_vertical_resolution(res);
- int horizontal = adjusted_horizontal_resolution(res);
+ int vertical = adjusted_vertical_resolution(v, res);
+ int horizontal = adjusted_horizontal_resolution(v, res);
pd->res = res;
pd->use_extended_commands =
@@ -3912,6 +3929,7 @@ setup_resolution(stp_vars_t *v)
}
else
{
+ /* Hard-coded values for older printers */
pd->unit_scale = 3600;
if (pd->res->hres <= 720)
pd->micro_units = vertical;
@@ -3920,8 +3938,8 @@ setup_resolution(stp_vars_t *v)
pd->horizontal_units = vertical;
}
/* Note hard-coded 1440 -- from Epson manuals */
- if (stp_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_1999) &&
- stp_escp2_has_cap(v, MODEL_VARIABLE_DOT, MODEL_VARIABLE_NO))
+ if (stpi_escp2_has_cap(v, MODEL_COMMAND, MODEL_COMMAND_1999) &&
+ stpi_escp2_has_cap(v, MODEL_VARIABLE_DOT, MODEL_VARIABLE_NO))
pd->micro_units = 1440;
pd->vertical_units = vertical;
pd->page_management_units = vertical;
@@ -4010,7 +4028,7 @@ setup_head_parameters(stp_vars_t *v)
if (stp_check_int_parameter(v, "BandEnhancement", STP_PARAMETER_ACTIVE))
pd->extra_vertical_passes =
1 << stp_get_int_parameter(v, "BandEnhancement");
- if (stp_escp2_has_cap(v, MODEL_FAST_360, MODEL_FAST_360_YES) &&
+ if (stpi_escp2_has_cap(v, MODEL_FAST_360, MODEL_FAST_360_YES) &&
(pd->inkname->inkset == INKSET_CMYK || pd->physical_channels == 1) &&
pd->res->hres == pd->physical_xdpi && pd->res->vres == 360)
pd->use_fast_360 = 1;
@@ -4081,7 +4099,7 @@ static void
setup_page(stp_vars_t *v)
{
escp2_privdata_t *pd = get_privdata(v);
- const input_slot_t *input_slot = stp_escp2_get_input_slot(v);
+ const input_slot_t *input_slot = stpi_escp2_get_input_slot(v);
stp_dimension_t extra_left = 0;
stp_dimension_t extra_top = 0;
stp_dimension_t hub_size = 0;
@@ -4116,7 +4134,7 @@ setup_page(stp_vars_t *v)
/* Don't use full bleed mode if the paper itself has a margin */
if (pd->page_left > 0 || pd->page_top > 0)
stp_set_boolean_parameter(v, "FullBleed", 0);
- if (stp_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_FULL) &&
+ if (stpi_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_FULL) &&
((!input_slot || !(input_slot->is_cd))))
{
pd->page_extra_height =
@@ -4127,7 +4145,7 @@ setup_page(stp_vars_t *v)
else
pd->paper_extra_bottom = escp2_paper_extra_bottom(v);
}
- else if (stp_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_YES) &&
+ else if (stpi_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_YES) &&
(stp_get_boolean_parameter(v, "FullBleed")) &&
((!input_slot || !(input_slot->is_cd))))
{
@@ -4136,14 +4154,14 @@ setup_page(stp_vars_t *v)
escp2_zero_margin_offset(v) * pd->page_management_units /
escp2_base_separation(v);
}
- else if (stp_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_RESTR) &&
+ else if (stpi_escp2_has_cap(v, MODEL_ZEROMARGIN, MODEL_ZEROMARGIN_RESTR) &&
(stp_get_boolean_parameter(v, "FullBleed")) &&
((!input_slot || !(input_slot->is_cd))))
{
pd->paper_extra_bottom = 0;
pd->page_extra_height = 0;
}
- else if (stp_escp2_printer_supports_duplex(v) && !pd->duplex)
+ else if (stpi_escp2_printer_supports_duplex(v) && !pd->duplex)
{
pd->paper_extra_bottom = escp2_paper_extra_bottom(v);
pd->page_extra_height =
@@ -4456,7 +4474,22 @@ escp2_do_print(stp_vars_t *v, stp_image_t *image, int print_op)
int i;
escp2_privdata_t *pd;
- int page_number = stp_get_int_parameter(v, "PageNumber");
+
+ if (strcmp(stp_get_string_parameter(v, "PrintingMode"), "BW") == 0 &&
+ (stp_get_string_parameter(v, "InkType") &&
+ (strcmp(stp_get_string_parameter(v, "InkType"), "RGB") == 0 ||
+ strcmp(stp_get_string_parameter(v, "InkType"), "CMY") == 0 ||
+ strcmp(stp_get_string_parameter(v, "InkType"), "CMYRB") == 0 ||
+ strcmp(stp_get_string_parameter(v, "InkType"), "CMYRBG") == 0 ||
+ strcmp(stp_get_string_parameter(v, "InkType"), "CMYRO") == 0 ||
+ strcmp(stp_get_string_parameter(v, "InkType"), "CMYROG") == 0 ||
+ strcmp(stp_get_string_parameter(v, "InkType"), "PhotoCMY") == 0 ||
+ strcmp(stp_get_string_parameter(v, "InkType"), "RGBG") == 0)))
+ {
+ stp_eprintf(v, "Warning: Inkset %s not available in BW\n",
+ stp_get_string_parameter(v, "InkType"));
+ stp_set_string_parameter(v, "InkType", "CMYK");
+ }
if (!stp_verify(v))
{
@@ -4467,6 +4500,7 @@ escp2_do_print(stp_vars_t *v, stp_image_t *image, int print_op)
if (strcmp(stp_get_string_parameter(v, "InputImageType"), "Raw") == 0 &&
!set_raw_ink_type(v))
return 0;
+ int page_number = stp_get_int_parameter(v, "PageNumber");
pd = (escp2_privdata_t *) stp_zalloc(sizeof(escp2_privdata_t));
@@ -4475,7 +4509,7 @@ escp2_do_print(stp_vars_t *v, stp_image_t *image, int print_op)
pd->last_pass_offset = 0;
pd->last_pass = -1;
pd->send_zero_pass_advance =
- stp_escp2_has_cap(v, MODEL_SEND_ZERO_ADVANCE, MODEL_SEND_ZERO_ADVANCE_YES);
+ stpi_escp2_has_cap(v, MODEL_SEND_ZERO_ADVANCE, MODEL_SEND_ZERO_ADVANCE_YES);
stp_allocate_component_data(v, "Driver", NULL, NULL, pd);
pd->inkname = get_inktype(v);
@@ -4554,10 +4588,11 @@ escp2_print(const stp_vars_t *v, stp_image_t *image)
stp_vars_t *nv = stp_vars_create_copy(v);
int op = OP_JOB_PRINT;
int status;
+
if (!stp_get_string_parameter(v, "JobMode") ||
strcmp(stp_get_string_parameter(v, "JobMode"), "Page") == 0)
op = OP_JOB_START | OP_JOB_PRINT | OP_JOB_END;
- stp_prune_inactive_options(nv);
+
status = escp2_do_print(nv, image, op);
stp_vars_destroy(nv);
return status;
@@ -4568,7 +4603,6 @@ escp2_job_start(const stp_vars_t *v, stp_image_t *image)
{
stp_vars_t *nv = stp_vars_create_copy(v);
int status;
- stp_prune_inactive_options(nv);
status = escp2_do_print(nv, image, OP_JOB_START);
stp_vars_destroy(nv);
return status;
@@ -4579,7 +4613,6 @@ escp2_job_end(const stp_vars_t *v, stp_image_t *image)
{
stp_vars_t *nv = stp_vars_create_copy(v);
int status;
- stp_prune_inactive_options(nv);
status = escp2_do_print(nv, image, OP_JOB_END);
stp_vars_destroy(nv);
return status;
@@ -4599,7 +4632,8 @@ static const stp_printfuncs_t print_escp2_printfuncs =
stp_verify_printer_params,
escp2_job_start,
escp2_job_end,
- NULL
+ NULL,
+ stpi_standard_describe_papersize
};
static stp_family_t print_escp2_module_data =
@@ -4621,14 +4655,14 @@ print_escp2_module_init(void)
"</sequence>\n"
"</curve>\n"
"</gutenprint>");
- return stp_family_register(print_escp2_module_data.printer_list);
+ return stpi_family_register(print_escp2_module_data.printer_list);
}
static int
print_escp2_module_exit(void)
{
- return stp_family_unregister(print_escp2_module_data.printer_list);
+ return stpi_family_unregister(print_escp2_module_data.printer_list);
}
diff --git a/src/main/print-escp2.h b/src/main/print-escp2.h
index 3f4bfa9..9f771e1 100644
--- a/src/main/print-escp2.h
+++ b/src/main/print-escp2.h
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GUTENPRINT_INTERNAL_ESCP2_H
@@ -457,42 +456,40 @@ typedef struct escp2_printer
/* From escp2-channels.c: */
extern const inkname_t *stpi_escp2_get_default_black_inkset(void);
-extern int stp_escp2_load_inkgroup(const stp_vars_t *v, const char *name);
+extern int stpi_escp2_load_inkgroup(const stp_vars_t *v, const char *name);
/* From escp2-papers.c: */
-extern int stp_escp2_load_media(const stp_vars_t *v, const char *name);
-extern int stp_escp2_has_media_feature(const stp_vars_t *v, const char *name);
-extern const paper_t *stp_escp2_get_default_media_type(const stp_vars_t *v);
-extern const paper_t *stp_escp2_get_media_type(const stp_vars_t *v, int ignore_res);
-extern int stp_escp2_printer_supports_rollfeed(const stp_vars_t *v);
-extern int stp_escp2_printer_supports_print_to_cd(const stp_vars_t *v);
-extern int stp_escp2_printer_supports_duplex(const stp_vars_t *v);
+extern int stpi_escp2_load_media(const stp_vars_t *v, const char *name);
+extern int stpi_escp2_has_media_feature(const stp_vars_t *v, const char *name);
+extern const paper_t *stpi_escp2_get_default_media_type(const stp_vars_t *v);
+extern const paper_t *stpi_escp2_get_media_type(const stp_vars_t *v, int ignore_res);
+extern int stpi_escp2_printer_supports_rollfeed(const stp_vars_t *v);
+extern int stpi_escp2_printer_supports_print_to_cd(const stp_vars_t *v);
+extern int stpi_escp2_printer_supports_duplex(const stp_vars_t *v);
-extern int stp_escp2_load_input_slots(const stp_vars_t *v, const char *name);
-extern const input_slot_t *stp_escp2_get_input_slot(const stp_vars_t *v);
+extern int stpi_escp2_load_input_slots(const stp_vars_t *v, const char *name);
+extern const input_slot_t *stpi_escp2_get_input_slot(const stp_vars_t *v);
-extern int stp_escp2_load_media_sizes(const stp_vars_t *v, const char *name);
-extern void stp_escp2_set_media_size(stp_vars_t *v, const stp_vars_t *src);
+extern int stpi_escp2_load_media_sizes(const stp_vars_t *v, const char *name);
+extern void stpi_escp2_set_media_size(stp_vars_t *v, const stp_vars_t *src);
/* From escp2-resolutions.c: */
-extern int stp_escp2_load_resolutions(const stp_vars_t *v, const char *name);
-extern int stp_escp2_load_resolutions_from_xml(const stp_vars_t *v, stp_mxml_node_t *node);
-extern int stp_escp2_load_printer_weaves(const stp_vars_t *v, const char *name);
-extern int stp_escp2_load_printer_weaves_from_xml(const stp_vars_t *v, stp_mxml_node_t *node);
-extern int stp_escp2_load_quality_presets(const stp_vars_t *v, const char *name);
-extern int stp_escp2_load_quality_presets_from_xml(const stp_vars_t *v, stp_mxml_node_t *node);
+extern int stpi_escp2_load_resolutions(const stp_vars_t *v, const char *name,
+ stp_mxml_node_t *node);
+extern int stpi_escp2_load_printer_weaves(const stp_vars_t *v, const char *name);
+extern int stpi_escp2_load_quality_presets(const stp_vars_t *v, const char *name);
/* From print-escp2.c: */
-extern const res_t *stp_escp2_find_resolution(const stp_vars_t *v);
-extern const inklist_t *stp_escp2_inklist(const stp_vars_t *v);
+extern const res_t *stpi_escp2_find_resolution(const stp_vars_t *v);
+extern const inklist_t *stpi_escp2_inklist(const stp_vars_t *v);
/* From print-escp2-data.c: */
-extern void stp_escp2_load_model(const stp_vars_t *v, int model);
-extern stpi_escp2_printer_t *stp_escp2_get_printer(const stp_vars_t *v);
-extern model_featureset_t stp_escp2_get_cap(const stp_vars_t *v,
- escp2_model_option_t feature);
-extern int stp_escp2_has_cap(const stp_vars_t *v, escp2_model_option_t feature,
- model_featureset_t class);
+extern void stpi_escp2_load_model(const stp_vars_t *v, int model);
+extern stpi_escp2_printer_t *stpi_escp2_get_printer(const stp_vars_t *v);
+extern model_featureset_t stpi_escp2_get_cap(const stp_vars_t *v,
+ escp2_model_option_t feature);
+extern int stpi_escp2_has_cap(const stp_vars_t *v, escp2_model_option_t feature,
+ model_featureset_t class);
typedef struct
diff --git a/src/main/print-lexmark.c b/src/main/print-lexmark.c
index 6c9df76..4672df9 100644
--- a/src/main/print-lexmark.c
+++ b/src/main/print-lexmark.c
@@ -21,8 +21,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -809,14 +808,14 @@ static int model_to_index(int model)
static const lexmark_cap_t *
-lexmark_get_model_capabilities(int model)
+lexmark_get_model_capabilities(const stp_vars_t *v, int model)
{
int i = model_to_index(model);
if (i != -1) {
return &(lexmark_model_capabilities[i]);
}
- stp_deprintf(STP_DBG_LEXMARK,
+ stp_dprintf(STP_DBG_LEXMARK, v,
"lexmark: model %d not found in capabilities list.\n",model);
return &(lexmark_model_capabilities[0]);
}
@@ -953,7 +952,7 @@ get_media_type(const char *name, const lexmark_cap_t * caps)
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wpedantic"
static inline int
-lexmark_source_type(const char *name, const lexmark_cap_t * caps)
+lexmark_source_type(const stp_vars_t *v, const char *name, const lexmark_cap_t * caps)
{
if (name)
{
@@ -962,7 +961,7 @@ lexmark_source_type(const char *name, const lexmark_cap_t * caps)
if (!strcmp(name,"ManualNP")) return 1;
}
- stp_deprintf(STP_DBG_LEXMARK,
+ stp_dprintf(STP_DBG_LEXMARK, v,
"lexmark: Unknown source type '%s' - reverting to auto\n",name);
return 4;
@@ -975,7 +974,8 @@ lexmark_source_type(const char *name, const lexmark_cap_t * caps)
lexmark_head_offset
*******************************/
static const lexmark_lineoff_t *
-lexmark_head_offset(int ydpi, /* i */
+lexmark_head_offset(const stp_vars_t *v,
+ int ydpi, /* i */
const char *ink_type, /* i */
const lexmark_cap_t * caps, /* i */
const lexmark_inkparam_t *ink_parameter, /* i */
@@ -983,7 +983,7 @@ lexmark_head_offset(int ydpi, /* i */
{
int i;
- stp_deprintf(STP_DBG_LEXMARK, " size %d, size_v %d, size_v[0] %d\n", (int)sizeof(*lineoff_buffer), (int)sizeof(lineoff_buffer->v), (int)sizeof(lineoff_buffer->v[0]));
+ stp_dprintf(STP_DBG_LEXMARK, v, " size %d, size_v %d, size_v[0] %d\n", (int)sizeof(*lineoff_buffer), (int)sizeof(lineoff_buffer->v), (int)sizeof(lineoff_buffer->v[0]));
memcpy(lineoff_buffer, ink_parameter->head_offset, sizeof(*lineoff_buffer));
for (i=0; i < (sizeof(lineoff_buffer->v) / sizeof(lineoff_buffer->v[0])); i++) {
@@ -1002,7 +1002,7 @@ lexmark_size_type
static unsigned char
lexmark_size_type(const stp_vars_t *v, const lexmark_cap_t * caps)
{
- const stp_papersize_t *pp = stp_get_papersize_by_size(stp_get_page_height(v),
+ const stp_papersize_t *pp = stpi_get_papersize_by_size(v, stp_get_page_height(v),
stp_get_page_width(v));
if (pp)
{
@@ -1043,9 +1043,9 @@ static int lexmark_get_phys_resolution_horizontal(int model)
#endif
static const lexmark_res_t
-*lexmark_get_resolution_para(int model, const char *resolution)
+*lexmark_get_resolution_para(const stp_vars_t *v, int model, const char *resolution)
{
- const lexmark_cap_t * caps= lexmark_get_model_capabilities(model);
+ const lexmark_cap_t * caps= lexmark_get_model_capabilities(v, model);
const lexmark_res_t *res = *(caps->res_parameters); /* get the resolution specific parameters of printer */
@@ -1062,15 +1062,15 @@ static const lexmark_res_t
res++;
}
}
- stp_deprintf(STP_DBG_LEXMARK, "lexmark_get_resolution_para: resolution not found (%s)\n", resolution);
+ stp_dprintf(STP_DBG_LEXMARK, v, "lexmark_get_resolution_para: resolution not found (%s)\n", resolution);
return NULL;
}
static int
-lexmark_print_bidirectional(int model, const char *resolution)
+lexmark_print_bidirectional(const stp_vars_t *v, int model, const char *resolution)
{
- const lexmark_res_t *res_para = lexmark_get_resolution_para(model, resolution);
+ const lexmark_res_t *res_para = lexmark_get_resolution_para(v, model, resolution);
return !res_para->unidirectional;
}
@@ -1099,7 +1099,7 @@ lexmark_describe_resolution(const stp_vars_t *v,
{
const char *resolution = stp_get_string_parameter(v, "Resolution");
const lexmark_res_t *res =
- lexmark_get_resolution_para(stp_get_model_id(v), resolution);
+ lexmark_get_resolution_para(v, stp_get_model_id(v), resolution);
if (res)
{
@@ -1149,7 +1149,7 @@ lexmark_describe_output(const stp_vars_t *v)
{
int printing_color = 0;
int model = stp_get_model_id(v);
- const lexmark_cap_t *caps = lexmark_get_model_capabilities(model);
+ const lexmark_cap_t *caps = lexmark_get_model_capabilities(v, model);
const char *print_mode = stp_get_string_parameter(v, "PrintingMode");
const char *ink_type = stp_get_string_parameter(v, "InkType");
const lexmark_inkparam_t *ink_parameter;
@@ -1174,7 +1174,7 @@ lexmark_parameters(const stp_vars_t *v, const char *name,
{
int i;
- const lexmark_cap_t * caps= lexmark_get_model_capabilities(stp_get_model_id(v));
+ const lexmark_cap_t * caps= lexmark_get_model_capabilities(v, stp_get_model_id(v));
description->p_type = STP_PARAMETER_TYPE_INVALID;
if (name == NULL)
@@ -1202,7 +1202,9 @@ lexmark_parameters(const stp_vars_t *v, const char *name,
{
unsigned int height_limit, width_limit;
unsigned int min_height_limit, min_width_limit;
- int papersizes = stp_known_papersizes();
+ const stp_papersize_list_t *paper_sizes = stpi_get_standard_papersize_list();
+ const stp_papersize_list_item_t *ptli =
+ stpi_papersize_list_get_start(paper_sizes);
description->bounds.str = stp_string_list_create();
width_limit = caps->max_paper_width;
@@ -1210,23 +1212,25 @@ lexmark_parameters(const stp_vars_t *v, const char *name,
min_width_limit = caps->min_paper_width;
min_height_limit = caps->min_paper_height;
- for (i = 0; i < papersizes; i++) {
- const stp_papersize_t *pt = stp_get_papersize_by_index(i);
+ while (ptli)
+ {
+ const stp_papersize_t *pt = stpi_paperlist_item_get_data(ptli);
- if (pt->paper_size_type != PAPERSIZE_TYPE_STANDARD &&
- pt->paper_size_type != PAPERSIZE_TYPE_ENVELOPE)
- continue;
+ if (pt->paper_size_type == PAPERSIZE_TYPE_STANDARD ||
+ pt->paper_size_type == PAPERSIZE_TYPE_ENVELOPE) {
- if (strlen(pt->name) > 0 &&
- pt->width <= width_limit && pt->height <= height_limit &&
- (pt->height >= min_height_limit || pt->height == 0) &&
- (pt->width >= min_width_limit || pt->width == 0))
- {
- if (stp_string_list_count(description->bounds.str) == 0)
- description->deflt.str = pt->name;
- stp_string_list_add_string(description->bounds.str,
- pt->name, gettext(pt->text));
+ if (strlen(pt->name) > 0 &&
+ pt->width <= width_limit && pt->height <= height_limit &&
+ (pt->height >= min_height_limit || pt->height == 0) &&
+ (pt->width >= min_width_limit || pt->width == 0))
+ {
+ if (stp_string_list_count(description->bounds.str) == 0)
+ description->deflt.str = pt->name;
+ stp_string_list_add_string(description->bounds.str,
+ pt->name, gettext(pt->text));
+ }
}
+ ptli = stpi_paperlist_item_next(ptli);
}
}
else if (strcmp(name, "Resolution") == 0)
@@ -1321,11 +1325,11 @@ internal_imageable_area(const stp_vars_t *v, /* I */
const char *media_size = stp_get_string_parameter(v, "PageSize");
const stp_papersize_t *pt = NULL;
const lexmark_cap_t *caps =
- lexmark_get_model_capabilities(stp_get_model_id(v));
+ lexmark_get_model_capabilities(v, stp_get_model_id(v));
if (media_size && use_paper_margins)
- pt = stp_get_papersize_by_name(media_size);
+ pt = stp_describe_papersize(v, media_size);
stp_default_media_size(v, &width, &length);
if (pt)
@@ -1363,7 +1367,7 @@ lexmark_limit(const stp_vars_t *v, /* I */
stp_dimension_t *min_width,
stp_dimension_t *min_height)
{
- const lexmark_cap_t * caps= lexmark_get_model_capabilities(stp_get_model_id(v));
+ const lexmark_cap_t * caps= lexmark_get_model_capabilities(v, stp_get_model_id(v));
*width = caps->max_paper_width;
*height = caps->max_paper_height;
*min_width = caps->min_paper_width;
@@ -1442,7 +1446,7 @@ lexmark_init_printer(const stp_vars_t *v, const lexmark_cap_t * caps,
break;
default:
- stp_erprintf("Unknown printer !! %i\n", caps->model);
+ stp_eprintf(v, "Unknown printer !! %i\n", caps->model);
return 0;
}
@@ -1657,14 +1661,12 @@ lexmark_do_print(stp_vars_t *v, stp_image_t *image)
stp_dimension_t top = stp_get_top(v);
stp_dimension_t left = stp_get_left(v);
- const lexmark_cap_t * caps= lexmark_get_model_capabilities(model);
+ const lexmark_cap_t * caps= lexmark_get_model_capabilities(v, model);
const lexmark_res_t *res_para_ptr =
- lexmark_get_resolution_para(model, resolution);
+ lexmark_get_resolution_para(v, model, resolution);
const paper_t *media = get_media_type(media_type,caps);
const lexmark_inkparam_t *ink_parameter;
- stp_prune_inactive_options(v);
-
#ifdef DEBUG
dbgfileprn = lex_open_tmp_file(); /* open file with xx */
#endif
@@ -1893,7 +1895,7 @@ densityDivisor /= 1.2;
/* initialize soft weaving */
privdata.ink_parameter = ink_parameter;
- privdata.bidirectional = lexmark_print_bidirectional(model, resolution);
+ privdata.bidirectional = lexmark_print_bidirectional(v, model, resolution);
privdata.outbuf = stp_malloc((((((pass_length/8)*11))+40) * out_width)+2000);
privdata.direction = 0;
stp_allocate_component_data(v, "Driver", NULL, NULL, &privdata);
@@ -1912,7 +1914,7 @@ densityDivisor /= 1.2;
((top * ydpi) / 72)+(((caps->offset_top_border+add_top_offset)*ydpi)
/caps->y_raster_res),
(page_height * ydpi) / 72,
- (const int *) lexmark_head_offset(ydpi, ink_type, caps, ink_parameter, &lineoff_buffer),
+ (const int *) lexmark_head_offset(v, ydpi, ink_type, caps, ink_parameter, &lineoff_buffer),
STP_WEAVE_ZIGZAG, /* weave_strategy */
flush_pass,
stp_fill_uncompressed, /* fill_start */
@@ -2182,7 +2184,8 @@ static const stp_printfuncs_t print_lexmark_printfuncs =
stp_verify_printer_params,
NULL,
NULL,
- NULL
+ NULL,
+ stpi_standard_describe_papersize
};
@@ -2195,7 +2198,8 @@ static const stp_printfuncs_t print_lexmark_printfuncs =
the pixels of the image could be printed.
*/
static unsigned char *
-lexmark_init_line(int mode, unsigned char *prnBuf,
+lexmark_init_line(const stp_vars_t *v,
+ int mode, unsigned char *prnBuf,
int pass_length,
int offset, /* offset from left in 1/"x_raster_res" DIP (printer resolution)*/
int width, int direction,
@@ -2210,7 +2214,7 @@ lexmark_init_line(int mode, unsigned char *prnBuf,
int header_size = 0;
- /* stp_erprintf("#### width %d, length %d, pass_length %d\n", width, length, pass_length);*/
+ /* stp_eprintf(v, "#### width %d, length %d, pass_length %d\n", width, length, pass_length);*/
/* first, we write the line header */
switch(caps->model) {
case m_z52:
@@ -2228,7 +2232,7 @@ lexmark_init_line(int mode, unsigned char *prnBuf,
/* K could only be present if black is printed only. */
if ((mode & COLOR_MODE_K) || (mode & (COLOR_MODE_K | COLOR_MODE_LC | COLOR_MODE_LM))) {
- stp_deprintf(STP_DBG_LEXMARK, "set photo/black cartridge \n");
+ stp_dprintf(STP_DBG_LEXMARK, v, "set photo/black cartridge \n");
prnBuf[LX_Z52_COLOR_MODE_POS] = LX_Z52_BLACK_PRINT;
if (direction) {
@@ -2236,7 +2240,7 @@ lexmark_init_line(int mode, unsigned char *prnBuf,
offset += ink_parameter->h_direction_offset;
}
} else {
- stp_deprintf(STP_DBG_LEXMARK, "set color cartridge \n");
+ stp_dprintf(STP_DBG_LEXMARK, v, "set color cartridge \n");
prnBuf[LX_Z52_COLOR_MODE_POS] = LX_Z52_COLOR_PRINT;
if (direction) {
@@ -2380,7 +2384,7 @@ lexmark_init_line(int mode, unsigned char *prnBuf,
break;
case m_lex7500:
- stp_erprintf("Lexmark 7500 not supported !\n");
+ stp_eprintf(v, "Lexmark 7500 not supported !\n");
return NULL;
break;
}
@@ -2466,7 +2470,7 @@ lexmark_write(const stp_vars_t *v, /* I - Print file or command */
xIter = -1;
}
- p = lexmark_init_line(mode, prnBuf, pass_length, offset, rwidth,
+ p = lexmark_init_line(v, mode, prnBuf, pass_length, offset, rwidth,
direction, /* direction */
ink_parameter, caps);
@@ -2648,7 +2652,7 @@ const stp_vars_t *lex_open_tmp_file() {
const stp_vars_t *ofile;
char tmpstr[256];
- stp_erprintf(" create file !\n");
+ stp_eprintf(v, " create file !\n");
for (i=0, sprintf(tmpstr, "/tmp/xx%d.prn", i), ofile = fopen(tmpstr, "r");
ofile != NULL;
i++, sprintf(tmpstr, "/tmp/xx%d.prn", i), ofile = fopen(tmpstr, "r")) {
@@ -2657,14 +2661,14 @@ const stp_vars_t *lex_open_tmp_file() {
fclose(ofile);
}
}
- stp_erprintf("Create file %s !\n", tmpstr);
+ stp_eprintf(v, "Create file %s !\n", tmpstr);
ofile = fopen(tmpstr, "wb");
STPI_ASSERT(ofile);
return ofile;
}
void lex_tmp_file_deinit(const stp_vars_t *file) {
- stp_erprintf("Close file %lx\n", file);
+ stp_eprintf(v, "Close file %lx\n", file);
fclose(file);
}
@@ -2697,7 +2701,7 @@ flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
int prn_mode;
int j; /* color counter */
- const lexmark_cap_t * caps= lexmark_get_model_capabilities(model);
+ const lexmark_cap_t * caps= lexmark_get_model_capabilities(v, model);
int paperShift;
Lexmark_head_colors head_colors[3]={{0, NULL, 0, 64/2, 64},
{0, NULL, 64/2, 128/2, 64},
@@ -2731,7 +2735,7 @@ flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
paperShift = (pass->logicalpassstart - pd->last_pass_offset) * (caps->y_raster_res/ydpi);
for (j = 0; j < pd->ncolors; j++)
stp_dprintf(STP_DBG_LEXMARK, v, "Color %d: active %d line %p jets %d offset %ld\n",
- j, lineactive[0].v[j], bufs[0].v[j], linecount[0].v[j],
+ j, lineactive[0].v[j], (void *)bufs[0].v[j], linecount[0].v[j],
lineoffs[0].v[j]);
/*** do we have to print something with the color cartridge ? ***/
@@ -2900,7 +2904,7 @@ flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
linecount[0].v[j] = 0;
}
- stp_deprintf(STP_DBG_LEXMARK, "lexmark_write finished\n");
+ stp_dprintf(STP_DBG_LEXMARK, v, "lexmark_write finished\n");
}
@@ -2928,10 +2932,10 @@ static void testprint(testdata *td)
fscanf(td->ifile, "%[^{]{%[^\"]\"%d %d %d %d\",", dummy1, dummy2, &(td->x), &(td->y), &(td->cols), &(td->deep));
td->cols -= 1; /* we reduce it by one because fist color will be ignored */
td->input_line = (char *)stp_malloc(td->x+10);
- stp_erprintf("<%s> <%s>\n", dummy1, dummy2);
- stp_erprintf("%d %d %d %d\n", td->x, td->y, td->cols, td->deep);
+ stp_eprintf(v, "<%s> <%s>\n", dummy1, dummy2);
+ stp_eprintf(v, "%d %d %d %d\n", td->x, td->y, td->cols, td->deep);
if (td->cols > 16) {
- stp_erprintf("too many colors !!\n");
+ stp_eprintf(v, "too many colors !!\n");
return;
}
@@ -2939,7 +2943,7 @@ static void testprint(testdata *td)
fscanf(td->ifile, "%[^\"]\"%c c %[^\"]\",", dummy1, dummy2, dummy2); /* jump over first color */
for (icol=0; icol < td->cols; icol++) { /* we ignore the first color. It is "no dot". */
fscanf(td->ifile, "%[^\"]\"%c c %[^\"]\",", dummy1, &(td->colchar[icol]), dummy2);
- stp_erprintf("colchar %d <%c>\n", i, td->colchar[icol]);
+ stp_eprintf(v, "colchar %d <%c>\n", i, td->colchar[icol]);
}
@@ -2958,7 +2962,7 @@ static void testprint(testdata *td)
linebufs.v[0] = (char *)stp_malloc((td->x+7)/8); /* allocate the color */
}
} else {
- stp_erprintf("can't open file !\n");
+ stp_eprintf(v, "can't open file !\n");
}
}
@@ -2968,13 +2972,13 @@ static void readtestprintline(testdata *td, lexmark_linebufs_t *linebufs)
char dummy1[256];
int icol, ix;
- stp_erprintf("start readtestprintline\n");
+ stp_eprintf(v, "start readtestprintline\n");
for (icol=0; icol < 7; icol++) {
if (linebufs->v[icol] != NULL) {
memset(linebufs->v[icol], 0, (td->x+7)/8); /* clean line */
}
}
- stp_erprintf("1 readtestprintline cols %d\n", td->cols);
+ stp_eprintf(v, "1 readtestprintline cols %d\n", td->cols);
fscanf(td->ifile, "%[^\"]\"%[^\"]\",", dummy1, td->input_line);
@@ -2993,7 +2997,7 @@ static void readtestprintline(testdata *td, lexmark_linebufs_t *linebufs)
}
}
}
- /* stp_erprintf("pixchar <%s><%s>\n",dummy1, td->input_line);*/
+ /* stp_eprintf(v, "pixchar <%s><%s>\n",dummy1, td->input_line);*/
}
#endif
@@ -3008,14 +3012,14 @@ static stp_family_t print_lexmark_module_data =
static int
print_lexmark_module_init(void)
{
- return stp_family_register(print_lexmark_module_data.printer_list);
+ return stpi_family_register(print_lexmark_module_data.printer_list);
}
static int
print_lexmark_module_exit(void)
{
- return stp_family_unregister(print_lexmark_module_data.printer_list);
+ return stpi_family_unregister(print_lexmark_module_data.printer_list);
}
diff --git a/src/main/print-list.c b/src/main/print-list.c
index 8ea2c0f..5a0ea5b 100644
--- a/src/main/print-list.c
+++ b/src/main/print-list.c
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -48,20 +47,20 @@ struct stp_list_item
/** The internal representation of an stp_list_t list. */
struct stp_list
{
- int index_cache; /*!< Cached node index */
struct stp_list_item *start; /*!< Start node */
struct stp_list_item *end; /*!< End node */
struct stp_list_item *index_cache_node; /*!< Cached node (for index) */
- int length; /*!< Number of nodes */
+ char *name_cache; /*!< Cached name */
+ struct stp_list_item *name_cache_node; /*!< Cached node (for name) */
+ char *long_name_cache; /*!< Cached long name */
+ struct stp_list_item *long_name_cache_node; /*!< Cached node (for long name) */
stp_node_freefunc freefunc; /*!< Callback to free node data */
stp_node_copyfunc copyfunc; /*!< Callback to copy node */
stp_node_namefunc namefunc; /*!< Callback to get node name */
stp_node_namefunc long_namefunc; /*!< Callback to get node long name */
stp_node_sortfunc sortfunc; /*!< Callback to compare (sort) nodes */
- char *name_cache; /*!< Cached name */
- struct stp_list_item *name_cache_node; /*!< Cached node (for name) */
- char *long_name_cache; /*!< Cached long name */
- struct stp_list_item *long_name_cache_node; /*!< Cached node (for long name) */
+ int index_cache; /*!< Cached node index */
+ int length; /*!< Number of nodes */
};
/**
@@ -252,7 +251,34 @@ stp_list_get_item_by_index(const stp_list_t *list, int idx)
if (idx >= list->length)
return NULL;
- /* see if using the cache is worthwhile */
+ /*
+ * Optimize the most likely cases of looking for the same, next,
+ * or previou item
+ * */
+ if (ulist->index_cache_node)
+ {
+ if (idx == ulist->index_cache)
+ return ulist->index_cache_node;
+ else if (idx == ulist->index_cache + 1)
+ {
+ ulist->index_cache = idx;
+ ulist->index_cache_node = ulist->index_cache_node->next;
+ return ulist->index_cache_node;
+ }
+ else if (idx == ulist->index_cache - 1)
+ {
+ ulist->index_cache = idx;
+ ulist->index_cache_node = ulist->index_cache_node->prev;
+ return ulist->index_cache_node;
+ }
+ }
+ /*
+ * See if using the cache is worthwhile. If the desired index is closer
+ * to the cached index than it is to the start or end, it will be faster
+ * to start from the cached element.
+ *
+ * Otherwise, decide which direction is best to start from.
+ */
if (list->index_cache)
{
if (idx < (list->length/2))
@@ -272,8 +298,8 @@ stp_list_get_item_by_index(const stp_list_t *list, int idx)
}
}
-
- if (c) /* use the cached index and node */
+ /* use the cached index and node */
+ if (c)
{
if (idx > list->index_cache) /* forward */
d = 0;
@@ -585,28 +611,6 @@ stp_list_item_create(stp_list_t *list,
lnn = lnn->prev;
}
}
-#if 0
- /*
- * This code #ifdef'ed out by Robert Krawitz on April 3, 2004.
- * Setting a debug variable should not result in taking a materially
- * different code path.
- */
- else if (stpi_get_debug_level() & STPI_DBG_LIST)
- {
- if (next)
- {
- lnn = list->start;
- while (lnn)
- {
- if (lnn == next)
- break;
- lnn = lnn->prev;
- }
- }
- else
- lnn = NULL;
- }
-#endif
else
lnn = next;
@@ -675,14 +679,14 @@ stp_list_item_destroy(stp_list_t *list, stp_list_item_t *item)
return 0;
}
-/* get previous node */
+/* get previous node, but don't update the cache */
stp_list_item_t *
stp_list_item_prev(const stp_list_item_t *item)
{
return item->prev;
}
-/* get next node */
+/* get next node, but don't update the cache */
stp_list_item_t *
stp_list_item_next(const stp_list_item_t *item)
{
diff --git a/src/main/print-papers.c b/src/main/print-papers.c
index b5fb1e7..c457295 100644
--- a/src/main/print-papers.c
+++ b/src/main/print-papers.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -37,109 +36,129 @@
#endif
#include <string.h>
#include <stdlib.h>
+#include <sys/param.h>
-static stp_list_t *paper_list = NULL;
+typedef struct
+{
+ char *name;
+ stp_papersize_list_t *list;
+} papersize_list_impl_t;
+
+static stp_list_t *list_of_papersize_lists = NULL;
static void
-stpi_paper_freefunc(void *item)
+papersize_list_impl_freefunc(void *item)
+{
+ papersize_list_impl_t *papersize_list = (papersize_list_impl_t *) item;
+ stp_list_destroy(papersize_list->list);
+ STP_SAFE_FREE(papersize_list->name);
+ STP_SAFE_FREE(papersize_list);
+}
+
+static const char *
+papersize_list_impl_namefunc(const void *item)
+{
+ return ((const papersize_list_impl_t *) item)->name;
+}
+
+static const char *
+papersize_list_impl_long_namefunc(const void *item)
+{
+ return ((const papersize_list_impl_t *) item)->name;
+}
+
+static void
+check_list_of_papersize_lists(void)
+{
+ if (! list_of_papersize_lists)
+ {
+ stp_deprintf(STP_DBG_PAPER, "Initializing...\n");
+ list_of_papersize_lists = stp_list_create();
+ stp_list_set_freefunc(list_of_papersize_lists, papersize_list_impl_freefunc);
+ stp_list_set_namefunc(list_of_papersize_lists, papersize_list_impl_namefunc);
+ stp_list_set_long_namefunc(list_of_papersize_lists, papersize_list_impl_long_namefunc);
+ }
+}
+
+static void
+stpi_papersize_freefunc(void *item)
{
stp_papersize_t *paper = (stp_papersize_t *) (item);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-qual"
STP_SAFE_FREE(paper->name);
STP_SAFE_FREE(paper->text);
STP_SAFE_FREE(paper->comment);
+#pragma GCC diagnostic pop
STP_SAFE_FREE(paper);
}
static const char *
-stpi_paper_namefunc(const void *item)
+stpi_papersize_namefunc(const void *item)
{
const stp_papersize_t *paper = (const stp_papersize_t *) (item);
return paper->name;
}
static const char *
-stpi_paper_long_namefunc(const void *item)
+stpi_papersize_long_namefunc(const void *item)
{
const stp_papersize_t *paper = (const stp_papersize_t *) (item);
return paper->text;
}
-static int
-stpi_paper_list_init(void)
-{
- if (paper_list)
- stp_list_destroy(paper_list);
- paper_list = stp_list_create();
- stp_list_set_freefunc(paper_list, stpi_paper_freefunc);
- stp_list_set_namefunc(paper_list, stpi_paper_namefunc);
- stp_list_set_long_namefunc(paper_list, stpi_paper_long_namefunc);
- /* stp_list_set_sortfunc(stpi_paper_sortfunc); */
-
- return 0;
-}
-
-static inline void
-check_paperlist(void)
+stp_papersize_list_t *
+stpi_create_papersize_list(void)
{
- if (paper_list == NULL)
- {
- stp_xml_parse_file_named("papers.xml");
- if (paper_list == NULL)
- {
- stp_erprintf("No papers found: is STP_MODULE_PATH correct?\n");
- stpi_paper_list_init();
- }
- }
+ stp_list_t *papersize_list = stp_list_create();
+ stp_list_set_freefunc(papersize_list, stpi_papersize_freefunc);
+ stp_list_set_namefunc(papersize_list, stpi_papersize_namefunc);
+ stp_list_set_long_namefunc(papersize_list, stpi_papersize_long_namefunc);
+ return (stp_papersize_list_t *) papersize_list;
}
-static int
-stpi_paper_create(stp_papersize_t *p)
+int
+stpi_papersize_create(stp_papersize_list_t *list, stp_papersize_t *p)
{
- stp_list_item_t *paper_item;
-
- if (paper_list == NULL)
- {
- stpi_paper_list_init();
- stp_deprintf(STP_DBG_PAPER,
- "stpi_paper_create(): initialising paper_list...\n");
- }
-
- /* Check the paper does not already exist */
- paper_item = stp_list_get_start(paper_list);
- while (paper_item)
+ stp_list_item_t *papersize_item;
+
+ /*
+ * Check the paper does not already exist
+ * Not the most efficient way of doing it, but the number of papers
+ * is not large enough to be a significant bottleneck.
+ */
+ papersize_item = stp_list_get_start(list);
+ while (papersize_item)
{
const stp_papersize_t *ep =
- (const stp_papersize_t *) stp_list_item_get_data(paper_item);
+ (const stp_papersize_t *) stp_list_item_get_data(papersize_item);
if (ep && !strcmp(p->name, ep->name))
{
- stp_erprintf("Duplicate paper size `%s'\n",
- p->name);
- stpi_paper_freefunc(p);
+ stp_erprintf("Duplicate paper size `%s'\n", p->name);
+ stpi_papersize_freefunc(p);
return 1;
}
- paper_item = stp_list_item_next(paper_item);
+ papersize_item = stp_list_item_next(papersize_item);
}
/* Add paper to list */
- stp_list_item_create(paper_list, NULL, (void *) p);
+ stp_list_item_create(list, NULL, (void *) p);
return 0;
}
int
-stp_known_papersizes(void)
+stpi_papersize_count(const stp_papersize_list_t *paper_size_list)
{
- check_paperlist();
- return stp_list_get_length(paper_list);
+ return stp_list_get_length(paper_size_list);
}
const stp_papersize_t *
-stp_get_papersize_by_name(const char *name)
+stpi_get_papersize_by_name(const stp_papersize_list_t *list, const char *name)
{
stp_list_item_t *paper;
- check_paperlist();
- paper = stp_list_get_item_by_name(paper_list, name);
+ paper = stp_list_get_item_by_name(list, name);
if (!paper)
return NULL;
else
@@ -147,37 +166,52 @@ stp_get_papersize_by_name(const char *name)
}
const stp_papersize_t *
-stp_get_papersize_by_index(int idx)
+stpi_get_listed_papersize(const char *name, const char *papersize_list)
{
- stp_list_item_t *paper;
-
- check_paperlist();
- paper = stp_list_get_item_by_index(paper_list, idx);
- if (!paper)
- return NULL;
+ const stp_papersize_list_t *list =
+ stpi_get_papersize_list_named(papersize_list, "");
+ if (list)
+ return stpi_get_papersize_by_name(list, name);
else
- return (const stp_papersize_t *) stp_list_item_get_data(paper);
+ return NULL;
+}
+
+const stp_papersize_t *
+stpi_standard_describe_papersize(const stp_vars_t *v, const char *name)
+{
+ STPI_ASSERT(v, NULL);
+ return stpi_get_listed_papersize(name, "standard");
+}
+
+const stp_papersize_t *
+stp_describe_papersize(const stp_vars_t *v, const char *name)
+{
+ return stpi_printer_describe_papersize(v, name);
}
static int
-paper_size_mismatch(stp_dimension_t l, stp_dimension_t w, const stp_papersize_t *val)
+papersize_size_mismatch(stp_dimension_t l, stp_dimension_t w,
+ const stp_papersize_t *val)
{
- stp_dimension_t hdiff = abs(l - (stp_dimension_t) val->height);
- stp_dimension_t vdiff = abs(w - (stp_dimension_t) val->width);
+ stp_dimension_t hdiff = STP_DABS(l - (stp_dimension_t) val->height);
+ stp_dimension_t vdiff = STP_DABS(w - (stp_dimension_t) val->width);
return hdiff > vdiff ? hdiff : vdiff;
}
-const stp_papersize_t *
-stp_get_papersize_by_size(stp_dimension_t l, stp_dimension_t w)
+static const stp_papersize_t *
+get_papersize_by_size_internal(const stp_papersize_list_t *list,
+ stp_dimension_t l, stp_dimension_t w,
+ int exact)
{
int score = INT_MAX;
const stp_papersize_t *ref = NULL;
const stp_papersize_t *val = NULL;
- int i;
- int sizes = stp_known_papersizes();
- for (i = 0; i < sizes; i++)
+ const stp_papersize_list_item_t *ptli =
+ stpi_papersize_list_get_start(list);
+ STPI_ASSERT(list, NULL);
+ while (ptli)
{
- val = stp_get_papersize_by_index(i);
+ val = stpi_paperlist_item_get_data(ptli);
if (val->width == w && val->height == l)
{
@@ -187,40 +221,32 @@ stp_get_papersize_by_size(stp_dimension_t l, stp_dimension_t w)
else
ref = val;
}
- else
+ else if (!exact)
{
- int myscore = paper_size_mismatch(l, w, val);
+ int myscore = papersize_size_mismatch(l, w, val);
if (myscore < score && myscore < 5)
{
ref = val;
score = myscore;
}
}
+ ptli = stpi_paperlist_item_next(ptli);
}
return ref;
}
const stp_papersize_t *
-stp_get_papersize_by_size_exact(stp_dimension_t l, stp_dimension_t w)
+stpi_get_papersize_by_size(const stp_papersize_list_t *list,
+ stp_dimension_t l, stp_dimension_t w)
{
- const stp_papersize_t *ref = NULL;
- const stp_papersize_t *val = NULL;
- int i;
- int sizes = stp_known_papersizes();
- for (i = 0; i < sizes; i++)
- {
- val = stp_get_papersize_by_index(i);
+ return get_papersize_by_size_internal(list, l, w, 0);
+}
- if (val->width == w && val->height == l)
- {
- if (val->top == 0 && val->left == 0 &&
- val->bottom == 0 && val->right == 0)
- return val;
- else
- ref = val;
- }
- }
- return ref;
+const stp_papersize_t *
+stpi_get_papersize_by_size_exact(const stp_papersize_list_t *list,
+ stp_dimension_t l, stp_dimension_t w)
+{
+ return get_papersize_by_size_internal(list, l, w, 1);
}
void
@@ -238,7 +264,7 @@ stp_default_media_size(const stp_vars_t *v, /* I */
const char *page_size = stp_get_string_parameter(v, "PageSize");
const stp_papersize_t *papersize = NULL;
if (page_size)
- papersize = stp_get_papersize_by_name(page_size);
+ papersize = stp_describe_papersize(v, page_size);
if (!papersize)
{
*width = 1;
@@ -262,8 +288,8 @@ stp_default_media_size(const stp_vars_t *v, /* I */
static stp_papersize_t *
stp_xml_process_paper(stp_mxml_node_t *paper) /* The paper node */
{
- stp_mxml_node_t *prop; /* Temporary node pointer */
- const char *stmp; /* Temporary string */
+ stp_mxml_node_t *prop; /* Temporary node pointer */
+ const char *stmp; /* Temporary string */
/* props[] (unused) is the correct tag sequence */
/* const char *props[] =
{
@@ -385,8 +411,6 @@ stp_xml_process_paper(stp_mxml_node_t *paper) /* The paper node */
{
if (!strcmp(stmp, "envelope"))
outpaper->paper_size_type = PAPERSIZE_TYPE_ENVELOPE;
- else if (!strcmp(stmp, "special"))
- outpaper->paper_size_type = PAPERSIZE_TYPE_SPECIAL;
else
outpaper->paper_size_type = PAPERSIZE_TYPE_STANDARD;
}
@@ -405,7 +429,8 @@ stp_xml_process_paper(stp_mxml_node_t *paper) /* The paper node */
* Parse the <paperdef> node.
*/
static int
-stp_xml_process_paperdef(stp_mxml_node_t *paperdef, const char *file) /* The paperdef node */
+stp_xml_process_papersize_def(stp_mxml_node_t *paperdef, const char *file,
+ stp_papersize_list_t *papersize_list)
{
stp_mxml_node_t *paper; /* paper node pointer */
stp_papersize_t *outpaper; /* Generated paper */
@@ -415,12 +440,12 @@ stp_xml_process_paperdef(stp_mxml_node_t *paperdef, const char *file) /* The pap
{
if (paper->type == STP_MXML_ELEMENT)
{
- const char *paper_name = paper->value.element.name;
- if (!strcmp(paper_name, "paper"))
+ const char *papersize_name = paper->value.element.name;
+ if (!strcmp(papersize_name, "paper"))
{
outpaper = stp_xml_process_paper(paper);
if (outpaper)
- stpi_paper_create(outpaper);
+ stpi_papersize_create(papersize_list, outpaper);
}
}
paper = paper->next;
@@ -428,8 +453,79 @@ stp_xml_process_paperdef(stp_mxml_node_t *paperdef, const char *file) /* The pap
return 1;
}
-void
-stpi_init_paper(void)
+const stp_papersize_list_t *
+stpi_get_papersize_list_named(const char *name, const char *file)
+{
+ stp_list_item_t *item;
+ papersize_list_impl_t *impl;
+
+ check_list_of_papersize_lists();
+ item = stp_list_get_item_by_name(list_of_papersize_lists, name);
+ if (item)
+ {
+ impl = (papersize_list_impl_t *) stp_list_item_get_data(item);
+ }
+ else
+ {
+ char buf[MAXPATHLEN+1];
+ stp_deprintf(STP_DBG_PAPER, "Loading paper list %s from %s\n",
+ name, file ? file : "(null)");
+ if (! file)
+ return NULL;
+ else if (!strcmp(file, ""))
+ (void) snprintf(buf, MAXPATHLEN, "papers/%s.xml", name);
+ else
+ strncpy(buf, file, MAXPATHLEN);
+ stp_mxml_node_t *node =
+ stp_xml_parse_file_from_path_safe(buf, "paperdef", NULL);
+ const char *stmp = stp_mxmlElementGetAttr(node, "name");
+ STPI_ASSERT(stmp && !strcmp(name, stmp), NULL);
+ impl = stp_malloc(sizeof(papersize_list_impl_t));
+ impl->name = stp_strdup(name);
+ impl->list = stpi_create_papersize_list();
+ stp_deprintf(STP_DBG_PAPER, " Loading %s\n", stmp);
+ stp_list_item_create(list_of_papersize_lists, NULL, impl);
+ stp_xml_process_papersize_def(node, buf, impl->list);
+ }
+ return impl->list;
+}
+
+stp_papersize_list_t *
+stpi_find_papersize_list_named(const char *name)
+{
+ stp_list_item_t *item;
+
+ check_list_of_papersize_lists();
+ item = stp_list_get_item_by_name(list_of_papersize_lists, name);
+ if (item)
+ {
+ papersize_list_impl_t *impl =
+ (papersize_list_impl_t *) stp_list_item_get_data(item);
+ if (impl)
+ return impl->list;
+ }
+ return NULL;
+}
+
+stp_papersize_list_t *
+stpi_new_papersize_list(const char *name)
+{
+ stp_list_item_t *item;
+ papersize_list_impl_t *impl;
+
+ check_list_of_papersize_lists();
+ item = stp_list_get_item_by_name(list_of_papersize_lists, name);
+ if (item)
+ return NULL;
+ impl = stp_malloc(sizeof(papersize_list_impl_t));
+ impl->name = stp_strdup(name);
+ impl->list = stpi_create_papersize_list();
+ stp_list_item_create(list_of_papersize_lists, NULL, impl);
+ return impl->list;
+}
+
+const stp_papersize_list_t *
+stpi_get_standard_papersize_list(void)
{
- stp_register_xml_parser("paperdef", stp_xml_process_paperdef);
+ return stpi_get_papersize_list_named("standard", "");
}
diff --git a/src/main/print-pcl.c b/src/main/print-pcl.c
index 8752e58..9ae9b72 100644
--- a/src/main/print-pcl.c
+++ b/src/main/print-pcl.c
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -38,6 +37,12 @@
/* #define DEBUG */
/* #define PCL_DEBUG_DISABLE_BLANKLINE_REMOVAL */
+#ifdef __GNUC__
+#define UNUSED __attribute__ ((unused))
+#else
+#define UNUSED
+#endif
+
/*
* Local functions...
*/
@@ -52,6 +57,7 @@ typedef struct
{
int do_blank;
int blank_lines;
+ unsigned char *row_buf; /* For color laser */
unsigned char *comp_buf;
void (*writefunc)(stp_vars_t *, unsigned char *, int, int); /* PCL output function */
int do_cret;
@@ -59,6 +65,7 @@ typedef struct
int do_6color;
int height;
int duplex;
+ int copies;
int tumble;
int use_crd;
int orientation;
@@ -66,6 +73,7 @@ typedef struct
unsigned int h_offset; /* decipoints */
unsigned int v_offset; /* decipoints */
int darkness;
+ int nodither;
} pcl_privdata_t;
/*
@@ -324,6 +332,7 @@ typedef struct {
#define PCL_COLOR_CMYK4 4 /* CRet printing */
#define PCL_COLOR_CMYKcm 8 /* CMY + Photo Cart */
#define PCL_COLOR_CMYK4b 16 /* CRet for HP840c */
+#define PCL_COLOR_RGB 32 /* RGB for color lasers */
#define PCL_PRINTER_LJ 1
#define PCL_PRINTER_DJ 2
@@ -335,6 +344,8 @@ typedef struct {
#define PCL_PRINTER_BLANKLINE 64 /* Blank line removal supported */
#define PCL_PRINTER_DUPLEX 128 /* Printer can have duplexer */
#define PCL_PRINTER_LABEL 256 /* Datamax-O'Neil PCL Label Printer */
+#define PCL_PRINTER_LJ_COLOR 512 /* Color laser printers */
+#define PCL_PRINTER_COPIES 1024 /* Supports PCL5/HPGL2/HP-RTL copies */
/*
* FIXME - the 520 shouldn't be lumped in with the 500 as it supports
@@ -711,7 +722,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{0, 0, 0, 0}, /* A4 Margins */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL |
- PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE,
+ PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES,
custom_papersizes,
emptylist,
emptylist,
@@ -725,7 +736,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{0, 0, 0, 0}, /* A4 Margins */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL |
- PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE,
+ PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES,
custom_papersizes,
emptylist,
emptylist,
@@ -739,7 +750,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{0, 0, 0, 0}, /* A4 Margins */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL |
- PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE,
+ PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES,
custom_papersizes,
emptylist,
emptylist,
@@ -753,7 +764,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{0, 0, 0, 0}, /* A4 Margins */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL |
- PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE,
+ PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES,
custom_papersizes,
emptylist,
emptylist,
@@ -767,7 +778,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{0, 0, 0, 0}, /* A4 Margins */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL |
- PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE,
+ PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES,
custom_papersizes,
emptylist,
emptylist,
@@ -781,7 +792,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{0, 0, 0, 0}, /* A4 Margins */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL |
- PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE,
+ PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES,
custom_papersizes,
emptylist,
emptylist,
@@ -795,7 +806,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{0, 0, 0, 0}, /* A4 Margins */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL |
- PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE,
+ PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES,
custom_papersizes,
emptylist,
emptylist,
@@ -808,7 +819,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{49, 49, 15, 15},
{49, 49, 15, 15},
PCL_COLOR_NONE,
- PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG,
+ PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES,
letter_a4_papersizes,
basic_papertypes,
standard_papersources,
@@ -822,7 +833,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{49, 49, 15, 15},
{49, 49, 15, 15},
PCL_COLOR_CMYK,
- PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG,
+ PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES,
letter_a4_papersizes,
basic_papertypes,
standard_papersources,
@@ -835,7 +846,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{30, 30, 15, 15}, /* These margins are for sheet mode FIX */
{30, 30, 15, 15},
PCL_COLOR_NONE,
- PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG,
+ PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES,
letter_a4_papersizes,
basic_papertypes,
standard_papersources,
@@ -848,7 +859,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{30, 30, 15, 15}, /* These margins are for roll mode FIX */
{30, 30, 15, 15},
PCL_COLOR_CMYK,
- PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG,
+ PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES,
letter_a4_papersizes,
basic_papertypes,
standard_papersources,
@@ -861,7 +872,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{49, 49, 15, 15}, /* Check/Fix */
{49, 49, 15, 15},
PCL_COLOR_CMYK,
- PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG,
+ PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES,
letter_a4_papersizes,
basic_papertypes,
standard_papersources,
@@ -874,7 +885,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{49, 49, 15, 15}, /* Check/Fix */
{49, 49, 15, 15},
PCL_COLOR_CMYK,
- PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG,
+ PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES,
letter_a4_papersizes,
basic_papertypes,
standard_papersources,
@@ -1081,7 +1092,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_CMY,
PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE |
- PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
dj1200_papersizes,
basic_papertypes,
dj_papersources,
@@ -1095,7 +1106,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_CMYK,
PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE |
- PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
dj1200_papersizes,
basic_papertypes,
dj_papersources,
@@ -1201,7 +1212,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18},
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_NONE,
- PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
ljsmall_papersizes,
emptylist,
laserjet_papersources,
@@ -1214,7 +1225,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18},
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_NONE,
- PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
ljsmall_papersizes,
emptylist,
laserjet_papersources,
@@ -1227,7 +1238,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18},
{12, 12, 18, 18}, /* Check/Fix */
PCL_COLOR_NONE,
- PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
ljsmall_papersizes,
emptylist,
laserjet_papersources,
@@ -1240,7 +1251,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18},
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_NONE,
- PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
ljbig_papersizes,
emptylist,
laserjet_papersources,
@@ -1253,7 +1264,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18},
{12, 12, 18, 18}, /* Check/Fix */
PCL_COLOR_NONE,
- PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
ljbig_papersizes,
emptylist,
laserjet_papersources,
@@ -1266,7 +1277,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18},
{12, 12, 18, 18}, /* Check/Fix */
PCL_COLOR_NONE,
- PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
ljtabloid_papersizes,
emptylist,
laserjet_papersources,
@@ -1279,7 +1290,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18},
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_NONE,
- PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
ljsmall_papersizes,
emptylist,
laserjet_papersources,
@@ -1292,7 +1303,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18},
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_NONE,
- PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE,
+ PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES,
ljbig_papersizes,
emptylist,
laserjet_papersources,
@@ -1306,7 +1317,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
- PCL_PRINTER_DUPLEX,
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
ljbig_papersizes,
emptylist,
laserjet_papersources,
@@ -1320,7 +1331,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
- PCL_PRINTER_DUPLEX,
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
ljsmall_papersizes,
emptylist,
laserjet_papersources,
@@ -1334,7 +1345,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
- PCL_PRINTER_DUPLEX,
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
ljbig_papersizes,
emptylist,
laserjet_papersources,
@@ -1348,7 +1359,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18}, /* Check/Fix */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
- PCL_PRINTER_DUPLEX,
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
ljsmall_papersizes,
emptylist,
laserjet_papersources,
@@ -1362,7 +1373,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18}, /* Check/Fix */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
- PCL_PRINTER_DUPLEX,
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
ljbig_papersizes,
emptylist,
laserjet_papersources,
@@ -1376,7 +1387,7 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 18, 18}, /* Check/Fix */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
- PCL_PRINTER_DUPLEX,
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
ljtabloid_papersizes,
emptylist,
laserjet_papersources,
@@ -1390,17 +1401,98 @@ static const pcl_cap_t pcl_model_capabilities[] =
{12, 12, 10, 10}, /* Check/Fix */
PCL_COLOR_NONE,
PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
- PCL_PRINTER_DUPLEX,
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
+ ljbig_papersizes,
+ emptylist,
+ laserjet_papersources,
+ },
+ /* Color laser printer, small format */
+ { 50000,
+ 17 * 72 / 2, 14 * 72,
+ 1, 1, /* Min paper size */
+ PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
+ {12, 12, 18, 18},
+ {12, 12, 10, 10}, /* Check/Fix */
+ PCL_COLOR_RGB,
+ PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
+ ljsmall_papersizes,
+ emptylist,
+ laserjet_papersources,
+ },
+ /* Color laser printer, large format */
+ { 50001,
+ 13 * 72, 19 * 72,
+ 1, 1, /* Min paper size */
+ PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
+ {12, 12, 18, 18},
+ {12, 12, 10, 10}, /* Check/Fix */
+ PCL_COLOR_RGB,
+ PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
+ ljbig_papersizes,
+ emptylist,
+ laserjet_papersources,
+ },
+ /* Color laser printer, small format, no expanded A4 margins */
+ { 50002,
+ 17 * 72 / 2, 14 * 72,
+ 1, 1, /* Min paper size */
+ PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
+ {12, 12, 18, 18},
+ {12, 12, 18, 18}, /* Check/Fix */
+ PCL_COLOR_RGB,
+ PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
+ ljsmall_papersizes,
+ emptylist,
+ laserjet_papersources,
+ },
+ /* Color laser printer with large paper, no expanded A4 margins */
+ { 50003,
+ 13 * 72, 19 * 72,
+ 1, 1, /* Min paper size */
+ PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
+ {12, 12, 18, 18},
+ {12, 12, 18, 18}, /* Check/Fix */
+ PCL_COLOR_RGB,
+ PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
ljbig_papersizes,
emptylist,
laserjet_papersources,
},
+ /* Color laser printer with tabloid paper, no expanded A4 margins */
+ { 50004,
+ 118 * 72 / 10, 17 * 72, /* 11.8*17 */
+ 1, 1, /* Min paper size */
+ PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
+ {12, 12, 18, 18},
+ {12, 12, 18, 18}, /* Check/Fix */
+ PCL_COLOR_RGB,
+ PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
+ ljtabloid_papersizes,
+ emptylist,
+ laserjet_papersources,
+ },
+ /* Special case the Color LaserJet 5 */
+ { 50012,
+ 17 * 72 / 2, 14 * 72,
+ 1, 1, /* Min paper size */
+ PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
+ {12, 12, 18, 18},
+ {12, 12, 18, 18}, /* Check/Fix */
+ PCL_COLOR_RGB,
+ PCL_PRINTER_LJ_COLOR | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
+ PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES,
+ ljsmall_papersizes,
+ emptylist,
+ laserjet_papersources,
+ },
};
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-const-variable"
-
-static const char standard_sat_adjustment[] =
+static const char UNUSED standard_sat_adjustment[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<gutenprint>\n"
"<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\">\n"
@@ -1414,7 +1506,6 @@ static const char standard_sat_adjustment[] =
"</sequence>\n"
"</curve>\n"
"</gutenprint>\n";
-#pragma GCC diagnostic pop
static const char standard_lum_adjustment[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
@@ -1521,6 +1612,12 @@ static const stp_parameter_t the_parameters[] =
STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
STP_PARAMETER_LEVEL_BASIC, 0, 1, STP_CHANNEL_NONE, 1, 0
},
+ {
+ "NativeCopies", N_("Printer Generates Copies Natively"), "Color=No,Category=Job Mode",
+ N_("Printer Generates Copies"),
+ STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE,
+ STP_PARAMETER_LEVEL_INTERNAL, 1, 0, STP_CHANNEL_NONE, 0, 1
+ },
};
static const int the_parameter_count =
@@ -1563,6 +1660,30 @@ static const float_param_t float_parameters[] =
},
{
{
+ "RedDensity", N_("Red Density"), "Color=Yes,Category=Output Level Adjustment",
+ N_("Adjust the red density"),
+ STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
+ STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 5, 1, 0
+ }, 0.0, 1.0, 1.0, 1
+ },
+ {
+ {
+ "GreenDensity", N_("Green Density"), "Color=Yes,Category=Output Level Adjustment",
+ N_("Adjust the green density"),
+ STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
+ STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 5, 1, 0
+ }, 0.0, 1.0, 1.0, 1
+ },
+ {
+ {
+ "BlueDensity", N_("Blue Density"), "Color=Yes,Category=Output Level Adjustment",
+ N_("Adjust the blue density"),
+ STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
+ STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 4, 1, 0
+ }, 0.0, 1.0, 1.0, 1
+ },
+ {
+ {
"BlackDensity", N_("Black Density"), "Color=Yes,Category=Output Level Adjustment",
N_("Adjust the black density"),
STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
@@ -1612,7 +1733,8 @@ sizeof(float_parameters) / sizeof(const float_param_t);
* Convert a name into it's option value
*/
-static int pcl_string_to_val(const char *string, /* I: String */
+static int pcl_string_to_val(const stp_vars_t *v,
+ const char *string, /* I: String */
const pcl_t *options, /* I: Options */
int num_options) /* I: Num options */
{
@@ -1631,7 +1753,7 @@ static int pcl_string_to_val(const char *string, /* I: String */
}
}
- stp_deprintf(STP_DBG_PCL, "String: %s, Code: %d\n", string, code);
+ stp_dprintf(STP_DBG_PCL, v, "String: %s, Code: %d\n", string, code);
return(code);
}
@@ -1640,7 +1762,8 @@ static int pcl_string_to_val(const char *string, /* I: String */
* Convert a value into it's option name
*/
-static const char * pcl_val_to_string(int code, /* I: Code */
+static const char * pcl_val_to_string(const stp_vars_t *v,
+ int code, /* I: Code */
const pcl_t *options, /* I: Options */
int num_options) /* I: Num options */
{
@@ -1659,12 +1782,13 @@ static const char * pcl_val_to_string(int code, /* I: Code */
}
}
- stp_deprintf(STP_DBG_PCL, "Code: %d, String: %s\n", code, string);
+ stp_dprintf(STP_DBG_PCL, v, "Code: %d, String: %s\n", code, string);
return(string);
}
-static const char * pcl_val_to_text(int code, /* I: Code */
+static const char * pcl_val_to_text(const stp_vars_t *v,
+ int code, /* I: Code */
const pcl_t *options, /* I: Options */
int num_options) /* I: Num options */
{
@@ -1683,7 +1807,7 @@ static const char * pcl_val_to_text(int code, /* I: Code */
}
}
- stp_deprintf(STP_DBG_PCL, "Code: %d, String: %s\n", code, string);
+ stp_dprintf(STP_DBG_PCL, v, "Code: %d, String: %s\n", code, string);
return(string);
}
@@ -1709,16 +1833,17 @@ static const stp_shade_t variable_shades[] =
*/
static const pcl_cap_t * /* O: Capabilities */
-pcl_get_model_capabilities(int model) /* I: Model */
+pcl_get_model_capabilities(const stp_vars_t *v) /* I: Model */
{
int i;
+ int model = stp_get_model_id(v);
int models= sizeof(pcl_model_capabilities) / sizeof(pcl_cap_t);
for (i=0; i<models; i++) {
if (pcl_model_capabilities[i].model == model) {
return &(pcl_model_capabilities[i]);
}
}
- stp_erprintf("pcl: model %d not found in capabilities list.\n",model);
+ stp_eprintf(v, "pcl: model %d not found in capabilities list.\n",model);
return &(pcl_model_capabilities[0]);
}
@@ -1730,7 +1855,6 @@ static void
pcl_describe_resolution(const stp_vars_t *v, stp_resolution_t *x, stp_resolution_t *y)
{
int i;
- int model = stp_get_model_id(v);
const char *resolution = stp_get_string_parameter(v, "Resolution");
const char *quality;
const pcl_cap_t *caps = NULL;
@@ -1747,7 +1871,7 @@ pcl_describe_resolution(const stp_vars_t *v, stp_resolution_t *x, stp_resolution
}
}
quality = stp_get_string_parameter(v, "Quality");
- caps = pcl_get_model_capabilities(model);
+ caps = pcl_get_model_capabilities(v);
if (quality && strcmp(quality, "None") == 0)
quality = "Standard";
if (quality)
@@ -1771,8 +1895,8 @@ pcl_describe_resolution(const stp_vars_t *v, stp_resolution_t *x, stp_resolution
* Convert Media size name into PCL media code for printer
*/
-static int pcl_convert_media_size(const char *media_size, /* I: Media size string */
- int model) /* I: model number */
+static int pcl_convert_media_size(const stp_vars_t *v,
+ const char *media_size)
{
int i;
@@ -1783,24 +1907,25 @@ static int pcl_convert_media_size(const char *media_size, /* I: Media size strin
* First look up the media size in the table and convert to the code.
*/
- media_code = pcl_string_to_val(media_size, pcl_media_sizes,
+ media_code = pcl_string_to_val(v, media_size, pcl_media_sizes,
NUM_PRINTER_PAPER_SIZES);
- stp_deprintf(STP_DBG_PCL, "Media Size: %s, Code: %d\n", media_size, media_code);
+ stp_dprintf(STP_DBG_PCL, v, "Media Size: %s, Code: %d\n", media_size, media_code);
/*
* Now see if the printer supports the code found.
*/
if (media_code != -1) {
- caps = pcl_get_model_capabilities(model);
+ int model = stp_get_model_id(v);
+ caps = pcl_get_model_capabilities(v);
for (i=0; (i<NUM_PRINTER_PAPER_SIZES) && (caps->paper_sizes[i] != -1); i++) {
if (media_code == (int) caps->paper_sizes[i])
return(media_code); /* Is supported */
}
- stp_deprintf(STP_DBG_PCL, "Media Code %d not supported by printer model %d.\n",
+ stp_dprintf(STP_DBG_PCL, v, "Media Code %d not supported by printer model %d.\n",
media_code, model);
return(-1); /* Not supported */
}
@@ -1864,11 +1989,11 @@ static const stp_param_string_t label_separator_types[] =
*/
static int
-pcl_papersize_valid(const stp_papersize_t *pt,
- int model)
+pcl_papersize_valid(const stp_vars_t *v,
+ const stp_papersize_t *pt)
{
- const pcl_cap_t *caps = pcl_get_model_capabilities(model);
+ const pcl_cap_t *caps = pcl_get_model_capabilities(v);
#ifdef PCL_NO_CUSTOM_PAPERSIZES
int use_custom = 0;
@@ -1907,7 +2032,7 @@ pcl_papersize_valid(const stp_papersize_t *pt,
* Is it a recognized supported name?
*/
- if (pcl_convert_media_size(pt->name, model) != -1)
+ if (pcl_convert_media_size(v, pt->name) != -1)
return(1);
/*
@@ -1983,21 +2108,21 @@ pcl_parameters(const stp_vars_t *v, const char *name,
if (name == NULL)
return;
- stp_deprintf(STP_DBG_PCL, "pcl_parameters(): Name = %s\n", name);
+ stp_dprintf(STP_DBG_PCL, v, "pcl_parameters(): Name = %s\n", name);
- caps = pcl_get_model_capabilities(model);
+ caps = pcl_get_model_capabilities(v);
- stp_deprintf(STP_DBG_PCL, "Printer model = %d\n", model);
- stp_deprintf(STP_DBG_PCL, "PageWidth = %d, PageHeight = %d\n", caps->custom_max_width, caps->custom_max_height);
- stp_deprintf(STP_DBG_PCL, "MinPageWidth = %d, MinPageHeight = %d\n", caps->custom_min_width, caps->custom_min_height);
- stp_deprintf(STP_DBG_PCL, "Normal Margins: top = %d, bottom = %d, left = %d, right = %d\n",
+ stp_dprintf(STP_DBG_PCL, v, "Printer model = %d\n", model);
+ stp_dprintf(STP_DBG_PCL, v, "PageWidth = %d, PageHeight = %d\n", caps->custom_max_width, caps->custom_max_height);
+ stp_dprintf(STP_DBG_PCL, v, "MinPageWidth = %d, MinPageHeight = %d\n", caps->custom_min_width, caps->custom_min_height);
+ stp_dprintf(STP_DBG_PCL, v, "Normal Margins: top = %d, bottom = %d, left = %d, right = %d\n",
caps->normal_margins.top_margin, caps->normal_margins.bottom_margin,
caps->normal_margins.left_margin, caps->normal_margins.right_margin);
- stp_deprintf(STP_DBG_PCL, "A4 Margins: top = %d, bottom = %d, left = %d, right = %d\n",
+ stp_dprintf(STP_DBG_PCL, v, "A4 Margins: top = %d, bottom = %d, left = %d, right = %d\n",
caps->a4_margins.top_margin, caps->a4_margins.bottom_margin,
caps->a4_margins.left_margin, caps->a4_margins.right_margin);
- stp_deprintf(STP_DBG_PCL, "Resolutions: %d\n", caps->resolutions);
- stp_deprintf(STP_DBG_PCL, "ColorType = %d, PrinterType = %d\n", caps->color_type, caps->stp_printer_type);
+ stp_dprintf(STP_DBG_PCL, v, "Resolutions: %d\n", caps->resolutions);
+ stp_dprintf(STP_DBG_PCL, v, "ColorType = %d, PrinterType = %d\n", caps->color_type, caps->stp_printer_type);
for (i = 0; i < the_parameter_count; i++)
if (strcmp(name, the_parameters[i].name) == 0)
@@ -2020,14 +2145,20 @@ pcl_parameters(const stp_vars_t *v, const char *name,
if (strcmp(name, "PageSize") == 0)
{
- int papersizes = stp_known_papersizes();
+ const stp_papersize_list_t *paper_sizes =
+ ((caps->stp_printer_type & PCL_PRINTER_LABEL) ?
+ stpi_get_papersize_list_named("labels", "") :
+ stpi_get_standard_papersize_list());
+ const stp_papersize_list_item_t *ptli =
+ stpi_papersize_list_get_start(paper_sizes);
description->bounds.str = stp_string_list_create();
- for (i = 0; i < papersizes; i++)
+ while (ptli)
{
- const stp_papersize_t *pt = stp_get_papersize_by_index(i);
- if (strlen(pt->name) > 0 && pcl_papersize_valid(pt, model))
+ const stp_papersize_t *pt = stpi_paperlist_item_get_data(ptli);
+ if (strlen(pt->name) > 0 && pcl_papersize_valid(v, pt))
stp_string_list_add_string(description->bounds.str,
pt->name, gettext(pt->text));
+ ptli = stpi_paperlist_item_next(ptli);
}
description->deflt.str =
stp_string_list_param(description->bounds.str, 0)->name;
@@ -2039,10 +2170,10 @@ pcl_parameters(const stp_vars_t *v, const char *name,
{
for (i=0; (i < NUM_PRINTER_PAPER_TYPES) && (caps->paper_types[i] != -1); i++)
stp_string_list_add_string(description->bounds.str,
- pcl_val_to_string(caps->paper_types[i],
+ pcl_val_to_string(v, caps->paper_types[i],
pcl_media_types,
NUM_PRINTER_PAPER_TYPES),
- pcl_val_to_text(caps->paper_types[i],
+ pcl_val_to_text(v, caps->paper_types[i],
pcl_media_types,
NUM_PRINTER_PAPER_TYPES));
description->deflt.str =
@@ -2058,10 +2189,10 @@ pcl_parameters(const stp_vars_t *v, const char *name,
{
for (i=0; (i < NUM_PRINTER_PAPER_SOURCES) && (caps->paper_sources[i] != -1); i++)
stp_string_list_add_string(description->bounds.str,
- pcl_val_to_string(caps->paper_sources[i],
+ pcl_val_to_string(v, caps->paper_sources[i],
pcl_media_sources,
NUM_PRINTER_PAPER_SOURCES),
- pcl_val_to_text(caps->paper_sources[i],
+ pcl_val_to_text(v, caps->paper_sources[i],
pcl_media_sources,
NUM_PRINTER_PAPER_SOURCES));
description->deflt.str =
@@ -2080,9 +2211,9 @@ pcl_parameters(const stp_vars_t *v, const char *name,
{
stp_string_list_add_string
(description->bounds.str,
- pcl_val_to_string(pcl_resolutions[i].pcl_code,
+ pcl_val_to_string(v, pcl_resolutions[i].pcl_code,
pcl_resolutions, NUM_RESOLUTIONS),
- pcl_val_to_text(pcl_resolutions[i].pcl_code,
+ pcl_val_to_text(v, pcl_resolutions[i].pcl_code,
pcl_resolutions, NUM_RESOLUTIONS));
}
}
@@ -2096,12 +2227,12 @@ pcl_parameters(const stp_vars_t *v, const char *name,
if (caps->resolutions & pcl_qualities[i].pcl_code)
{
const char *qual =
- pcl_val_to_string(pcl_qualities[i].pcl_code,
+ pcl_val_to_string(v, pcl_qualities[i].pcl_code,
pcl_qualities, NUM_QUALITIES);
if (! stp_string_list_is_present(description->bounds.str, qual))
stp_string_list_add_string
(description->bounds.str, qual,
- pcl_val_to_text(pcl_qualities[i].pcl_code,
+ pcl_val_to_text(v, pcl_qualities[i].pcl_code,
pcl_qualities, NUM_QUALITIES));
if (strcmp(qual, "Standard") == 0)
has_standard_quality = 1;
@@ -2212,7 +2343,18 @@ pcl_parameters(const stp_vars_t *v, const char *name,
strcmp(name, "YellowDensity") == 0 ||
strcmp(name, "BlackDensity") == 0)
{
- if (caps->color_type != PCL_COLOR_NONE &&
+ if ((caps->color_type & ~PCL_COLOR_RGB) != PCL_COLOR_NONE &&
+ stp_check_string_parameter(v, "PrintingMode", STP_PARAMETER_DEFAULTED) &&
+ strcmp(stp_get_string_parameter(v, "PrintingMode"), "Color") == 0)
+ description->is_active = 1;
+ else
+ description->is_active = 0;
+ }
+ else if (strcmp(name, "RedDensity") == 0 ||
+ strcmp(name, "GreenDensity") == 0 ||
+ strcmp(name, "BlueDensity") == 0)
+ {
+ if (caps->color_type & PCL_COLOR_RGB &&
stp_check_string_parameter(v, "PrintingMode", STP_PARAMETER_DEFAULTED) &&
strcmp(stp_get_string_parameter(v, "PrintingMode"), "Color") == 0)
description->is_active = 1;
@@ -2247,6 +2389,8 @@ pcl_parameters(const stp_vars_t *v, const char *name,
description->deflt.integer = 6;
else if (caps->color_type == PCL_COLOR_NONE)
description->deflt.integer = 1;
+ else if (caps->color_type & PCL_COLOR_RGB)
+ description->deflt.integer = 3;
else
description->deflt.integer = 4;
description->bounds.integer.lower = -1;
@@ -2263,6 +2407,11 @@ pcl_parameters(const stp_vars_t *v, const char *name,
description->deflt.str =
stp_string_list_param(description->bounds.str, 0)->name;
}
+ else if (strcmp(name, "NativeCopies") == 0)
+ {
+ description->deflt.boolean = caps->stp_printer_type & PCL_PRINTER_COPIES;
+ description->is_active = 1;
+ }
}
@@ -2286,8 +2435,9 @@ internal_imageable_area(const stp_vars_t *v, /* I */
stp_dimension_t right_margin = 0;
stp_dimension_t bottom_margin = 0;
stp_dimension_t top_margin = 0;
+ const stp_papersize_list_t *papersize_list = stpi_get_standard_papersize_list();
- caps = pcl_get_model_capabilities(stp_get_model_id(v));
+ caps = pcl_get_model_capabilities(v);
stp_default_media_size(v, &width, &height);
@@ -2299,16 +2449,16 @@ internal_imageable_area(const stp_vars_t *v, /* I */
if (!media_size)
media_size = "";
if (strlen(media_size) == 0 &&
- ((pp = stp_get_papersize_by_size(stp_get_page_height(v),
- stp_get_page_width(v))) != NULL))
+ ((pp = stpi_get_papersize_by_size(papersize_list, stp_get_page_height(v),
+ stp_get_page_width(v))) != NULL))
media_size = pp->name;
- stp_deprintf(STP_DBG_PCL, "pcl_imageable_area(): media_size: '%s'\n",
+ stp_dprintf(STP_DBG_PCL, v, "pcl_imageable_area(): media_size: '%s'\n",
media_size);
- pcl_media_size = pcl_convert_media_size(media_size, stp_get_model_id(v));
+ pcl_media_size = pcl_convert_media_size(v, media_size);
if (media_size)
- pp = stp_get_papersize_by_name(media_size);
+ pp = stp_describe_papersize(v, media_size);
if (pp && use_paper_margins)
{
left_margin = pp->left;
@@ -2354,7 +2504,7 @@ pcl_limit(const stp_vars_t *v, /* I */
stp_dimension_t *min_width,
stp_dimension_t *min_height)
{
- const pcl_cap_t *caps= pcl_get_model_capabilities(stp_get_model_id(v));
+ const pcl_cap_t *caps= pcl_get_model_capabilities(v);
*width = caps->custom_max_width;
*height = caps->custom_max_height;
*min_width = caps->custom_min_width;
@@ -2365,8 +2515,7 @@ static const char *
pcl_describe_output(const stp_vars_t *v)
{
int printing_color = 0;
- int model = stp_get_model_id(v);
- const pcl_cap_t *caps = pcl_get_model_capabilities(model);
+ const pcl_cap_t *caps = pcl_get_model_capabilities(v);
const char *print_mode = stp_get_string_parameter(v, "PrintingMode");
stp_resolution_t xdpi, ydpi;
@@ -2378,7 +2527,9 @@ pcl_describe_output(const stp_vars_t *v)
printing_color = 0;
if (printing_color)
{
- if ((caps->color_type & PCL_COLOR_CMY) == PCL_COLOR_CMY)
+ if ((caps->color_type & PCL_COLOR_RGB) == PCL_COLOR_RGB)
+ return "RGB";
+ else if ((caps->color_type & PCL_COLOR_CMY) == PCL_COLOR_CMY)
return "CMY";
else
return "CMYK";
@@ -2387,6 +2538,16 @@ pcl_describe_output(const stp_vars_t *v)
return "Grayscale";
}
+static const stp_papersize_t *
+pcl_describe_papersize(const stp_vars_t *v, const char *name)
+{
+ const pcl_cap_t *caps= pcl_get_model_capabilities(v);
+ if (caps->stp_printer_type & PCL_PRINTER_LABEL)
+ return stpi_get_listed_papersize(name, "labels");
+ else
+ return stpi_get_listed_papersize(name, "standard");
+}
+
/*
* 'pcl_print()' - Print an image to an HP printer.
*/
@@ -2425,7 +2586,7 @@ pcl_printfunc(stp_vars_t *v)
if (pd->blank_lines > 1) /* Output accumulated lines */
{
pd->blank_lines--; /* correct for one already output */
- stp_deprintf(STP_DBG_PCL, "Blank Lines = %d\n", pd->blank_lines);
+ stp_dprintf(STP_DBG_PCL, v, "Blank Lines = %d\n", pd->blank_lines);
stp_zprintf(v, "\033*b%dY", pd->blank_lines);
pd->blank_lines=0;
}
@@ -2513,12 +2674,53 @@ get_double_param(stp_vars_t *v, const char *param)
return 1.0;
}
+static void
+initialize_lj_color(stp_vars_t *v)
+{
+ /* Magic initialization sequence */
+ stp_zprintf(v, "\033*v6W%c%c%c%c%c%c", 0, 3, 8, 8, 8, 8); /* RTL config */
+ stp_puts("\033*t3J", v); /* Render alg (best) */
+ stp_zprintf(v, "\033*o3W%c%c%c", 6, 4, 6); /* Driver config */
+ stp_puts("\033*v255A", v); /* Color comp 1) */
+ stp_puts("\033*v255B", v); /* Color comp 2) */
+ stp_puts("\033*v255C", v); /* Color comp 3) */
+ stp_puts("\033*v0I", v); /* Assign color idx 0 (white)*/
+ stp_puts("\033*v255A", v); /* Color comp 1) */
+ stp_puts("\033*v0B", v); /* Color comp 2) */
+ stp_puts("\033*v0C", v); /* Color comp 3) */
+ stp_puts("\033*v6I", v); /* Assign color idx 1 (red) */
+ stp_puts("\033*v0A", v); /* Color comp 1) */
+ stp_puts("\033*v255B", v); /* Color comp 2) */
+ stp_puts("\033*v0C", v); /* Color comp 3) */
+ stp_puts("\033*v5I", v); /* Assign color idx 5 (green) */
+ stp_puts("\033*v0A", v); /* Color comp 1) */
+ stp_puts("\033*v0B", v); /* Color comp 2) */
+ stp_puts("\033*v255C", v); /* Color comp 3) */
+ stp_puts("\033*v4I", v); /* Assign color idx 4 (blue) */
+ stp_puts("\033*v255A", v); /* Color comp 1) */
+ stp_puts("\033*v255B", v); /* Color comp 2) */
+ stp_puts("\033*v0C", v); /* Color comp 3) */
+ stp_puts("\033*v3I", v); /* Assign color idx 3 (yellow) */
+ stp_puts("\033*v255A", v); /* Color comp 1) */
+ stp_puts("\033*v0B", v); /* Color comp 2) */
+ stp_puts("\033*v255C", v); /* Color comp 3) */
+ stp_puts("\033*v2I", v); /* Assign color idx 2 (green)*/
+ stp_puts("\033*v0A", v); /* Color comp 1) */
+ stp_puts("\033*v255B", v); /* Color comp 2) */
+ stp_puts("\033*v255C", v); /* Color comp 3) */
+ stp_puts("\033*v1I", v); /* Assign color idx 1 (magenta) */
+ stp_puts("\033*v0A", v); /* Color comp 1) */
+ stp_puts("\033*v0B", v); /* Color comp 2) */
+ stp_puts("\033*v0C", v); /* Color comp 3) */
+ stp_puts("\033*v7I", v); /* Assign color idx (black) */
+ stp_puts("\033*v7S", v); /* Set Foreground Color (black) */
+}
+
static int
pcl_do_print(stp_vars_t *v, stp_image_t *image)
{
pcl_privdata_t privdata;
int status = 1;
- int model = stp_get_model_id(v);
const char *media_size = stp_get_string_parameter(v, "PageSize");
const char *media_type = stp_get_string_parameter(v, "MediaType");
const char *media_source = stp_get_string_parameter(v, "InputSlot");
@@ -2554,6 +2756,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
errlast; /* Last raster line loaded */
unsigned zero_mask;
int image_height;
+ int image_width;
const pcl_cap_t *caps; /* Printer capabilities */
int planes = 3; /* # of output planes */
int pcl_media_size; /* PCL media size code */
@@ -2565,6 +2768,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
int extra_left_margin = 0;
double density;
int label = 0;
+ const stp_papersize_list_t *paper_sizes = stpi_get_standard_papersize_list();
if (!stp_verify(v))
{
@@ -2574,7 +2778,9 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
if (strcmp(print_mode, "Color") == 0)
printing_color = 1;
- caps = pcl_get_model_capabilities(model);
+ (void) memset(&privdata, 0, sizeof(privdata));
+
+ caps = pcl_get_model_capabilities(v);
/*
* Setup a read-only pixel region for the entire image...
@@ -2589,13 +2795,16 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
pcl_describe_resolution(v, &xdpi, &ydpi);
- stp_deprintf(STP_DBG_PCL,"pcl: resolution=%dx%d\n",(int)xdpi,(int)ydpi);
+ stp_dprintf(STP_DBG_PCL, v,"pcl: resolution=%dx%d\n",(int)xdpi,(int)ydpi);
if (xdpi <= 0 || ydpi <= 0)
{
stp_eprintf(v, "No resolution found; cannot print.\n");
return 0;
}
+ if (printing_color && (caps->stp_printer_type & PCL_PRINTER_LJ_COLOR)) {
+ privdata.nodither = 1;
+ }
/*
* Choose the correct color conversion function...
*/
@@ -2619,15 +2828,15 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
dot_sizes_use=dot_sizes;
}
- stp_deprintf(STP_DBG_PCL, "privdata.do_cret = %d\n", privdata.do_cret);
- stp_deprintf(STP_DBG_PCL, "privdata.do_cretb = %d\n", privdata.do_cretb);
+ stp_dprintf(STP_DBG_PCL, v, "privdata.do_cret = %d\n", privdata.do_cret);
+ stp_dprintf(STP_DBG_PCL, v, "privdata.do_cretb = %d\n", privdata.do_cretb);
if (ink_type && printing_color)
privdata.do_6color = (strcmp(ink_type, "Photo") == 0);
else
privdata.do_6color = 0;
- stp_deprintf(STP_DBG_PCL, "privdata.do_6color = %d\n", privdata.do_6color);
+ stp_dprintf(STP_DBG_PCL, v, "privdata.do_6color = %d\n", privdata.do_6color);
/*
* Compute the output size...
@@ -2642,6 +2851,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
top -= page_top;
image_height = stp_image_height(image);
+ image_width = stp_image_width(image);
/*
* Set media size here because it is needed by the margin calculation code.
@@ -2650,13 +2860,13 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
if (!media_size)
media_size = "";
if (strlen(media_size) == 0 &&
- ((pp = stp_get_papersize_by_size(stp_get_page_height(v),
- stp_get_page_width(v))) != NULL))
+ ((pp = stpi_get_papersize_by_size(paper_sizes, stp_get_page_height(v),
+ stp_get_page_width(v))) != NULL))
media_size = pp->name;
- pcl_media_size = pcl_convert_media_size(media_size, model);
+ pcl_media_size = pcl_convert_media_size(v, media_size);
- stp_deprintf(STP_DBG_PCL,"pcl_media_size = %d, media_size = %s\n", pcl_media_size, media_size);
+ stp_dprintf(STP_DBG_PCL, v,"pcl_media_size = %d, media_size = %s\n", pcl_media_size, media_size);
/*
* If the media size requested is unknown, try it as a custom size.
@@ -2665,15 +2875,16 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
*/
if (pcl_media_size == -1) {
- stp_deprintf(STP_DBG_PCL, "Paper size %s is not directly supported by printer.\n",
+ stp_dprintf(STP_DBG_PCL, v, "Paper size %s is not directly supported by printer.\n",
media_size);
- stp_deprintf(STP_DBG_PCL, "Trying as custom pagesize (watch the margins!)\n");
+ stp_dprintf(STP_DBG_PCL, v, "Trying as custom pagesize (watch the margins!)\n");
pcl_media_size = PCL_PAPERSIZE_CUSTOM; /* Custom */
}
- stp_deprintf(STP_DBG_PCL, "Duplex: %s, Page_Number: %d\n", duplex_mode, page_number);
+ stp_dprintf(STP_DBG_PCL, v, "Duplex: %s, Page_Number: %d\n", duplex_mode, page_number);
privdata.duplex=0;
privdata.tumble=0;
+ privdata.copies=1;
/*
* Duplex
@@ -2690,6 +2901,15 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
}
}
+ /*
+ * Multiple copies!
+ */
+
+ if (stp_check_boolean_parameter(v, "NativeCopies", STP_PARAMETER_ACTIVE) &&
+ stp_get_boolean_parameter(v, "NativeCopies") &&
+ stp_check_int_parameter(v, "NumCopies", STP_PARAMETER_ACTIVE))
+ privdata.copies = stp_get_int_parameter(v, "NumCopies");
+
/*
* Label (PJL) settings and Orientation
*/
@@ -2748,7 +2968,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
int pcl_media_type, /* PCL media type code */
pcl_media_source; /* PCL media source code */
- stp_deprintf(STP_DBG_PCL, "Normal init\n");
+ stp_dprintf(STP_DBG_PCL, v, "Normal init\n");
if (label)
{
@@ -2812,14 +3032,14 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
*/
if (media_source && strlen(media_source) != 0) {
- pcl_media_source = pcl_string_to_val(media_source, pcl_media_sources,
+ pcl_media_source = pcl_string_to_val(v, media_source, pcl_media_sources,
sizeof(pcl_media_sources) / sizeof(pcl_t));
- stp_deprintf(STP_DBG_PCL,"pcl_media_source = %d, media_source = %s\n", pcl_media_source,
+ stp_dprintf(STP_DBG_PCL, v,"pcl_media_source = %d, media_source = %s\n", pcl_media_source,
media_source);
if (pcl_media_source == -1)
- stp_deprintf(STP_DBG_PCL, "Unknown media source %s, ignored.\n", media_source);
+ stp_dprintf(STP_DBG_PCL, v, "Unknown media source %s, ignored.\n", media_source);
else if (pcl_media_source != PCL_PAPERSOURCE_STANDARD) {
/* Correct the value by taking the modulus */
@@ -2828,7 +3048,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
PAPERSOURCE_ADJ_GUIDE)
{
manual_feed_left_adjust = 1;
- stp_deprintf(STP_DBG_PCL, "Adjusting left margin for manual feed.\n");
+ stp_dprintf(STP_DBG_PCL, v, "Adjusting left margin for manual feed.\n");
}
pcl_media_source = pcl_media_source % PAPERSOURCE_MOD;
stp_zprintf(v, "\033&l%dH", pcl_media_source);
@@ -2840,14 +3060,14 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
*/
if (media_type && strlen(media_type) != 0) {
- pcl_media_type = pcl_string_to_val(media_type, pcl_media_types,
+ pcl_media_type = pcl_string_to_val(v, media_type, pcl_media_types,
sizeof(pcl_media_types) / sizeof(pcl_t));
- stp_deprintf(STP_DBG_PCL,"pcl_media_type = %d, media_type = %s\n", pcl_media_type,
+ stp_dprintf(STP_DBG_PCL, v,"pcl_media_type = %d, media_type = %s\n", pcl_media_type,
media_type);
if (pcl_media_type == -1) {
- stp_deprintf(STP_DBG_PCL, "Unknown media type %s, set to PLAIN.\n", media_type);
+ stp_dprintf(STP_DBG_PCL, v, "Unknown media type %s, set to PLAIN.\n", media_type);
pcl_media_type = PCL_PAPERTYPE_PLAIN;
}
@@ -2858,7 +3078,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
*/
if (privdata.do_cretb && pcl_media_type == PCL_PAPERTYPE_GLOSSY) {
- stp_deprintf(STP_DBG_PCL, "Media type GLOSSY, set to PREMIUM for PhotoRET II.\n");
+ stp_dprintf(STP_DBG_PCL, v, "Media type GLOSSY, set to PREMIUM for PhotoRET II.\n");
pcl_media_type = PCL_PAPERTYPE_PREMIUM;
}
}
@@ -2869,7 +3089,9 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
* Set DJ print quality to "best" if resolution >= 300
*/
- if ((xdpi >= 300) && ((caps->stp_printer_type & PCL_PRINTER_DJ) == PCL_PRINTER_DJ))
+ if (caps->stp_printer_type & PCL_PRINTER_LJ_COLOR)
+ stp_zprintf(v, "\033&l%dM", pcl_media_type);
+ else if ((xdpi >= 300) && ((caps->stp_printer_type & PCL_PRINTER_DJ) == PCL_PRINTER_DJ))
{
if ((caps->stp_printer_type & PCL_PRINTER_MEDIATYPE) == PCL_PRINTER_MEDIATYPE)
{
@@ -2898,16 +3120,19 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
}
}
+ /* Number of copies */
+ if (privdata.copies > 1)
+ stp_zprintf(v,"\033&l%dX", privdata.copies);
+
/*
* Duplex
*/
-
if (privdata.duplex)
stp_zprintf(v,"\033&l%dS", privdata.duplex + privdata.tumble);
}
else
{
- stp_deprintf(STP_DBG_PCL, "Back face init\n");
+ stp_dprintf(STP_DBG_PCL, v, "Back face init\n");
stp_puts("\033&a2G", v);
}
@@ -2947,7 +3172,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
*/
if (printing_color)
- if ((caps->color_type & PCL_COLOR_CMY) == PCL_COLOR_CMY)
+ if (caps->color_type & (PCL_COLOR_CMY | PCL_COLOR_RGB))
planes = 3;
else
if (privdata.do_6color)
@@ -2979,7 +3204,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
else
{
stp_zprintf(v, "\033*t%dR", (int) xdpi); /* Simple resolution */
- if (printing_color)
+ if (printing_color && ! (caps->stp_printer_type & PCL_PRINTER_LJ_COLOR))
{
if ((caps->color_type & PCL_COLOR_CMY) == PCL_COLOR_CMY)
stp_puts("\033*r-3U", v); /* Simple CMY color */
@@ -3016,7 +3241,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
the_top_margin = caps->normal_margins.top_margin;
}
- stp_deprintf(STP_DBG_PCL, "left %d margin %d top %d margin %d width %d height %d\n",
+ stp_dprintf(STP_DBG_PCL, v, "left %d margin %d top %d margin %d width %d height %d\n",
left, the_left_margin, top, the_top_margin, out_width, out_height);
if (manual_feed_left_adjust)
@@ -3031,7 +3256,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
* of the difference between the maximum width and the actual
* width experimentally yields correct results -- rlk 20081014
*/
- stp_deprintf(STP_DBG_PCL,
+ stp_dprintf(STP_DBG_PCL, v,
" Adjusting manual feed left margin by %d\n", wdelta / 3);
extra_left_margin += wdelta / 3;
}
@@ -3045,6 +3270,12 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
stp_zprintf(v, "\033*r%dS", out_width); /* Set raster width */
stp_zprintf(v, "\033*r%dT", out_height); /* Set raster height */
+ if (printing_color && caps->stp_printer_type & PCL_PRINTER_LJ_COLOR)
+ {
+ privdata.row_buf = stp_malloc(out_width * out_height);
+ initialize_lj_color(v);
+ }
+
if (privdata.do_cretb)
{
/* Move to top left of printed area */
@@ -3060,6 +3291,8 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
privdata.height = (out_width + 7) / 8;
if (privdata.do_cret)
privdata.height *= 2;
+ else if (printing_color && caps->stp_printer_type & PCL_PRINTER_LJ_COLOR)
+ privdata.height = out_width * 3;
if (!printing_color)
{
@@ -3076,7 +3309,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
magenta = stp_malloc(privdata.height);
yellow = stp_malloc(privdata.height);
- if ((caps->color_type & PCL_COLOR_CMY) == PCL_COLOR_CMY)
+ if (caps->color_type & (PCL_COLOR_CMY | PCL_COLOR_RGB))
black = NULL;
else
black = stp_malloc(privdata.height);
@@ -3099,6 +3332,8 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
else
stp_set_string_parameter(v, "STPIOutputType", "Grayscale");
}
+ else if (caps->color_type & PCL_COLOR_RGB)
+ stp_set_string_parameter(v, "STPIOutputType", "RGB");
else
stp_set_string_parameter(v, "STPIOutputType", "CMY");
@@ -3126,21 +3361,37 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
#endif
stp_dither_init(v, image, out_width, xdpi, ydpi);
- if (black)
+ if (privdata.nodither)
{
- stp_dither_add_channel(v, black, STP_ECOLOR_K, 0);
- stp_channel_set_black_channel(v, STP_ECOLOR_K);
+ int i = 0;
+ stp_channel_reset(v);
+ if (black)
+ stp_channel_add(v, i++, 0, 1.0);
+ if (cyan)
+ stp_channel_add(v, i++, 0, 1.0);
+ if (magenta)
+ stp_channel_add(v, i++, 0, 1.0);
+ if (yellow)
+ stp_channel_add(v, i++, 0, 1.0);
+ }
+ else
+ {
+ if (black)
+ {
+ stp_dither_add_channel(v, black, STP_ECOLOR_K, 0);
+ stp_channel_set_black_channel(v, STP_ECOLOR_K);
+ }
+ if (cyan)
+ stp_dither_add_channel(v, cyan, STP_ECOLOR_C, 0);
+ if (lcyan)
+ stp_dither_add_channel(v, lcyan, STP_ECOLOR_C, 1);
+ if (magenta)
+ stp_dither_add_channel(v, magenta, STP_ECOLOR_M, 0);
+ if (lmagenta)
+ stp_dither_add_channel(v, lmagenta, STP_ECOLOR_M, 1);
+ if (yellow)
+ stp_dither_add_channel(v, yellow, STP_ECOLOR_Y, 0);
}
- if (cyan)
- stp_dither_add_channel(v, cyan, STP_ECOLOR_C, 0);
- if (lcyan)
- stp_dither_add_channel(v, lcyan, STP_ECOLOR_C, 1);
- if (magenta)
- stp_dither_add_channel(v, magenta, STP_ECOLOR_M, 0);
- if (lmagenta)
- stp_dither_add_channel(v, lmagenta, STP_ECOLOR_M, 1);
- if (yellow)
- stp_dither_add_channel(v, yellow, STP_ECOLOR_Y, 0);
/* Ensure that density does not exceed 1.0 */
@@ -3150,7 +3401,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
stp_set_float_parameter(v, "Density", 1.0);
}
- stp_deprintf(STP_DBG_PCL, "Density: %f\n", stp_get_float_parameter(v, "Density"));
+ stp_dprintf(STP_DBG_PCL, v, "Density: %f\n", stp_get_float_parameter(v, "Density"));
if (stp_get_float_parameter(v, "Density") > 1.0)
stp_set_float_parameter(v, "Density", 1.0);
density = stp_get_float_parameter(v, "Density");
@@ -3219,36 +3470,45 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
density));
- if (!stp_check_curve_parameter(v, "HueMap", STP_PARAMETER_ACTIVE))
+ if (!(caps->color_type & PCL_COLOR_RGB))
{
- stp_curve_t *hue_adjustment =
- stp_curve_create_from_string(standard_hue_adjustment);
- stp_set_curve_parameter(v, "HueMap", hue_adjustment);
- stp_curve_destroy(hue_adjustment);
- }
- if (!stp_check_curve_parameter(v, "LumMap", STP_PARAMETER_ACTIVE))
- {
- stp_curve_t *lum_adjustment =
- stp_curve_create_from_string(standard_lum_adjustment);
+ if (!stp_check_curve_parameter(v, "HueMap", STP_PARAMETER_ACTIVE))
+ {
+ stp_curve_t *hue_adjustment =
+ stp_curve_create_from_string(standard_hue_adjustment);
+ stp_set_curve_parameter(v, "HueMap", hue_adjustment);
+ stp_curve_destroy(hue_adjustment);
+ }
+ if (!stp_check_curve_parameter(v, "LumMap", STP_PARAMETER_ACTIVE))
+ {
+ stp_curve_t *lum_adjustment =
+ stp_curve_create_from_string(standard_lum_adjustment);
#if 0
- /*
- * This would represent a change to the PCL driver in 5.2.12
- *
- * This call was missing and has represented a bug (if a clearly
- * non-fatal one) in the PCL driver since time immemorial. The
- * non-use of the variable was finally called out by gcc6. In my
- * judgment, fixing the bug and changing the output of many PCL
- * printers (even if it were for the better) would be more problematic
- * than leaving the output as-is.
- *
- * - Robert Krawitz 2016-12-29
- */
- stp_set_curve_parameter(v, "LumMap", lum_adjustment);
+ /*
+ * This would represent a change to the PCL driver in 5.2.12
+ *
+ * This call was missing and has represented a bug (if a clearly
+ * non-fatal one) in the PCL driver since time immemorial. The
+ * non-use of the variable was finally called out by gcc6. In my
+ * judgment, fixing the bug and changing the output of many PCL
+ * printers (even if it were for the better) would be more problematic
+ * than leaving the output as-is.
+ *
+ * - Robert Krawitz 2016-12-29
+ */
+ stp_set_curve_parameter(v, "LumMap", lum_adjustment);
#endif
- stp_curve_destroy(lum_adjustment);
+ stp_curve_destroy(lum_adjustment);
+ }
}
- (void) stp_color_init(v, image, 65536);
+ if (printing_color && (caps->stp_printer_type & PCL_PRINTER_LJ_COLOR))
+ {
+ stp_set_float_parameter(v, "AppGammaScale", 1.0);
+ (void) stp_color_init(v, image, 256);
+ }
+ else
+ (void) stp_color_init(v, image, 65536);
errdiv = image_height / out_height;
errmod = image_height % out_height;
@@ -3277,9 +3537,51 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
break;
}
}
- stp_dither(v, y, duplicate_line, zero_mask, NULL);
- pcl_printfunc(v);
- stp_deprintf(STP_DBG_PCL,"pcl_print: y = %d, line = %d, val = %d, mod = %d, height = %d\n",
+ if (privdata.nodither)
+ {
+ if (! duplicate_line)
+ {
+ unsigned row_errdiv = image_width / out_width;
+ unsigned row_errmod = image_width % out_width;
+ unsigned row_errval = 0;
+ unsigned row_errlast = -1;
+ unsigned row_errcol = 0;
+ unsigned short *output = stp_channel_get_output(v);
+ unsigned char *optr = privdata.row_buf;
+ int x;
+ for (x = 0; x < out_width; x++)
+ {
+ if (row_errcol != row_errlast)
+ {
+ row_errlast = row_errcol;
+ optr[0] = output[(row_errcol * 3) + 0] / (unsigned short) 257;
+ optr[1] = output[(row_errcol * 3) + 1] / (unsigned short) 257;
+ optr[2] = output[(row_errcol * 3) + 2] / (unsigned short) 257;
+ }
+ else
+ {
+ optr[0] = optr[-3];
+ optr[1] = optr[-2];
+ optr[2] = optr[-1];
+ }
+ optr += 3;
+ row_errval += row_errmod;
+ row_errcol += row_errdiv;
+ if (row_errval >= out_width)
+ {
+ row_errval -= out_width;
+ row_errcol++;
+ }
+ }
+ }
+ (*(privdata.writefunc))(v, privdata.row_buf, privdata.height, 1);
+ }
+ else
+ {
+ stp_dither(v, y, duplicate_line, zero_mask, NULL);
+ pcl_printfunc(v);
+ }
+ stp_dprintf(STP_DBG_PCL, v,"pcl_print: y = %d, line = %d, val = %d, mod = %d, height = %d\n",
y, errline, errval, errmod, out_height);
errval += errmod;
errline += errdiv;
@@ -3295,7 +3597,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
if (privdata.blank_lines > 1)
{
privdata.blank_lines--; /* correct for one already output */
- stp_deprintf(STP_DBG_PCL, "Blank Lines = %d\n", privdata.blank_lines);
+ stp_dprintf(STP_DBG_PCL, v, "Blank Lines = %d\n", privdata.blank_lines);
stp_zprintf(v, "\033*b%dY", privdata.blank_lines);
privdata.blank_lines=0;
}
@@ -3322,6 +3624,8 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image)
if (privdata.comp_buf != NULL)
stp_free(privdata.comp_buf);
+ if (privdata.row_buf != NULL)
+ stp_free(privdata.row_buf);
if ((caps->stp_printer_type & PCL_PRINTER_NEW_ERG) == PCL_PRINTER_NEW_ERG)
stp_puts("\033*rC", v);
@@ -3345,7 +3649,6 @@ pcl_print(const stp_vars_t *v, stp_image_t *image)
{
int status;
stp_vars_t *nv = stp_vars_create_copy(v);
- stp_prune_inactive_options(nv);
status = pcl_do_print(nv, image);
stp_vars_destroy(nv);
return status;
@@ -3365,7 +3668,8 @@ static const stp_printfuncs_t print_pcl_printfuncs =
stp_verify_printer_params,
NULL,
NULL,
- NULL
+ NULL,
+ pcl_describe_papersize
};
@@ -3420,14 +3724,14 @@ static stp_family_t print_pcl_module_data =
static int
print_pcl_module_init(void)
{
- return stp_family_register(print_pcl_module_data.printer_list);
+ return stpi_family_register(print_pcl_module_data.printer_list);
}
static int
print_pcl_module_exit(void)
{
- return stp_family_unregister(print_pcl_module_data.printer_list);
+ return stpi_family_unregister(print_pcl_module_data.printer_list);
}
diff --git a/src/main/print-ps.c b/src/main/print-ps.c
index 5a8ab9c..751424d 100644
--- a/src/main/print-ps.c
+++ b/src/main/print-ps.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -94,7 +93,8 @@ static const int the_parameter_count =
sizeof(the_parameters) / sizeof(const stp_parameter_t);
static int
-ps_option_to_param(stp_parameter_t *param, stp_mxml_node_t *option)
+ps_option_to_param(const stp_vars_t *v, stp_parameter_t *param,
+ stp_mxml_node_t *option)
{
const char *group_text = stp_mxmlElementGetAttr(option, "grouptext");
@@ -120,7 +120,7 @@ ps_option_to_param(stp_parameter_t *param, stp_mxml_node_t *option)
param->is_active = 1;
param->verify_this_parameter = 1;
param->name = stp_mxmlElementGetAttr(option, "stpname");
- stp_deprintf(STP_DBG_PS,
+ stp_dprintf(STP_DBG_PS, v,
"Gutenprint parameter %s type %d mandatory %d class %d level %d channel %d default %s %f",
param->name, param->p_type, param->is_mandatory,
param->p_class, param->p_level, param->channel,
@@ -131,7 +131,7 @@ ps_option_to_param(stp_parameter_t *param, stp_mxml_node_t *option)
param->deflt.dbl = stp_default_value;
param->bounds.dbl.upper = upper_bound;
param->bounds.dbl.lower = lower_bound;
- stp_deprintf(STP_DBG_PS, " %.3f %.3f %.3f\n",
+ stp_dprintf(STP_DBG_PS, v, " %.3f %.3f %.3f\n",
param->deflt.dbl, param->bounds.dbl.upper,
param->bounds.dbl.lower);
break;
@@ -139,7 +139,7 @@ ps_option_to_param(stp_parameter_t *param, stp_mxml_node_t *option)
param->deflt.dimension = atoi(default_value);
param->bounds.dimension.upper = (stp_dimension_t) upper_bound;
param->bounds.dimension.lower = (stp_dimension_t) lower_bound;
- stp_deprintf(STP_DBG_PS, " %f %f %f\n",
+ stp_dprintf(STP_DBG_PS, v, " %f %f %f\n",
param->deflt.dimension, param->bounds.dimension.upper,
param->bounds.dimension.lower);
break;
@@ -147,16 +147,16 @@ ps_option_to_param(stp_parameter_t *param, stp_mxml_node_t *option)
param->deflt.integer = atoi(default_value);
param->bounds.integer.upper = (int) upper_bound;
param->bounds.integer.lower = (int) lower_bound;
- stp_deprintf(STP_DBG_PS, " %d %d %d\n",
+ stp_dprintf(STP_DBG_PS, v, " %d %d %d\n",
param->deflt.integer, param->bounds.integer.upper,
param->bounds.integer.lower);
break;
case STP_PARAMETER_TYPE_BOOLEAN:
param->deflt.boolean = strcasecmp(default_value, "true") == 0 ? 1 : 0;
- stp_deprintf(STP_DBG_PS, " %d\n", param->deflt.boolean);
+ stp_dprintf(STP_DBG_PS, v, " %d\n", param->deflt.boolean);
break;
default:
- stp_deprintf(STP_DBG_PS, "\n");
+ stp_dprintf(STP_DBG_PS, v, "\n");
break;
}
}
@@ -263,7 +263,7 @@ ps_list_parameters(const stp_vars_t *v)
option = stpi_xmlppd_find_option_index(m_ppd, i);
if (option)
{
- ps_option_to_param(param, option);
+ ps_option_to_param(v, param, option);
if (param->p_type != STP_PARAMETER_TYPE_INVALID &&
strcmp(param->name, "PageRegion") != 0 &&
strcmp(param->name, "PageSize") != 0)
@@ -314,8 +314,8 @@ ps_parameters_internal(const stp_vars_t *v, const char *name,
nickname = stp_mxmlElementGetAttr(m_ppd, "nickname");
else
nickname = _("None; please provide a PPD file");
- stp_string_list_add_string(description->bounds.str,
- nickname, nickname);
+ stp_string_list_add_string_unsafe(description->bounds.str,
+ nickname, nickname);
description->deflt.str = nickname;
description->is_active = 1;
return;
@@ -374,7 +374,7 @@ ps_parameters_internal(const stp_vars_t *v, const char *name,
}
}
- ps_option_to_param(description, option);
+ ps_option_to_param(v, description, option);
if (description->p_type != STP_PARAMETER_TYPE_STRING_LIST)
return;
num_choices = atoi(stp_mxmlElementGetAttr(option, "num_choices"));
@@ -470,6 +470,74 @@ ps_media_size_internal(const stp_vars_t *v, /* I */
return;
}
+static const stp_papersize_t *
+ps_describe_papersize(const stp_vars_t *v, const char *name)
+{
+ int status = check_ppd_file(v);
+ if (status)
+ {
+ stp_mxml_node_t *paper = stpi_xmlppd_find_page_size(m_ppd, name);
+ if (paper)
+ {
+ const char *papersize_list_name = m_ppd_file ? m_ppd_file : "NOPPD";
+ stp_papersize_list_t *ourlist =
+ stpi_find_papersize_list_named(papersize_list_name);
+ const stp_papersize_t *papersize;
+ const stp_papersize_t *standard_papersize =
+ stpi_get_listed_papersize(name, "standard");
+
+ if (! ourlist)
+ ourlist = stpi_new_papersize_list(papersize_list_name);
+
+ papersize = stpi_get_papersize_by_name(ourlist, name);
+ if (! papersize)
+ {
+ stp_papersize_t *npapersize = stp_malloc(sizeof(stp_papersize_t));
+ npapersize->name = stp_strdup(name);
+ npapersize->text = stp_strdup(name);
+ npapersize->comment = NULL;
+ /*
+ * Note that we used the width and height from the PPD file,
+ * not from the standard definition. This is so that if the
+ * PPD file is for another driver that uses slightly different
+ * dimensions than we do that our description matches that of
+ * driver in use.
+ */
+ npapersize->width = atof(stp_mxmlElementGetAttr(paper, "width"));
+ npapersize->height = atof(stp_mxmlElementGetAttr(paper, "height"));
+ /*
+ * Only use auxiliary information from our list if our paper size
+ * really is substantially the same as what the PPD file says!
+ */
+ if (standard_papersize &&
+ fabs(npapersize->width - standard_papersize->width) < 1 &&
+ fabs(npapersize->height - standard_papersize->height) < 1)
+ {
+ npapersize->paper_unit = standard_papersize->paper_unit;
+ npapersize->paper_size_type = standard_papersize->paper_size_type;
+ npapersize->top = standard_papersize->top;
+ npapersize->left = standard_papersize->left;
+ npapersize->bottom = standard_papersize->bottom;
+ npapersize->right = standard_papersize->right;
+ }
+ else
+ {
+ npapersize->top = 0;
+ npapersize->left = 0;
+ npapersize->bottom = 0;
+ npapersize->right = 0;
+ npapersize->paper_unit = PAPERSIZE_ENGLISH_STANDARD;
+ npapersize->paper_size_type = PAPERSIZE_TYPE_STANDARD;
+ }
+ if (stpi_papersize_create(ourlist, npapersize))
+ return npapersize;
+ }
+ return papersize;
+ }
+ }
+ return NULL;
+}
+
static void
ps_media_size(const stp_vars_t *v, stp_dimension_t *width, stp_dimension_t *height)
{
@@ -954,7 +1022,7 @@ ps_print_internal(stp_vars_t *v, stp_image_t *image)
* Output a standard PostScript header with DSC comments...
*/
- curtime = time(NULL);
+ curtime = stpi_time(NULL);
top = paper_height - top;
@@ -1175,7 +1243,6 @@ ps_print(const stp_vars_t *v, stp_image_t *image)
char *locale;
#endif
stp_vars_t *nv = stp_vars_create_copy(v);
- stp_prune_inactive_options(nv);
if (!stp_verify(nv))
{
stp_eprintf(nv, "Print options not verified; cannot print.\n");
@@ -1341,7 +1408,8 @@ static const stp_printfuncs_t print_ps_printfuncs =
stp_verify_printer_params,
NULL,
NULL,
- ps_external_options
+ ps_external_options,
+ ps_describe_papersize
};
@@ -1355,14 +1423,14 @@ static stp_family_t print_ps_module_data =
static int
print_ps_module_init(void)
{
- return stp_family_register(print_ps_module_data.printer_list);
+ return stpi_family_register(print_ps_module_data.printer_list);
}
static int
print_ps_module_exit(void)
{
- return stp_family_unregister(print_ps_module_data.printer_list);
+ return stpi_family_unregister(print_ps_module_data.printer_list);
}
diff --git a/src/main/print-raw.c b/src/main/print-raw.c
index 131d095..756f7a9 100644
--- a/src/main/print-raw.c
+++ b/src/main/print-raw.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -156,15 +155,17 @@ raw_parameters(const stp_vars_t *v, const char *name,
}
else if (strcmp(name, "PageSize") == 0)
{
- int papersizes = stp_known_papersizes();
+ const stp_papersize_list_t *paper_sizes =
+ stpi_get_standard_papersize_list();
+ const stp_papersize_list_item_t *ptli =
+ stpi_papersize_list_get_start(paper_sizes);
description->bounds.str = stp_string_list_create();
- for (i = 0; i < papersizes; i++)
+ while (ptli)
{
- /* All users of the raw drivers should use "Custom" PageSize
- and manually set page height/width! */
- const stp_papersize_t *pt = stp_get_papersize_by_index(i);
+ const stp_papersize_t *pt = stpi_paperlist_item_get_data(ptli);
stp_string_list_add_string(description->bounds.str,
pt->name, gettext(pt->text));
+ ptli = stpi_paperlist_item_next(ptli);
}
description->deflt.str =
stp_string_list_param(description->bounds.str, 0)->name;
@@ -237,7 +238,6 @@ raw_print(const stp_vars_t *v, stp_image_t *image)
const char *ink_type = stp_get_string_parameter(nv, "InkType");
stp_image_init(image);
- stp_prune_inactive_options(nv);
if (!stp_verify(nv))
{
stp_eprintf(nv, _("Print options not verified; cannot print.\n"));
@@ -361,7 +361,8 @@ static const stp_printfuncs_t print_raw_printfuncs =
stp_verify_printer_params,
NULL,
NULL,
- NULL
+ NULL,
+ stpi_standard_describe_papersize
};
@@ -377,14 +378,14 @@ static stp_family_t print_raw_module_data =
static int
print_raw_module_init(void)
{
- return stp_family_register(print_raw_module_data.printer_list);
+ return stpi_family_register(print_raw_module_data.printer_list);
}
static int
print_raw_module_exit(void)
{
- return stp_family_unregister(print_raw_module_data.printer_list);
+ return stpi_family_unregister(print_raw_module_data.printer_list);
}
diff --git a/src/main/print-util.c b/src/main/print-util.c
index 400f7b7..1119484 100644
--- a/src/main/print-util.c
+++ b/src/main/print-util.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -48,6 +47,11 @@
#define FMIN(a, b) ((a) < (b) ? (a) : (b))
+static stp_outfunc_t global_errfunc;
+static void *global_errdata;
+static stp_outfunc_t global_dbgfunc;
+static void *global_dbgdata;
+
typedef struct
{
stp_outfunc_t ofunc;
@@ -283,14 +287,68 @@ stp_send_command(const stp_vars_t *v, const char *command,
}
void
+stp_set_global_errfunc(stp_outfunc_t val)
+{
+ global_errfunc = val;
+}
+
+stp_outfunc_t
+stp_get_global_errfunc(void)
+{
+ return global_errfunc;
+}
+
+void
+stp_set_global_errdata(void *val)
+{
+ global_errdata = val;
+}
+
+void *
+stp_get_global_errdata(void)
+{
+ return global_errdata;
+}
+
+void
+stp_set_global_dbgfunc(stp_outfunc_t val)
+{
+ global_dbgfunc = val;
+}
+
+stp_outfunc_t
+stp_get_global_dbgfunc(void)
+{
+ return global_dbgfunc;
+}
+
+void
+stp_set_global_dbgdata(void *val)
+{
+ global_dbgdata = val;
+}
+
+void *
+stp_get_global_dbgdata(void)
+{
+ return global_dbgdata;
+}
+
+void
stp_eprintf(const stp_vars_t *v, const char *format, ...)
{
int bytes;
- if (stp_get_errfunc(v))
+ stp_outfunc_t errfunc = stp_get_errfunc(v);
+ if (! errfunc)
+ errfunc = global_errfunc;
+ void * errdata = stp_get_errdata(v);
+ if (! errdata)
+ errdata = global_errdata;
+ if (errfunc)
{
char *result;
STPI_VASPRINTF(result, bytes, format);
- (stp_get_errfunc(v))((void *)(stp_get_errdata(v)), result, bytes);
+ errfunc(errdata, result, bytes);
stp_free(result);
}
else
@@ -305,16 +363,34 @@ stp_eprintf(const stp_vars_t *v, const char *format, ...)
void
stp_erputc(int ch)
{
- putc(ch, stderr);
+ if (global_errfunc)
+ {
+ char c[1];
+ c[0] = (char) ch;
+ global_errfunc(global_errdata, c, 1);
+ }
+ else
+ putc(ch, stderr);
}
void
stp_erprintf(const char *format, ...)
{
- va_list args;
- va_start(args, format);
- vfprintf(stderr, format, args);
- va_end(args);
+ if (global_errfunc)
+ {
+ int bytes;
+ char *result;
+ STPI_VASPRINTF(result, bytes, format);
+ global_errfunc(global_errdata, result, bytes);
+ stp_free(result);
+ }
+ else
+ {
+ va_list args;
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ }
}
static unsigned long stpi_debug_level = 0;
@@ -345,17 +421,33 @@ stp_get_debug_level(void)
void
stp_dprintf(unsigned long level, const stp_vars_t *v, const char *format, ...)
{
- int bytes;
stpi_init_debug();
if (level & stpi_debug_level)
{
- if (stp_get_errfunc(v))
+ stp_outfunc_t dbgfunc = stp_get_dbgfunc(v);
+ if (! dbgfunc)
+ dbgfunc = global_dbgfunc;
+ if (! dbgfunc)
+ dbgfunc = stp_get_errfunc(v);
+ if (! dbgfunc)
+ dbgfunc = global_errfunc;
+ void *dbgdata = stp_get_dbgdata(v);
+ if (! dbgdata)
+ dbgdata = global_dbgdata;
+ if (! dbgdata)
+ dbgdata = stp_get_errdata(v);
+ if (! dbgdata)
+ dbgdata = global_errdata;
+ if (dbgfunc)
{
+ int bytes;
char *result;
STPI_VASPRINTF(result, bytes, format);
- (stp_get_errfunc(v))((void *)(stp_get_errdata(v)), result, bytes);
+ dbgfunc(dbgdata, result, bytes);
stp_free(result);
- } else {
+ }
+ else
+ {
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
@@ -367,12 +459,25 @@ stp_dprintf(unsigned long level, const stp_vars_t *v, const char *format, ...)
void
stp_deprintf(unsigned long level, const char *format, ...)
{
- va_list args;
- va_start(args, format);
stpi_init_debug();
if (level & stpi_debug_level)
- vfprintf(stderr, format, args);
- va_end(args);
+ {
+ if (global_dbgfunc)
+ {
+ int bytes;
+ char *result;
+ STPI_VASPRINTF(result, bytes, format);
+ global_dbgfunc(global_dbgdata, result, bytes);
+ stp_free(result);
+ }
+ else
+ {
+ va_list args;
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ }
+ }
}
static void
@@ -393,12 +498,12 @@ stp_init_debug_messages(stp_vars_t *v)
{
int verified_flag = stp_get_verified(v);
debug_msgbuf_t *msgbuf = stp_malloc(sizeof(debug_msgbuf_t));
- msgbuf->ofunc = stp_get_errfunc(v);
- msgbuf->odata = stp_get_errdata(v);
+ msgbuf->ofunc = stp_get_dbgfunc(v);
+ msgbuf->odata = stp_get_dbgdata(v);
msgbuf->data = NULL;
msgbuf->bytes = 0;
- stp_set_errfunc((stp_vars_t *) v, fill_buffer_writefunc);
- stp_set_errdata((stp_vars_t *) v, msgbuf);
+ stp_set_dbgfunc((stp_vars_t *) v, fill_buffer_writefunc);
+ stp_set_dbgdata((stp_vars_t *) v, msgbuf);
stp_set_verified((stp_vars_t *) v, verified_flag);
}
@@ -406,13 +511,17 @@ void
stp_flush_debug_messages(stp_vars_t *v)
{
int verified_flag = stp_get_verified(v);
- debug_msgbuf_t *msgbuf = (debug_msgbuf_t *)stp_get_errdata(v);
- stp_set_errfunc((stp_vars_t *) v, msgbuf->ofunc);
- stp_set_errdata((stp_vars_t *) v, msgbuf->odata);
+ debug_msgbuf_t *msgbuf = (debug_msgbuf_t *)stp_get_dbgdata(v);
+ stp_set_dbgfunc((stp_vars_t *) v, msgbuf->ofunc);
+ stp_set_dbgdata((stp_vars_t *) v, msgbuf->odata);
stp_set_verified((stp_vars_t *) v, verified_flag);
if (msgbuf->bytes > 0)
{
- stp_eprintf(v, "%s", msgbuf->data);
+ /*
+ * Messages aren't tagged by debug value, so we force them
+ * out if any debug flag is set.
+ */
+ stp_dprintf((unsigned long) -1, v, "%s", msgbuf->data);
stp_free(msgbuf->data);
}
stp_free(msgbuf);
@@ -485,7 +594,6 @@ stp_init(void)
stpi_init_debug();
stp_xml_preinit();
stpi_init_printer();
- stpi_init_paper();
stpi_init_dither();
/* Load modules */
if (stp_module_load())
@@ -596,7 +704,7 @@ stp_merge_printvars(stp_vars_t *user, const stp_vars_t *print)
int i;
stp_parameter_list_t params = stp_get_parameter_list(print);
int count = stp_parameter_list_count(params);
- stp_deprintf(STP_DBG_VARS, "Merging printvars from %s\n",
+ stp_dprintf(STP_DBG_VARS, user, "Merging printvars from %s\n",
stp_get_driver(print));
for (i = 0; i < count; i++)
{
@@ -631,7 +739,7 @@ stp_merge_printvars(stp_vars_t *user, const stp_vars_t *print)
stp_parameter_description_destroy(&desc);
}
}
- stp_deprintf(STP_DBG_VARS, "Exiting merge printvars\n");
+ stp_dprintf(STP_DBG_VARS, user, "Exiting merge printvars\n");
stp_parameter_list_destroy(params);
}
@@ -666,3 +774,16 @@ stp_abort(void)
}
abort();
}
+
+time_t
+stpi_time(time_t *t)
+{
+ if (stp_get_debug_level() & STP_DBG_STATIC_TIME)
+ {
+ if (t)
+ *t = (time_t) 0;
+ return (time_t) 0;
+ }
+ else
+ return time(t);
+}
diff --git a/src/main/print-vars.c b/src/main/print-vars.c
index 4526f71..e6a9e3f 100644
--- a/src/main/print-vars.c
+++ b/src/main/print-vars.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -79,6 +78,8 @@ struct stp_vars /* Plug-in variables */
void *outdata;
void (*errfunc)(void *data, const char *buffer, size_t bytes);
void *errdata;
+ void (*dbgfunc)(void *data, const char *buffer, size_t bytes);
+ void *dbgdata;
int verified; /* Ensure that params are OK! */
};
@@ -366,10 +367,10 @@ pre##_set_##s(stp_vars_t *v, const char *val) \
{ \
CHECK_VARS(v); \
if (val) \
- stp_deprintf(STP_DBG_VARS, "set %s to %s (0x%p)\n", #s, val, \
+ stp_dprintf(STP_DBG_VARS, v, "set %s to %s (0x%p)\n", #s, val, \
(const void *) v); \
else \
- stp_deprintf(STP_DBG_VARS, "clear %s (0x%p)\n", #s, \
+ stp_dprintf(STP_DBG_VARS, v, "clear %s (0x%p)\n", #s, \
(const void *) v); \
if (v->s == val) \
return; \
@@ -422,8 +423,10 @@ DEF_FUNCS(page_width, stp_dimension_t, stp)
DEF_FUNCS(page_height, stp_dimension_t, stp)
DEF_FUNCS(outdata, void *, stp)
DEF_FUNCS(errdata, void *, stp)
+DEF_FUNCS(dbgdata, void *, stp)
DEF_FUNCS(outfunc, stp_outfunc_t, stp)
DEF_FUNCS(errfunc, stp_outfunc_t, stp)
+DEF_FUNCS(dbgfunc, stp_outfunc_t, stp)
void
stp_set_verified(stp_vars_t *v, int val)
@@ -490,10 +493,10 @@ stp_set_string_parameter_n(stp_vars_t *v, const char *parameter,
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_STRING_LIST];
if (value)
- stp_deprintf(STP_DBG_VARS, "stp_set_string_parameter(0x%p, %s, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_string_parameter(0x%p, %s, %s)\n",
(const void *) v, parameter, value);
else
- stp_deprintf(STP_DBG_VARS, "stp_set_string_parameter(0x%p, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_string_parameter(0x%p, %s)\n",
(const void *) v, parameter);
set_raw_parameter(list, parameter, value, bytes,
STP_PARAMETER_TYPE_STRING_LIST);
@@ -507,7 +510,7 @@ stp_set_string_parameter(stp_vars_t *v, const char *parameter,
int byte_count = 0;
if (value)
byte_count = strlen(value);
- stp_deprintf(STP_DBG_VARS, "stp_set_string_parameter(0x%p, %s, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_string_parameter(0x%p, %s, %s)\n",
(const void *) v, parameter, value ? value : "NULL");
stp_set_string_parameter_n(v, parameter, value, byte_count);
stp_set_verified(v, 0);
@@ -518,7 +521,7 @@ stp_set_default_string_parameter_n(stp_vars_t *v, const char *parameter,
const char *value, size_t bytes)
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_STRING_LIST];
- stp_deprintf(STP_DBG_VARS, "stp_set_default_string_parameter(0x%p, %s, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_default_string_parameter(0x%p, %s, %s)\n",
(const void *) v, parameter, value ? value : "NULL");
set_default_raw_parameter(list, parameter, value, bytes,
STP_PARAMETER_TYPE_STRING_LIST);
@@ -605,7 +608,7 @@ stp_set_file_parameter(stp_vars_t *v, const char *parameter,
size_t byte_count = 0;
if (value)
byte_count = strlen(value);
- stp_deprintf(STP_DBG_VARS, "stp_set_file_parameter(0x%p, %s, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_file_parameter(0x%p, %s, %s)\n",
(const void *) v, parameter, value ? value : "NULL");
set_raw_parameter(list, parameter, value, byte_count,
STP_PARAMETER_TYPE_FILE);
@@ -617,7 +620,7 @@ stp_set_file_parameter_n(stp_vars_t *v, const char *parameter,
const char *value, size_t byte_count)
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_FILE];
- stp_deprintf(STP_DBG_VARS, "stp_set_file_parameter(0x%p, %s, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_file_parameter(0x%p, %s, %s)\n",
(const void *) v, parameter, value ? value : "NULL");
set_raw_parameter(list, parameter, value, byte_count,
STP_PARAMETER_TYPE_FILE);
@@ -632,7 +635,7 @@ stp_set_default_file_parameter(stp_vars_t *v, const char *parameter,
size_t byte_count = 0;
if (value)
byte_count = strlen(value);
- stp_deprintf(STP_DBG_VARS, "stp_set_default_file_parameter(0x%p, %s, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_default_file_parameter(0x%p, %s, %s)\n",
(const void *) v, parameter, value ? value : "NULL");
set_default_raw_parameter(list, parameter, value, byte_count,
STP_PARAMETER_TYPE_FILE);
@@ -644,7 +647,7 @@ stp_set_default_file_parameter_n(stp_vars_t *v, const char *parameter,
const char *value, size_t byte_count)
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_FILE];
- stp_deprintf(STP_DBG_VARS, "stp_set_default_file_parameter(0x%p, %s, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_default_file_parameter(0x%p, %s, %s)\n",
(const void *) v, parameter, value ? value : "NULL");
set_default_raw_parameter(list, parameter, value, byte_count,
STP_PARAMETER_TYPE_FILE);
@@ -678,7 +681,7 @@ stp_set_curve_parameter(stp_vars_t *v, const char *parameter,
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_CURVE];
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_curve_parameter(0x%p, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_curve_parameter(0x%p, %s)\n",
(const void *) v, parameter);
if (curve)
{
@@ -712,7 +715,7 @@ stp_set_default_curve_parameter(stp_vars_t *v, const char *parameter,
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_CURVE];
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_default_curve_parameter(0x%p, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_default_curve_parameter(0x%p, %s)\n",
(const void *) v, parameter);
if (!item)
{
@@ -757,7 +760,7 @@ stp_set_array_parameter(stp_vars_t *v, const char *parameter,
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_ARRAY];
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_array_parameter(0x%p, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_array_parameter(0x%p, %s)\n",
(const void *) v, parameter);
if (array)
{
@@ -790,7 +793,7 @@ stp_set_default_array_parameter(stp_vars_t *v, const char *parameter,
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_ARRAY];
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_default_array_parameter(0x%p, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_default_array_parameter(0x%p, %s)\n",
(const void *) v, parameter);
if (!item)
{
@@ -835,7 +838,7 @@ stp_set_int_parameter(stp_vars_t *v, const char *parameter, int ival)
stp_list_t *list = v->params[STP_PARAMETER_TYPE_INT];
value_t *val;
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_int_parameter(0x%p, %s, %d)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_int_parameter(0x%p, %s, %d)\n",
(const void *) v, parameter, ival);
if (item)
{
@@ -861,7 +864,7 @@ stp_set_default_int_parameter(stp_vars_t *v, const char *parameter, int ival)
stp_list_t *list = v->params[STP_PARAMETER_TYPE_INT];
value_t *val;
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_default_int_parameter(0x%p, %s, %d)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_default_int_parameter(0x%p, %s, %d)\n",
(const void *) v, parameter, ival);
if (!item)
{
@@ -880,7 +883,7 @@ stp_clear_int_parameter(stp_vars_t *v, const char *parameter)
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_INT];
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_clear_int_parameter(0x%p, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_clear_int_parameter(0x%p, %s)\n",
(const void *) v, parameter);
if (item)
stp_list_item_destroy(list, item);
@@ -910,8 +913,8 @@ stp_get_int_parameter(const stp_vars_t *v, const char *parameter)
else
{
stp_parameter_description_destroy(&desc);
- stp_erprintf
- ("Gutenprint: Attempt to retrieve unset integer parameter %s\n",
+ stp_eprintf
+ (v, "Gutenprint: Attempt to retrieve unset integer parameter %s\n",
parameter);
return 0;
}
@@ -924,7 +927,7 @@ stp_set_boolean_parameter(stp_vars_t *v, const char *parameter, int ival)
stp_list_t *list = v->params[STP_PARAMETER_TYPE_BOOLEAN];
value_t *val;
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_boolean_parameter(0x%p, %s, %d)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_boolean_parameter(0x%p, %s, %d)\n",
(const void *) v, parameter, ival);
if (item)
{
@@ -954,7 +957,7 @@ stp_set_default_boolean_parameter(stp_vars_t *v, const char *parameter,
stp_list_t *list = v->params[STP_PARAMETER_TYPE_BOOLEAN];
value_t *val;
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_default_boolean_parameter(0x%p, %s, %d)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_default_boolean_parameter(0x%p, %s, %d)\n",
(const void *) v, parameter, ival);
if (!item)
{
@@ -976,7 +979,7 @@ stp_clear_boolean_parameter(stp_vars_t *v, const char *parameter)
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_BOOLEAN];
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_clear_boolean_parameter(0x%p, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_clear_boolean_parameter(0x%p, %s)\n",
(const void *) v, parameter);
if (item)
stp_list_item_destroy(list, item);
@@ -1006,8 +1009,8 @@ stp_get_boolean_parameter(const stp_vars_t *v, const char *parameter)
else
{
stp_parameter_description_destroy(&desc);
- stp_erprintf
- ("Gutenprint: Attempt to retrieve unset boolean parameter %s\n",
+ stp_eprintf
+ (v, "Gutenprint: Attempt to retrieve unset boolean parameter %s\n",
parameter);
return 0;
}
@@ -1020,7 +1023,7 @@ stp_set_dimension_parameter(stp_vars_t *v, const char *parameter, stp_dimension_
stp_list_t *list = v->params[STP_PARAMETER_TYPE_DIMENSION];
value_t *val;
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_dimension_parameter(0x%p, %s, %f)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_dimension_parameter(0x%p, %s, %f)\n",
(const void *) v, parameter, sval);
if (item)
{
@@ -1047,7 +1050,7 @@ stp_set_default_dimension_parameter(stp_vars_t *v, const char *parameter,
stp_list_t *list = v->params[STP_PARAMETER_TYPE_DIMENSION];
value_t *val;
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_default_dimension_parameter(0x%p, %s, %f)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_default_dimension_parameter(0x%p, %s, %f)\n",
(const void *) v, parameter, sval);
if (!item)
{
@@ -1066,7 +1069,7 @@ stp_clear_dimension_parameter(stp_vars_t *v, const char *parameter)
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_DIMENSION];
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_clear_dimension_parameter(0x%p, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_clear_dimension_parameter(0x%p, %s)\n",
(const void *) v, parameter);
if (item)
stp_list_item_destroy(list, item);
@@ -1096,8 +1099,8 @@ stp_get_dimension_parameter(const stp_vars_t *v, const char *parameter)
else
{
stp_parameter_description_destroy(&desc);
- stp_erprintf
- ("Gutenprint: Attempt to retrieve unset dimension parameter %s\n",
+ stp_eprintf
+ (v, "Gutenprint: Attempt to retrieve unset dimension parameter %s\n",
parameter);
return 0;
}
@@ -1110,7 +1113,7 @@ stp_set_float_parameter(stp_vars_t *v, const char *parameter, double dval)
stp_list_t *list = v->params[STP_PARAMETER_TYPE_DOUBLE];
value_t *val;
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_float_parameter(0x%p, %s, %f)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_float_parameter(0x%p, %s, %f)\n",
(const void *) v, parameter, dval);
if (item)
{
@@ -1137,7 +1140,7 @@ stp_set_default_float_parameter(stp_vars_t *v, const char *parameter,
stp_list_t *list = v->params[STP_PARAMETER_TYPE_DOUBLE];
value_t *val;
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_set_default_float_parameter(0x%p, %s, %f)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_set_default_float_parameter(0x%p, %s, %f)\n",
(const void *) v, parameter, dval);
if (!item)
{
@@ -1156,7 +1159,7 @@ stp_clear_float_parameter(stp_vars_t *v, const char *parameter)
{
stp_list_t *list = v->params[STP_PARAMETER_TYPE_DOUBLE];
stp_list_item_t *item = stp_list_get_item_by_name(list, parameter);
- stp_deprintf(STP_DBG_VARS, "stp_clear_float_parameter(0x%p, %s)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_clear_float_parameter(0x%p, %s)\n",
(const void *) v, parameter);
if (item)
stp_list_item_destroy(list, item);
@@ -1186,8 +1189,8 @@ stp_get_float_parameter(const stp_vars_t *v, const char *parameter)
else
{
stp_parameter_description_destroy(&desc);
- stp_erprintf
- ("Gutenprint: Attempt to retrieve unset float parameter %s\n",
+ stp_eprintf
+ (v, "Gutenprint: Attempt to retrieve unset float parameter %s\n",
parameter);
return 1.0;
}
@@ -1213,7 +1216,7 @@ stp_scale_float_parameter(stp_vars_t *v, const char *parameter,
val = desc.deflt.dbl;
stp_parameter_description_destroy(&desc);
}
- stp_deprintf(STP_DBG_VARS, "stp_scale_float_parameter(%p, %s, %f*%f)\n",
+ stp_dprintf(STP_DBG_VARS, v, "stp_scale_float_parameter(%p, %s, %f*%f)\n",
(const void *) v, parameter, val, scale);
stp_set_float_parameter(v, parameter, val * scale);
}
@@ -1387,7 +1390,7 @@ void \
stp_set_##type##_parameter_active(stp_vars_t *v, const char *parameter, \
stp_parameter_activity_t active) \
{ \
- stp_deprintf(STP_DBG_VARS, \
+ stp_dprintf(STP_DBG_VARS, v, \
"stp_set_%s_parameter_active(0x%p, %s, %d)\n", \
#type, (const void *) v, parameter, active); \
stp_set_parameter_active(v, parameter, active, index); \
@@ -1434,6 +1437,12 @@ stp_vars_copy(stp_vars_t *vd, const stp_vars_t *vs)
if (vs == vd)
return;
+ stp_set_outdata(vd, stp_get_outdata(vs));
+ stp_set_errdata(vd, stp_get_errdata(vs));
+ stp_set_dbgdata(vd, stp_get_dbgdata(vs));
+ stp_set_outfunc(vd, stp_get_outfunc(vs));
+ stp_set_errfunc(vd, stp_get_errfunc(vs));
+ stp_set_dbgfunc(vd, stp_get_dbgfunc(vs));
stp_set_driver(vd, stp_get_driver(vs));
stp_set_color_conversion(vd, stp_get_color_conversion(vs));
stp_set_left(vd, stp_get_left(vs));
@@ -1442,10 +1451,6 @@ stp_vars_copy(stp_vars_t *vd, const stp_vars_t *vs)
stp_set_height(vd, stp_get_height(vs));
stp_set_page_width(vd, stp_get_page_width(vs));
stp_set_page_height(vd, stp_get_page_height(vs));
- stp_set_outdata(vd, stp_get_outdata(vs));
- stp_set_errdata(vd, stp_get_errdata(vs));
- stp_set_outfunc(vd, stp_get_outfunc(vs));
- stp_set_errfunc(vd, stp_get_errfunc(vs));
for (i = 0; i < STP_PARAMETER_TYPE_INVALID; i++)
{
stp_list_destroy(vd->params[i]);
@@ -1457,7 +1462,7 @@ stp_vars_copy(stp_vars_t *vd, const stp_vars_t *vs)
}
void
-stpi_vars_print_error(const stp_vars_t *v, const char *prefix)
+stp_vars_print_error(const stp_vars_t *v, const char *prefix)
{
int i;
char *cptr;
@@ -1473,13 +1478,15 @@ stpi_vars_print_error(const stp_vars_t *v, const char *prefix)
"Dimension",
"(Inactive)"
};
- stp_erprintf("%s: Gutenprint: === BEGIN GUTENPRINT SETTINGS ===\n", prefix);
- stp_erprintf("%s: Gutenprint: Driver: %s\n", prefix, stp_get_driver(v));
- stp_erprintf("%s: Gutenprint: L: %f T: %f W: %f H: %f\n", prefix, stp_get_left(v),
- stp_get_top(v), stp_get_width(v), stp_get_height(v));
- stp_erprintf("%s: Gutenprint: Page: %fx%f\n", prefix, stp_get_page_width(v),
- stp_get_page_height(v));
- stp_erprintf("%s: Gutenprint: Conversion: %s\n", prefix, stp_get_color_conversion(v));
+ if (! prefix)
+ prefix = "";
+ stp_eprintf(v, "%s: Gutenprint: === BEGIN GUTENPRINT SETTINGS ===\n", prefix);
+ stp_eprintf(v, "%s: Gutenprint: Driver: %s\n", prefix, stp_get_driver(v));
+ stp_eprintf(v, "%s: Gutenprint: L: %f T: %f W: %f H: %f\n", prefix, stp_get_left(v),
+ stp_get_top(v), stp_get_width(v), stp_get_height(v));
+ stp_eprintf(v, "%s: Gutenprint: Page: %fx%f\n", prefix, stp_get_page_width(v),
+ stp_get_page_height(v));
+ stp_eprintf(v, "%s: Gutenprint: Conversion: %s\n", prefix, stp_get_color_conversion(v));
for (i = 0; i < STP_PARAMETER_TYPE_INVALID; i++)
{
const stp_list_item_t *item =
@@ -1499,9 +1506,9 @@ stpi_vars_print_error(const stp_vars_t *v, const char *prefix)
*cptr = ' ';
cptr++;
}
- stp_erprintf("%s: Gutenprint: (%s) (%i) (%s) [%s]\n", prefix,
- val->name, val->active, data_types[val->typ],
- crep ? crep : "NULL");
+ stp_eprintf(v, "%s: Gutenprint: (%s) (%i) (%s) [%s]\n", prefix,
+ val->name, val->active, data_types[val->typ],
+ crep ? crep : "NULL");
if (crep)
stp_free(crep);
break;
@@ -1511,27 +1518,27 @@ stpi_vars_print_error(const stp_vars_t *v, const char *prefix)
case STP_PARAMETER_TYPE_FILE:
case STP_PARAMETER_TYPE_RAW:
crep = stp_rawtoxmlstr(&(val->value.rval));
- stp_erprintf("%s: Gutenprint: (%s) (%i) (%s) [%s]\n", prefix,
- val->name, val->active, data_types[val->typ],
- crep ? crep : "NULL");
+ stp_eprintf(v, "%s: Gutenprint: (%s) (%i) (%s) [%s]\n", prefix,
+ val->name, val->active, data_types[val->typ],
+ crep ? crep : "NULL");
if (crep)
stp_free(crep);
break;
case STP_PARAMETER_TYPE_DIMENSION:
- stp_erprintf("%s: Gutenprint: (%s) (%i) (%s) [%f]\n", prefix,
- val->name, val->active, data_types[val->typ],
- val->value.sval);
+ stp_eprintf(v, "%s: Gutenprint: (%s) (%i) (%s) [%f]\n", prefix,
+ val->name, val->active, data_types[val->typ],
+ val->value.sval);
break;
case STP_PARAMETER_TYPE_INT:
case STP_PARAMETER_TYPE_BOOLEAN:
- stp_erprintf("%s: Gutenprint: (%s) (%i) (%s) [%d]\n", prefix,
- val->name, val->active, data_types[val->typ],
- val->value.ival);
+ stp_eprintf(v, "%s: Gutenprint: (%s) (%i) (%s) [%d]\n", prefix,
+ val->name, val->active, data_types[val->typ],
+ val->value.ival);
break;
case STP_PARAMETER_TYPE_DOUBLE:
- stp_erprintf("%s: Gutenprint: (%s) (%i) (%s) [%f]\n", prefix,
- val->name, val->active, data_types[val->typ],
- val->value.dval);
+ stp_eprintf(v, "%s: Gutenprint: (%s) (%i) (%s) [%f]\n", prefix,
+ val->name, val->active, data_types[val->typ],
+ val->value.dval);
break;
default:
break;
@@ -1539,7 +1546,7 @@ stpi_vars_print_error(const stp_vars_t *v, const char *prefix)
item = stp_list_item_next(item);
}
}
- stp_erprintf("%s: Gutenprint: === END GUTENPRINT SETTINGS ===\n", prefix);
+ stp_eprintf(v, "%s: Gutenprint: === END GUTENPRINT SETTINGS ===\n", prefix);
}
void
@@ -1611,75 +1618,75 @@ debug_print_parameter_description(const stp_parameter_t *desc, const char *who,
char *curve;
if (! (stp_get_debug_level() & STP_DBG_VARS))
return;
- stp_deprintf(STP_DBG_VARS, "Describe %s: vars 0x%p from %s type %d class %d level %d\n",
+ stp_dprintf(STP_DBG_VARS, v, "Describe %s: vars 0x%p from %s type %d class %d level %d\n",
desc->name, (const void *) v, who,
desc->p_type, desc->p_class, desc->p_level);
- stp_deprintf(STP_DBG_VARS, " driver %s mandatory %d active %d channel %d verify %d ro %d\n",
+ stp_dprintf(STP_DBG_VARS, v, " driver %s mandatory %d active %d channel %d verify %d ro %d\n",
stp_get_driver(v), desc->is_mandatory, desc->is_active,
desc->channel, desc->verify_this_parameter, desc->read_only);
switch (desc->p_type)
{
case STP_PARAMETER_TYPE_STRING_LIST:
- stp_deprintf(STP_DBG_VARS,
+ stp_dprintf(STP_DBG_VARS, v,
" String default: %s\n",
desc->deflt.str ? desc->deflt.str : "(null)");
if (desc->bounds.str)
for (i = 0; i < stp_string_list_count(desc->bounds.str); i++)
{
if (i == 0)
- stp_deprintf(STP_DBG_VARS, " Choices: %s\n",
+ stp_dprintf(STP_DBG_VARS, v, " Choices: %s\n",
stp_string_list_param(desc->bounds.str, i)->name);
else
- stp_deprintf(STP_DBG_VARS, " : %s\n",
+ stp_dprintf(STP_DBG_VARS, v, " : %s\n",
stp_string_list_param(desc->bounds.str, i)->name);
}
break;
case STP_PARAMETER_TYPE_INT:
- stp_deprintf(STP_DBG_VARS,
+ stp_dprintf(STP_DBG_VARS, v,
" Integer default: %d Bounds: %d %d\n",
desc->deflt.integer,
desc->bounds.integer.lower, desc->bounds.integer.upper);
break;
case STP_PARAMETER_TYPE_DIMENSION:
- stp_deprintf(STP_DBG_VARS,
+ stp_dprintf(STP_DBG_VARS, v,
" Dimension default: %f Bounds: %f %f\n",
desc->deflt.dimension,
desc->bounds.dimension.lower, desc->bounds.dimension.upper);
break;
case STP_PARAMETER_TYPE_BOOLEAN:
- stp_deprintf(STP_DBG_VARS,
+ stp_dprintf(STP_DBG_VARS, v,
" Boolean default: %d\n", desc->deflt.boolean);
break;
case STP_PARAMETER_TYPE_DOUBLE:
- stp_deprintf(STP_DBG_VARS,
+ stp_dprintf(STP_DBG_VARS, v,
" Double default: %f Bounds: %f %f\n",
desc->deflt.dbl,
desc->bounds.dbl.lower, desc->bounds.dbl.upper);
break;
case STP_PARAMETER_TYPE_FILE:
- stp_deprintf(STP_DBG_VARS, " File (no default)\n");
+ stp_dprintf(STP_DBG_VARS, v, " File (no default)\n");
break;
case STP_PARAMETER_TYPE_RAW:
- stp_deprintf(STP_DBG_VARS, " Raw (no default)\n");
+ stp_dprintf(STP_DBG_VARS, v, " Raw (no default)\n");
break;
case STP_PARAMETER_TYPE_CURVE:
curve = stp_curve_write_string(desc->deflt.curve);
- stp_deprintf(STP_DBG_VARS,
+ stp_dprintf(STP_DBG_VARS, v,
" Curve default: %s\n", curve);
stp_free(curve);
curve = stp_curve_write_string(desc->bounds.curve);
- stp_deprintf(STP_DBG_VARS,
+ stp_dprintf(STP_DBG_VARS, v,
" bounds: %s\n", curve);
stp_free(curve);
break;
case STP_PARAMETER_TYPE_ARRAY:
- stp_deprintf(STP_DBG_VARS, " Array\n");
+ stp_dprintf(STP_DBG_VARS, v, " Array\n");
break;
case STP_PARAMETER_TYPE_INVALID:
- stp_deprintf(STP_DBG_VARS, " *** Invalid ***\n");
+ stp_dprintf(STP_DBG_VARS, v, " *** Invalid ***\n");
break;
default:
- stp_deprintf(STP_DBG_VARS, " Unknown type!\n");
+ stp_dprintf(STP_DBG_VARS, v, " Unknown type!\n");
}
}
@@ -1713,7 +1720,7 @@ stp_describe_parameter(const stp_vars_t *v, const char *name,
if (description->p_type != STP_PARAMETER_TYPE_INVALID)
debug_print_parameter_description(description, "generic", v);
else
- stp_deprintf(STP_DBG_VARS, "Describing invalid parameter %s\n", name);
+ stp_dprintf(STP_DBG_VARS, v, "Describing invalid parameter %s\n", name);
}
stp_string_list_t *
@@ -1948,10 +1955,10 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
char *locale = stp_strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, "C");
#endif
- stp_deprintf(STP_DBG_XML, "Enter fill_vars_from_xmltree()\n");
+ stp_dprintf(STP_DBG_XML, v, "Enter fill_vars_from_xmltree()\n");
while (prop)
{
- stp_deprintf(STP_DBG_XML, "Property type %d (%s)\n", prop->type,
+ stp_dprintf(STP_DBG_XML, v, "Property type %d (%s)\n", prop->type,
prop->type == STP_MXML_ELEMENT ? prop->value.element.name :
(prop->type == STP_MXML_TEXT ? prop->value.text.string : "(nil)"));
if (prop->type == STP_MXML_ELEMENT &&
@@ -1962,7 +1969,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
const char *p_type = stp_mxmlElementGetAttr(prop, "type");
const char *p_name = stp_mxmlElementGetAttr(prop, "name");
if (!strcmp(prop_name, "parameter") && (!p_type || !p_name))
- stp_erprintf("Bad property found!\n");
+ stp_eprintf(v, "Bad property found!\n");
else if (!strcmp(prop_name, "parameter"))
{
const char *active = stp_mxmlElementGetAttr(prop, "active");
@@ -1976,7 +1983,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
STP_MXML_DESCEND);
STPI_ASSERT(cnode && cnode->type == STP_MXML_ELEMENT &&
cnode->child, v);
- stp_deprintf(STP_DBG_XML, "Found parameter ref %s\n", cref);
+ stp_dprintf(STP_DBG_XML, v, "Found parameter ref %s\n", cref);
cnode = cnode->child;
}
if (strcmp(p_type, "float") == 0)
@@ -1987,7 +1994,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
(v, p_name, stp_xmlstrtod(cnode->value.text.string));
type = STP_PARAMETER_TYPE_DOUBLE;
if (stp_get_debug_level() & STP_DBG_XML)
- stp_deprintf(STP_DBG_XML, " Set float '%s' to '%s' (%f)\n",
+ stp_dprintf(STP_DBG_XML, v, " Set float '%s' to '%s' (%f)\n",
p_name, cnode->value.text.string,
stp_get_float_parameter(v, p_name));
}
@@ -2000,7 +2007,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
(v, p_name, (int) stp_xmlstrtol(cnode->value.text.string));
type = STP_PARAMETER_TYPE_DOUBLE;
if (stp_get_debug_level() & STP_DBG_XML)
- stp_deprintf(STP_DBG_XML, " Set int '%s' to '%s' (%d)\n",
+ stp_dprintf(STP_DBG_XML, v, " Set int '%s' to '%s' (%d)\n",
p_name, cnode->value.text.string,
stp_get_int_parameter(v, p_name));
}
@@ -2013,7 +2020,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
(v, p_name, (int) stp_xmlstrtodim(cnode->value.text.string));
type = STP_PARAMETER_TYPE_DOUBLE;
if (stp_get_debug_level() & STP_DBG_XML)
- stp_deprintf(STP_DBG_XML, " Set dimension '%s' to '%s' (%f)\n",
+ stp_dprintf(STP_DBG_XML, v, " Set dimension '%s' to '%s' (%f)\n",
p_name, cnode->value.text.string,
stp_get_dimension_parameter(v, p_name));
}
@@ -2026,7 +2033,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
(v, p_name, (int) stp_xmlstrtol(cnode->value.text.string));
type = STP_PARAMETER_TYPE_DOUBLE;
if (stp_get_debug_level() & STP_DBG_XML)
- stp_deprintf(STP_DBG_XML, " Set bool '%s' to '%s' (%d)\n",
+ stp_dprintf(STP_DBG_XML, v, " Set bool '%s' to '%s' (%d)\n",
p_name, cnode->value.text.string,
stp_get_boolean_parameter(v, p_name));
}
@@ -2039,7 +2046,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
(v, p_name, cnode->value.text.string);
type = STP_PARAMETER_TYPE_DOUBLE;
if (stp_get_debug_level() & STP_DBG_XML)
- stp_deprintf(STP_DBG_XML, " Set string '%s' to '%s' (%s)\n",
+ stp_dprintf(STP_DBG_XML, v, " Set string '%s' to '%s' (%s)\n",
p_name, cnode->value.text.string,
stp_get_string_parameter(v, p_name));
}
@@ -2052,7 +2059,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
(v, p_name, cnode->value.text.string);
type = STP_PARAMETER_TYPE_DOUBLE;
if (stp_get_debug_level() & STP_DBG_XML)
- stp_deprintf(STP_DBG_XML, " Set file '%s' to '%s' (%s)\n",
+ stp_dprintf(STP_DBG_XML, v, " Set file '%s' to '%s' (%s)\n",
p_name, cnode->value.text.string,
stp_get_file_parameter(v, p_name));
}
@@ -2066,7 +2073,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
{
stp_set_raw_parameter(v, p_name, raw->data,raw->bytes);
type = STP_PARAMETER_TYPE_DOUBLE;
- stp_deprintf(STP_DBG_XML, " Set raw '%s' to '%s'\n",
+ stp_dprintf(STP_DBG_XML, v, " Set raw '%s' to '%s'\n",
p_name, cnode->value.text.string);
stp_free(stpi_cast_safe(raw->data));
stp_free(raw);
@@ -2086,7 +2093,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
if (stp_get_debug_level() & STP_DBG_XML)
{
char *cv = stp_curve_write_string(curve);
- stp_deprintf(STP_DBG_XML, " Set curve '%s' (%s)\n",
+ stp_dprintf(STP_DBG_XML, v, " Set curve '%s' (%s)\n",
p_name, cv);
stp_free(cv);
}
@@ -2102,12 +2109,12 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
STPI_ASSERT(array, v);
type = STP_PARAMETER_TYPE_DOUBLE;
stp_set_array_parameter(v, p_name, array);
- stp_deprintf(STP_DBG_XML, " Set array '%s'\n", p_name);
+ stp_dprintf(STP_DBG_XML, v, " Set array '%s'\n", p_name);
stp_array_destroy(array);
}
else
{
- stp_erprintf("Bad property %s type %s\n", p_name, p_type);
+ stp_eprintf(v, "Bad property %s type %s\n", p_name, p_type);
}
if (active && type != STP_PARAMETER_TYPE_INVALID)
{
@@ -2122,7 +2129,7 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
}
else if (child->type == STP_MXML_TEXT)
{
- stp_deprintf(STP_DBG_XML, " Set property %s ('%s')\n",
+ stp_dprintf(STP_DBG_XML, v, " Set property %s ('%s')\n",
prop_name, child->value.text.string ?
child->value.text.string : "(nil)");
if (!strcmp(prop_name, "driver"))
@@ -2146,12 +2153,12 @@ fill_vars_from_xmltree(stp_mxml_node_t *prop, stp_mxml_node_t *root,
else
{
if (prop->type == STP_MXML_ELEMENT)
- stp_deprintf(STP_DBG_XML, "Unexpected node type %d name %s\n",
+ stp_dprintf(STP_DBG_XML, v, "Unexpected node type %d name %s\n",
prop->type, prop->value.element.name);
}
prop = prop->next;
}
- stp_deprintf(STP_DBG_XML, "End fill_vars_from_xmltree()\n");
+ stp_dprintf(STP_DBG_XML, v, "End fill_vars_from_xmltree()\n");
#ifdef HAVE_LOCALE_H
setlocale(LC_ALL, locale);
stp_free(locale);
diff --git a/src/main/print-version.c b/src/main/print-version.c
index ca8ac3c..2ddd70e 100644
--- a/src/main/print-version.c
+++ b/src/main/print-version.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
diff --git a/src/main/print-weave.c b/src/main/print-weave.c
index c9f36ff..f510e01 100644
--- a/src/main/print-weave.c
+++ b/src/main/print-weave.c
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -1572,9 +1571,9 @@ stp_flush_all(stp_vars_t *v)
}
static void
-finalize_row(stp_vars_t *v, int row)
+finalize_row(stp_vars_t *v, stpi_softweave_t *sw)
{
- stpi_softweave_t *sw = get_sw(v);
+ int row = sw->lineno;
int i,j;
stp_dprintf(STP_DBG_ROWS, v, "Finalizing row %d...\n", row);
for (i = 0; i < sw->oversample; i++)
@@ -1686,7 +1685,7 @@ stp_write_weave(stp_vars_t *v, unsigned char *const cols[])
sw->current_vertical_subpass++;
if (sw->current_vertical_subpass >= sw->vertical_oversample)
{
- finalize_row(v, sw->lineno);
+ finalize_row(v, sw);
sw->lineno++;
sw->current_vertical_subpass = 0;
}
diff --git a/src/main/printers.c b/src/main/printers.c
index d9fb458..58787fa 100644
--- a/src/main/printers.c
+++ b/src/main/printers.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
@@ -31,6 +30,7 @@
#include <gutenprint/gutenprint.h>
#include "gutenprint-internal.h"
#include <gutenprint/gutenprint-intl-internal.h>
+#include <stdint.h>
#include <math.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
@@ -197,13 +197,6 @@ stp_printer_get_manufacturer(const stp_printer_t *printer)
}
const char *
-stp_printer_get_foomatic_id(const stp_printer_t *printer)
-{
- stp_erprintf("stp_printer_get_foomatic_id is DEPRECATED\n");
- return NULL;
-}
-
-const char *
stp_printer_get_comment(const stp_printer_t *printer)
{
return printer->comment;
@@ -278,13 +271,6 @@ stp_get_printer_by_device_id(const char *device_id)
return NULL;
}
-const stp_printer_t *
-stp_get_printer_by_foomatic_id(const char *foomatic_id)
-{
- stp_erprintf("stp_get_printer_by_foomatic_id is DEPRECATED\n");
- return NULL;
-}
-
int
stp_get_printer_index_by_driver(const char *driver)
{
@@ -508,6 +494,8 @@ stp_describe_output(const stp_vars_t *v)
int
stp_verify(stp_vars_t *v)
{
+ if (stp_get_verified(v))
+ return 1;
const stp_printfuncs_t *printfuncs =
stpi_get_printfuncs(stp_get_printer(v));
stp_vars_t *nv = stp_vars_create_copy(v);
@@ -566,6 +554,14 @@ stp_get_external_options(const stp_vars_t *v)
return NULL;
}
+const stp_papersize_t *
+stpi_printer_describe_papersize(const stp_vars_t *v, const char *name)
+{
+ const stp_printfuncs_t *printfuncs =
+ stpi_get_printfuncs(stp_get_printer(v));
+ return (printfuncs->describe_papersize)(v, name);
+}
+
static int
verify_string_param(const stp_vars_t *v, const char *parameter,
stp_parameter_t *desc, int quiet)
@@ -578,7 +574,6 @@ verify_string_param(const stp_vars_t *v, const char *parameter,
const char *checkval = stp_get_string_parameter(v, parameter);
stp_string_list_t *vptr = desc->bounds.str;
size_t count = 0;
- int i;
stp_dprintf(STP_DBG_VARS, v, " value %s\n",
checkval ? checkval : "(null)");
if (vptr)
@@ -597,12 +592,8 @@ verify_string_param(const stp_vars_t *v, const char *parameter,
}
else if (count > 0)
{
- for (i = 0; i < count; i++)
- if (!strcmp(checkval, stp_string_list_param(vptr, i)->name))
- {
- answer = PARAMETER_OK;
- break;
- }
+ if (stp_string_list_is_present(vptr, checkval))
+ answer = PARAMETER_OK;
if (!answer && !quiet)
stp_eprintf(v, _("`%s' is not a valid %s\n"), checkval, parameter);
}
@@ -956,8 +947,76 @@ stp_find_params(const char *name, const char *family)
return NULL;
}
+/* Why couldn't strcmp be a valid comparison function... */
+static int
+compare_names(const void *n1, const void *n2)
+{
+ return strcmp((const char *) n2, (const char *) n2);
+}
+
+void
+stpi_find_duplicate_printers(void)
+{
+ size_t nelts = stp_list_get_length(printer_list);
+ const char **str_data = stp_zalloc(sizeof(const char *) * nelts);
+ stp_list_item_t *printer_item = stp_list_get_start(printer_list);
+ size_t i = 0;
+ int found_dups = 0;
+ const stp_printer_t *printer;
+ while (printer_item)
+ {
+ printer = stp_list_item_get_data(printer_item);
+ STPI_ASSERT(i < nelts, NULL);
+ str_data[i] = printer->driver;
+ printer_item = stp_list_item_next(printer_item);
+ i++;
+ }
+ qsort(str_data, nelts, sizeof(const char *), compare_names);
+ for (i = 0; i < nelts - 1; i++)
+ {
+ if (!strcmp(str_data[i], str_data[i+1]))
+ {
+ printer_item =
+ stp_list_get_item_by_name(printer_list, str_data[i]);
+ printer = stp_list_item_get_data(printer_item);
+ stp_erprintf("Duplicate printer entry '%s' (%s)\n",
+ printer->driver, printer->long_name);
+ found_dups++;
+ }
+ }
+ printer_item = stp_list_get_start(printer_list);
+ i = 0;
+ while (printer_item)
+ {
+ printer = stp_list_item_get_data(printer_item);
+ STPI_ASSERT(i < nelts, NULL);
+ str_data[i] = printer->long_name;
+ printer_item = stp_list_item_next(printer_item);
+ i++;
+ }
+ qsort(str_data, nelts, sizeof(const char *), compare_names);
+ for (i = 0; i < nelts - 1; i++)
+ {
+ if (!strcmp(str_data[i], str_data[i+1]))
+ {
+ printer_item =
+ stp_list_get_item_by_long_name(printer_list, str_data[i]);
+ printer = stp_list_item_get_data(printer_item);
+ stp_erprintf("Duplicate printer entry '%s' (%s)\n",
+ printer->driver, printer->long_name);
+ found_dups++;
+ }
+ }
+ stp_free(str_data);
+ if (found_dups > 0)
+ {
+ stp_erprintf("FATAL Duplicate printers in printer list. Aborting!\n");
+ stp_abort();
+ }
+}
+
int
-stp_family_register(stp_list_t *family)
+stpi_family_register(stp_list_t *family)
{
stp_list_item_t *printer_item;
const stp_printer_t *printer;
@@ -972,25 +1031,21 @@ stp_family_register(stp_list_t *family)
if (family)
{
+ /* Check for duplicates after loading printers */
printer_item = stp_list_get_start(family);
while(printer_item)
{
printer = (const stp_printer_t *) stp_list_item_get_data(printer_item);
- if (!stp_list_get_item_by_name(printer_list, printer->driver))
- stp_list_item_create(printer_list, NULL, printer);
- else
- stp_erprintf("Duplicate printer entry `%s' (%s)\n",
- printer->driver, printer->long_name);
+ stp_list_item_create(printer_list, NULL, printer);
printer_item = stp_list_item_next(printer_item);
}
}
-
return 0;
}
int
-stp_family_unregister(stp_list_t *family)
+stpi_family_unregister(stp_list_t *family)
{
stp_list_item_t *printer_item;
stp_list_item_t *old_printer_item;
@@ -1256,5 +1311,4 @@ void
stpi_init_printer(void)
{
stp_register_xml_parser("printdef", stpi_xml_process_printdef);
- stp_register_xml_preload("printers.xml");
}
diff --git a/src/main/refcache.c b/src/main/refcache.c
new file mode 100644
index 0000000..9664528
--- /dev/null
+++ b/src/main/refcache.c
@@ -0,0 +1,231 @@
+/*
+ * Object cache for Gutenprint
+ *
+ * Copyright 2017 Robert Krawitz (rlk@alum.mit.edu)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <gutenprint/gutenprint.h>
+#include "gutenprint-internal.h"
+#include <gutenprint/gutenprint-intl-internal.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+/*
+ * Lists aren't exactly the right data structure for this...if we start
+ * getting into enough items for it to matter, we'll reimplement it them.
+ */
+
+static stp_list_t *global_cache_list = NULL;
+static stp_string_list_t *global_cache_names = NULL;
+
+typedef struct stp_cache
+{
+ char *name;
+ stp_list_t *cache;
+ stp_string_list_t *cache_items;
+} stp_refcache_t;
+
+typedef struct
+{
+ char *name;
+ void *content;
+} stp_refcache_item_t;
+
+static const char *
+stp_refcache_namefunc(const void *cache)
+{
+ return ((const stp_refcache_t *) cache)->name;
+}
+
+static void
+stp_refcache_freefunc(void *item)
+{
+ stp_refcache_t *cache = (stp_refcache_t *) item;
+ STP_SAFE_FREE(cache->name);
+ stp_list_destroy(cache->cache);
+ stp_string_list_destroy(cache->cache_items);
+ STP_SAFE_FREE(item);
+}
+
+static const char *
+stp_refcache_item_namefunc(const void *item)
+{
+ return ((const stp_refcache_item_t *) item)->name;
+}
+
+static void
+stp_refcache_item_freefunc(void *item)
+{
+ stp_refcache_item_t *cache_item = (stp_refcache_item_t *) item;
+ STP_SAFE_FREE(cache_item->name);
+ STP_SAFE_FREE(item);
+}
+
+static void
+check_stp_cache(void)
+{
+ if (! global_cache_list)
+ {
+ global_cache_list = stp_list_create();
+ stp_list_set_namefunc(global_cache_list, stp_refcache_namefunc);
+ stp_list_set_freefunc(global_cache_list, stp_refcache_freefunc);
+ global_cache_names = stp_string_list_create();
+ }
+}
+
+int
+stp_refcache_create(const char *name)
+{
+ check_stp_cache();
+ if (stp_list_get_item_by_name(global_cache_list, name))
+ return 0;
+ else
+ {
+ stp_refcache_t *cache = stp_zalloc(sizeof(stp_refcache_t));
+ cache->name = stp_strdup(name);
+ cache->cache = stp_list_create();
+ cache->cache_items = stp_string_list_create();
+ stp_list_set_namefunc(cache->cache, stp_refcache_item_namefunc);
+ stp_list_set_freefunc(cache->cache, stp_refcache_item_freefunc);
+ stp_list_item_create(global_cache_list, NULL, cache);
+ stp_string_list_add_string_unsafe(global_cache_names, name, name);
+ return 1;
+ }
+}
+
+static stp_refcache_t *
+find_cache_named(const char *cache)
+{
+ check_stp_cache();
+ stp_list_item_t *item = stp_list_get_item_by_name(global_cache_list, cache);
+ if (item)
+ return (stp_refcache_t *) stp_list_item_get_data(item);
+ else
+ return NULL;
+}
+
+static stp_refcache_t *
+find_or_create_cache_named(const char *cache)
+{
+ check_stp_cache();
+ stp_list_item_t *item = stp_list_get_item_by_name(global_cache_list, cache);
+ if (!item)
+ {
+ stp_refcache_create(cache);
+ item = stp_list_get_item_by_name(global_cache_list, cache);
+ }
+ return (stp_refcache_t *) stp_list_item_get_data(item);
+}
+
+void *
+stp_refcache_find_item(const char *cache, const char *item)
+{
+ stp_refcache_t *cache_impl = find_cache_named(cache);
+ if (cache_impl)
+ {
+ stp_list_item_t *item_impl =
+ stp_list_get_item_by_name(cache_impl->cache, item);
+ if (item_impl)
+ return ((stp_refcache_item_t *)stp_list_item_get_data(item_impl))->content;
+ }
+ return NULL;
+}
+
+static void
+add_item_to_cache(stp_refcache_t *cache, const char *item, void *data)
+{
+ stp_refcache_item_t *item_impl = stp_zalloc(sizeof(stp_refcache_item_t));
+ item_impl->name = stp_strdup(item);
+ item_impl->content = data;
+ stp_list_item_create(cache->cache, NULL, item_impl);
+ stp_string_list_add_string_unsafe(cache->cache_items, item, item);
+}
+
+int
+stp_refcache_add_item(const char *cache, const char *item, void *data)
+{
+ stp_refcache_t *cache_impl = find_or_create_cache_named(cache);
+ if (!stp_list_get_item_by_name(cache_impl->cache, item))
+ {
+ add_item_to_cache(cache_impl, item, data);
+ return 1;
+ }
+ return 0;
+}
+
+void
+stp_refcache_remove_item(const char *cache, const char *item)
+{
+ stp_refcache_t *cache_impl = find_cache_named(cache);
+ if (cache_impl)
+ {
+ stp_list_item_t *item_impl =
+ stp_list_get_item_by_name(cache_impl->cache, item);
+ if (item_impl)
+ {
+ stp_list_item_destroy(cache_impl->cache, item_impl);
+ stp_string_list_remove_string(cache_impl->cache_items, item);
+ }
+ }
+}
+
+void
+stp_refcache_replace_item(const char *cache, const char *item, void *data)
+{
+ stp_refcache_t *cache_impl = find_or_create_cache_named(cache);
+ stp_list_item_t *item_item =
+ stp_list_get_item_by_name(cache_impl->cache, item);
+ if (item_item)
+ {
+ stp_refcache_item_t *item_impl =
+ (stp_refcache_item_t *) stp_list_item_get_data(item_item);
+ item_impl->content = data;
+ }
+ else
+ {
+ add_item_to_cache(cache_impl, item, data);
+ }
+}
+
+void
+stp_refcache_destroy(const char *cache)
+{
+ check_stp_cache();
+ stp_list_item_t *item = stp_list_get_item_by_name(global_cache_list, cache);
+ if (item)
+ {
+ stp_list_item_destroy(global_cache_list, item);
+ stp_string_list_remove_string(global_cache_names, cache);
+ }
+}
+
+const stp_string_list_t *
+stp_refcache_list_caches(void)
+{
+ check_stp_cache();
+ return global_cache_names;
+}
+
+const stp_string_list_t *
+stp_refcache_list_cache_items(const char *cache)
+{
+ stp_refcache_t *cache_impl = find_cache_named(cache);
+ return cache_impl ? cache_impl->cache_items : NULL;
+}
diff --git a/src/main/sequence.c b/src/main/sequence.c
index 9792181..8be0911 100644
--- a/src/main/sequence.c
+++ b/src/main/sequence.c
@@ -17,8 +17,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -254,7 +253,7 @@ stp_sequence_set_data(stp_sequence_t *sequence,
sequence->size = size;
if (sequence->data)
stp_free(sequence->data);
- sequence->data = stp_zalloc(sizeof(double) * size);
+ sequence->data = stp_malloc(sizeof(double) * size);
memcpy(sequence->data, data, (sizeof(double) * size));
invalidate_auxilliary_data(sequence);
sequence->recompute_range = 1;
@@ -384,6 +383,12 @@ stp_sequence_create_from_xmltree(stp_mxml_node_t *da)
if (child->type == STP_MXML_TEXT)
{
char *endptr;
+ /*
+ * Explicitly documented that callers to strtod should clear
+ * errno before calling it if they want to check the return
+ * status.
+ */
+ errno = 0;
double tmpval = strtod(child->value.text.string, &endptr);
if (endptr == child->value.text.string)
{
@@ -399,8 +404,9 @@ stp_sequence_create_from_xmltree(stp_mxml_node_t *da)
{
stp_erprintf("stp_sequence_create_from_xmltree: "
"read aborted: datum out of bounds: "
- "%g (require %g <= x <= %g), n = %d\n",
- tmpval, low, high, i);
+ "%g %d %s (require %g <= x <= %g), n = %d\n",
+ tmpval, errno, child->value.text.string,
+ low, high, i);
goto error;
}
/* Datum was valid, so now add to the sequence */
diff --git a/src/main/string-list.c b/src/main/string-list.c
index 3d39822..ac888ef 100644
--- a/src/main/string-list.c
+++ b/src/main/string-list.c
@@ -16,8 +16,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
diff --git a/src/main/xml.c b/src/main/xml.c
index c4c92f4..5587a12 100644
--- a/src/main/xml.c
+++ b/src/main/xml.c
@@ -15,8 +15,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -51,6 +50,10 @@ static stp_list_t *stpi_xml_registry;
static stp_list_t *stpi_xml_preloads;
+static stp_list_t *stpi_xml_files_loaded;
+
+static stp_string_list_t *cached_xml_files;
+
static const char *
xml_registry_namefunc(const void *item)
{
@@ -130,16 +133,28 @@ static int xml_is_initialised; /* Flag for init */
void
stp_xml_preinit(void)
{
- static int xml_is_preinitialized = 0;
- if (!xml_is_preinitialized)
+ if (! stpi_xml_registry)
{
stpi_xml_registry = stp_list_create();
stp_list_set_freefunc(stpi_xml_registry, xml_registry_freefunc);
stp_list_set_namefunc(stpi_xml_registry, xml_registry_namefunc);
+ }
+ if (! stpi_xml_preloads)
+ {
stpi_xml_preloads = stp_list_create();
stp_list_set_freefunc(stpi_xml_preloads, xml_preload_freefunc);
stp_list_set_namefunc(stpi_xml_preloads, xml_preload_namefunc);
}
+ if (! stpi_xml_files_loaded)
+ {
+ stpi_xml_files_loaded = stp_list_create();
+ stp_list_set_freefunc(stpi_xml_files_loaded, xml_preload_freefunc);
+ stp_list_set_namefunc(stpi_xml_files_loaded, xml_preload_namefunc);
+ }
+ if (! cached_xml_files)
+ {
+ cached_xml_files = stp_string_list_create();
+ }
}
/*
@@ -183,11 +198,14 @@ stp_xml_exit(void)
return;
}
else if (xml_is_initialised < 1)
- return;
+ {
+ stp_erprintf("stp_xml_exit: unmatched stp_xml_init!\n");
+ stp_abort();
+ }
/* Restore locale */
#ifdef HAVE_LOCALE_H
- stp_deprintf(STP_DBG_XML, "stp_xml_init: restoring locale %s\n", saved_locale);
+ stp_deprintf(STP_DBG_XML, "stp_xml_exit: restoring locale %s\n", saved_locale);
setlocale(LC_ALL, saved_locale);
stp_free(saved_locale);
saved_locale = NULL;
@@ -198,21 +216,19 @@ stp_xml_exit(void)
void
stp_xml_parse_file_named(const char *name)
{
- stp_list_t *file_list = stpi_list_files_on_data_path(name); /* List of XML files */
- stp_list_item_t *item; /* Pointer to current list item */
- item = stp_list_get_start(file_list);
- while (item)
+ stp_xml_preinit();
+ stp_deprintf(STP_DBG_XML, "stp_xml_parse_file_named(%s)\n", name);
+ if (! stp_list_get_item_by_name(stpi_xml_files_loaded, name))
{
- stp_deprintf(STP_DBG_XML,
- "stp_xml_parse_file_named: source file: %s\n",
- (const char *) stp_list_item_get_data(item));
- stp_xml_parse_file((const char *) stp_list_item_get_data(item));
- item = stp_list_item_next(item);
+ char *file_name = stp_path_find_file(NULL, name);
+ if (file_name)
+ {
+ stp_xml_parse_file(file_name);
+ free(file_name);
+ }
}
- stp_list_destroy(file_list);
}
-
/*
* Read all available XML files.
*/
@@ -239,7 +255,6 @@ stp_xml_init_defaults(void)
return 0;
}
-
/*
* Parse a single XML file.
*/
@@ -248,55 +263,186 @@ stp_xml_parse_file(const char *file) /* File to parse */
{
stp_mxml_node_t *doc;
stp_mxml_node_t *cur;
- FILE *fp;
+ int status = 0;
stp_deprintf(STP_DBG_XML, "stp_xml_parse_file: reading `%s'...\n", file);
- fp = fopen(file, "r");
- if (!fp)
+ stp_xml_init();
+
+ doc = stp_mxmlLoadFromFile(NULL, file, STP_MXML_NO_CALLBACK);
+
+ if ((cur = stp_xml_get_node(doc, "gutenprint", NULL)) == NULL)
{
- stp_erprintf("stp_xml_parse_file: unable to open %s: %s\n", file,
- strerror(errno));
- return 1;
+ stp_erprintf("stp_xml_parse_file: %s: parse error\n", file);
+ status = 1;
}
+ else
+ /* The XML file was read and is the right format */
+ stpi_xml_process_gutenprint(cur, file);
- stp_xml_init();
+ stp_mxmlDelete(doc);
- doc = stp_mxmlLoadFile(NULL, fp, STP_MXML_NO_CALLBACK);
- fclose(fp);
+ stp_xml_exit();
- cur = doc->child;
- while (cur &&
- (cur->type != STP_MXML_ELEMENT ||
- (strcmp(cur->value.element.name, "gutenprint") != 0 &&
- strcmp(cur->value.element.name, "gimp-print") != 0)))
- cur = cur->next;
+ return status;
+}
- if (cur == NULL || cur->type != STP_MXML_ELEMENT)
+static stp_mxml_node_t *
+xml_try_parse_file_1(const char *pathname, const char *topnodename)
+{
+ stp_mxml_node_t *root =
+ stp_mxmlLoadFromFile(NULL, pathname, STP_MXML_NO_CALLBACK);
+ if (root)
{
- stp_erprintf("stp_xml_parse_file: %s: parse error\n", file);
- stp_mxmlDelete(doc);
- return 1;
+ stp_mxml_node_t *answer =
+ stp_xml_get_node(root, "gutenprint", topnodename, NULL);
+ if (answer)
+ return answer;
+ stp_mxmlDelete(root);
+ return NULL;
}
+ else
+ return NULL;
+}
+
+static stp_mxml_node_t *
+xml_try_parse_file(const char *pathname, const char *topnodename)
+{
+ stp_xml_init();
+ stp_mxml_node_t *answer = xml_try_parse_file_1(pathname, topnodename);
+ stp_xml_exit();
+ return answer;
+}
- if (strcmp(cur->value.element.name, "gutenprint") != 0 &&
- strcmp(cur->value.element.name, "gimp-print") != 0)
+static void
+xml_cache_file(const char *name, const char *cache, stp_mxml_node_t *node)
+{
+ char *addr_string;
+ stp_asprintf(&addr_string, "%p", (void *) node);
+ /*
+ * A given XML object should never be in multiple caches! However,
+ * it's possible that different nodes of the same file will be in different
+ * caches.
+ */
+ STPI_ASSERT(!stp_string_list_is_present(cached_xml_files, addr_string), NULL);
+ if (cache)
{
- stp_erprintf
- ("XML file of the wrong type, root node is %s != (gutenprint || gimp-print)",
- cur->value.element.name);
- stp_mxmlDelete(doc);
- return 1;
+ stp_refcache_add_item(cache, name, node);
+ stp_string_list_add_string_unsafe(cached_xml_files, addr_string, cache);
}
+ else
+ stp_string_list_add_string_unsafe(cached_xml_files, addr_string, "");
+ stp_free(addr_string);
+}
- /* The XML file was read and is the right format */
+static stp_mxml_node_t *
+xml_parse_file_from_path(const char *name, const char *topnodename,
+ const char *path, const char *cache)
+{
+ stp_mxml_node_t *answer = NULL;
+ if (!(name[0] != '/' && strncmp(name, "./", 2) && strncmp(name, "../", 3)))
+ answer = xml_try_parse_file(name, topnodename);
+ else
+ {
+ stp_list_t *path_to_search;
+ stp_list_item_t *item;
+ if (path)
+ path_to_search = stp_generate_path(path);
+ else
+ path_to_search = stp_data_path();
+ item = stp_list_get_start(path_to_search);
+ while (item)
+ {
+ const char *dn = (const char *) stp_list_item_get_data(item);
+ char *ffn = stpi_path_merge(dn, name);
+ answer = xml_try_parse_file(ffn, topnodename);
+ stp_free(ffn);
+ if (answer)
+ break;
+ item = stp_list_item_next(item);
+ }
+ stp_list_destroy(path_to_search);
+ }
+ if (answer)
+ xml_cache_file(name, cache, answer);
+ return answer;
+}
- stpi_xml_process_gutenprint(cur, file);
- stp_mxmlDelete(doc);
+stp_mxml_node_t *
+stp_xml_parse_file_from_path_uncached(const char *name, const char *topnodename,
+ const char *path)
+{
+ return xml_parse_file_from_path(name, topnodename, path, NULL);
+}
- stp_xml_exit();
+stp_mxml_node_t *
+stp_xml_parse_file_from_path_uncached_safe(const char *name,
+ const char *topnodename,
+ const char *path)
+{
+ stp_mxml_node_t *answer =
+ xml_parse_file_from_path(name, topnodename, path, NULL);
+ if (! answer)
+ {
+ stp_erprintf("Cannot find file %s of type %s\n", name, topnodename);
+ stp_abort();
+ }
+ return answer;
+}
- return 0;
+stp_mxml_node_t *
+stp_xml_parse_file_from_path(const char *name, const char *topnodename,
+ const char *path)
+{
+ char *cache;
+ void *data;
+ stp_asprintf(&cache, "%s_%s_%s", "xml_cache", topnodename,
+ path ? path : "DEFAULT");
+ data = stp_refcache_find_item(cache, name);
+ if (! data)
+ data = xml_parse_file_from_path(name, topnodename, path, cache);
+ stp_free(cache);
+ return (stp_mxml_node_t *) data;
+}
+
+stp_mxml_node_t *
+stp_xml_parse_file_from_path_safe(const char *name, const char *topnodename,
+ const char *path)
+{
+ stp_mxml_node_t *answer = stp_xml_parse_file_from_path(name, topnodename,
+ path);
+ if (! answer)
+ {
+ stp_erprintf("FATAL: Cannot find file %s of type %s\n", name, topnodename);
+ stp_abort();
+ }
+ return answer;
+}
+
+void
+stp_xml_free_parsed_file(stp_mxml_node_t *node)
+{
+ char *addr_string;
+ /* free(NULL) is legal and a no-op. */
+ if (! node)
+ return;
+ stp_asprintf(&addr_string, "%p", (void *) node);
+ stp_param_string_t *cache_entry =
+ stp_string_list_find(cached_xml_files, addr_string);
+ if (! cache_entry)
+ {
+ stp_erprintf("FATAL: Trying to free unrecorded node %s\n", addr_string);
+ stp_abort();
+ }
+ if (cache_entry->text && cache_entry->text[0] != '\0')
+ stp_refcache_remove_item(cache_entry->text, addr_string);
+ stp_string_list_remove_string(cached_xml_files, addr_string);
+ stp_free(addr_string);
+ while (node->parent && node->parent != node)
+ node = node->parent;
+ stp_xml_init();
+ stp_mxmlDelete(node);
+ stp_xml_exit();
}
/*
@@ -494,11 +640,14 @@ stp_xml_get_node(stp_mxml_node_t *xmlroot, ...)
child = xmlroot;
target = va_arg(ap, const char *);
+ stp_xml_init();
while (target && child)
{
- child = stp_mxmlFindElement(child, child, target, NULL, NULL, STP_MXML_DESCEND);
+ child = stp_mxmlFindElement(child, child, target, NULL, NULL,
+ STP_MXML_DESCEND);
target = va_arg(ap, const char *);
}
+ stp_xml_exit();
va_end(ap);
return child;
}
@@ -543,6 +692,7 @@ stp_xmldoc_create_generic(void)
stp_mxml_node_t *doc;
stp_mxml_node_t *rootnode;
+ stp_xml_init();
/* Create the XML tree */
doc = stp_mxmlNewElement(NULL, "?xml");
stp_mxmlElementSetAttr(doc, "version", "1.0");
@@ -555,6 +705,50 @@ stp_xmldoc_create_generic(void)
stp_mxmlElementSetAttr
(rootnode, "xsi:schemaLocation",
"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd");
+ stp_xml_exit();
return doc;
}
+
+void
+stpi_print_xml_node(stp_mxml_node_t *node)
+{
+ int i;
+ stp_erprintf("Node @%p:\n", (void *) node);
+ stp_erprintf(" Type %d\n", node->type);
+ stp_erprintf(" Next @%p\n", (void *) node->next);
+ stp_erprintf(" Prev @%p\n", (void *) node->prev);
+ stp_erprintf(" Parent @%p\n", (void *) node->parent);
+ stp_erprintf(" Child @%p\n", (void *) node->child);
+ stp_erprintf(" Last @%p\n", (void *) node->last_child);
+ stp_erprintf(" Value: ");
+ switch (node->type)
+ {
+ case STP_MXML_ELEMENT:
+ stp_erprintf("\n Element, name: %s\n", node->value.element.name);
+ stp_erprintf(" Attrs: %d\n", node->value.element.num_attrs);
+ for (i = 0; i < node->value.element.num_attrs; i++)
+ stp_erprintf(" %s => %s\n",
+ node->value.element.attrs[i].name,
+ node->value.element.attrs[i].value);
+ break;
+ case STP_MXML_INTEGER:
+ stp_erprintf(" Integer: %d\n", node->value.integer);
+ break;
+ case STP_MXML_REAL:
+ stp_erprintf(" Real: %f\n", node->value.real);
+ break;
+ case STP_MXML_DIMENSION:
+ stp_erprintf(" Dimension: %f\n", node->value.real);
+ break;
+ case STP_MXML_OPAQUE:
+ stp_erprintf(" Opaque: '%s'\n", node->value.opaque);
+ break;
+ case STP_MXML_TEXT:
+ stp_erprintf(" Text: %d '%s'\n", node->value.text.whitespace,
+ node->value.text.string);
+ break;
+ default:
+ stp_erprintf("UNKNOWN!\n");
+ }
+}
diff --git a/src/main/xmlppd.h b/src/main/xmlppd.h
index a0ca355..c7689ab 100644
--- a/src/main/xmlppd.h
+++ b/src/main/xmlppd.h
@@ -13,8 +13,7 @@
* 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.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GUTENPRINT_INTERNAL_XMLPPD_H