diff options
Diffstat (limited to 'debian/lcms/lcms-1.19.dfsg2/samples')
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/Makefile.am | 32 | ||||
| -rw-r--r-- | debian/lcms/lcms-1.19.dfsg2/samples/Makefile.in | 611 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/icc2ps.1 | 41 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/icc2ps.c | 260 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/icclink.1 | 90 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/icclink.c | 392 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/icctrans.1 | 61 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/icctrans.c | 1288 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/makefile.simple | 36 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/mkcmy.c | 222 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/mkgrayer.c | 84 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/mktiff8.c | 142 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/vprf.c | 67 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/wtpt.1 | 28 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/wtpt.c | 88 | ||||
| -rwxr-xr-x | debian/lcms/lcms-1.19.dfsg2/samples/xgetopt.c | 75 |
16 files changed, 3517 insertions, 0 deletions
diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/Makefile.am b/debian/lcms/lcms-1.19.dfsg2/samples/Makefile.am new file mode 100755 index 00000000..c5738db9 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/Makefile.am @@ -0,0 +1,32 @@ +# +# Makefile for building lcms sample programs +# Originally Written by Bob Friesenhahn, June 2003 +# Additions and bugs by Marti Maria Oct 2004 + +# Don't require all the GNU mandated files +AUTOMAKE_OPTIONS = 1.7 foreign + +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include + +bin_PROGRAMS = icctrans wtpt icc2ps icclink + +icctrans_LDADD = $(top_builddir)/src/liblcms.la +icctrans_LDFLAGS = @LDFLAGS@ +icctrans_SOURCES = icctrans.c xgetopt.c vprf.c +icctrans_MANS = icctrans.1 + +wtpt_LDADD = $(top_builddir)/src/liblcms.la +wtpt_LDFLAGS = @LDFLAGS@ +wtpt_SOURCES = wtpt.c xgetopt.c + + +icc2ps_LDADD = $(top_builddir)/src/liblcms.la +icc2ps_LDFLAGS = @LDFLAGS@ +icc2ps_SOURCES = icc2ps.c xgetopt.c + +icclink_LDADD = $(top_builddir)/src/liblcms.la +icclink_LDFLAGS = @LDFLAGS@ +icclink_SOURCES = icclink.c xgetopt.c vprf.c + +man_MANS = wtpt.1 icc2ps.1 icclink.1 +EXTRA_DIST = $(man_MANS) diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/Makefile.in b/debian/lcms/lcms-1.19.dfsg2/samples/Makefile.in new file mode 100644 index 00000000..da52ca57 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/Makefile.in @@ -0,0 +1,611 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 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@ + +# +# Makefile for building lcms sample programs +# Originally Written by Bob Friesenhahn, June 2003 +# Additions and bugs by Marti Maria Oct 2004 + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +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@ +target_triplet = @target@ +bin_PROGRAMS = icctrans$(EXEEXT) wtpt$(EXEEXT) icc2ps$(EXEEXT) \ + icclink$(EXEEXT) +subdir = samples +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_icc2ps_OBJECTS = icc2ps.$(OBJEXT) xgetopt.$(OBJEXT) +icc2ps_OBJECTS = $(am_icc2ps_OBJECTS) +icc2ps_DEPENDENCIES = $(top_builddir)/src/liblcms.la +icc2ps_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(icc2ps_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_icclink_OBJECTS = icclink.$(OBJEXT) xgetopt.$(OBJEXT) \ + vprf.$(OBJEXT) +icclink_OBJECTS = $(am_icclink_OBJECTS) +icclink_DEPENDENCIES = $(top_builddir)/src/liblcms.la +icclink_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(icclink_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_icctrans_OBJECTS = icctrans.$(OBJEXT) xgetopt.$(OBJEXT) \ + vprf.$(OBJEXT) +icctrans_OBJECTS = $(am_icctrans_OBJECTS) +icctrans_DEPENDENCIES = $(top_builddir)/src/liblcms.la +icctrans_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(icctrans_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_wtpt_OBJECTS = wtpt.$(OBJEXT) xgetopt.$(OBJEXT) +wtpt_OBJECTS = $(am_wtpt_OBJECTS) +wtpt_DEPENDENCIES = $(top_builddir)/src/liblcms.la +wtpt_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(wtpt_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(icc2ps_SOURCES) $(icclink_SOURCES) $(icctrans_SOURCES) \ + $(wtpt_SOURCES) +DIST_SOURCES = $(icc2ps_SOURCES) $(icclink_SOURCES) \ + $(icctrans_SOURCES) $(wtpt_SOURCES) +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT16_T = @INT16_T@ +INT32_T = @INT32_T@ +INT64_T = @INT64_T@ +INT8_T = @INT8_T@ +JPEGICC_DEPLIBS = @JPEGICC_DEPLIBS@ +LCMS_LIB_DEPLIBS = @LCMS_LIB_DEPLIBS@ +LCMS_PYEXECDIR = @LCMS_PYEXECDIR@ +LCMS_PYINCLUDE = @LCMS_PYINCLUDE@ +LCMS_PYLIB = @LCMS_PYLIB@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBRARY_AGE = @LIBRARY_AGE@ +LIBRARY_CURRENT = @LIBRARY_CURRENT@ +LIBRARY_REVISION = @LIBRARY_REVISION@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LIB_JPEG = @LIB_JPEG@ +LIB_MATH = @LIB_MATH@ +LIB_TIFF = @LIB_TIFF@ +LIB_ZLIB = @LIB_ZLIB@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJDUMP = @OBJDUMP@ +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@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TIFFICC_DEPLIBS = @TIFFICC_DEPLIBS@ +UINT16_T = @UINT16_T@ +UINT32_T = @UINT32_T@ +UINT64_T = @UINT64_T@ +UINT8_T = @UINT8_T@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +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@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +inline = @inline@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# Don't require all the GNU mandated files +AUTOMAKE_OPTIONS = 1.7 foreign +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include +icctrans_LDADD = $(top_builddir)/src/liblcms.la +icctrans_LDFLAGS = @LDFLAGS@ +icctrans_SOURCES = icctrans.c xgetopt.c vprf.c +icctrans_MANS = icctrans.1 +wtpt_LDADD = $(top_builddir)/src/liblcms.la +wtpt_LDFLAGS = @LDFLAGS@ +wtpt_SOURCES = wtpt.c xgetopt.c +icc2ps_LDADD = $(top_builddir)/src/liblcms.la +icc2ps_LDFLAGS = @LDFLAGS@ +icc2ps_SOURCES = icc2ps.c xgetopt.c +icclink_LDADD = $(top_builddir)/src/liblcms.la +icclink_LDFLAGS = @LDFLAGS@ +icclink_SOURCES = icclink.c xgetopt.c vprf.c +man_MANS = wtpt.1 icc2ps.1 icclink.1 +EXTRA_DIST = $(man_MANS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(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) --foreign samples/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign samples/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-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_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 $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +icc2ps$(EXEEXT): $(icc2ps_OBJECTS) $(icc2ps_DEPENDENCIES) + @rm -f icc2ps$(EXEEXT) + $(icc2ps_LINK) $(icc2ps_OBJECTS) $(icc2ps_LDADD) $(LIBS) +icclink$(EXEEXT): $(icclink_OBJECTS) $(icclink_DEPENDENCIES) + @rm -f icclink$(EXEEXT) + $(icclink_LINK) $(icclink_OBJECTS) $(icclink_LDADD) $(LIBS) +icctrans$(EXEEXT): $(icctrans_OBJECTS) $(icctrans_DEPENDENCIES) + @rm -f icctrans$(EXEEXT) + $(icctrans_LINK) $(icctrans_OBJECTS) $(icctrans_LDADD) $(LIBS) +wtpt$(EXEEXT): $(wtpt_OBJECTS) $(wtpt_DEPENDENCIES) + @rm -f wtpt$(EXEEXT) + $(wtpt_LINK) $(wtpt_OBJECTS) $(wtpt_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icc2ps.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icclink.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icctrans.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vprf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wtpt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetopt.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@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 +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done + +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) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + 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) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; 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." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +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-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic 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-binPROGRAMS 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-man \ + install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-man \ + uninstall-man1 + +# 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/debian/lcms/lcms-1.19.dfsg2/samples/icc2ps.1 b/debian/lcms/lcms-1.19.dfsg2/samples/icc2ps.1 new file mode 100755 index 00000000..9296553c --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/icc2ps.1 @@ -0,0 +1,41 @@ +.\"Shiju P. Nair September 30, 2004 +.TH ICC2PS 1 "September 30, 2004" +.SH NAME +icc2ps - little cms PostScript converter. +.SH SYNOPSIS +.B icc2ps +.RI [ options ] +.SH DESCRIPTION +lcms is a standalone CMM engine, which deals with the color management. +It implements a fast transformation between ICC profiles. +.B icc2ps +is little cms PostScript converter. +.SH OPTIONS +.TP +.B \-b +Black point compensation (CRD only). +.TP +.BI \-i\ profile +Input profile: Generates Color Space Array (CSA). +.TP +.BI \-o\ profile +.p +Output profile: Generates Color Rendering Dictionary(CRD). +.TP +.B \-t <0,1,2,3> +Intent (0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute). +.TP +.B \-u +Do NOT generate resource name on CRD. +.SH NOTES +For suggestions, comments, bug reports etc. send mail to +info@littlecms.com. +.SH SEE ALSO +.BR jpegicc (1), +.BR tifficc (1), +.BR icclink (1), +.BR icctrans (1), +.BR wtpt (1) +.SH AUTHOR +This manual page was written by Shiju p. Nair <shiju.p@gmail.com>, +for the Debian project. diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/icc2ps.c b/debian/lcms/lcms-1.19.dfsg2/samples/icc2ps.c new file mode 100755 index 00000000..09bc0401 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/icc2ps.c @@ -0,0 +1,260 @@ +// +// Little cms +// Copyright (C) 1998-2007 Marti Maria +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +// EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +// WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +// +// IN NO EVENT SHALL MARTI MARIA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, +// INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +// OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +// WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +// LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +// OF THIS SOFTWARE. +// +// Version 1.12 + +#include "lcms.h" +#include <stdarg.h> + +// xgetopt() interface ----------------------------------------------------- + +extern int xoptind; +extern char *xoptarg; +extern int xopterr; +extern char SW; +int cdecl xgetopt(int argc, char *argv[], char *optionS); + +// ------------------------------------------------------------------------ + +static char *cInProf = NULL; +static char *cOutProf = NULL; +static int Intent = INTENT_PERCEPTUAL; +static FILE* OutFile; +static int BlackPointCompensation = FALSE; +static int Undecorated = FALSE; +static int PrecalcMode = 1; +static int NumOfGridPoints = 0; + +static +void FatalError(const char *frm, ...) +{ + va_list args; + + va_start(args, frm); + vfprintf(stderr, frm, args); + va_end(args); + + exit(1); +} + + + +// The toggles stuff + +static +void HandleSwitches(int argc, char *argv[]) +{ + int s; + + while ((s = xgetopt(argc,argv,"uUbBI:i:O:o:T:t:c:C:n:N:")) != EOF) { + + switch (s){ + + + case 'i': + case 'I': + cInProf = xoptarg; + break; + + case 'o': + case 'O': + cOutProf = xoptarg; + break; + + case 'b': + case 'B': BlackPointCompensation =TRUE; + break; + + + case 't': + case 'T': + Intent = atoi(xoptarg); + if (Intent > 3) Intent = 3; + if (Intent < 0) Intent = 0; + break; + + case 'U': + case 'u': + Undecorated = TRUE; + break; + + case 'c': + case 'C': + PrecalcMode = atoi(xoptarg); + if (PrecalcMode < 0 || PrecalcMode > 2) + FatalError("ERROR: Unknown precalc mode '%d'", PrecalcMode); + break; + + + case 'n': + case 'N': + if (PrecalcMode != 1) + FatalError("Precalc mode already specified"); + NumOfGridPoints = atoi(xoptarg); + break; + + + default: + + FatalError("Unknown option - run without args to see valid ones.\n"); + } + } +} + +static +void Help(void) +{ + + + fprintf(stderr, "usage: icc2ps [flags]\n\n"); + + fprintf(stderr, "flags:\n\n"); + + fprintf(stderr, "%ci<profile> - Input profile: Generates Color Space Array (CSA)\n", SW); + fprintf(stderr, "%co<profile> - Output profile: Generates Color Rendering Dictionary(CRD)\n", SW); + + fprintf(stderr, "%ct<0,1,2,3> - Intent (0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute)\n", SW); + + fprintf(stderr, "%cb - Black point compensation (CRD only)\n", SW); + fprintf(stderr, "%cu - Do NOT generate resource name on CRD\n", SW); + fprintf(stderr, "%cc<0,1,2> - Precission (0=LowRes, 1=Normal (default), 2=Hi-res) (CRD only)\n", SW); + fprintf(stderr, "%cn<gridpoints> - Alternate way to set precission, number of CLUT points (CRD only)\n", SW); + + fprintf(stderr, "\n"); + fprintf(stderr, "This program is intended to be a demo of the little cms\n" + "engine. Both lcms and this program are freeware. You can\n" + "obtain both in source code at http://www.littlecms.com\n" + "For suggestions, comments, bug reports etc. send mail to\n" + "info@littlecms.com\n\n"); + exit(0); +} + + +static +void GenerateCSA(void) +{ + cmsHPROFILE hProfile = cmsOpenProfileFromFile(cInProf, "r"); + size_t n; + char* Buffer; + + n = cmsGetPostScriptCSA(hProfile, Intent, NULL, 0); + if (n == 0) return; + + Buffer = (char*) _cmsMalloc(n + 1); + cmsGetPostScriptCSA(hProfile, Intent, Buffer, n); + Buffer[n] = 0; + + fprintf(OutFile, "%s", Buffer); + + _cmsFree(Buffer); + cmsCloseProfile(hProfile); +} + + +static +void GenerateCRD(void) +{ + cmsHPROFILE hProfile = cmsOpenProfileFromFile(cOutProf, "r"); + size_t n; + char* Buffer; + DWORD dwFlags = 0; + + if (BlackPointCompensation) dwFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION; + if (Undecorated) dwFlags |= cmsFLAGS_NODEFAULTRESOURCEDEF; + + switch (PrecalcMode) { + + case 0: dwFlags |= cmsFLAGS_LOWRESPRECALC; break; + case 2: dwFlags |= cmsFLAGS_HIGHRESPRECALC; break; + case 1: + if (NumOfGridPoints > 0) + dwFlags |= cmsFLAGS_GRIDPOINTS(NumOfGridPoints); + break; + + default: FatalError("ERROR: Unknown precalculation mode '%d'", PrecalcMode); + } + + + + n = cmsGetPostScriptCRDEx(hProfile, Intent, dwFlags, NULL, 0); + if (n == 0) return; + + Buffer = (char*) _cmsMalloc(n + 1); + cmsGetPostScriptCRDEx(hProfile, Intent, dwFlags, Buffer, n); + Buffer[n] = 0; + + fprintf(OutFile, "%s", Buffer); + _cmsFree(Buffer); + cmsCloseProfile(hProfile); +} + + +static +int MyErrorHandler(int ErrorCode, const char *ErrorText) +{ + FatalError("icc2ps: %s", ErrorText); + return 0; +} + + + +int main(int argc, char *argv[]) +{ + int nargs; + + fprintf(stderr, "little cms PostScript converter - v1.5\n\n"); + + HandleSwitches(argc, argv); + + cmsSetErrorHandler(MyErrorHandler); + + nargs = (argc - xoptind); + if (nargs != 0 && nargs != 1) + Help(); + + if (nargs == 0) + OutFile = stdout; + else + OutFile = fopen(argv[xoptind], "wt"); + + + if (cInProf == NULL && cOutProf == NULL) + Help(); + + + if (cInProf != NULL) + GenerateCSA(); + + if (cOutProf != NULL) + GenerateCRD(); + + if (nargs == 1) { + fclose(OutFile); + } + + return 0; +} + + diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/icclink.1 b/debian/lcms/lcms-1.19.dfsg2/samples/icclink.1 new file mode 100755 index 00000000..2d0093a3 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/icclink.1 @@ -0,0 +1,90 @@ +.\"Shiju P. Nair September 30, 2004 +.TH ICCLINK 1 "September 30, 2004" +.SH NAME +icclink - little cms device link generator. +.SH SYNOPSIS +.B icclink +.RI [ options ] " <profiles>" +.SH DESCRIPTION +lcms is a standalone CMM engine, which deals with the color management. +It implements a fast transformation between ICC profiles. +.B icclink +is little cms device link generator. +.P +Links two or more profiles into a single devicelink profile. +Colorspaces must be paired except Lab/XYZ, that can be interchanged. +.SH OPTIONS +.TP +.B \-8 +Creates 8-bit devicelink. +.TP +.B \-b +Black point compensation. +.TP +.B \-c <0,1,2,3> +Precission (0=LowRes, 1=Normal, 2=Hi-res). [defaults to 1] +.TP +.BI \-d\ description +Description text (quotes can be used). +.TP +.B \-h <0,1,2,3> +Show summary of options and examples. +.TP +.BI \-i\ profile +Input profile (defaults to sRGB). +.TP +.B -k <0..400> +Ink-limiting in % (CMYK only) +.TP +.BI \-o\ profile +Output devicelink profile. [defaults to 'devicelink.icm'] +.TP +.B \-t <0,1,2,3> +Intent (0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute). +.TP +.B \-x +Creatively, guess deviceclass of resulting profile. +.TP +.nf +Built-in profiles: + *Lab -- D50-based CIEL*a*b (PCS) + *XYZ -- CIE XYZ (PCS) + *sRGB -- sRGB color space + *Gray22- Monochrome of Gamma 2.2 + *Lin2222- CMYK linearization of gamma 2.2 on each channel +.fi +.SH EXAMPLES +.nf +To create 'devicelink.icm' from a.icc to b.icc: + icclink a.icc b.icc + +To create 'out.icc' from sRGB to cmyk.icc: + icclink -o out.icc *sRGB cmyk.icc + +To create a sRGB input profile working in Lab: + icclink -x -o sRGBLab.icc *sRGB *Lab + +To create a XYZ -> sRGB output profile: + icclink -x -o sRGBLab.icc *XYZ *sRGB + +To create a abstract profile doing softproof for cmyk.icc: + icclink -t1 -x -o softproof.icc *Lab cmyk.icc cmyk.icc *Lab + +To create a 'grayer' sRGB input profile: + icclink -x -o grayer.icc *sRGB gray.icc gray.icc *Lab + +To embed ink limiting into a cmyk output profile: + icclink -x -o cmyklimited.icc -k 250 cmyk.icc *Lab +.fi +.SH NOTES +For suggestions, comments, bug reports etc. send mail to +info@littlecms.com. +.SH SEE ALSO +.BR jpegicc (1), +.BR tifficc (1), +.BR icc2ps (1), +.BR icctrans (1), +.BR wtpt (1) +.SH AUTHOR +This manual page was written by Shiju p. Nair <shiju.p@gmail.com>, +for the Debian project. diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/icclink.c b/debian/lcms/lcms-1.19.dfsg2/samples/icclink.c new file mode 100755 index 00000000..bb7867ae --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/icclink.c @@ -0,0 +1,392 @@ +// +// Little cms +// Copyright (C) 1998-2007 Marti Maria +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +// EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +// WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +// +// IN NO EVENT SHALL MARTI MARIA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, +// INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +// OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +// WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +// LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +// OF THIS SOFTWARE. +// + +#include "lcms.h" +#include <stdarg.h> + +// xgetopt() interface ----------------------------------------------------- + +extern int xoptind; +extern char *xoptarg; +extern int xopterr; +extern char SW; +int cdecl xgetopt(int argc, char *argv[], char *optionS); + +// ------------------------------------------------------------------------ + +static char* Description = "Devicelink profile"; +static int Intent = INTENT_PERCEPTUAL; +static char *cOutProf = "devicelink.icm"; + +static int PrecalcMode = 1; +static int NumOfGridPoints = 0; + +static LCMSBOOL BlackPointCompensation = FALSE; +static int BlackPreservation = 0; + +static double InkLimit = 400; +static LCMSBOOL lUse8bits = FALSE; +static LCMSBOOL TagResult = FALSE; +static LCMSBOOL NoPrelinearization = FALSE; + + + +static +void FatalError(const char *frm, ...) +{ + va_list args; + + va_start(args, frm); + vfprintf(stderr, frm, args); + va_end(args); + + exit(1); +} + + +static +void Help(int level) +{ + switch(level) { + + default: + case 0: + + fprintf(stderr, "\nLinks two or more profiles into a single devicelink profile.\n"); + fprintf(stderr, "Colorspaces must be paired except Lab/XYZ, that can be interchanged.\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "usage: icclink [flags] <profiles>\n\n"); + fprintf(stderr, "flags:\n\n"); + fprintf(stderr, "%co<profile> - Output devicelink profile. [defaults to 'devicelink.icm']\n", SW); + fprintf(stderr, "%ct<0,1,2,3> - Intent (0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute)\n", SW); + fprintf(stderr, "%cc<0,1,2> - Precission (0=LowRes, 1=Normal, 2=Hi-res) [defaults to 1]\n", SW); + fprintf(stderr, "%cn<gridpoints> - Alternate way to set precission, number of CLUT points\n", SW); + fprintf(stderr, "%cd<description> - description text (quotes can be used)\n", SW); + fprintf(stderr, "\n%cb - Black point compensation\n", SW); + fprintf(stderr, "%cf<0,1,2> - Black preserving 0=off, 1=K ink only 2=K plane\n", SW); + fprintf(stderr, "\n%ck<0..400> - Ink-limiting in %% (CMYK only)\n", SW); + fprintf(stderr, "%c8 - Creates 8-bit devicelink\n", SW); + fprintf(stderr, "%cx - Creatively, guess deviceclass of resulting profile.\n", SW); + fprintf(stderr, "%cl - no prelinearization.\n", SW); + fprintf(stderr, "\n"); + fprintf(stderr, "%ch<0,1,2,3> - More help\n", SW); + break; + + case 1: + + fprintf(stderr, "\nBuilt-in profiles:\n\n"); + fprintf(stderr, "\t*Lab -- D50-based CIEL*a*b (PCS)\n" + "\t*XYZ -- CIE XYZ (PCS)\n" + "\t*sRGB -- sRGB color space\n" + "\t*Gray22- Monochrome of Gamma 2.2\n" + "\t*Lin2222- CMYK linearization of gamma 2.2 on each channel\n"); + break; + + case 2: + + fprintf(stderr, "\nExamples:\n\n" + "To create 'devicelink.icm' from a.icc to b.icc:\n" + "\ticclink a.icc b.icc\n\n" + "To create 'out.icc' from sRGB to cmyk.icc:\n" + "\ticclink -o out.icc *sRGB cmyk.icc\n\n" + "To create a sRGB input profile working in Lab:\n" + "\ticclink -x -o sRGBLab.icc *sRGB *Lab\n\n" + "To create a XYZ -> sRGB output profile:\n" + "\ticclink -x -o sRGBLab.icc *XYZ *sRGB\n\n" + "To create a abstract profile doing softproof for cmyk.icc:\n" + "\ticclink -t1 -x -o softproof.icc *Lab cmyk.icc cmyk.icc *Lab\n\n" + "To create a 'grayer' sRGB input profile:\n" + "\ticclink -x -o grayer.icc *sRGB gray.icc gray.icc *Lab\n\n" + "To embed ink limiting into a cmyk output profile:\n" + "\ticclink -x -o cmyklimited.icc -k 250 cmyk.icc *Lab\n\n"); + break; + + case 3: + + fprintf(stderr, "This program is intended to be a demo of the little cms\n" + "engine. Both lcms and this program are freeware. You can\n" + "obtain both in source code at http://www.littlecms.com\n" + "For suggestions, comments, bug reports etc. send mail to\n" + "info@littlecms.com\n\n"); + } + + exit(0); +} + +// The toggles stuff + +static +void HandleSwitches(int argc, char *argv[]) +{ + int s; + + while ((s = xgetopt(argc,argv,"xXH:h:8k:K:BbO:o:T:t:D:d:C:c:n:N:f:F:lL")) != EOF) { + + switch (s){ + + + case '8': + lUse8bits = TRUE; + break; + + case 'd': + case 'D': + Description = xoptarg; + break; + + case 'o': + case 'O': + cOutProf = xoptarg; + break; + + + case 't': + case 'T': + Intent = atoi(xoptarg); + if (Intent > 3) Intent = 3; + if (Intent < 0) Intent = 0; + break; + + case 'c': + case 'C': + PrecalcMode = atoi(xoptarg); + if (PrecalcMode < 0 || PrecalcMode > 2) + FatalError("ERROR: Unknown precalc mode '%d'", PrecalcMode); + break; + + + case 'n': + case 'N': + if (PrecalcMode != 1) + FatalError("Precalc mode already specified"); + NumOfGridPoints = atoi(xoptarg); + break; + + case 'b': + case 'B': + BlackPointCompensation = TRUE; + break; + + case 'f': + case 'F': + BlackPreservation = atoi(xoptarg); + if (BlackPreservation < 0 || BlackPreservation > 2) + FatalError("ERROR: Unknown black preservation mode '%d'", BlackPreservation); + break; + + case 'k': + case 'K': + InkLimit = atof(xoptarg); + if (InkLimit < 0.0 || InkLimit > 400.0) + FatalError("Ink limit must be 0%%..400%%"); + break; + + case 'x': + case 'X': TagResult = TRUE; + break; + + case 'h': + case 'H': + Help(atoi(xoptarg)); + break; + + case 'l': + case 'L': NoPrelinearization = TRUE; + break; + default: + + FatalError("Unknown option - run without args to see valid ones.\n"); + } + } +} + +static +cmsHPROFILE OpenProfile(const char* File) +{ + cmsHPROFILE h; + + if (!File) + return cmsCreate_sRGBProfile(); + + if (stricmp(File, "*Lab") == 0) + return cmsCreateLabProfile(NULL); + + if (stricmp(File, "*XYZ") == 0) + return cmsCreateXYZProfile(); + + if (stricmp(File, "*srgb") == 0) + return cmsCreate_sRGBProfile(); + + + if (stricmp(File, "*Gray22") == 0) { + LPGAMMATABLE Gamma = cmsBuildGamma(256, 2.2); + cmsHPROFILE hProfile = cmsCreateGrayProfile(cmsD50_xyY(), Gamma); + cmsFreeGamma(Gamma); + return hProfile; + + } + + if (stricmp(File, "*Lin2222") == 0) { + + LPGAMMATABLE Gamma = cmsBuildGamma(256, 2.2); + LPGAMMATABLE Gamma4[4]; + cmsHPROFILE hProfile; + + Gamma4[0] = Gamma4[1] = Gamma4[2] = Gamma4[3] = Gamma; + hProfile = cmsCreateLinearizationDeviceLink(icSigCmykData, Gamma4); + cmsFreeGamma(Gamma); + return hProfile; + + } + + + h = cmsOpenProfileFromFile(File, "r"); + + + if (cmsGetDeviceClass(h) == icSigNamedColorClass) + FatalError("ERROR: Cannot make devicelink of named color profiles!"); + + + return h; +} + +static +int MyErrorHandler(int ErrorCode, const char *ErrorText) +{ + FatalError("icclink: %s", ErrorText); + return 0; +} + + + + +int main(int argc, char *argv[]) +{ + int i, nargs; + cmsHPROFILE Profiles[257]; + cmsHPROFILE hProfile; + DWORD dwFlags = 0; + cmsHTRANSFORM hTransform; + + + fprintf(stderr, "little cms device link generator - v1.7\n"); + + HandleSwitches(argc, argv); + + cmsSetErrorHandler(MyErrorHandler); + + nargs = (argc - xoptind); + if (nargs < 1) + Help(0); + + if (nargs > 255) + FatalError("ERROR: Holy profile! what are you trying to do with so many profiles?"); + + + for (i=0; i < nargs; i++) { + Profiles[i] = OpenProfile(argv[i + xoptind]); + } + + + + switch (PrecalcMode) { + + case 0: dwFlags |= cmsFLAGS_LOWRESPRECALC; break; + case 2: dwFlags |= cmsFLAGS_HIGHRESPRECALC; break; + case 1: + if (NumOfGridPoints > 0) + dwFlags |= cmsFLAGS_GRIDPOINTS(NumOfGridPoints); + break; + + default: FatalError("ERROR: Unknown precalculation mode '%d'", PrecalcMode); + } + + if (BlackPointCompensation) + dwFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION; + + if (BlackPreservation > 0) { + + dwFlags |= cmsFLAGS_PRESERVEBLACK; + cmsSetCMYKPreservationStrategy(BlackPreservation-1); + } + + if (TagResult) + dwFlags |= cmsFLAGS_GUESSDEVICECLASS; + + if (NoPrelinearization) + dwFlags |= cmsFLAGS_NOPRELINEARIZATION; + + if (InkLimit != 400.0) { + + cmsHPROFILE hInkLimit = cmsCreateInkLimitingDeviceLink( + cmsGetColorSpace(Profiles[nargs-1]), InkLimit); + + Profiles[nargs++] = hInkLimit; + } + + if (lUse8bits) dwFlags |= cmsFLAGS_NOPRELINEARIZATION; + + hTransform = cmsCreateMultiprofileTransform(Profiles, nargs, 0, 0, Intent, dwFlags); + if (hTransform) { + + size_t size = sizeof(int) + nargs * sizeof(cmsPSEQDESC); + LPcmsSEQ pseq = (LPcmsSEQ) _cmsMalloc(size); + + ZeroMemory(pseq, size); + pseq ->n = nargs; + + for (i=0; i < nargs; i++) { + + strcpy(pseq ->seq[i].Manufacturer, cmsTakeManufacturer(Profiles[i])); + strcpy(pseq ->seq[1].Model, cmsTakeModel(Profiles[i])); + } + + hProfile = cmsTransform2DeviceLink(hTransform, dwFlags); + + cmsAddTag(hProfile, icSigProfileDescriptionTag, (LPVOID) Description); + cmsAddTag(hProfile, icSigCopyrightTag, (LPVOID) "Generated by littlecms icclink. No copyright, use freely"); + cmsAddTag(hProfile, icSigProfileSequenceDescTag, (LPVOID) pseq); + + if (lUse8bits) _cmsSetLUTdepth(hProfile, 8); + + if (_cmsSaveProfile(hProfile, cOutProf)) + fprintf(stderr, "Ok"); + else + fprintf(stderr, "Error saving file!"); + + cmsCloseProfile(hProfile); + _cmsFree(pseq); + } + + cmsDeleteTransform(hTransform); + + for (i=0; i < nargs; i++) { + cmsCloseProfile(Profiles[i]); + } + + + return 0; +} diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/icctrans.1 b/debian/lcms/lcms-1.19.dfsg2/samples/icctrans.1 new file mode 100755 index 00000000..d99eb251 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/icctrans.1 @@ -0,0 +1,61 @@ +.\"Shiju P. Nair September 30, 2004 +.TH ICCTRANS 1 "September 30, 2004" +.SH NAME +icctrans - little cms ColorSpace conversion calculator. +.SH SYNOPSIS +.B icctrans +.RI [ options ] +.SH DESCRIPTION +lcms is a standalone CMM engine, which deals with the color management. +It implements a fast transformation between ICC profiles. +.B icctrans +is lcms ColorSpace conversion calculator. +.SH OPTIONS +.TP +.B \-% +use percent % of ink. +.TP +.B \-b +Black point compensation. +.TP +.B \-c <0,1,2,3> +Precalculates transform. (0=Off, 1=Normal, 2=Hi-res, 3=LoRes) [defaults to 1] +.TP +.BI \-i\ profile +Input profile (defaults to sRGB). +.TP +.B \-l +Transform by device-link profile. +.TP +.B \-n +Terse output, intended for pipe usage. +.TP +.BI \-o\ profile +.p +Output profile (defaults to sRGB). +.TP +.B \-t <0,1,2,3> +Intent (0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute). +.TP +.B \-v +Verbose. +.TP +.B \-w +Use 16 bits. +.TP +.B \-x +Hexadecimal. +.TP +You can use '*Lab' and '*xyz' as built-in profiles. +.SH NOTES +For suggestions, comments, bug reports etc. send mail to +info@littlecms.com. +.SH SEE ALSO +.BR jpegicc (1), +.BR tifficc (1), +.BR icc2ps (1), +.BR icclink (1), +.BR wtpt (1) +.SH AUTHOR +This manual page was written by Shiju p. Nair <shiju.p@gmail.com>, +for the Debian project. diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/icctrans.c b/debian/lcms/lcms-1.19.dfsg2/samples/icctrans.c new file mode 100755 index 00000000..67fc63f0 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/icctrans.c @@ -0,0 +1,1288 @@ +// +// Little cms +// Copyright (C) 1998-2007 Marti Maria +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +#include "lcms.h" + +#include <stdarg.h> +#include <ctype.h> + +#ifndef NON_WINDOWS +#include <io.h> +#endif + +// xgetopt() interface ----------------------------------------------------- + +extern int xoptind; +extern char *xoptarg; +extern int xopterr; +extern char SW; +int cdecl xgetopt(int argc, char *argv[], char *optionS); + +// ------------------------------------------------------------------------ + +// Stock profiles function +extern cmsHPROFILE OpenStockProfile(const char* File); + + +// Globals + +static LCMSBOOL InHexa = FALSE; +static LCMSBOOL Verbose = FALSE; +static LCMSBOOL GamutCheck = FALSE; +static LCMSBOOL Width16 = FALSE; +static LCMSBOOL BlackPointCompensation = FALSE; +static LCMSBOOL PreserveBlack = FALSE; +static LCMSBOOL lIsDeviceLink = FALSE; +static LCMSBOOL lTerse = FALSE; +static LCMSBOOL lQuantize = FALSE; +static LCMSBOOL lUse255always = FALSE; + +static char *cInProf = NULL; +static char *cOutProf = NULL; +static char *cProofing = NULL; + +static char *IncludePart = NULL; + +static LCMSHANDLE hIT8in = NULL; // CGATS input +static LCMSHANDLE hIT8out = NULL; // CGATS output + +static char CGATSPatch[1024]; // Actual Patch Name +static char CGATSoutFilename[MAX_PATH]; + + +static int Intent = INTENT_PERCEPTUAL; +static int ProofingIntent = INTENT_PERCEPTUAL; +static int PrecalcMode = 0; +static int nMaxPatches; + +static cmsHPROFILE hInput, hOutput, hProof, hLab = NULL, hXYZ = NULL; +static cmsHTRANSFORM hTrans, hTransXYZ, hTransLab; + +static icColorSpaceSignature InputColorSpace, OutputColorSpace; +static cmsCIEXYZ xyz; +static cmsCIELab Lab; + + +static LPcmsNAMEDCOLORLIST InputColorant = NULL; +static LPcmsNAMEDCOLORLIST OutputColorant = NULL; + + +// isatty replacement + +#ifdef _MSC_VER +#define xisatty(x) _isatty( _fileno( (x) ) ) +#else +#define xisatty(x) isatty( fileno( (x) ) ) +#endif + + +// Give up + +static +void FatalError(const char *frm, ...) +{ + va_list args; + + va_start(args, frm); + vfprintf(stderr, frm, args); + va_end(args); + + exit(1); +} + +// Issue a message + +static +void Warning(const char *frm, ...) +{ + va_list args; + + va_start(args, frm); + vfprintf(stderr, frm, args); + va_end(args); +} + +// The error handler + +static +int MyErrorHandler(int ErrorCode, const char *ErrorText) +{ + FatalError("icctrans: %s", ErrorText); + return 0; +} + +// Print usage to stderr + +static +void Help(void) +{ + + fprintf(stderr, "usage: icctrans [flags] [CGATS input] [CGATS output]\n\n"); + + fprintf(stderr, "flags:\n\n"); + fprintf(stderr, "%cv - Verbose (Print PCS as well)\n", SW); + fprintf(stderr, "%cw - use 16 bits\n", SW); + fprintf(stderr, "%c5 - don't use %% on inks (always 0..255, even on CMYK)\n", SW); + fprintf(stderr, "%cx - Hexadecimal\n", SW); + fprintf(stderr, "%cq - Quantize CGATS to 8 bits\n\n", SW); + + fprintf(stderr, "%ci<profile> - Input profile (defaults to sRGB)\n", SW); + fprintf(stderr, "%co<profile> - Output profile (defaults to sRGB)\n", SW); + fprintf(stderr, "%cl<profile> - Transform by device-link profile\n", SW); + + fprintf(stderr, "\nYou can use '*Lab', '*xyz' and others as built-in profiles\n\n"); + + fprintf(stderr, "%ct<0,1,2,3> Intent (0=Perceptual, 1=Rel.Col, 2=Saturation, 3=Abs.Col.)\n", SW); + fprintf(stderr, "%cd<0..1> - Observer adaptation state (abs.col. only)\n\n", SW); + + fprintf(stderr, "%cb - Black point compensation\n", SW); + fprintf(stderr, "%cf<n> - Preserve black (CMYK only) 0=off, 1=black ink only, 2=full K plane\n", SW); + fprintf(stderr, "%cc<0,1,2,3> Precalculates transform (0=Off, 1=Normal, 2=Hi-res, 3=LoRes)\n\n", SW); + fprintf(stderr, "%cn - Terse output, intended for pipe usage\n", SW); + + fprintf(stderr, "%cp<profile> - Soft proof profile\n", SW); + fprintf(stderr, "%cm<0,1,2,3> - Soft proof intent\n", SW); + fprintf(stderr, "%cg - Marks out-of-gamut colors on softproof\n\n", SW); + + + + fprintf(stderr, "This program is intended to be a demo of the little cms\n" + "engine. Both lcms and this program are freeware. You can\n" + "obtain both in source code at http://www.littlecms.com\n" + "For suggestions, comments, bug reports etc. send mail to\n" + "info@littlecms.com\n\n"); + exit(0); +} + + + +// The toggles stuff + +static +void HandleSwitches(int argc, char *argv[]) +{ + int s; + + while ((s = xgetopt(argc,argv, + "%C:c:VvQqWwxXhHbBnNI:i:O:o:T:t:L:l:p:P:m:M:gGF:f:d:D:!:5")) != EOF) { + + switch (s){ + + case '5': + lUse255always = TRUE; + break; + + case '!': + IncludePart = xoptarg; + break; + + case 'b': + case 'B': + BlackPointCompensation = TRUE; + break; + + case 'c': + case 'C': + PrecalcMode = atoi(xoptarg); + if (PrecalcMode < 0 || PrecalcMode > 3) + FatalError("icctrans: Unknown precalc mode '%d'", PrecalcMode); + break; + + case 'd': + case 'D': { + double ObserverAdaptationState = atof(xoptarg); + if (ObserverAdaptationState != 0 && + ObserverAdaptationState != 1.0) + Warning("Adaptation states other that 0 or 1 are not yet implemented"); + + cmsSetAdaptationState(ObserverAdaptationState); + } + break; + + case 'f': + case 'F': + PreserveBlack = atoi(xoptarg); + if (PreserveBlack < 0 || PreserveBlack > 2) + FatalError("Unknown PreserveBlack '%d'", PreserveBlack); + break; + + case 'g': + case 'G': + GamutCheck = TRUE; + break; + + case 'i': + case 'I': + if (lIsDeviceLink) + FatalError("icctrans: Device-link already specified"); + + cInProf = xoptarg; + break; + + case 'l': + case 'L': + cInProf = xoptarg; + lIsDeviceLink = TRUE; + break; + + case 'm': + case 'M': + ProofingIntent = atoi(xoptarg); + if (ProofingIntent > 3) ProofingIntent = 3; + if (ProofingIntent < 0) ProofingIntent = 0; + break; + + case 'n': + case 'N': + lTerse = TRUE; + break; + + + case 'o': + case 'O': + if (lIsDeviceLink) + FatalError("icctrans: Device-link already specified"); + cOutProf = xoptarg; + break; + + case 'p': + case 'P': + cProofing = xoptarg; + break; + + case 'q': + case 'Q': + lQuantize = TRUE; + break; + + case 't': + case 'T': + Intent = atoi(xoptarg); + if (Intent > 3) Intent = 3; + if (Intent < 0) Intent = 0; + break; + + case 'v': + case 'V': + Verbose = TRUE; + break; + + case 'W': + case 'w': + Width16 = TRUE; + break; + + case 'x': + case 'X': + InHexa = TRUE; + break; + + default: + + FatalError("icctrans: Unknown option - run without args to see valid ones.\n"); + } + } +} + + +// Displays the colorant table + +static +void PrintColorantTable(cmsHPROFILE hInput, icTagSignature Sig, const char* Title) +{ + LPcmsNAMEDCOLORLIST list; + int i; + + if (cmsIsTag(hInput, Sig)) { + + printf("%s:\n", Title); + + list = cmsReadColorantTable(hInput, Sig); + + for (i=0; i < list ->nColors; i++) + printf("\t%s\n", list ->List[i].Name); + + cmsFreeNamedColorList(list); + printf("\n"); + } + +} + +// Creates all needed color transforms + +static +void OpenTransforms(void) +{ + + DWORD dwIn, dwOut, dwFlags; + + dwFlags = 0; + + + if (lIsDeviceLink) { + + hInput = cmsOpenProfileFromFile(cInProf, "r"); + hOutput = NULL; + InputColorSpace = cmsGetColorSpace(hInput); + OutputColorSpace = cmsGetPCS(hInput); + + // Read colorant tables if present + + if (cmsIsTag(hInput, icSigColorantTableTag)) + InputColorant = cmsReadColorantTable(hInput, icSigColorantTableTag); + + if (cmsIsTag(hInput, icSigColorantTableOutTag)) + OutputColorant = cmsReadColorantTable(hInput, icSigColorantTableOutTag); + + + + } + else { + + hInput = OpenStockProfile(cInProf); + hOutput = OpenStockProfile(cOutProf); + hProof = NULL; + + if (cmsIsTag(hInput, icSigColorantTableTag)) + InputColorant = cmsReadColorantTable(hInput, icSigColorantTableTag); + + if (cmsIsTag(hOutput, icSigColorantTableTag)) + OutputColorant = cmsReadColorantTable(hOutput, icSigColorantTableTag); + + + if (cProofing != NULL) { + + hProof = OpenStockProfile(cProofing); + dwFlags |= cmsFLAGS_SOFTPROOFING; + } + + InputColorSpace = cmsGetColorSpace(hInput); + OutputColorSpace = cmsGetColorSpace(hOutput); + + if (cmsGetDeviceClass(hInput) == icSigLinkClass || + cmsGetDeviceClass(hOutput) == icSigLinkClass) + FatalError("icctrans: Use %cl flag for devicelink profiles!\n", SW); + + } + + + + if (Verbose) { + + printf("From: %s\n", cmsTakeProductName(hInput)); + printf("Desc: %s\n", cmsTakeProductDesc(hInput)); + printf("Info: %s\n\n", cmsTakeProductInfo(hInput)); + PrintColorantTable(hInput, icSigColorantTableTag, "Input colorant table"); + PrintColorantTable(hInput, icSigColorantTableOutTag, "Input colorant out table"); + + if (hOutput) { + printf("To : %s\n", cmsTakeProductName(hOutput)); + printf("Desc: %s\n", cmsTakeProductDesc(hOutput)); + printf("Info: %s\n\n", cmsTakeProductInfo(hOutput)); + PrintColorantTable(hOutput, icSigColorantTableTag, "Output colorant table"); + PrintColorantTable(hOutput, icSigColorantTableOutTag, "Input colorant out table"); + } + } + + + dwIn = BYTES_SH(2) | CHANNELS_SH(_cmsChannelsOf(InputColorSpace)); + dwOut = BYTES_SH(2) | CHANNELS_SH(_cmsChannelsOf(OutputColorSpace)); + + + if (PreserveBlack) { + dwFlags |= cmsFLAGS_PRESERVEBLACK; + if (PrecalcMode == 0) PrecalcMode = 1; + cmsSetCMYKPreservationStrategy(PreserveBlack-1); + } + + + switch (PrecalcMode) { + + case 0: dwFlags |= cmsFLAGS_NOTPRECALC; break; + case 2: dwFlags |= cmsFLAGS_HIGHRESPRECALC; break; + case 3: dwFlags |= cmsFLAGS_LOWRESPRECALC; break; + case 1: break; + + default: FatalError("icctrans: Unknown precalculation mode '%d'", PrecalcMode); + } + + + if (BlackPointCompensation) + dwFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION; + + + + if (GamutCheck) { + + if (hProof == NULL) + FatalError("icctrans: I need proofing profile -p for gamut checking!"); + + cmsSetAlarmCodes(0xFF, 0xFF, 0xFF); + dwFlags |= cmsFLAGS_GAMUTCHECK; + } + + if (cmsGetDeviceClass(hInput) == icSigNamedColorClass) { + dwIn = TYPE_NAMED_COLOR_INDEX; + } + + + hTrans = cmsCreateProofingTransform(hInput, dwIn, + hOutput, dwOut, + hProof, + Intent, ProofingIntent, dwFlags); + + + hTransXYZ = NULL; hTransLab = NULL; + + if (hOutput && Verbose) { + + hXYZ = cmsCreateXYZProfile(); + hLab = cmsCreateLabProfile(NULL); + + hTransXYZ = cmsCreateTransform(hInput, dwIn, + hXYZ, TYPE_XYZ_16, + Intent, cmsFLAGS_NOTPRECALC); + + hTransLab = cmsCreateTransform(hInput, dwIn, + hLab, TYPE_Lab_16, + Intent, cmsFLAGS_NOTPRECALC); + } + +} + + +// Free open resources + +static +void CloseTransforms(void) +{ + if (InputColorant) cmsFreeNamedColorList(InputColorant); + if (OutputColorant) cmsFreeNamedColorList(OutputColorant); + + cmsDeleteTransform(hTrans); + if (hTransLab) cmsDeleteTransform(hTransLab); + if (hTransXYZ) cmsDeleteTransform(hTransXYZ); + cmsCloseProfile(hInput); + if (hOutput) cmsCloseProfile(hOutput); + if (hProof) cmsCloseProfile(hProof); + if (hXYZ) cmsCloseProfile(hXYZ); + if (hLab) cmsCloseProfile(hLab); + +} + + +// Print a value, with a prefix, normalized to a given range + +static +void PrintRange(const char* C, double v, double Range) +{ + char Prefix[20]; + + Prefix[0] = 0; + if (!lTerse) + sprintf(Prefix, "%s=", C); + + if (InHexa) + { + if (Width16) + printf("%s0x%x ", Prefix, (int) floor(v + .5)); + else + printf("%s0x%x ", Prefix, (int) floor(v / 257. + .5)); + + } + else + { + + double out = (v * Range) / 65535.0; + if (lQuantize) + out = floor(out + 0.5); + + printf("%s%.2f ", Prefix, out); + } +} + + +static +void Print255(const char* C, double v) +{ + PrintRange(C, v, 255.0); +} + +static +void Print100(const char* C, double v) +{ + PrintRange(C, v, lUse255always ? 255.0 : 100.0); +} + +static +void PrintCooked(const char* C, double v) +{ + if (lQuantize) + v = floor(v + 0.5); + + if (lTerse) + printf("%.4f ", v); + else + printf("%s=%.4f ", C, v); +} + + +static +void PrintResults(WORD Encoded[], icColorSpaceSignature ColorSpace) +{ + int i; + + switch (ColorSpace) { + + case icSigXYZData: + cmsXYZEncoded2Float(&xyz, Encoded); + PrintCooked("X", xyz.X * 100.); + PrintCooked("Y", xyz.Y * 100.); + PrintCooked("Z", xyz.Z * 100.); + break; + + case icSigLabData: + cmsLabEncoded2Float(&Lab, Encoded); + PrintCooked("L*", Lab.L); + PrintCooked("a*", Lab.a); + PrintCooked("b*", Lab.b); + break; + + case icSigLuvData: + Print255("L", Encoded[0]); + Print255("u", Encoded[1]); + Print255("v", Encoded[2]); + break; + + case icSigYCbCrData: + Print255("Y", Encoded[0]); + Print255("Cb", Encoded[1]); + Print255("Cr", Encoded[2]); + break; + + + case icSigYxyData: + Print255("Y", Encoded[0]); + Print255("x", Encoded[1]); + Print255("y", Encoded[2]); + break; + + case icSigRgbData: + Print255("R", Encoded[0]); + Print255("G", Encoded[1]); + Print255("B", Encoded[2]); + break; + + case icSigGrayData: + Print255("G", Encoded[0]); + break; + + case icSigHsvData: + Print255("H", Encoded[0]); + Print255("s", Encoded[1]); + Print255("v", Encoded[2]); + break; + + case icSigHlsData: + Print255("H", Encoded[0]); + Print255("l", Encoded[1]); + Print255("s", Encoded[2]); + break; + + case icSigCmykData: + Print100("C", Encoded[0]); + Print100("M", Encoded[1]); + Print100("Y", Encoded[2]); + Print100("K", Encoded[3]); + break; + + case icSigCmyData: + Print100("C", Encoded[0]); + Print100("M", Encoded[1]); + Print100("Y", Encoded[2]); + break; + + + + default: + + for (i=0; i < _cmsChannelsOf(OutputColorSpace); i++) { + + char Buffer[256]; + + if (OutputColorant) + sprintf(Buffer, "%s", OutputColorant->List[i].Name); + else + sprintf(Buffer, "Channel #%d", i + 1); + + Print255(Buffer, Encoded[i]); + } + } + + printf("\n"); +} + + +// Get input from user + +static +void GetLine(char* Buffer) +{ + scanf("%s", Buffer); + + if (toupper(Buffer[0]) == 'Q') { // Quit? + + CloseTransforms(); + + if (xisatty(stdin)) + printf("Done.\n"); + + exit(0); + } + +} + + +// Ask for a value + +static +double GetAnswer(const char* Prompt, double Range) +{ + char Buffer[4096]; + double val = 0.0; + + if (Range == 0.0) { // Range 0 means double value + + if (xisatty(stdin)) printf("%s? ", Prompt); + GetLine(Buffer); + return atof(Buffer); + + } + else { + + if (InHexa) { // Hexadecimal + + int hexa; + + if (Width16) + Range = 0xFFFF; + else + Range = 0xFF; + + if (xisatty(stdin)) printf("%s (0..%X)? ", Prompt, (int) Range); + GetLine(Buffer); + sscanf(Buffer, "%x", &hexa); + val = hexa; + } + else { // Normal usage + + if (xisatty(stdin)) printf("%s (0..%d)? ", Prompt, (int) Range); + GetLine(Buffer); + sscanf(Buffer, "%lf", &val); + } + + // Normalize to 0..0xffff + + if (val > Range) return 0xFFFF; + return floor((val * 65535.0) / Range + 0.5); + + } +} + + +// Get a value in % +static +WORD Get100(const char* AskFor) +{ + return (WORD) GetAnswer(AskFor, lUse255always ? 255.0 : 100.0); +} + + +// Get a simple value in 0..255 range + +static +WORD GetVal(const char* AskFor) +{ + return (WORD) GetAnswer(AskFor, 255.0); +} + +// Get a double value +static +double GetDbl(const char* AskFor) +{ + return GetAnswer(AskFor, 0.0); +} + + +// Get a named-color index +static +WORD GetIndex(void) +{ + char Buffer[4096], Name[40], Prefix[40], Suffix[40]; + int index, max; + + max = cmsNamedColorCount(hTrans)-1; + + if (xisatty(stdin)) printf("Color index (0..%d)? ", max); + + GetLine(Buffer); + index = atoi(Buffer); + + if (index > max) + FatalError("icctrans: Named color %d out of range!", index); + + cmsNamedColorInfo(hTrans, index, Name, Prefix, Suffix); + + printf("\n%s %s %s: ", Prefix, Name, Suffix); + + return index; +} + + + +// Read values from a text file or terminal + +static +void TakeTextValues(WORD Encoded[]) +{ + + if (xisatty(stdin)) + printf("\nEnter values, 'q' to quit\n"); + + if (cmsGetDeviceClass(hInput) == icSigNamedColorClass) { + + Encoded[0] = GetIndex(); + return; + } + + switch (InputColorSpace) { + + case icSigXYZData: + xyz.X = GetDbl("X"); + xyz.Y = GetDbl("Y"); + xyz.Z = GetDbl("Z"); + cmsFloat2XYZEncoded(Encoded, &xyz); + break; + + case icSigLabData: + Lab.L = GetDbl("L*"); + Lab.a = GetDbl("a*"); + Lab.b = GetDbl("b*"); + cmsFloat2LabEncoded(Encoded, &Lab); + break; + + case icSigLuvData: + Encoded[0] = GetVal("L"); + Encoded[1] = GetVal("u"); + Encoded[2] = GetVal("v"); + break; + + case icSigYCbCrData: + Encoded[0] = GetVal("Y"); + Encoded[1] = GetVal("Cb"); + Encoded[2] = GetVal("Cr"); + break; + + + case icSigYxyData: + Encoded[0] = GetVal("Y"); + Encoded[1] = GetVal("x"); + Encoded[2] = GetVal("y"); + break; + + case icSigRgbData: + Encoded[0] = GetVal("R"); + Encoded[1] = GetVal("G"); + Encoded[2] = GetVal("B"); + break; + + case icSigGrayData: + Encoded[0] = GetVal("G"); + break; + + case icSigHsvData: + Encoded[0] = GetVal("H"); + Encoded[1] = GetVal("s"); + Encoded[2] = GetVal("v"); + break; + + case icSigHlsData: + Encoded[0] = GetVal("H"); + Encoded[1] = GetVal("l"); + Encoded[2] = GetVal("s"); + break; + + case icSigCmykData: + Encoded[0] = Get100("C"); + Encoded[1] = Get100("M"); + Encoded[2] = Get100("Y"); + Encoded[3] = Get100("K"); + break; + + case icSigCmyData: + Encoded[0] = Get100("C"); + Encoded[1] = Get100("M"); + Encoded[2] = Get100("Y"); + break; + + case icSigHexachromeData: + Encoded[0] = Get100("C"); Encoded[1] = Get100("M"); + Encoded[2] = Get100("Y"); Encoded[3] = Get100("K"); + Encoded[4] = Get100("c"); Encoded[5] = Get100("m"); + break; + + case icSig2colorData: + case icSig3colorData: + case icSig4colorData: + case icSig5colorData: + case icSig6colorData: + case icSig7colorData: + case icSig8colorData: + case icSigMCH5Data: + case icSigMCH7Data: + case icSigMCH8Data: + case icSigMCH9Data: + case icSigMCHAData: + case icSigMCHBData: + case icSigMCHCData: + case icSigMCHDData: + case icSigMCHEData: + case icSigMCHFData: + + { + + int i; + + for (i=0; i < _cmsChannelsOf(InputColorSpace); i++) { + + char Name[256]; + + if (InputColorant) + sprintf(Name, "%s", InputColorant->List[i].Name); + else + sprintf(Name, "Channel #%d", i+1); + + Encoded[i] = GetVal(Name); + } + } + break; + + default: + FatalError("icctrans: Unsupported %d channel profile", _cmsChannelsOf(InputColorSpace)); + } + + if (xisatty(stdin)) + printf("\n"); + +} + + + +// Take a value from IT8 and scale it accordly to fill a WORD (0..FFFF) + +static +WORD GetIT8Val(const char* Name, double Max) +{ + double CGATSfactor = 65535.0 / Max; + double res; + const char* Val = cmsIT8GetData(hIT8in, CGATSPatch, Name); + + if (Val == NULL) + FatalError("icctrans: Field '%s' not found", Name); + + res = atof(Val); + if (res > Max) return 0xFFFF; + + return (WORD) floor(res * CGATSfactor + 0.5); + +} + + +// Read input values from CGATS file. + +static +void TakeCGATSValues(int nPatch, WORD Encoded[]) +{ + // At first take the name if SAMPLE_ID is present + if (cmsIT8GetPatchName(hIT8in, nPatch, CGATSPatch) == NULL) { + FatalError("icctrans: Sorry, I need 'SAMPLE_ID' on input CGATS to operate."); + } + + + // Special handling for named color profiles. + // Lookup the name in the names database (the transform) + + if (cmsGetDeviceClass(hInput) == icSigNamedColorClass) { + + int index = cmsNamedColorIndex(hTrans, CGATSPatch); + if (index < 0) + FatalError("icctrans: Named color '%s' not found in the profile", CGATSPatch); + + Encoded[0] = (WORD) index; + return; + } + + // Color is not a spot color, proceed. + + switch (InputColorSpace) { + + + // Encoding should follow CGATS specification. + + case icSigXYZData: + xyz.X = cmsIT8GetDataDbl(hIT8in, CGATSPatch, "XYZ_X") / 100.0; + xyz.Y = cmsIT8GetDataDbl(hIT8in, CGATSPatch, "XYZ_Y") / 100.0; + xyz.Z = cmsIT8GetDataDbl(hIT8in, CGATSPatch, "XYZ_Z") / 100.0; + cmsFloat2XYZEncoded(Encoded, &xyz); + break; + + case icSigLabData: + Lab.L = cmsIT8GetDataDbl(hIT8in, CGATSPatch, "LAB_L"); + Lab.a = cmsIT8GetDataDbl(hIT8in, CGATSPatch, "LAB_A"); + Lab.b = cmsIT8GetDataDbl(hIT8in, CGATSPatch, "LAB_B"); + cmsFloat2LabEncoded(Encoded, &Lab); + break; + + + case icSigRgbData: + Encoded[0] = GetIT8Val("RGB_R", 255.0); + Encoded[1] = GetIT8Val("RGB_G", 255.0); + Encoded[2] = GetIT8Val("RGB_B", 255.0); + break; + + case icSigGrayData: + Encoded[0] = GetIT8Val("GRAY", 255.0); + break; + + case icSigCmykData: + Encoded[0] = GetIT8Val("CMYK_C", lUse255always ? 255.0 : 100.0); + Encoded[1] = GetIT8Val("CMYK_M", lUse255always ? 255.0 : 100.0); + Encoded[2] = GetIT8Val("CMYK_Y", lUse255always ? 255.0 : 100.0); + Encoded[3] = GetIT8Val("CMYK_K", lUse255always ? 255.0 : 100.0); + break; + + case icSigCmyData: + Encoded[0] = GetIT8Val("CMY_C", lUse255always ? 255.0 : 100.0); + Encoded[1] = GetIT8Val("CMY_M", lUse255always ? 255.0 : 100.0); + Encoded[2] = GetIT8Val("CMY_Y", lUse255always ? 255.0 : 100.0); + break; + + default: { + + int i; + + for (i=0; i < _cmsChannelsOf(InputColorSpace); i++) { + + char Buffer[255]; + + sprintf(Buffer, "CHAN_%d", i); + Encoded[i] = GetIT8Val(Buffer, 255.0); + } + + } + } + +} + + +static +void SetCGATSfld(const char* Col, double Val) +{ + + if (lQuantize) + Val = floor(Val + 0.5); + + if (!cmsIT8SetDataDbl(hIT8out, CGATSPatch, Col, Val)) { + FatalError("icctrans: couldn't set '%s' on output cgats '%s'", Col, CGATSoutFilename); + } +} + + + +static +void PutCGATSValues(int nPatch, WORD Encoded[]) +{ + + cmsIT8SetData(hIT8out, CGATSPatch, "SAMPLE_ID", CGATSPatch); + switch (OutputColorSpace) { + + + // Encoding should follow CGATS specification. + + case icSigXYZData: + cmsXYZEncoded2Float(&xyz, Encoded); + SetCGATSfld("XYZ_X", xyz.X * 100.0); + SetCGATSfld("XYZ_Y", xyz.Y * 100.0); + SetCGATSfld("XYZ_Z", xyz.Z * 100.0); + break; + + case icSigLabData: + cmsLabEncoded2Float(&Lab, Encoded); + SetCGATSfld("LAB_L", Lab.L); + SetCGATSfld("LAB_A", Lab.a); + SetCGATSfld("LAB_B", Lab.b); + break; + + + case icSigRgbData: + SetCGATSfld("RGB_R", Encoded[0] / 257.0); + SetCGATSfld("RGB_G", Encoded[1] / 257.0); + SetCGATSfld("RGB_B", Encoded[2] / 257.0); + break; + + case icSigGrayData: + SetCGATSfld("GRAY", Encoded[0] / 257.0); + break; + + case icSigCmykData: + SetCGATSfld("CMYK_C", (lUse255always ? 255.0 : 100.0) * Encoded[0] / 65535.0); + SetCGATSfld("CMYK_M", (lUse255always ? 255.0 : 100.0) * Encoded[1] / 65535.0); + SetCGATSfld("CMYK_Y", (lUse255always ? 255.0 : 100.0) * Encoded[2] / 65535.0); + SetCGATSfld("CMYK_K", (lUse255always ? 255.0 : 100.0) * Encoded[3] / 65535.0); + break; + + case icSigCmyData: + SetCGATSfld("CMY_C", (lUse255always ? 255.0 : 100.0) * Encoded[0] / 65535.0); + SetCGATSfld("CMY_M", (lUse255always ? 255.0 : 100.0) * Encoded[1] / 65535.0); + SetCGATSfld("CMY_Y", (lUse255always ? 255.0 : 100.0) * Encoded[2] / 65535.0); + break; + + default: { + + int i; + + for (i=1; i <= _cmsChannelsOf(OutputColorSpace); i++) { + + char Buffer[255]; + + sprintf(Buffer, "CHAN_%d", i); + SetCGATSfld(Buffer, Encoded[i-1] / 257.0); + } + } + } +} + + +// Print XYZ/Lab values on verbose mode + +static +void PrintPCS(WORD Input[], WORD PCSxyz[], WORD PCSLab[]) +{ + if (Verbose && hTransXYZ && hTransLab) { + + if (hTransXYZ) cmsDoTransform(hTransXYZ, Input, PCSxyz, 1); + if (hTransLab) cmsDoTransform(hTransLab, Input, PCSLab, 1); + + PrintResults(PCSxyz, icSigXYZData); + PrintResults(PCSLab, icSigLabData); + } +} + + + +// Create data format + + +static +void SetOutputDataFormat() +{ + + cmsIT8SetPropertyStr(hIT8out, "ORIGINATOR", "icctrans"); + + if (IncludePart != NULL) + cmsIT8SetPropertyStr(hIT8out, ".INCLUDE", IncludePart); + + cmsIT8SetComment(hIT8out, "Data follows"); + cmsIT8SetPropertyDbl(hIT8out, "NUMBER_OF_SETS", nMaxPatches); + + + switch (OutputColorSpace) { + + + // Encoding should follow CGATS specification. + + case icSigXYZData: + cmsIT8SetPropertyDbl(hIT8out, "NUMBER_OF_FIELDS", 4); + cmsIT8SetDataFormat(hIT8out, 0, "SAMPLE_ID"); + cmsIT8SetDataFormat(hIT8out, 1, "XYZ_X"); + cmsIT8SetDataFormat(hIT8out, 2, "XYZ_Y"); + cmsIT8SetDataFormat(hIT8out, 3, "XYZ_Z"); + break; + + case icSigLabData: + cmsIT8SetPropertyDbl(hIT8out, "NUMBER_OF_FIELDS", 4); + cmsIT8SetDataFormat(hIT8out, 0, "SAMPLE_ID"); + cmsIT8SetDataFormat(hIT8out, 1, "LAB_L"); + cmsIT8SetDataFormat(hIT8out, 2, "LAB_A"); + cmsIT8SetDataFormat(hIT8out, 3, "LAB_B"); + break; + + + case icSigRgbData: + cmsIT8SetPropertyDbl(hIT8out, "NUMBER_OF_FIELDS", 4); + cmsIT8SetDataFormat(hIT8out, 0, "SAMPLE_ID"); + cmsIT8SetDataFormat(hIT8out, 1, "RGB_R"); + cmsIT8SetDataFormat(hIT8out, 2, "RGB_G"); + cmsIT8SetDataFormat(hIT8out, 3, "RGB_B"); + break; + + case icSigGrayData: + cmsIT8SetPropertyDbl(hIT8out, "NUMBER_OF_FIELDS", 2); + cmsIT8SetDataFormat(hIT8out, 0, "SAMPLE_ID"); + cmsIT8SetDataFormat(hIT8out, 1, "GRAY"); + break; + + case icSigCmykData: + cmsIT8SetPropertyDbl(hIT8out, "NUMBER_OF_FIELDS", 5); + cmsIT8SetDataFormat(hIT8out, 0, "SAMPLE_ID"); + cmsIT8SetDataFormat(hIT8out, 1, "CMYK_C"); + cmsIT8SetDataFormat(hIT8out, 2, "CMYK_M"); + cmsIT8SetDataFormat(hIT8out, 3, "CMYK_Y"); + cmsIT8SetDataFormat(hIT8out, 4, "CMYK_K"); + break; + + case icSigCmyData: + cmsIT8SetPropertyDbl(hIT8out, "NUMBER_OF_FIELDS", 4); + cmsIT8SetDataFormat(hIT8out, 0, "SAMPLE_ID"); + cmsIT8SetDataFormat(hIT8out, 1, "CMY_C"); + cmsIT8SetDataFormat(hIT8out, 2, "CMY_M"); + cmsIT8SetDataFormat(hIT8out, 3, "CMY_Y"); + break; + + default: { + + int i, n; + char Buffer[255]; + + n = _cmsChannelsOf(OutputColorSpace); + cmsIT8SetPropertyDbl(hIT8out, "NUMBER_OF_FIELDS", n+1); + cmsIT8SetDataFormat(hIT8out, 0, "SAMPLE_ID"); + + for (i=1; i <= n; i++) { + sprintf(Buffer, "CHAN_%d", i); + cmsIT8SetDataFormat(hIT8out, i, Buffer); + } + } + } +} + +// Open CGATS if specified + +static +void OpenCGATSFiles(int argc, char *argv[]) +{ + int nParams = argc - xoptind; + + if (nParams >= 1) { + + hIT8in = cmsIT8LoadFromFile(argv[xoptind]); + + if (hIT8in == NULL) + FatalError("icctrans: '%s' is not recognized as a CGATS file", argv[xoptind]); + + nMaxPatches = (int) cmsIT8GetPropertyDbl(hIT8in, "NUMBER_OF_SETS"); + } + + + if (nParams == 2) { + + hIT8out = cmsIT8Alloc(); + SetOutputDataFormat(); + strncpy(CGATSoutFilename, argv[xoptind+1], MAX_PATH-1); + } + + if (nParams > 2) FatalError("icctrans: Too many CGATS files"); +} + + + +// The main sink + +int main(int argc, char *argv[]) +{ + WORD Input[MAXCHANNELS]; + WORD Output[MAXCHANNELS]; + WORD PCSLab[MAXCHANNELS]; + WORD PCSxyz[MAXCHANNELS]; + int nPatch = 0; + + + cmsSetErrorHandler(MyErrorHandler); + + fprintf(stderr, "LittleCMS ColorSpace conversion calculator - v3.3\n\n"); + + if (argc == 1) + Help(); + + HandleSwitches(argc, argv); + + // Open profiles, create transforms + OpenTransforms(); + + // Open CGATS input if specified + OpenCGATSFiles(argc, argv); + + for(;;) { + + if (hIT8in != NULL) { + + if (nPatch >= nMaxPatches) break; + TakeCGATSValues(nPatch++, Input); + + } else { + + if (feof(stdin)) break; + TakeTextValues(Input); + + } + + cmsDoTransform(hTrans, Input, Output, 1); + + + if (hIT8out != NULL) { + + PutCGATSValues(nPatch, Output); + } + else { + + PrintResults(Output, OutputColorSpace); + PrintPCS(Input, PCSxyz, PCSLab); + } + } + + + CloseTransforms(); + + if (hIT8in) + cmsIT8Free(hIT8in); + + if (hIT8out) { + + cmsIT8SaveToFile(hIT8out, CGATSoutFilename); + cmsIT8Free(hIT8out); + } + + return 0; +} + + diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/makefile.simple b/debian/lcms/lcms-1.19.dfsg2/samples/makefile.simple new file mode 100755 index 00000000..5da70407 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/makefile.simple @@ -0,0 +1,36 @@ +SHELL = /bin/sh
+
+CFLAGS = -g -O4 -Wall
+BASEDIR = $(DESTDIR)/usr
+BINDIR = $(BASEDIR)/bin
+
+
+all: icctrans wtpt icc2ps icclink
+
+icctrans: icctrans.c xgetopt.c vprf.c
+ $(CC) $(CFLAGS) icctrans.c xgetopt.c vprf.c ../src/liblcms.a -I../include -o icctrans -lm
+
+wtpt: wtpt.c
+ $(CC) $(CFLAGS) wtpt.c ../src/liblcms.a -I../include -o wtpt -lm
+
+icc2ps: icc2ps.c xgetopt.c
+ $(CC) $(CFLAGS) icc2ps.c xgetopt.c ../src/liblcms.a -I../include -o icc2ps -lm
+
+icclink: icclink.c xgetopt.c
+ $(CC) $(CFLAGS) icclink.c xgetopt.c ../src/liblcms.a -I../include -o icclink -lm
+
+
+install: icctrans icc2ps icclink
+ -cp icctrans $(BINDIR)
+ -cp icctrans.exe $(BINDIR) # Cygwin
+ -cp icc2ps $(BINDIR)
+ -cp icc2ps.exe $(BINDIR) # Cygwin
+ -cp icclink $(BINDIR)
+ -cp icclink.exe $(BINDIR) # Cygwin
+
+
+test:
+ # Nothing to do for test target
+
+clean:
+ -rm wtpt icctrans wtpt.exe icctrans.exe icc2ps icc2ps.exe icclink icclink.exe
diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/mkcmy.c b/debian/lcms/lcms-1.19.dfsg2/samples/mkcmy.c new file mode 100755 index 00000000..6b58580d --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/mkcmy.c @@ -0,0 +1,222 @@ +// +// Little cms +// Copyright (C) 1998-2003 Marti Maria +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +// EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +// WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +// +// IN NO EVENT SHALL MARTI MARIA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, +// INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +// OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +// WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +// LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +// OF THIS SOFTWARE. +// +// Version 1.12 + + +#include "lcms.h" + + +typedef struct { + cmsHPROFILE hLab; + cmsHPROFILE hRGB; + cmsHTRANSFORM Lab2RGB; + cmsHTRANSFORM RGB2Lab; + + } CARGO, FAR* LPCARGO; + +static cmsCIExyY Cus; + +// Does create our perceptual CIE-Based RGB space + +static +cmsHPROFILE CreateRGBSpace(void) +{ + cmsHPROFILE hProfile; + + LPGAMMATABLE Gamma3[3]; + cmsCIExyYTRIPLE CIEPrimaries = { {0.7355,0.2645 }, + {0.2658,0.7243 }, + {0.1669,0.0085}}; + + + Gamma3[0] = Gamma3[1] = Gamma3[2] = cmsBuildGamma(4096, 4.5); + + hProfile = cmsCreateRGBProfile(&Cus, &CIEPrimaries, Gamma3); + + cmsFreeGamma(Gamma3[0]); + + return hProfile; +} + + + +// Does create a linear ramp +static +LPGAMMATABLE CreateLinear() +{ + LPGAMMATABLE Gamma = cmsAllocGamma(4096); + LPWORD Table = Gamma ->GammaTable; + int i; + + for (i=0; i < 4096; i++) { + + Table[i] = _cmsQuantizeVal(i, 4096); + + } + return Gamma; +} + + + +// Our space will be CIE primaries plus a gamma of 4.5 + +static +int Forward(register WORD In[], register WORD Out[], register LPVOID Cargo) +{ + LPCARGO C = (LPCARGO) Cargo; + WORD RGB[3]; + + cmsDoTransform(C ->Lab2RGB, In, &RGB, 1); + + Out[0] = 0xFFFF - RGB[0]; // Our CMY is negative of RGB + Out[1] = 0xFFFF - RGB[1]; + Out[2] = 0xFFFF - RGB[2]; + + + return TRUE; + +} + + +static +int Reverse(register WORD In[], register WORD Out[], register LPVOID Cargo) +{ + + LPCARGO C = (LPCARGO) Cargo; + WORD RGB[3]; + + RGB[0] = 0xFFFF - In[0]; + RGB[1] = 0xFFFF - In[1]; + RGB[2] = 0xFFFF - In[2]; + + cmsDoTransform(C ->RGB2Lab, &RGB, Out, 1); + + return TRUE; + +} + + + +static +void InitCargo(LPCARGO Cargo) +{ + + + Cargo -> hLab = cmsCreateLabProfile(NULL); + Cargo -> hRGB = CreateRGBSpace(); + + Cargo->Lab2RGB = cmsCreateTransform(Cargo->hLab, TYPE_Lab_16, + Cargo ->hRGB, TYPE_RGB_16, + INTENT_RELATIVE_COLORIMETRIC, + cmsFLAGS_NOTPRECALC); + + Cargo->RGB2Lab = cmsCreateTransform(Cargo ->hRGB, TYPE_RGB_16, + Cargo ->hLab, TYPE_Lab_16, + INTENT_RELATIVE_COLORIMETRIC, + cmsFLAGS_NOTPRECALC); +} + + + + +static +void FreeCargo(LPCARGO Cargo) +{ + cmsDeleteTransform(Cargo ->Lab2RGB); + cmsDeleteTransform(Cargo ->RGB2Lab); + cmsCloseProfile(Cargo ->hLab); + cmsCloseProfile(Cargo ->hRGB); +} + + + + +int main(int argc, char *argv[]) +{ + LPLUT AToB0, BToA0; + LPGAMMATABLE PreLinear[3]; + LPGAMMATABLE Lin; + CARGO Cargo; + cmsHPROFILE hProfile; + cmsCIEXYZ wp; + + fprintf(stderr, "Creating lcmscmy.icm..."); + + + wp.X = 55.6549; + wp.Y = 59.0485; + wp.Z = 72.5494; + + cmsXYZ2xyY(&Cus, &wp); + + InitCargo(&Cargo); + + hProfile = cmsCreateLabProfile(&Cus); + + // Create linearization + Lin = CreateLinear(); + + PreLinear[0] = Lin; + PreLinear[1] = Lin; + PreLinear[2] = Lin; + + AToB0 = cmsAllocLUT(); + BToA0 = cmsAllocLUT(); + + cmsAlloc3DGrid(AToB0, 33, 3, 3); + cmsAlloc3DGrid(BToA0, 33, 3, 3); + + cmsSample3DGrid(AToB0, Reverse, &Cargo, 0); + cmsSample3DGrid(BToA0, Forward, &Cargo, 0); + + cmsAllocLinearTable(AToB0, PreLinear, 1); + cmsAllocLinearTable(BToA0, PreLinear, 2); + + cmsAddTag(hProfile, icSigAToB0Tag, AToB0); + cmsAddTag(hProfile, icSigBToA0Tag, BToA0); + + cmsSetColorSpace(hProfile, icSigCmyData); + cmsSetDeviceClass(hProfile, icSigOutputClass); + + cmsAddTag(hProfile, icSigProfileDescriptionTag, "Little cms CMY mixing"); + cmsAddTag(hProfile, icSigCopyrightTag, "Copyright (c) Marti Maria, 2005. All rights reserved."); + cmsAddTag(hProfile, icSigDeviceMfgDescTag, "Little cms"); + cmsAddTag(hProfile, icSigDeviceModelDescTag, "CMY mixing"); + + _cmsSaveProfile(hProfile, "lcmscmy.icm"); + + + cmsFreeGamma(Lin); + cmsFreeLUT(AToB0); + cmsFreeLUT(BToA0); + cmsCloseProfile(hProfile); + FreeCargo(&Cargo); + fprintf(stderr, "Done.\n"); + + + + return 0; +} diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/mkgrayer.c b/debian/lcms/lcms-1.19.dfsg2/samples/mkgrayer.c new file mode 100755 index 00000000..48c9da9b --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/mkgrayer.c @@ -0,0 +1,84 @@ +// +// Little cms +// Copyright (C) 1998-2003 Marti Maria +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +#include "lcms.h" + + +#define GRID_POINTS 33 + +static +int Forward(register WORD In[], register WORD Out[], register LPVOID Cargo) +{ + cmsCIELab Lab; + + + + cmsLabEncoded2Float(&Lab, In); + Lab.a = Lab.b = 0; + cmsFloat2LabEncoded(Out, &Lab); + + return TRUE; +} + + + + + +int main(int argc, char *argv[]) +{ + LPLUT AToB0; + cmsHPROFILE hProfile; + + fprintf(stderr, "Creating grayer.icm..."); + + unlink("grayer.icm"); + hProfile = cmsOpenProfileFromFile("grayer.icm", "w"); + + + AToB0 = cmsAllocLUT(); + + + cmsAlloc3DGrid(AToB0, GRID_POINTS, 3, 3); + + cmsSample3DGrid(AToB0, Forward, NULL, 0); + + cmsAddTag(hProfile, icSigAToB0Tag, AToB0); + + cmsSetColorSpace(hProfile, icSigLabData); + cmsSetPCS(hProfile, icSigLabData); + cmsSetDeviceClass(hProfile, icSigAbstractClass); + + cmsAddTag(hProfile, icSigProfileDescriptionTag, "Little cms Grayifier"); + cmsAddTag(hProfile, icSigCopyrightTag, "Copyright (c) Marti Maria 2003. All rights reserved."); + cmsAddTag(hProfile, icSigDeviceMfgDescTag, "Little cms"); + cmsAddTag(hProfile, icSigDeviceModelDescTag, "Grayifier abstract profile"); + + + cmsCloseProfile(hProfile); + + cmsFreeLUT(AToB0); + + fprintf(stderr, "Done.\n"); + + return 0; +} diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/mktiff8.c b/debian/lcms/lcms-1.19.dfsg2/samples/mktiff8.c new file mode 100755 index 00000000..dcd09266 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/mktiff8.c @@ -0,0 +1,142 @@ +// +// Little cms +// Copyright (C) 1998-2003 Marti Maria +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +#include "lcms.h" + + + +static +double DecodeAbTIFF(double ab) +{ + if (ab <= 128.) + ab += 127.; + else + ab -= 127.; + + return ab; +} + + +static +LPGAMMATABLE CreateStep(void) +{ + LPGAMMATABLE Gamma = cmsAllocGamma(4096); + LPWORD Table = Gamma ->GammaTable; + int i; + double a; + + for (i=0; i < 4096; i++) { + + a = (double) i * 255. / 4095.; + + a = DecodeAbTIFF(a); + + Table[i] = (WORD) floor(a * 257. + 0.5); + } + + return Gamma; +} + + +static +LPGAMMATABLE CreateLinear() +{ + LPGAMMATABLE Gamma = cmsAllocGamma(4096); + LPWORD Table = Gamma ->GammaTable; + int i; + + for (i=0; i < 4096; i++) { + + Table[i] = _cmsQuantizeVal(i, 4096); + + } + return Gamma; +} + + +static +int Identity(register WORD In[], register WORD Out[], register LPVOID Cargo) +{ + Out[0] = In[0]; + Out[1] = In[1]; + Out[2] = In[2]; + return TRUE; +} + + + + +int main(int argc, char *argv[]) +{ + cmsHPROFILE hProfile; + LPLUT AToB0, BToA0; + LPGAMMATABLE PreLinear[3]; + LPGAMMATABLE Lin, Step; + + fprintf(stderr, "Creating lcmstiff8.icm..."); + + + unlink("lcmstiff8.icm"); + hProfile = cmsOpenProfileFromFile("lcmstiff8.icm", "w"); + + // Create linearization + Lin = CreateLinear(); + Step = CreateStep(); + + PreLinear[0] = Lin; + PreLinear[1] = Step; + PreLinear[2] = Step; + + AToB0 = cmsAllocLUT(); + BToA0 = cmsAllocLUT(); + + cmsAlloc3DGrid(AToB0, 2, 3, 3); + cmsAlloc3DGrid(BToA0, 2, 3, 3); + + cmsSample3DGrid(AToB0, Identity, NULL, 0); + cmsSample3DGrid(BToA0, Identity, NULL, 0); + + cmsAllocLinearTable(AToB0, PreLinear, 1); + cmsAllocLinearTable(BToA0, PreLinear, 2); + + cmsAddTag(hProfile, icSigAToB0Tag, AToB0); + cmsAddTag(hProfile, icSigBToA0Tag, BToA0); + + cmsAddTag(hProfile, icSigProfileDescriptionTag, "Little cms Tiff8 CIELab"); + cmsAddTag(hProfile, icSigCopyrightTag, "Copyright (c) Marti Maria, 2003. All rights reserved."); + cmsAddTag(hProfile, icSigDeviceMfgDescTag, "Little cms"); + cmsAddTag(hProfile, icSigDeviceModelDescTag, "TIFF Lab8"); + + + cmsCloseProfile(hProfile); + + cmsFreeGamma(Lin); + cmsFreeGamma(Step); + cmsFreeLUT(AToB0); + cmsFreeLUT(BToA0); + + + fprintf(stderr, "Done.\n"); + + return 0; +} diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/vprf.c b/debian/lcms/lcms-1.19.dfsg2/samples/vprf.c new file mode 100755 index 00000000..6d48cb6c --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/vprf.c @@ -0,0 +1,67 @@ + +// +// Little cms +// Copyright (C) 1998-2007 Marti Maria +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#include "lcms.h" + +// Virtual profiles are handled here. + +cmsHPROFILE OpenStockProfile(const char* File) +{ + if (!File) + return cmsCreate_sRGBProfile(); + + if (stricmp(File, "*Lab") == 0) + return cmsCreateLabProfile(NULL); + + if (stricmp(File, "*Lab4") == 0) + return cmsCreateLab4Profile(NULL); + + if (stricmp(File, "*LabD65") == 0) { + + cmsCIExyY D65xyY; + + cmsWhitePointFromTemp(6504, &D65xyY); + return cmsCreateLabProfile(&D65xyY); + } + + if (stricmp(File, "*XYZ") == 0) + return cmsCreateXYZProfile(); + + + if (stricmp(File, "*Gray22") == 0) { + + LPGAMMATABLE Gamma = cmsBuildGamma(256, 2.2); + cmsHPROFILE hProfile = cmsCreateGrayProfile(cmsD50_xyY(), Gamma); + cmsFreeGamma(Gamma); + return hProfile; + } + + if (stricmp(File, "*srgb") == 0) + return cmsCreate_sRGBProfile(); + + if (stricmp(File, "*null") == 0) + return cmsCreateNULLProfile(); + + + return cmsOpenProfileFromFile(File, "r"); +} diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/wtpt.1 b/debian/lcms/lcms-1.19.dfsg2/samples/wtpt.1 new file mode 100755 index 00000000..fbd37ac2 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/wtpt.1 @@ -0,0 +1,28 @@ +.\"Shiju P. Nair September 30, 2004 +.TH WTPT 1 "September 30, 2004" +.SH NAME +wtpt - Show media white of profiles, identifying black body locus. +.SH SYNOPSIS +.B wtpt +.RI [ profile ] +.SH DESCRIPTION +lcms is a standalone CMM engine, which deals with the color management. +It implements a fast transformation between ICC profiles. +.B wtpt +shows media white of profiles, identifying black body locus. +.P +If no parameters are given, then this program will +ask for XYZ value of media white. If parameter given, it must be +the profile to inspect. +.SH NOTES +For suggestions, comments, bug reports etc. send mail to +info@littlecms.com +.SH SEE ALSO +.BR jpegicc (1), +.BR tifficc (1), +.BR icc2ps (1), +.BR icclink (1), +.BR icctrans (1) +.SH AUTHOR +This manual page was written by Shiju p. Nair <shiju.p@gmail.com>, +for the Debian project. diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/wtpt.c b/debian/lcms/lcms-1.19.dfsg2/samples/wtpt.c new file mode 100755 index 00000000..f65aed1f --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/wtpt.c @@ -0,0 +1,88 @@ +// +// Little cms +// Copyright (C) 1998-2007 Marti Maria +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + + +// Example: how to show white points of profiles + + +#include "lcms.h" + + + +static +void ShowWhitePoint(LPcmsCIEXYZ WtPt) +{ + cmsCIELab Lab; + cmsCIELCh LCh; + cmsCIExyY xyY; + char Buffer[1024]; + + + _cmsIdentifyWhitePoint(Buffer, WtPt); + printf("%s\n", Buffer); + + cmsXYZ2Lab(NULL, &Lab, WtPt); + cmsLab2LCh(&LCh, &Lab); + cmsXYZ2xyY(&xyY, WtPt); + + printf("XYZ=(%3.1f, %3.1f, %3.1f)\n", WtPt->X, WtPt->Y, WtPt->Z); + printf("Lab=(%3.3f, %3.3f, %3.3f)\n", Lab.L, Lab.a, Lab.b); + printf("(x,y)=(%3.3f, %3.3f)\n", xyY.x, xyY.y); + printf("Hue=%3.2f, Chroma=%3.2f\n", LCh.h, LCh.C); + printf("\n"); + +} + + +int main (int argc, char *argv[]) +{ + printf("Show media white of profiles, identifying black body locus. v2\n\n"); + + + if (argc == 2) { + cmsCIEXYZ WtPt; + cmsHPROFILE hProfile = cmsOpenProfileFromFile(argv[1], "r"); + + printf("%s\n", cmsTakeProductName(hProfile)); + cmsTakeMediaWhitePoint(&WtPt, hProfile); + ShowWhitePoint(&WtPt); + cmsCloseProfile(hProfile); + } + else + { + cmsCIEXYZ xyz; + + printf("usage:\n\nIf no parameters are given, then this program will\n"); + printf("ask for XYZ value of media white. If parameter given, it must be\n"); + printf("the profile to inspect.\n\n"); + + printf("X? "); scanf("%lf", &xyz.X); + printf("Y? "); scanf("%lf", &xyz.Y); + printf("Z? "); scanf("%lf", &xyz.Z); + + ShowWhitePoint(&xyz); + } + + return 0; +} + diff --git a/debian/lcms/lcms-1.19.dfsg2/samples/xgetopt.c b/debian/lcms/lcms-1.19.dfsg2/samples/xgetopt.c new file mode 100755 index 00000000..3eb08fe2 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/samples/xgetopt.c @@ -0,0 +1,75 @@ +/* + getopt.c + +*/ + +#include <errno.h> +#include <string.h> +#include <stdio.h> + +int xoptind = 1; /* index of which argument is next */ +char *xoptarg; /* pointer to argument of current option */ +int xopterr = 0; /* allow error message */ + +static char *letP = NULL; /* remember next option char's location */ +char SW = '-'; /* DOS switch character, either '-' or '/' */ + +/* + Parse the command line options, System V style. + + Standard option syntax is: + + option ::= SW [optLetter]* [argLetter space* argument] + +*/ + +int xgetopt(int argc, char *argv[], char *optionS) +{ + unsigned char ch; + char *optP; + + if (SW == 0) { + SW = '/'; + } + + if (argc > xoptind) { + if (letP == NULL) { + if ((letP = argv[xoptind]) == NULL || + *(letP++) != SW) goto gopEOF; + if (*letP == SW) { + xoptind++; goto gopEOF; + } + } + if (0 == (ch = *(letP++))) { + xoptind++; goto gopEOF; + } + if (':' == ch || (optP = strchr(optionS, ch)) == NULL) + goto gopError; + if (':' == *(++optP)) { + xoptind++; + if (0 == *letP) { + if (argc <= xoptind) goto gopError; + letP = argv[xoptind++]; + } + xoptarg = letP; + letP = NULL; + } else { + if (0 == *letP) { + xoptind++; + letP = NULL; + } + xoptarg = NULL; + } + return ch; + } +gopEOF: + xoptarg = letP = NULL; + return EOF; + +gopError: + xoptarg = NULL; + errno = EINVAL; + if (xopterr) + perror ("get command line option"); + return ('?'); +} |
