diff options
Diffstat (limited to 'src/gimp2')
-rw-r--r-- | src/gimp2/Makefile.am | 52 | ||||
-rw-r--r-- | src/gimp2/Makefile.in | 644 | ||||
-rw-r--r-- | src/gimp2/print-image-gimp.c | 447 | ||||
-rw-r--r-- | src/gimp2/print-intl.h | 38 | ||||
-rw-r--r-- | src/gimp2/print.c | 462 | ||||
-rw-r--r-- | src/gimp2/print_gimp.h | 46 |
6 files changed, 1689 insertions, 0 deletions
diff --git a/src/gimp2/Makefile.am b/src/gimp2/Makefile.am new file mode 100644 index 0000000..49f45fa --- /dev/null +++ b/src/gimp2/Makefile.am @@ -0,0 +1,52 @@ +## $Id: Makefile.am,v 1.5 2004/12/29 19:09:55 rlk Exp $ +## Copyright (C) 2000 Roger Leigh +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +## Process this file with automake to produce Makefile.in. + +AUTOMAKE_OPTIONS = 1.4 gnu + +@SET_MAKE@ + +MAINT_CHARSET = latin1 + +include $(top_srcdir)/scripts/global.mk + + +## Variables + +LOCAL_CPPFLAGS = $(GUTENPRINT_CFLAGS) $(GIMP2_CFLAGS) + + +## Programs + +if BUILD_GIMP2 +gimp2_plug_in_PROGRAMS = print +endif + +print_SOURCES = \ + print-image-gimp.c \ + print-intl.h \ + print.c \ + print_gimp.h + +print_LDADD = $(GIMP2_LIBS) $(GUTENPRINTUI2_LIBS) +print_DEPENDENCIES = $(GUTENPRINTUI2_LIBS) $(GUTENPRINT_LIBS) + + +## Clean + +MAINTAINERCLEANFILES = Makefile.in diff --git a/src/gimp2/Makefile.in b/src/gimp2/Makefile.in new file mode 100644 index 0000000..897d99e --- /dev/null +++ b/src/gimp2/Makefile.in @@ -0,0 +1,644 @@ +# Makefile.in generated by automake 1.9.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Variables + +SOURCES = $(print_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/scripts/global.mk +@BUILD_GIMP2_TRUE@gimp2_plug_in_PROGRAMS = print$(EXEEXT) +subdir = src/gimp2 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gimp.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/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/stp_release.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(gimp2_plug_indir)" +gimp2_plug_inPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(gimp2_plug_in_PROGRAMS) +am_print_OBJECTS = print-image-gimp.$(OBJEXT) print.$(OBJEXT) +print_OBJECTS = $(am_print_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = \ + $(top_builddir)/src/gutenprintui2/libgutenprintui2.la +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(print_SOURCES) +DIST_SOURCES = $(print_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_CUPS_FALSE = @BUILD_CUPS_FALSE@ +BUILD_CUPS_PPDS_FALSE = @BUILD_CUPS_PPDS_FALSE@ +BUILD_CUPS_PPDS_TRUE = @BUILD_CUPS_PPDS_TRUE@ +BUILD_CUPS_TRUE = @BUILD_CUPS_TRUE@ +BUILD_ESCPUTIL_FALSE = @BUILD_ESCPUTIL_FALSE@ +BUILD_ESCPUTIL_TRUE = @BUILD_ESCPUTIL_TRUE@ +BUILD_FOOMATIC_3_FALSE = @BUILD_FOOMATIC_3_FALSE@ +BUILD_FOOMATIC_3_TRUE = @BUILD_FOOMATIC_3_TRUE@ +BUILD_FOOMATIC_FALSE = @BUILD_FOOMATIC_FALSE@ +BUILD_FOOMATIC_TRUE = @BUILD_FOOMATIC_TRUE@ +BUILD_GENPPD_STATIC_FALSE = @BUILD_GENPPD_STATIC_FALSE@ +BUILD_GENPPD_STATIC_TRUE = @BUILD_GENPPD_STATIC_TRUE@ +BUILD_GHOSTSCRIPT_FALSE = @BUILD_GHOSTSCRIPT_FALSE@ +BUILD_GHOSTSCRIPT_TRUE = @BUILD_GHOSTSCRIPT_TRUE@ +BUILD_GIMP2_FALSE = @BUILD_GIMP2_FALSE@ +BUILD_GIMP2_TRUE = @BUILD_GIMP2_TRUE@ +BUILD_GIMP_FALSE = @BUILD_GIMP_FALSE@ +BUILD_GIMP_TRUE = @BUILD_GIMP_TRUE@ +BUILD_LIBGUTENPRINTUI2_FALSE = @BUILD_LIBGUTENPRINTUI2_FALSE@ +BUILD_LIBGUTENPRINTUI2_TRUE = @BUILD_LIBGUTENPRINTUI2_TRUE@ +BUILD_LIBGUTENPRINTUI_FALSE = @BUILD_LIBGUTENPRINTUI_FALSE@ +BUILD_LIBGUTENPRINTUI_TRUE = @BUILD_LIBGUTENPRINTUI_TRUE@ +BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@ +BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@ +BUILD_TESTPATTERN_FALSE = @BUILD_TESTPATTERN_FALSE@ +BUILD_TESTPATTERN_TRUE = @BUILD_TESTPATTERN_TRUE@ +BUILD_TEST_FALSE = @BUILD_TEST_FALSE@ +BUILD_TEST_TRUE = @BUILD_TEST_TRUE@ +BUILD_TRANSLATED_CUPS_PPDS_FALSE = @BUILD_TRANSLATED_CUPS_PPDS_FALSE@ +BUILD_TRANSLATED_CUPS_PPDS_TRUE = @BUILD_TRANSLATED_CUPS_PPDS_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONVERT = @CONVERT@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CUPS_PPDS_AT_TOP_LEVEL_FALSE = @CUPS_PPDS_AT_TOP_LEVEL_FALSE@ +CUPS_PPDS_AT_TOP_LEVEL_TRUE = @CUPS_PPDS_AT_TOP_LEVEL_TRUE@ +CUPS_PPD_PS_LEVEL = @CUPS_PPD_PS_LEVEL@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DB2HTML = @DB2HTML@ +DB2PDF = @DB2PDF@ +DB2PS = @DB2PS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIALOG = @DIALOG@ +DOXYGEN = @DOXYGEN@ +DVIPDF = @DVIPDF@ +DVIPS = @DVIPS@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FIND = @FIND@ +FOOMATIC_CONFIGURE = @FOOMATIC_CONFIGURE@ +FOOMATIC_KITLOAD = @FOOMATIC_KITLOAD@ +FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ +GENPPD_LIBS = @GENPPD_LIBS@ +GIMP2_CFLAGS = @GIMP2_CFLAGS@ +GIMP2_LIBS = @GIMP2_LIBS@ +GIMPTOOL = @GIMPTOOL@ +GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ +GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ +GIMP_CFLAGS = @GIMP_CFLAGS@ +GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ +GIMP_DATA_DIR = @GIMP_DATA_DIR@ +GIMP_LIBS = @GIMP_LIBS@ +GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ +GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_CONFIG = @GLIB_CONFIG@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GMSGFMT = @GMSGFMT@ +GNUCFLAGS = @GNUCFLAGS@ +GTK2_CFLAGS = @GTK2_CFLAGS@ +GTK2_LIBS = @GTK2_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ +GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ +GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ +GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ +GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ +GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la +GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ +GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ +GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ +GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ +GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ +GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la +GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ +GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ +GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ +GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ +GUTENPRINT_INTERFACE_AGE = @GUTENPRINT_INTERFACE_AGE@ +GUTENPRINT_LIBDEPS = @GUTENPRINT_LIBDEPS@ + +# Libraries +GUTENPRINT_LIBS = $(top_builddir)/src/main/libgutenprint.la +GUTENPRINT_MAJOR_VERSION = @GUTENPRINT_MAJOR_VERSION@ +GUTENPRINT_MICRO_VERSION = @GUTENPRINT_MICRO_VERSION@ +GUTENPRINT_MINOR_VERSION = @GUTENPRINT_MINOR_VERSION@ +GUTENPRINT_VERSION = @GUTENPRINT_VERSION@ +IJS_CFLAGS = @IJS_CFLAGS@ +IJS_CONFIG = @IJS_CONFIG@ +IJS_LIBS = @IJS_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SAMPLES_FALSE = @INSTALL_SAMPLES_FALSE@ +INSTALL_SAMPLES_TRUE = @INSTALL_SAMPLES_TRUE@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_USER_GUIDE_FALSE = @INSTALL_USER_GUIDE_FALSE@ +INSTALL_USER_GUIDE_TRUE = @INSTALL_USER_GUIDE_TRUE@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBREADLINE_DEPS = @LIBREADLINE_DEPS@ +LIBS = $(INTLLIBS) @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +LTALLOCA = @LTALLOCA@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PLUG_IN_PATH = @PLUG_IN_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +RELEASE_DATE = @RELEASE_DATE@ +RM = @RM@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TEXI2HTML = @TEXI2HTML@ +USE_LEVEL3_PS_FALSE = @USE_LEVEL3_PS_FALSE@ +USE_LEVEL3_PS_TRUE = @USE_LEVEL3_PS_TRUE@ +USE_NLS = @USE_NLS@ +USE_NLS_FALSE = @USE_NLS_FALSE@ +USE_NLS_TRUE = @USE_NLS_TRUE@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +cups_bindir = @cups_bindir@ +cups_conf_datadir = @cups_conf_datadir@ +cups_conf_serverbin = @cups_conf_serverbin@ +cups_conf_serverroot = @cups_conf_serverroot@ +cups_exec_prefix = @cups_exec_prefix@ +cups_prefix = @cups_prefix@ +cups_sbindir = @cups_sbindir@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +gimp2_plug_indir = @gimp2_plug_indir@ +gimp_plug_indir = @gimp_plug_indir@ +gutenprint_cflags = @gutenprint_cflags@ +gutenprint_libs = @gutenprint_libs@ +gutenprintui2_cflags = @gutenprintui2_cflags@ +gutenprintui2_libs = @gutenprintui2_libs@ +gutenprintui_cflags = @gutenprintui_cflags@ +gutenprintui_libs = @gutenprintui_libs@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = 1.4 gnu +MAINT_CHARSET = latin1 +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +LOCAL_CPPFLAGS = $(GUTENPRINT_CFLAGS) $(GIMP2_CFLAGS) +print_SOURCES = \ + print-image-gimp.c \ + print-intl.h \ + print.c \ + print_gimp.h + +print_LDADD = $(GIMP2_LIBS) $(GUTENPRINTUI2_LIBS) +print_DEPENDENCIES = $(GUTENPRINTUI2_LIBS) $(GUTENPRINT_LIBS) +MAINTAINERCLEANFILES = Makefile.in +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/scripts/global.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/gimp2/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/gimp2/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);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-gimp2_plug_inPROGRAMS: $(gimp2_plug_in_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(gimp2_plug_indir)" || $(mkdir_p) "$(DESTDIR)$(gimp2_plug_indir)" + @list='$(gimp2_plug_in_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(gimp2_plug_inPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(gimp2_plug_indir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(gimp2_plug_inPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(gimp2_plug_indir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-gimp2_plug_inPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(gimp2_plug_in_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(gimp2_plug_indir)/$$f'"; \ + rm -f "$(DESTDIR)$(gimp2_plug_indir)/$$f"; \ + done + +clean-gimp2_plug_inPROGRAMS: + @list='$(gimp2_plug_in_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +print$(EXEEXT): $(print_OBJECTS) $(print_DEPENDENCIES) + @rm -f print$(EXEEXT) + $(LINK) $(print_LDFLAGS) $(print_OBJECTS) $(print_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-image-gimp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/../../scripts + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(gimp2_plug_indir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-gimp2_plug_inPROGRAMS clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-gimp2_plug_inPROGRAMS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-gimp2_plug_inPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-gimp2_plug_inPROGRAMS clean-libtool ctags 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-exec \ + install-exec-am install-gimp2_plug_inPROGRAMS install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-gimp2_plug_inPROGRAMS \ + uninstall-info-am + + +@SET_MAKE@ + +export STP_MODULE_PATH = $(top_builddir)/src/main/.libs:$(top_builddir)/src/main +export STP_DATA_PATH = $(top_srcdir)/src/main + +# Rules + +$(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) +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/gimp2/print-image-gimp.c b/src/gimp2/print-image-gimp.c new file mode 100644 index 0000000..8227409 --- /dev/null +++ b/src/gimp2/print-image-gimp.c @@ -0,0 +1,447 @@ +/* + * "$Id: print-image-gimp.c,v 1.2 2004/06/22 18:52:15 rleigh Exp $" + * + * Print plug-in for the GIMP. + * + * Copyright 1997-2000 Michael Sweet (mike@easysw.com) and + * Robert Krawitz (rlk@alum.mit.edu) + * Copyright 2000 Charles Briscoe-Smith <cpbs@debian.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <string.h> + +#include "print_gimp.h" + +#include "print-intl.h" + + +/* + * "Image" ADT + * + * This file defines an abstract data type called "Image". An Image wraps + * a Gimp drawable (or some other application-level image representation) + * for presentation to the low-level printer drivers (which do CMYK + * separation, dithering and weaving). The Image ADT has the ability + * to perform any combination of flips and rotations on the image, + * and then deliver individual rows to the driver code. + * + * Stuff which might be useful to do in this layer: + * + * - Scaling, optionally with interpolation/filtering. + * + * - Colour-adjustment. + * + * - Multiple-image composition. + * + * Also useful might be to break off a thin application-dependent + * sublayer leaving this layer (which does the interesting stuff) + * application-independent. + */ + + +/* Concrete type to represent image */ +typedef struct +{ + GimpDrawable *drawable; + GimpPixelRgn rgn; + + /* + * Transformations we can impose on the image. The transformations + * are considered to be performed in the order given here. + */ + + /* 1: Transpose the x and y axes (flip image over its leading diagonal) */ + int columns; /* Set if returning columns instead of rows. */ + + /* 2: Translate (ox,oy) to the origin */ + int ox, oy; /* Origin of image */ + + /* 3: Flip vertically about the x axis */ + int increment; /* +1 or -1 for offset of row n+1 from row n. */ + + /* 4: Crop to width w, height h */ + int w, h; /* Width and height of output image */ + + /* 5: Flip horizontally about the vertical centre-line of the image */ + int mirror; /* Set if mirroring rows end-for-end. */ + + gint32 image_ID; + gint32 ncolors; + gint32 real_bpp; + GimpImageBaseType base_type; + guchar *cmap; + guchar *alpha_table; + guchar *tmp; + gint last_printed_percent; + gint initialized; +} Gimp_Image_t; + +static const char *Image_get_appname(stp_image_t *image); +static void Image_conclude(stp_image_t *image); +static stp_image_status_t Image_get_row(stp_image_t *image, + unsigned char *data, + size_t byte_limit, int row); +static int Image_height(stp_image_t *image); +static int Image_width(stp_image_t *image); +static void Image_reset(stp_image_t *image); +static void Image_init(stp_image_t *image); + +static void Image_transpose(stpui_image_t *image); +static void Image_hflip(stpui_image_t *image); +static void Image_vflip(stpui_image_t *image); +static void Image_rotate_ccw(stpui_image_t *image); +static void Image_rotate_cw(stpui_image_t *image); +static void Image_rotate_180(stpui_image_t *image); +static void Image_crop(stpui_image_t *image, int, int, int, int); + +static stpui_image_t theImage = +{ + { + Image_init, + Image_reset, + Image_width, + Image_height, + Image_get_row, + Image_get_appname, + Image_conclude, + NULL, + }, + Image_transpose, + Image_hflip, + Image_vflip, + Image_rotate_ccw, + Image_rotate_cw, + Image_rotate_180, + Image_crop +}; + +static void +compute_alpha_table(Gimp_Image_t *image) +{ + unsigned val, alpha; + image->alpha_table = stp_malloc(65536 * sizeof(unsigned char)); + for (val = 0; val < 256; val++) + for (alpha = 0; alpha < 256; alpha++) + image->alpha_table[(val * 256) + alpha] = + val * alpha / 255 + 255 - alpha; +} + +static inline unsigned char +alpha_lookup(Gimp_Image_t *image, int val, int alpha) +{ + return image->alpha_table[(val * 256) + alpha]; +} + +stpui_image_t * +Image_GimpDrawable_new(GimpDrawable *drawable, gint32 image_ID) +{ + Gimp_Image_t *im = stp_malloc(sizeof(Gimp_Image_t)); + memset(im, 0, sizeof(Gimp_Image_t)); + im->drawable = drawable; + gimp_pixel_rgn_init(&(im->rgn), drawable, 0, 0, + drawable->width, drawable->height, FALSE, FALSE); + im->image_ID = image_ID; + im->base_type = gimp_image_base_type(image_ID); + im->initialized = 0; + theImage.im.rep = im; + theImage.im.reset(&(theImage.im)); + switch (im->base_type) + { + case GIMP_INDEXED: + im->cmap = gimp_image_get_cmap(image_ID, &(im->ncolors)); + im->real_bpp = 3; + break; + case GIMP_GRAY: + im->real_bpp = 1; + break; + case GIMP_RGB: + im->real_bpp = 3; + break; + } + if (im->drawable->bpp == 2 || im->drawable->bpp == 4) + compute_alpha_table(im); + return &theImage; +} + +static void +Image_init(stp_image_t *image) +{ + /* Nothing to do. */ +} + +static void +Image_reset(stp_image_t *image) +{ + Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); + im->columns = FALSE; + im->ox = 0; + im->oy = 0; + im->increment = 1; + im->w = im->drawable->width; + im->h = im->drawable->height; + im->mirror = FALSE; +} + +static int +Image_width(stp_image_t *image) +{ + Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); + return im->w; +} + +static int +Image_height(stp_image_t *image) +{ + Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); + return im->h; +} + +static stp_image_status_t +Image_get_row(stp_image_t *image, unsigned char *data, size_t byte_limit, + int row) +{ + Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); + int last_printed_percent; + guchar *inter; + if (!im->initialized) + { + gimp_progress_init(_("Printing...")); + switch (im->base_type) + { + case GIMP_INDEXED: + im->tmp = stp_malloc(im->drawable->bpp * im->w); + break; + case GIMP_GRAY: + if (im->drawable->bpp == 2) + im->tmp = stp_malloc(im->drawable->bpp * im->w); + break; + case GIMP_RGB: + if (im->drawable->bpp == 4) + im->tmp = stp_malloc(im->drawable->bpp * im->w); + break; + } + im->initialized = 1; + } + if (im->tmp) + inter = im->tmp; + else + inter = data; + if (im->columns) + gimp_pixel_rgn_get_col(&(im->rgn), inter, + im->oy + row * im->increment, im->ox, im->w); + else + gimp_pixel_rgn_get_row(&(im->rgn), inter, + im->ox, im->oy + row * im->increment, im->w); + if (im->cmap) + { + int i; + if (im->alpha_table) + { + for (i = 0; i < im->w; i++) + { + int j; + for (j = 0; j < 3; j++) + { + gint32 tval = im->cmap[(3 * inter[2 * i]) + j]; + data[(3 * i) + j] = alpha_lookup(im, tval, + inter[(2 * i) + 1]); + } + + } + } + else + { + for (i = 0; i < im->w; i++) + { + data[(3 * i) + 0] = im->cmap[(3 * inter[i]) + 0]; + data[(3 * i) + 1] = im->cmap[(3 * inter[i]) + 1]; + data[(3 * i) + 2] = im->cmap[(3 * inter[i]) + 2]; + } + } + } + else if (im->alpha_table) + { + int i; + for (i = 0; i < im->w; i++) + { + int j; + for (j = 0; j < im->real_bpp; j++) + { + gint32 tval = inter[(i * im->drawable->bpp) + j]; + data[(i * im->real_bpp) + j] = + alpha_lookup(im, tval, + inter[((i + 1) * im->drawable->bpp) - 1]); + } + + } + } + if (im->mirror) + { + /* Flip row -- probably inefficiently */ + int f; + int l; + int b = im->real_bpp; + for (f = 0, l = im->w - 1; f < l; f++, l--) + { + int c; + unsigned char tmp; + for (c = 0; c < b; c++) + { + tmp = data[f*b+c]; + data[f*b+c] = data[l*b+c]; + data[l*b+c] = tmp; + } + } + } + last_printed_percent = row * 100 / im->h; + if (last_printed_percent > im->last_printed_percent) + { + gimp_progress_update((double) row / (double) im->h); + im->last_printed_percent = last_printed_percent; + } + return STP_IMAGE_STATUS_OK; +} + +static void +Image_transpose(stpui_image_t *image) +{ + Gimp_Image_t *im = (Gimp_Image_t *) (image->im.rep); + int tmp; + + if (im->mirror) im->ox += im->w - 1; + + im->columns = !im->columns; + + tmp = im->ox; + im->ox = im->oy; + im->oy = tmp; + + tmp = im->mirror; + im->mirror = im->increment < 0; + im->increment = tmp ? -1 : 1; + + tmp = im->w; + im->w = im->h; + im->h = tmp; + + if (im->mirror) im->ox -= im->w - 1; +} + +static void +Image_hflip(stpui_image_t *image) +{ + Gimp_Image_t *im = (Gimp_Image_t *) (image->im.rep); + im->mirror = !im->mirror; +} + +static void +Image_vflip(stpui_image_t *image) +{ + Gimp_Image_t *im = (Gimp_Image_t *) (image->im.rep); + im->oy += (im->h-1) * im->increment; + im->increment = -im->increment; +} + +/* + * Image_crop: + * + * Crop the given number of pixels off the LEFT, TOP, RIGHT and BOTTOM + * of the image. + */ + +static void +Image_crop(stpui_image_t *image, int left, int top, int right, int bottom) +{ + Gimp_Image_t *im = (Gimp_Image_t *) (image->im.rep); + int xmax = (im->columns ? im->drawable->height : im->drawable->width) - 1; + int ymax = (im->columns ? im->drawable->width : im->drawable->height) - 1; + + int nx = im->ox + im->mirror ? right : left; + int ny = im->oy + top * (im->increment); + + int nw = im->w - left - right; + int nh = im->h - top - bottom; + + int wmax, hmax; + + if (nx < 0) nx = 0; + else if (nx > xmax) nx = xmax; + + if (ny < 0) ny = 0; + else if (ny > ymax) ny = ymax; + + wmax = xmax - nx + 1; + hmax = im->increment ? ny + 1 : ymax - ny + 1; + + if (nw < 1) nw = 1; + else if (nw > wmax) nw = wmax; + + if (nh < 1) nh = 1; + else if (nh > hmax) nh = hmax; + + im->ox = nx; + im->oy = ny; + im->w = nw; + im->h = nh; +} + +static void +Image_rotate_ccw(stpui_image_t *image) +{ + Image_transpose(image); + Image_vflip(image); +} + +static void +Image_rotate_cw(stpui_image_t *image) +{ + Image_transpose(image); + Image_hflip(image); +} + +static void +Image_rotate_180(stpui_image_t *image) +{ + Image_vflip(image); + Image_hflip(image); +} + +static void +Image_conclude(stp_image_t *image) +{ + Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); + gimp_progress_update(1); + if (im->alpha_table) + stp_free(im->alpha_table); + if (im->tmp) + stp_free(im->tmp); +} + +static const char * +Image_get_appname(stp_image_t *image) +{ + static char pluginname[] = "Print plug-in V" VERSION " - " RELEASE_DATE + " for GIMP"; + return pluginname; +} + +/* + * End of "$Id: print-image-gimp.c,v 1.2 2004/06/22 18:52:15 rleigh Exp $". + */ diff --git a/src/gimp2/print-intl.h b/src/gimp2/print-intl.h new file mode 100644 index 0000000..634f23a --- /dev/null +++ b/src/gimp2/print-intl.h @@ -0,0 +1,38 @@ +/* + * "$Id: print-intl.h,v 1.3 2004/09/17 18:38:13 rleigh Exp $" + * + * I18N header file for the GIMP2 Print plugin. + * + * Copyright 1997-2000 Michael Sweet (mike@easysw.com), + * Robert Krawitz (rlk@alum.mit.edu) and Michael Natterer (mitch@gimp.org) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#ifndef GIMP2_PRINT_INTL_H +#define GIMP2_PRINT_INTL_H + +#include <glib.h> +#include <gutenprint/gutenprint-intl.h> + +#define INIT_LOCALE(domain) \ +do \ +{ \ + gtk_set_locale (); \ + setlocale (LC_NUMERIC, "C"); \ + bindtextdomain (domain, PACKAGE_LOCALE_DIR); \ + textdomain (domain); \ +} while (0) + +#endif /* GIMP2_PRINT_INTL_H */ diff --git a/src/gimp2/print.c b/src/gimp2/print.c new file mode 100644 index 0000000..8ae4e26 --- /dev/null +++ b/src/gimp2/print.c @@ -0,0 +1,462 @@ +/* + * "$Id: print.c,v 1.6 2004/11/01 20:46:34 rleigh Exp $" + * + * Print plug-in for the GIMP. + * + * Copyright 1997-2000 Michael Sweet (mike@easysw.com) and + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gutenprintui2/gutenprintui.h> +#include "print_gimp.h" + +#include <sys/types.h> +#include <signal.h> +#include <ctype.h> +#include <sys/wait.h> + +#include <unistd.h> +#include <stdio.h> +#include <string.h> + +#include "print-intl.h" + +/* + * Local functions... + */ + +static void query (void); +static void run (const char *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); +static int do_print_dialog (const gchar *proc_name, + gint32 image_ID); + +/* + * Work around GIMP library not being const-safe. This is a very ugly + * hack, but the excessive warnings generated can mask more serious + * problems. + */ + +#define BAD_CONST_CHAR char * + +/* + * Globals... + */ + +GimpPlugInInfo PLUG_IN_INFO = /* Plug-in information */ +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + query, /* query_proc */ + run, /* run_proc */ +}; + +static stpui_plist_t gimp_vars; + +/* + * 'main()' - Main entry - just call gimp_main()... + */ + +MAIN() + +/* + * 'query()' - Respond to a plug-in query... + */ + +static void +query (void) +{ + static GimpParamDef args[] = + { + { GIMP_PDB_INT32, (BAD_CONST_CHAR) "run_mode", (BAD_CONST_CHAR) "Interactive, non-interactive" }, + { GIMP_PDB_IMAGE, (BAD_CONST_CHAR) "image", (BAD_CONST_CHAR) "Input image" }, + { GIMP_PDB_DRAWABLE, (BAD_CONST_CHAR) "drawable", (BAD_CONST_CHAR) "Input drawable" }, + { GIMP_PDB_STRING, (BAD_CONST_CHAR) "output_to", (BAD_CONST_CHAR) "Print command or filename (| to pipe to command)" }, + { GIMP_PDB_STRING, (BAD_CONST_CHAR) "driver", (BAD_CONST_CHAR) "Printer driver short name" }, + { GIMP_PDB_STRING, (BAD_CONST_CHAR) "ppd_file", (BAD_CONST_CHAR) "PPD file" }, + { GIMP_PDB_INT32, (BAD_CONST_CHAR) "output_type", (BAD_CONST_CHAR) "Output type (0 = gray, 1 = color)" }, + { GIMP_PDB_STRING, (BAD_CONST_CHAR) "resolution", (BAD_CONST_CHAR) "Resolution (\"300\", \"720\", etc.)" }, + { GIMP_PDB_STRING, (BAD_CONST_CHAR) "media_size", (BAD_CONST_CHAR) "Media size (\"Letter\", \"A4\", etc.)" }, + { GIMP_PDB_STRING, (BAD_CONST_CHAR) "media_type", (BAD_CONST_CHAR) "Media type (\"Plain\", \"Glossy\", etc.)" }, + { GIMP_PDB_STRING, (BAD_CONST_CHAR) "media_source", (BAD_CONST_CHAR) "Media source (\"Tray1\", \"Manual\", etc.)" }, + { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "brightness", (BAD_CONST_CHAR) "Brightness (0-400%)" }, + { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "scaling", (BAD_CONST_CHAR) "Output scaling (0-100%, -PPI)" }, + { GIMP_PDB_INT32, (BAD_CONST_CHAR) "orientation", (BAD_CONST_CHAR) "Output orientation (-1 = auto, 0 = portrait, 1 = landscape)" }, + { GIMP_PDB_INT32, (BAD_CONST_CHAR) "left", (BAD_CONST_CHAR) "Left offset (points, -1 = centered)" }, + { GIMP_PDB_INT32, (BAD_CONST_CHAR) "top", (BAD_CONST_CHAR) "Top offset (points, -1 = centered)" }, + { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "gamma", (BAD_CONST_CHAR) "Output gamma (0.1 - 3.0)" }, + { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "contrast", (BAD_CONST_CHAR) "Contrast" }, + { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "cyan", (BAD_CONST_CHAR) "Cyan level" }, + { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "magenta", (BAD_CONST_CHAR) "Magenta level" }, + { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "yellow", (BAD_CONST_CHAR) "Yellow level" }, + { GIMP_PDB_INT32, (BAD_CONST_CHAR) "linear", (BAD_CONST_CHAR) "Linear output (0 = normal, 1 = linear)" }, + { GIMP_PDB_INT32, (BAD_CONST_CHAR) "image_type", (BAD_CONST_CHAR) "Image type (0 = line art, 1 = solid tones, 2 = continuous tone, 3 = monochrome)"}, + { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "saturation", (BAD_CONST_CHAR) "Saturation (0-1000%)" }, + { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "density", (BAD_CONST_CHAR) "Density (0-200%)" }, + { GIMP_PDB_STRING, (BAD_CONST_CHAR) "ink_type", (BAD_CONST_CHAR) "Type of ink or cartridge" }, + { GIMP_PDB_STRING, (BAD_CONST_CHAR) "dither_algorithm", (BAD_CONST_CHAR) "Dither algorithm" }, + { GIMP_PDB_INT32, (BAD_CONST_CHAR) "unit", (BAD_CONST_CHAR) "Unit 0=Inches 1=Metric" }, + }; + + static const gchar *blurb = "This plug-in prints images from The GIMP."; + static const gchar *help = "Prints images to PostScript, PCL, or ESC/P2 printers."; + static const gchar *auth = "Michael Sweet <mike@easysw.com> and Robert Krawitz <rlk@alum.mit.edu>"; + static const gchar *copy = "Copyright 1997-2000 by Michael Sweet and Robert Krawitz"; + static const gchar *types = "RGB*,GRAY*,INDEXED*"; + + gimp_plugin_domain_register ((BAD_CONST_CHAR) PACKAGE, (BAD_CONST_CHAR) PACKAGE_LOCALE_DIR); + + gimp_install_procedure ((BAD_CONST_CHAR) "file_print_gimp", + (BAD_CONST_CHAR) blurb, + (BAD_CONST_CHAR) help, + (BAD_CONST_CHAR) auth, + (BAD_CONST_CHAR) copy, + (BAD_CONST_CHAR) VERSION " - " RELEASE_DATE, + (BAD_CONST_CHAR) N_("<Image>/File/Print..."), + (BAD_CONST_CHAR) types, + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); +} + +static guchar *gimp_thumbnail_data = NULL; + +static guchar * +stpui_get_thumbnail_data_function(void *image_ID, gint *width, gint *height, + gint *bpp, gint page) +{ + if (gimp_thumbnail_data) + g_free(gimp_thumbnail_data); + gimp_thumbnail_data = + gimp_image_get_thumbnail_data((gint) image_ID, width, height, bpp); + return gimp_thumbnail_data; +} + +/* + * 'run()' - Run the plug-in... + */ + +volatile int SDEBUG = 1; + +static void +run (const char *name, /* I - Name of print program. */ + gint nparams, /* I - Number of parameters passed in */ + const GimpParam *param, /* I - Parameter values */ + gint *nreturn_vals, /* O - Number of return values */ + GimpParam **return_vals) /* O - Return values */ +{ + GimpDrawable *drawable; /* Drawable for image */ + GimpRunMode run_mode; /* Current run mode */ + GimpParam *values; /* Return values */ + gint32 drawable_ID; /* drawable ID */ + GimpExportReturn export = GIMP_EXPORT_CANCEL; /* return value of gimp_export_image() */ + gdouble xres, yres; + char *image_filename; + stpui_image_t *image; + gint32 image_ID; + gint32 base_type; + if (getenv("STP_DEBUG_STARTUP")) + while (SDEBUG) + ; + + /* + * Initialise libgutenprint + */ + + stp_init(); + + stp_set_output_codeset("UTF-8"); + +#ifdef INIT_I18N_UI + INIT_I18N_UI(); +#else + /* + * With GCC and glib 1.2, there will be a warning here about braces in + * expressions. Getting rid of it causes more problems than it solves. + * In particular, turning on -ansi on the command line causes a number of + * other useful things, such as strcasecmp, popen, and snprintf to go away + */ + INIT_LOCALE (PACKAGE); +#endif + + stpui_printer_initialize(&gimp_vars); + /* + * Initialize parameter data... + */ + + run_mode = (GimpRunMode)param[0].data.d_int32; + + values = g_new (GimpParam, 1); + + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = GIMP_PDB_SUCCESS; + + *nreturn_vals = 1; + *return_vals = values; + + image_ID = param[1].data.d_int32; + drawable_ID = param[2].data.d_int32; + + image_filename = gimp_image_get_filename (image_ID); + if (image_filename) + { + if (strchr(image_filename, '/')) + image_filename = strrchr(image_filename, '/') + 1; + stpui_set_image_filename(image_filename); + /* g_free(image_filename); */ + } + else + stpui_set_image_filename("Untitled"); + + /* eventually export the image */ + switch (run_mode) + { + case GIMP_RUN_INTERACTIVE: + case GIMP_RUN_WITH_LAST_VALS: + gimp_ui_init ("print", TRUE); + export = gimp_export_image (&image_ID, &drawable_ID, "Print", + (GIMP_EXPORT_CAN_HANDLE_RGB | + GIMP_EXPORT_CAN_HANDLE_GRAY | + GIMP_EXPORT_CAN_HANDLE_INDEXED | + GIMP_EXPORT_CAN_HANDLE_ALPHA)); + if (export == GIMP_EXPORT_CANCEL) + { + *nreturn_vals = 1; + values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + return; + } + break; + default: + break; + } + + /* + * Get drawable... + */ + + drawable = gimp_drawable_get (drawable_ID); + stpui_set_image_dimensions(drawable->width, drawable->height); + gimp_image_get_resolution (image_ID, &xres, &yres); + stpui_set_image_resolution(xres, yres); + stpui_set_image_channel_depth(8); + base_type = gimp_image_base_type(image_ID); + switch (base_type) + { + case GIMP_INDEXED: + case GIMP_RGB: + stpui_set_image_type("RGB"); + break; + case GIMP_GRAY: + stpui_set_image_type("Whitescale"); + break; + default: + break; + } + + image = Image_GimpDrawable_new(drawable, image_ID); + stp_set_float_parameter(gimp_vars.v, "AppGamma", gimp_gamma()); + + /* + * See how we will run + */ + + switch (run_mode) + { + case GIMP_RUN_INTERACTIVE: + /* + * Get information from the dialog... + */ + + if (!do_print_dialog (name, image_ID)) + goto cleanup; + stpui_plist_copy(&gimp_vars, stpui_get_current_printer()); + break; + + case GIMP_RUN_NONINTERACTIVE: + /* + * Make sure all the arguments are present... + */ + if (nparams < 11) + values[0].data.d_status = GIMP_PDB_CALLING_ERROR; + else + { +#if 0 + /* What do we do with old output_to? Probably best ignore it. */ + stpui_plist_set_output_to(&gimp_vars, param[3].data.d_string); +#endif + stp_set_driver(gimp_vars.v, param[4].data.d_string); + stp_set_file_parameter(gimp_vars.v, "PPDFile", param[5].data.d_string); + switch (param[6].data.d_int32) + { + case 0: + default: + stp_set_string_parameter(gimp_vars.v, "PrintingMode", "BW"); + case 1: + stp_set_string_parameter(gimp_vars.v, "PrintingMode", "Color"); + } + stp_set_string_parameter(gimp_vars.v, "Resolution", param[7].data.d_string); + stp_set_string_parameter(gimp_vars.v, "PageSize", param[8].data.d_string); + stp_set_string_parameter(gimp_vars.v, "MediaType", param[9].data.d_string); + stp_set_string_parameter(gimp_vars.v, "InputSlot", param[10].data.d_string); + + if (nparams > 11) + stp_set_float_parameter(gimp_vars.v, "Brightness", param[11].data.d_float); + + if (nparams > 12) + gimp_vars.scaling = param[12].data.d_float; + + if (nparams > 13) + gimp_vars.orientation = param[13].data.d_int32; + + if (nparams > 14) + stp_set_left(gimp_vars.v, param[14].data.d_int32); + + if (nparams > 15) + stp_set_top(gimp_vars.v, param[15].data.d_int32); + + if (nparams > 16) + stp_set_float_parameter(gimp_vars.v, "Gamma", param[16].data.d_float); + + if (nparams > 17) + stp_set_float_parameter(gimp_vars.v, "Contrast", param[17].data.d_float); + + if (nparams > 18) + stp_set_float_parameter(gimp_vars.v, "Cyan", param[18].data.d_float); + + if (nparams > 19) + stp_set_float_parameter(gimp_vars.v, "Magenta", param[19].data.d_float); + + if (nparams > 20) + stp_set_float_parameter(gimp_vars.v, "Yellow", param[20].data.d_float); + + if (nparams > 21) + stp_set_string_parameter(gimp_vars.v, "ImageOptimization", param[21].data.d_string); + + if (nparams > 22) + stp_set_float_parameter(gimp_vars.v, "Saturation", param[23].data.d_float); + + if (nparams > 23) + stp_set_float_parameter(gimp_vars.v, "Density", param[24].data.d_float); + + if (nparams > 24) + stp_set_string_parameter(gimp_vars.v, "InkType", param[25].data.d_string); + + if (nparams > 25) + stp_set_string_parameter(gimp_vars.v, "DitherAlgorithm", + param[26].data.d_string); + + if (nparams > 26) + gimp_vars.unit = param[27].data.d_int32; + } + + break; + + case GIMP_RUN_WITH_LAST_VALS: + values[0].data.d_status = GIMP_PDB_CALLING_ERROR; + break; + + default: + values[0].data.d_status = GIMP_PDB_CALLING_ERROR; + break; + } + + if (gimp_thumbnail_data) + g_free(gimp_thumbnail_data); + + /* + * Print the image... + */ + if (values[0].data.d_status == GIMP_PDB_SUCCESS) + { + /* + * Set the tile cache size... + */ + + if (drawable->height > drawable->width) + gimp_tile_cache_ntiles ((drawable->height + gimp_tile_width () - 1) / + gimp_tile_width () + 1); + else + gimp_tile_cache_ntiles ((drawable->width + gimp_tile_width () - 1) / + gimp_tile_width () + 1); + + if (! stpui_print(&gimp_vars, image)) + values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + + /* + * Store data... + * FIXME! This is broken! + */ + +#if 0 + if (run_mode == GIMP_RUN_INTERACTIVE) + gimp_set_data (PLUG_IN_NAME, vars, sizeof (vars)); +#endif + } + + /* + * Detach from the drawable... + */ + gimp_drawable_detach (drawable); + + cleanup: + if (export == GIMP_EXPORT_EXPORT) + gimp_image_delete (image_ID); + stp_vars_destroy(gimp_vars.v); +} + +/* + * 'do_print_dialog()' - Pop up the print dialog... + */ + +static void +gimp_writefunc(void *file, const char *buf, size_t bytes) +{ + FILE *prn = (FILE *)file; + fwrite(buf, 1, bytes, prn); +} + +static void +gimp_errfunc(void *file, const char *buf, size_t bytes) +{ + char formatbuf[32]; + snprintf(formatbuf, 31, "%%%ds", bytes); + g_message(formatbuf, buf); +} + +static gint +do_print_dialog (const gchar *proc_name, + gint32 image_ID) +{ + /* + * Generate the filename for the current user... + */ + char *filename = gimp_personal_rc_file ((BAD_CONST_CHAR) "printrc"); + stpui_set_printrc_file(filename); + g_free(filename); + if (! getenv("STP_PRINT_MESSAGES_TO_STDERR")) + stpui_set_errfunc(gimp_errfunc); + stpui_set_thumbnail_func(stpui_get_thumbnail_data_function); + stpui_set_thumbnail_data((void *) image_ID); + return stpui_do_print_dialog(); +} diff --git a/src/gimp2/print_gimp.h b/src/gimp2/print_gimp.h new file mode 100644 index 0000000..c6f9239 --- /dev/null +++ b/src/gimp2/print_gimp.h @@ -0,0 +1,46 @@ +/* + * "$Id: print_gimp.h,v 1.4 2004/11/01 20:46:34 rleigh Exp $" + * + * Print plug-in for the GIMP. + * + * Copyright 1997-2000 Michael Sweet (mike@easysw.com), + * Robert Krawitz (rlk@alum.mit.edu). and Steve Miller (smiller@rni.net + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * Revision History: + * + * See ChangeLog + */ + +#ifndef __PRINT_GIMP_H__ +#define __PRINT_GIMP_H__ + +#ifdef __GNUC__ +#define inline __inline__ +#endif + +#include <gtk/gtk.h> +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include <gutenprint/gutenprint.h> +#include <gutenprintui2/gutenprintui.h> + +/* How to create an Image wrapping a Gimp drawable */ +extern stpui_image_t *Image_GimpDrawable_new(GimpDrawable *drawable, gint32); + +#endif /* __PRINT_GIMP_H__ */ |