summaryrefslogtreecommitdiff
path: root/tiff/contrib/ras
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-09-01 13:56:46 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-09-01 13:56:46 +0200
commit22f703cab05b7cd368f4de9e03991b7664dc5022 (patch)
tree6f4d50beaa42328e24b1c6b56b6ec059e4ef21a5 /tiff/contrib/ras
Initial import of argyll version 1.5.1-8debian/1.5.1-8
Diffstat (limited to 'tiff/contrib/ras')
-rw-r--r--tiff/contrib/ras/Makefile.am28
-rw-r--r--tiff/contrib/ras/Makefile.in421
-rw-r--r--tiff/contrib/ras/README10
-rw-r--r--tiff/contrib/ras/ras2tif.c254
-rw-r--r--tiff/contrib/ras/tif2ras.c344
5 files changed, 1057 insertions, 0 deletions
diff --git a/tiff/contrib/ras/Makefile.am b/tiff/contrib/ras/Makefile.am
new file mode 100644
index 0000000..c80acd0
--- /dev/null
+++ b/tiff/contrib/ras/Makefile.am
@@ -0,0 +1,28 @@
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE 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 SAM LEFFLER OR SILICON GRAPHICS 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.
+
+# Process this file with automake to produce Makefile.in.
+
+EXTRA_DIST = README ras2tif.c tif2ras.c
+
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
diff --git a/tiff/contrib/ras/Makefile.in b/tiff/contrib/ras/Makefile.in
new file mode 100644
index 0000000..a994bcb
--- /dev/null
+++ b/tiff/contrib/ras/Makefile.in
@@ -0,0 +1,421 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
+
+# Tag Image File Format (TIFF) Software
+#
+# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE 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 SAM LEFFLER OR SILICON GRAPHICS 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.
+
+# Process this file with automake to produce Makefile.in.
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@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@
+subdir = contrib/ras
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \
+ $(top_builddir)/libtiff/tiffconf.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+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@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+GLUT_LIBS = @GLUT_LIBS@
+GLU_CFLAGS = @GLU_CFLAGS@
+GLU_LIBS = @GLU_LIBS@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDIR = @LIBDIR@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@
+LIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@
+LIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@
+LIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@
+LIBTIFF_VERSION = @LIBTIFF_VERSION@
+LIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+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_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+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@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+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_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = README ras2tif.c tif2ras.c
+INCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff
+all: all-am
+
+.SUFFIXES:
+$(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 ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/ras/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign contrib/ras/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
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$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
+installdirs:
+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)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+# 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/tiff/contrib/ras/README b/tiff/contrib/ras/README
new file mode 100644
index 0000000..f87bfde
--- /dev/null
+++ b/tiff/contrib/ras/README
@@ -0,0 +1,10 @@
+Sun May 19 22:28:16 PDT 1991
+
+These programs are from Patrick Naughton (naughton@wind.sun.com).
+I've tried to update them to reflect changes to the library, but
+I am unable to verify that they operate properly, because they
+require the Sun pixrect library.
+
+Please contact Patrick directly if you have questions/problems.
+
+ Sam
diff --git a/tiff/contrib/ras/ras2tif.c b/tiff/contrib/ras/ras2tif.c
new file mode 100644
index 0000000..c44b313
--- /dev/null
+++ b/tiff/contrib/ras/ras2tif.c
@@ -0,0 +1,254 @@
+#ifndef lint
+static char sccsid[] = "@(#)ras2tif.c 1.2 90/03/06";
+#endif
+/*-
+ * ras2tif.c - Converts from a Sun Rasterfile to a Tagged Image File.
+ *
+ * Copyright (c) 1990 by Sun Microsystems, Inc.
+ *
+ * Author: Patrick J. Naughton
+ * naughton@wind.sun.com
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * This file is provided AS IS with no warranties of any kind. The author
+ * shall have no liability with respect to the infringement of copyrights,
+ * trade secrets or any patents by this file or any part thereof. In no
+ * event will the author be liable for any lost revenue or profits or
+ * other special, indirect and consequential damages.
+ *
+ * Comments and additions should be sent to the author:
+ *
+ * Patrick J. Naughton
+ * Sun Microsystems
+ * 2550 Garcia Ave, MS 14-40
+ * Mountain View, CA 94043
+ * (415) 336-1080
+ *
+ * Revision History:
+ * 11-Jan-89: Created.
+ * 06-Mar-90: fix bug in SCALE() macro.
+ * got rid of xres and yres, (they weren't working anyways).
+ * fixed bpsl calculation.
+ * 25-Nov-99: y2k fix (year as 1900 + tm_year) <mike@onshore.com>
+ *
+ * Description:
+ * This program takes a Sun Rasterfile [see rasterfile(5)] as input and
+ * writes a MicroSoft/Aldus "Tagged Image File Format" image or "TIFF" file.
+ * The input file may be standard input, but the output TIFF file must be a
+ * real file since seek(2) is used.
+ */
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <pixrect/pixrect_hs.h>
+#include "tiffio.h"
+
+typedef int boolean;
+#define True (1)
+#define False (0)
+#define SCALE(x) (((x)*((1L<<16)-1))/255)
+
+boolean Verbose = False;
+boolean dummyinput = False;
+char *pname; /* program name (used for error messages) */
+
+void
+error(s1, s2)
+ char *s1,
+ *s2;
+{
+ fprintf(stderr, s1, pname, s2);
+ exit(1);
+}
+
+void
+usage()
+{
+ error("usage: %s -[vq] [-|rasterfile] TIFFfile\n", NULL);
+}
+
+
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ char *inf = NULL;
+ char *outf = NULL;
+ FILE *fp;
+ int depth,
+ i;
+ long row;
+ TIFF *tif;
+ Pixrect *pix; /* The Sun Pixrect */
+ colormap_t Colormap; /* The Pixrect Colormap */
+ u_short red[256],
+ green[256],
+ blue[256];
+ struct tm *ct;
+ struct timeval tv;
+ long width,
+ height;
+ long rowsperstrip;
+ int year;
+ short photometric;
+ short samplesperpixel;
+ short bitspersample;
+ int bpsl;
+ static char *version = "ras2tif 1.0";
+ static char *datetime = "1990:01:01 12:00:00";
+
+ gettimeofday(&tv, (struct timezone *) NULL);
+ ct = localtime(&tv.tv_sec);
+ year=1900 + ct->tm_year;
+ sprintf(datetime, "%04d:%02d:%02d %02d:%02d:%02d",
+ year, ct->tm_mon + 1, ct->tm_mday,
+ ct->tm_hour, ct->tm_min, ct->tm_sec);
+
+ setbuf(stderr, NULL);
+ pname = argv[0];
+
+ while (--argc) {
+ if ((++argv)[0][0] == '-') {
+ switch (argv[0][1]) {
+ case 'v':
+ Verbose = True;
+ break;
+ case 'q':
+ usage();
+ break;
+ case '\0':
+ if (inf == NULL)
+ dummyinput = True;
+ else
+ usage();
+ break;
+ default:
+ fprintf(stderr, "%s: illegal option -%c.\n", pname,
+ argv[0][1]);
+ exit(1);
+ }
+ } else if (inf == NULL && !dummyinput) {
+ inf = argv[0];
+ } else if (outf == NULL)
+ outf = argv[0];
+ else
+ usage();
+ }
+
+ if (outf == NULL)
+ error("%s: can't write output file to a stream.\n", NULL);
+
+ if (dummyinput || inf == NULL) {
+ inf = "Standard Input";
+ fp = stdin;
+ } else if ((fp = fopen(inf, "r")) == NULL)
+ error("%s: %s couldn't be opened.\n", inf);
+
+ if (Verbose)
+ fprintf(stderr, "Reading rasterfile from %s...", inf);
+
+ pix = pr_load(fp, &Colormap);
+ if (pix == NULL)
+ error("%s: %s is not a raster file.\n", inf);
+
+ if (Verbose)
+ fprintf(stderr, "done.\n");
+
+ if (Verbose)
+ fprintf(stderr, "Writing %s...", outf);
+
+ tif = TIFFOpen(outf, "w");
+
+ if (tif == NULL)
+ error("%s: error opening TIFF file %s", outf);
+
+ width = pix->pr_width;
+ height = pix->pr_height;
+ depth = pix->pr_depth;
+
+ switch (depth) {
+ case 1:
+ samplesperpixel = 1;
+ bitspersample = 1;
+ photometric = PHOTOMETRIC_MINISBLACK;
+ break;
+ case 8:
+ samplesperpixel = 1;
+ bitspersample = 8;
+ photometric = PHOTOMETRIC_PALETTE;
+ break;
+ case 24:
+ samplesperpixel = 3;
+ bitspersample = 8;
+ photometric = PHOTOMETRIC_RGB;
+ break;
+ case 32:
+ samplesperpixel = 4;
+ bitspersample = 8;
+ photometric = PHOTOMETRIC_RGB;
+ break;
+ default:
+ error("%s: bogus depth: %d\n", depth);
+ }
+
+ bpsl = ((depth * width + 15) >> 3) & ~1;
+ rowsperstrip = (8 * 1024) / bpsl;
+
+ TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);
+ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bitspersample);
+ TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
+ TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);
+ TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, inf);
+ TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, "converted Sun rasterfile");
+ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
+ TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+ TIFFSetField(tif, TIFFTAG_STRIPBYTECOUNTS, height / rowsperstrip);
+ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ TIFFSetField(tif, TIFFTAG_SOFTWARE, version);
+ TIFFSetField(tif, TIFFTAG_DATETIME, datetime);
+
+ memset(red, 0, sizeof(red));
+ memset(green, 0, sizeof(green));
+ memset(blue, 0, sizeof(blue));
+ if (depth == 8) {
+ TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
+ for (i = 0; i < Colormap.length; i++) {
+ red[i] = SCALE(Colormap.map[0][i]);
+ green[i] = SCALE(Colormap.map[1][i]);
+ blue[i] = SCALE(Colormap.map[2][i]);
+ }
+ }
+ if (Verbose)
+ fprintf(stderr, "%dx%dx%d image, ", width, height, depth);
+
+ for (row = 0; row < height; row++)
+ if (TIFFWriteScanline(tif,
+ (u_char *) mprd_addr(mpr_d(pix), 0, row),
+ row, 0) < 0) {
+ fprintf("failed a scanline write (%d)\n", row);
+ break;
+ }
+ TIFFFlushData(tif);
+ TIFFClose(tif);
+
+ if (Verbose)
+ fprintf(stderr, "done.\n");
+
+ pr_destroy(pix);
+
+ exit(0);
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */
diff --git a/tiff/contrib/ras/tif2ras.c b/tiff/contrib/ras/tif2ras.c
new file mode 100644
index 0000000..b665aed
--- /dev/null
+++ b/tiff/contrib/ras/tif2ras.c
@@ -0,0 +1,344 @@
+#ifndef lint
+static char id[] = "$Id: tif2ras.c,v 1.2.2.1 2010-06-08 18:50:41 bfriesen Exp $";
+#endif
+/*-
+ * tif2ras.c - Converts from a Tagged Image File Format image to a Sun Raster.
+ *
+ * Copyright (c) 1990 by Sun Microsystems, Inc.
+ *
+ * Author: Patrick J. Naughton
+ * naughton@wind.sun.com
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * This file is provided AS IS with no warranties of any kind. The author
+ * shall have no liability with respect to the infringement of copyrights,
+ * trade secrets or any patents by this file or any part thereof. In no
+ * event will the author be liable for any lost revenue or profits or
+ * other special, indirect and consequential damages.
+ *
+ * Comments and additions should be sent to the author:
+ *
+ * Patrick J. Naughton
+ * Sun Microsystems
+ * 2550 Garcia Ave, MS 14-40
+ * Mountain View, CA 94043
+ * (415) 336-1080
+ *
+ * Revision History:
+ * 10-Jan-89: Created.
+ * 06-Mar-90: Change to byte encoded rasterfiles.
+ * fix bug in call to ReadScanline().
+ * fix bug in CVT() macro.
+ * fix assignment of td, (missing &).
+ *
+ * Description:
+ * This program takes a MicroSoft/Aldus "Tagged Image File Format" image or
+ * "TIFF" file as input and writes a Sun Rasterfile [see rasterfile(5)]. The
+ * output file may be standard output, but the input TIFF file must be a real
+ * file since seek(2) is used.
+ */
+
+#include <stdio.h>
+#include <pixrect/pixrect_hs.h>
+#include "tiffio.h"
+
+typedef int boolean;
+#define True (1)
+#define False (0)
+#define CVT(x) (((x) * 255) / ((1L<<16)-1))
+
+boolean Verbose = False;
+char *pname; /* program name (used for error messages) */
+
+void
+error(s1, s2)
+ char *s1,
+ *s2;
+{
+ fprintf(stderr, s1, pname, s2);
+ exit(1);
+}
+
+void
+usage()
+{
+ error("usage: %s -[vq] TIFFfile [rasterfile]\n", NULL);
+}
+
+
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ char *inf = NULL;
+ char *outf = NULL;
+ FILE *fp;
+ long width,
+ height;
+ int depth,
+ numcolors;
+ register TIFF *tif;
+ TIFFDirectory *td;
+ register u_char *inp,
+ *outp;
+ register int col,
+ i;
+ register long row;
+ u_char *Map = NULL;
+ u_char *buf;
+ short bitspersample;
+ short samplesperpixel;
+ short photometric;
+ u_short *redcolormap,
+ *bluecolormap,
+ *greencolormap;
+
+ Pixrect *pix; /* The Sun Pixrect */
+ colormap_t Colormap; /* The Pixrect Colormap */
+ u_char red[256],
+ green[256],
+ blue[256];
+
+ setbuf(stderr, NULL);
+ pname = argv[0];
+
+ while (--argc) {
+ if ((++argv)[0][0] == '-')
+ switch (argv[0][1]) {
+ case 'v':
+ Verbose = True;
+ break;
+ case 'q':
+ usage();
+ break;
+ default:
+ fprintf(stderr, "%s: illegal option -%c.\n", pname,
+ argv[0][1]);
+ exit(1);
+ }
+ else if (inf == NULL)
+ inf = argv[0];
+ else if (outf == NULL)
+ outf = argv[0];
+ else
+ usage();
+
+ }
+
+ if (inf == NULL)
+ error("%s: can't read input file from a stream.\n", NULL);
+
+ if (Verbose)
+ fprintf(stderr, "Reading %s...", inf);
+
+ tif = TIFFOpen(inf, "r");
+
+ if (tif == NULL)
+ error("%s: error opening TIFF file %s", inf);
+
+ if (Verbose)
+ TIFFPrintDirectory(tif, stderr, True, False, False);
+ TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+ if (bitspersample > 8)
+ error("%s: can't handle more than 8-bits per sample\n", NULL);
+
+ TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+ switch (samplesperpixel) {
+ case 1:
+ if (bitspersample == 1)
+ depth = 1;
+ else
+ depth = 8;
+ break;
+ case 3:
+ case 4:
+ depth = 24;
+ break;
+ default:
+ error("%s: only handle 1-channel gray scale or 3-channel color\n");
+ }
+
+ TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
+ TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);
+
+ if (Verbose)
+ fprintf(stderr, "%dx%dx%d image, ", width, height, depth);
+ if (Verbose)
+ fprintf(stderr, "%d bits/sample, %d samples/pixel, ",
+ bitspersample, samplesperpixel);
+
+ pix = mem_create(width, height, depth);
+ if (pix == (Pixrect *) NULL)
+ error("%s: can't allocate memory for output pixrect...\n", NULL);
+
+ numcolors = (1 << bitspersample);
+
+ TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric);
+ if (numcolors == 2) {
+ if (Verbose)
+ fprintf(stderr, "monochrome ");
+ Colormap.type = RMT_NONE;
+ Colormap.length = 0;
+ Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;
+ } else {
+ switch (photometric) {
+ case PHOTOMETRIC_MINISBLACK:
+ if (Verbose)
+ fprintf(stderr, "%d graylevels (min=black), ", numcolors);
+ Map = (u_char *) malloc(numcolors * sizeof(u_char));
+ for (i = 0; i < numcolors; i++)
+ Map[i] = (255 * i) / numcolors;
+ Colormap.type = RMT_EQUAL_RGB;
+ Colormap.length = numcolors;
+ Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;
+ break;
+ case PHOTOMETRIC_MINISWHITE:
+ if (Verbose)
+ fprintf(stderr, "%d graylevels (min=white), ", numcolors);
+ Map = (u_char *) malloc(numcolors * sizeof(u_char));
+ for (i = 0; i < numcolors; i++)
+ Map[i] = 255 - ((255 * i) / numcolors);
+ Colormap.type = RMT_EQUAL_RGB;
+ Colormap.length = numcolors;
+ Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;
+ break;
+ case PHOTOMETRIC_RGB:
+ if (Verbose)
+ fprintf(stderr, "truecolor ");
+ Colormap.type = RMT_NONE;
+ Colormap.length = 0;
+ Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;
+ break;
+ case PHOTOMETRIC_PALETTE:
+ if (Verbose)
+ fprintf(stderr, "colormapped ");
+ Colormap.type = RMT_EQUAL_RGB;
+ Colormap.length = numcolors;
+ memset(red, 0, sizeof(red));
+ memset(green, 0, sizeof(green));
+ memset(blue, 0, sizeof(blue));
+ TIFFGetField(tif, TIFFTAG_COLORMAP,
+ &redcolormap, &greencolormap, &bluecolormap);
+ for (i = 0; i < numcolors; i++) {
+ red[i] = (u_char) CVT(redcolormap[i]);
+ green[i] = (u_char) CVT(greencolormap[i]);
+ blue[i] = (u_char) CVT(bluecolormap[i]);
+ }
+ Colormap.map[0] = red;
+ Colormap.map[1] = green;
+ Colormap.map[2] = blue;
+ break;
+ case PHOTOMETRIC_MASK:
+ error("%s: Don't know how to handle PHOTOMETRIC_MASK\n");
+ break;
+ case PHOTOMETRIC_DEPTH:
+ error("%s: Don't know how to handle PHOTOMETRIC_DEPTH\n");
+ break;
+ default:
+ error("%s: unknown photometric (cmap): %d\n", photometric);
+ }
+ }
+
+ buf = (u_char *) malloc(TIFFScanlineSize(tif));
+ if (buf == NULL)
+ error("%s: can't allocate memory for scanline buffer...\n", NULL);
+
+ for (row = 0; row < height; row++) {
+ if (TIFFReadScanline(tif, buf, row, 0) < 0)
+ error("%s: bad data read on line: %d\n", row);
+ inp = buf;
+ outp = (u_char *) mprd_addr(mpr_d(pix), 0, row);
+ switch (photometric) {
+ case PHOTOMETRIC_RGB:
+ if (samplesperpixel == 4)
+ for (col = 0; col < width; col++) {
+ *outp++ = *inp++; /* Blue */
+ *outp++ = *inp++; /* Green */
+ *outp++ = *inp++; /* Red */
+ inp++; /* skip alpha channel */
+ }
+ else
+ for (col = 0; col < width; col++) {
+ *outp++ = *inp++; /* Blue */
+ *outp++ = *inp++; /* Green */
+ *outp++ = *inp++; /* Red */
+ }
+ break;
+ case PHOTOMETRIC_MINISWHITE:
+ case PHOTOMETRIC_MINISBLACK:
+ switch (bitspersample) {
+ case 1:
+ for (col = 0; col < ((width + 7) / 8); col++)
+ *outp++ = *inp++;
+ break;
+ case 2:
+ for (col = 0; col < ((width + 3) / 4); col++) {
+ *outp++ = (*inp >> 6) & 3;
+ *outp++ = (*inp >> 4) & 3;
+ *outp++ = (*inp >> 2) & 3;
+ *outp++ = *inp++ & 3;
+ }
+ break;
+ case 4:
+ for (col = 0; col < width / 2; col++) {
+ *outp++ = *inp >> 4;
+ *outp++ = *inp++ & 0xf;
+ }
+ break;
+ case 8:
+ for (col = 0; col < width; col++)
+ *outp++ = *inp++;
+ break;
+ default:
+ error("%s: bad bits/sample: %d\n", bitspersample);
+ }
+ break;
+ case PHOTOMETRIC_PALETTE:
+ memcpy(outp, inp, width);
+ break;
+ default:
+ error("%s: unknown photometric (write): %d\n", photometric);
+ }
+ }
+
+ free((char *) buf);
+
+ if (Verbose)
+ fprintf(stderr, "done.\n");
+
+ if (outf == NULL || strcmp(outf, "Standard Output") == 0) {
+ outf = "Standard Output";
+ fp = stdout;
+ } else {
+ if (!(fp = fopen(outf, "w")))
+ error("%s: %s couldn't be opened for writing.\n", outf);
+ }
+
+ if (Verbose)
+ fprintf(stderr, "Writing rasterfile in %s...", outf);
+
+ if (pr_dump(pix, fp, &Colormap, RT_BYTE_ENCODED, 0) == PIX_ERR)
+ error("%s: error writing Sun Rasterfile: %s\n", outf);
+
+ if (Verbose)
+ fprintf(stderr, "done.\n");
+
+ pr_destroy(pix);
+
+ if (fp != stdout)
+ fclose(fp);
+
+ exit(0);
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */