v13i017: ImageMagick - Graphics display programs, Part01/21

cristy at dupont.com cristy at dupont.com
Wed May 22 18:50:52 AEST 1991


Submitted-by: cristy at dupont.com
Posting-number: Volume 13, Issue 17
Archive-name: imagemagic/part01

The X utilites read and write MIFF images.  Refer to the end of the
README for more information about MIFF.  You can find filters to
convert to and from the MIFF format in the 'filters' directory.


#!/bin/sh
# This is ImageMagick, a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 05/14/1991 13:45 UTC by cristy at dupont.com
# Source directory /internet/cristy/ImageMagick
#
# existing files will NOT be overwritten unless -c is specified
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#    929 -rwxr-xr-x ImageMagick/Imakefile
#  10190 -rwxr-xr-x ImageMagick/Makefile
#    904 -rwxr-xr-x ImageMagick/PreR4Icccm.h
#   8665 -rwxr-xr-x ImageMagick/README
#  16185 -rwxr-xr-x ImageMagick/XtoPS.c
#   5731 -rwxr-xr-x ImageMagick/XtoPS.man
#   2570 -rwxr-xr-x ImageMagick/Manifest.ps
#   9085 -rwxr-xr-x ImageMagick/colors.c
#   3167 -rwxr-xr-x ImageMagick/Make.com
#   1993 -rwxr-xr-x ImageMagick/display.h
#  33436 -rwxr-xr-x ImageMagick/display.man
#   8840 -rwxr-xr-x ImageMagick/xtp/Makefile
#    143 -rwxr-xr-x ImageMagick/xtp/Imakefile
#   8203 -rwxr-xr-x ImageMagick/xtp/xtp.1
#   1872 -rwxr-xr-x ImageMagick/xtp/README
#  33398 -rwxr-xr-x ImageMagick/xtp/regular.c
#   1245 -rwxr-xr-x ImageMagick/xtp/regular.h
#  37231 -rwxr-xr-x ImageMagick/xtp/xtp.c
#   5832 -rwxr-xr-x ImageMagick/xtp/xtp.man
# 121441 -rwxr-xr-x ImageMagick/image.c
#  38867 -rwx------ ImageMagick/images/swan.miff.Z
# 204043 -rwx------ ImageMagick/images/mandrill.miff.Z
#  14198 -rwxr-xr-x ImageMagick/import.c
#   3992 -rwxr-xr-x ImageMagick/import.man
#  22830 -rwxr-xr-x ImageMagick/kolb.c
#  20010 -rwxr-xr-x ImageMagick/quantize.c
#  32713 -rwxr-xr-x ImageMagick/rotate.c
#  23716 -rwxr-xr-x ImageMagick/compress.c
#    563 -rwxr-xr-x ImageMagick/image.h
#  14700 -rwxr-xr-x ImageMagick/filters/Makefile
#  20330 -rwxr-xr-x ImageMagick/filters/GIFtoMIFF.c
#  20166 -rwxr-xr-x ImageMagick/filters/SUNtoMIFF.c
#  25596 -rwxr-xr-x ImageMagick/filters/TIFFtoMIFF.c
#  11939 -rwxr-xr-x ImageMagick/filters/MIFFtoTIFF.c
#  13529 -rwxr-xr-x ImageMagick/filters/MIFFtoSUN.c
#  10081 -rwxr-xr-x ImageMagick/filters/MIFFtoAVS.c
#  12689 -rwxr-xr-x ImageMagick/filters/AVStoMIFF.c
#  22134 -rwxr-xr-x ImageMagick/filters/XWDtoMIFF.c
#   4132 -rwxr-xr-x ImageMagick/filters/Imakefile
#  11243 -rwxr-xr-x ImageMagick/filters/MIFFtoXBM.c
#  13275 -rwxr-xr-x ImageMagick/filters/XBMtoMIFF.c
#  12416 -rwxr-xr-x ImageMagick/filters/PPMtoMIFF.c
#  31233 -rwxr-xr-x ImageMagick/filters/TIFFtoSUN.c
#   9806 -rwxr-xr-x ImageMagick/filters/MIFFtoPPM.c
#  12356 -rwxr-xr-x ImageMagick/filters/MTVtoMIFF.c
#  11346 -rwxr-xr-x ImageMagick/filters/ANIMOLtoMIFF.c
#  12419 -rwxr-xr-x ImageMagick/filters/GRAYtoMIFF.c
#   9941 -rwxr-xr-x ImageMagick/filters/MIFFtoGRAY.c
#   9938 -rwxr-xr-x ImageMagick/filters/MIFFtoMTV.c
#   9872 -rwxr-xr-x ImageMagick/filters/MIFFtoRGB.c
#  15929 -rwxr-xr-x ImageMagick/filters/MIFFtoXWD.c
#   1055 -rwxr-xr-x ImageMagick/filters/README
#  12104 -rwxr-xr-x ImageMagick/filters/RGBtoMIFF.c
#  22524 -rwxr-xr-x ImageMagick/filters/MIFFtoGIF.c
# 148390 -rwxr-xr-x ImageMagick/display.c
#   2573 -rwxr-xr-x ImageMagick/X.h
#  29239 -rwxr-xr-x ImageMagick/animate.man
#   2779 -rwxr-xr-x ImageMagick/Announce
#  99539 -rwxr-xr-x ImageMagick/X.c
#    487 -rwxr-xr-x ImageMagick/animate.h
#  73911 -rwxr-xr-x ImageMagick/animate.c
#   3056 -rwxr-xr-x ImageMagick/PreR4Icccm.c
#     22 -rwxr-xr-x ImageMagick/patchlevel.h
#
if test -r _shar_seq_.tmp; then
	echo 'Must unpack archives in sequence!'
	echo Please unpack part `cat _shar_seq_.tmp` next
	exit 1
fi
# ============= ImageMagick/Imakefile ==============
if test ! -d 'ImageMagick'; then
    echo 'x - creating directory ImageMagick'
    mkdir 'ImageMagick'
fi
if test -f 'ImageMagick/Imakefile' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/Imakefile (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/Imakefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/Imakefile' &&
EXTRA_LIBRARIES= $(XLIB) -lm
PROGRAMS= display import XtoPS animate
SRCS= display.c X.c image.c kolb.c quantize.c colors.c rotate.c compress.c\
X  PreR4Icccm.c
OBJS= display.o X.o image.o kolb.o quantize.o colors.o rotate.o compress.o\
X  PreR4Icccm.o
ImportObjects= import.o X.o image.o kolb.o quantize.o rotate.o compress.o\
X  PreR4Icccm.o
XXtoPSObjects= XtoPS.o X.o image.o kolb.o quantize.o rotate.o compress.o\
X  PreR4Icccm.o
AnimateObjects= animate.o X.o image.o kolb.o quantize.o colors.o rotate.o\
X  compress.o PreR4Icccm.o
X
AllTarget($(PROGRAMS))
X
ComplexProgramTarget(display)
SingleProgramTarget(import,$(ImportObjects), , )
InstallProgram(import,$(BINDIR))
InstallManPage(import,$(MANDIR))
SingleProgramTarget(XtoPS,$(XtoPSObjects), , )
InstallProgram(XtoPS,$(BINDIR))
InstallManPage(XtoPS,$(MANDIR))
SingleProgramTarget(animate,$(AnimateObjects), , )
InstallProgram(animate,$(BINDIR))
InstallManPage(animate,$(MANDIR))
SHAR_EOF
chmod 0755 ImageMagick/Imakefile ||
echo 'restore of ImageMagick/Imakefile failed'
Wc_c="`wc -c < 'ImageMagick/Imakefile'`"
test 929 -eq "$Wc_c" ||
	echo 'ImageMagick/Imakefile: original size 929, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/Makefile ==============
if test -f 'ImageMagick/Makefile' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/Makefile (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/Makefile' &&
# Makefile generated by imake - do not edit!
# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
#
# The cpp used on this machine replaces all newlines and multiple tabs and
# spaces in a macro expansion with a single space.  Imake tries to compensate
# for this, but is not always successful.
#
X
###########################################################################
# Makefile generated from "Imake.tmpl" and <Imakefile>
# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
#
# Platform-specific parameters may be set in the appropriate .cf
# configuration files.  Site-wide parameters may be set in the file
# site.def.  Full rebuilds are recommended if any parameters are changed.
#
# If your C preprocessor doesn't define any unique symbols, you'll need
# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
# "make Makefile", "make Makefiles", or "make World").
#
# If you absolutely can't get imake to work, you'll need to set the
# variables at the top of each Makefile as well as the dependencies at the
# bottom (makedepend will do this automatically).
#
X
###########################################################################
# platform-specific configuration parameters - edit sun.cf to change
X
# platform:  $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $
# operating system:  SunOS 4.0.3
X
###########################################################################
# site-specific configuration parameters - edit site.def to change
X
# site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
X
X            SHELL = /bin/sh
X
X              TOP = .
X      CURRENT_DIR = .
X
X               AR = ar cq
X  BOOTSTRAPCFLAGS =
X               CC = cc
X
X         COMPRESS = compress
X              CPP = /lib/cpp $(STD_CPP_DEFINES)
X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
X          INSTALL = install
X               LD = ld
X             LINT = lint
X      LINTLIBFLAG = -C
X         LINTOPTS = -axz
X               LN = ln -s
X             MAKE = make
X               MV = mv
X               CP = cp
X           RANLIB = ranlib
X  RANLIBINSTFLAGS =
X               RM = rm -f
X     STD_INCLUDES =
X  STD_CPP_DEFINES =
X      STD_DEFINES =
X EXTRA_LOAD_FLAGS =
X  EXTRA_LIBRARIES =
X             TAGS = ctags
X
X    SHAREDCODEDEF = -DSHAREDCODE
X         SHLIBDEF = -DSUNSHLIB
X
X    PROTO_DEFINES =
X
X     INSTPGMFLAGS =
X
X     INSTBINFLAGS = -m 0755
X     INSTUIDFLAGS = -m 4755
X     INSTLIBFLAGS = -m 0664
X     INSTINCFLAGS = -m 0444
X     INSTMANFLAGS = -m 0444
X     INSTDATFLAGS = -m 0444
X    INSTKMEMFLAGS = -m 4755
X
X          DESTDIR =
X
X     TOP_INCLUDES = -I$(INCROOT)
X
X      CDEBUGFLAGS = -O
X        CCOPTIONS =
X      COMPATFLAGS =
X
X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS)
X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
X   LDCOMBINEFLAGS = -X -r
X
X        MACROFILE = sun.cf
X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
X
X    IMAKE_DEFINES =
X
X         IRULESRC = $(CONFIGDIR)
X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
X
X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
X			$(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
X			$(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
X
###########################################################################
# X Window System Build Parameters
# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
###########################################################################
# X Window System make variables; this need to be coordinated with rules
# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X          PATHSEP = /
X        USRLIBDIR = $(DESTDIR)/usr/lib
X           BINDIR = $(DESTDIR)/usr/bin/X11
X          INCROOT = $(DESTDIR)/usr/include
X     BUILDINCROOT = $(TOP)
X      BUILDINCDIR = $(BUILDINCROOT)/X11
X      BUILDINCTOP = ..
X           INCDIR = $(INCROOT)/X11
X           ADMDIR = $(DESTDIR)/usr/adm
X           LIBDIR = $(USRLIBDIR)/X11
X        CONFIGDIR = $(LIBDIR)/config
X       LINTLIBDIR = $(USRLIBDIR)/lint
X
X          FONTDIR = $(LIBDIR)/fonts
X         XINITDIR = $(LIBDIR)/xinit
X           XDMDIR = $(LIBDIR)/xdm
X           AWMDIR = $(LIBDIR)/awm
X           TWMDIR = $(LIBDIR)/twm
X           GWMDIR = $(LIBDIR)/gwm
X          MANPATH = $(DESTDIR)/usr/man
X    MANSOURCEPATH = $(MANPATH)/man
X           MANDIR = $(MANSOURCEPATH)n
X        LIBMANDIR = $(MANSOURCEPATH)3
X      XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X        SOXLIBREV = 4.2
X          SOXTREV = 4.0
X         SOXAWREV = 4.0
X        SOOLDXREV = 4.0
X         SOXMUREV = 4.0
X        SOXEXTREV = 4.0
X
X       FONTCFLAGS = -t
X
X     INSTAPPFLAGS = $(INSTDATFLAGS)
X
X            IMAKE = imake
X           DEPEND = makedepend
X              RGB = rgb
X            FONTC = bdftosnf
X        MKFONTDIR = mkfontdir
X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh
X
X        CONFIGSRC = $(TOP)/config
X        CLIENTSRC = $(TOP)/clients
X          DEMOSRC = $(TOP)/demos
X           LIBSRC = $(TOP)/lib
X          FONTSRC = $(TOP)/fonts
X       INCLUDESRC = $(TOP)/X11
X        SERVERSRC = $(TOP)/server
X          UTILSRC = $(TOP)/util
X        SCRIPTSRC = $(UTILSRC)/scripts
X       EXAMPLESRC = $(TOP)/examples
X       CONTRIBSRC = $(TOP)/../contrib
X           DOCSRC = $(TOP)/doc
X           RGBSRC = $(TOP)/rgb
X        DEPENDSRC = $(UTILSRC)/makedepend
X         IMAKESRC = $(CONFIGSRC)
X         XAUTHSRC = $(LIBSRC)/Xau
X          XLIBSRC = $(LIBSRC)/X
X           XMUSRC = $(LIBSRC)/Xmu
X       TOOLKITSRC = $(LIBSRC)/Xt
X       AWIDGETSRC = $(LIBSRC)/Xaw
X       OLDXLIBSRC = $(LIBSRC)/oldX
X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X     EXTENSIONSRC = $(TOP)/extensions
X
X  DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
X     EXTENSIONLIB =  -lXext
X
X          DEPXLIB = $(DEPEXTENSIONLIB)
X             XLIB = $(EXTENSIONLIB) -lX11
X
X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
X         XAUTHLIB =  -lXau
X
X        DEPXMULIB =
X           XMULIB = -lXmu
X
X       DEPOLDXLIB =
X          OLDXLIB = -loldX
X
X      DEPXTOOLLIB =
X         XTOOLLIB = -lXt
X
X        DEPXAWLIB =
X           XAWLIB = -lXaw
X
X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln
X         LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
X          LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
X        LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
X          LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
X
X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
X
X         DEPLIBS1 = $(DEPLIBS)
X         DEPLIBS2 = $(DEPLIBS)
X         DEPLIBS3 = $(DEPLIBS)
X
###########################################################################
# Imake rules for building libraries, programs, scripts, and data files
# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
X
###########################################################################
# start of Imakefile
X
EXTRA_LIBRARIES= $(XLIB) -lm
PROGRAMS= display import XtoPS animate
SRCS= display.c X.c image.c kolb.c quantize.c colors.c rotate.c compress.c\
X  PreR4Icccm.c
OBJS= display.o X.o image.o kolb.o quantize.o colors.o rotate.o compress.o\
X  PreR4Icccm.o
ImportObjects= import.o X.o image.o kolb.o quantize.o rotate.o compress.o\
X  PreR4Icccm.o
XXtoPSObjects= XtoPS.o X.o image.o kolb.o quantize.o rotate.o compress.o\
X  PreR4Icccm.o
AnimateObjects= animate.o X.o image.o kolb.o quantize.o colors.o rotate.o\
X  compress.o PreR4Icccm.o
X
all:: $(PROGRAMS)
X
X PROGRAM = display
X
all:: display
X
display: $(OBJS) $(DEPLIBS)
X	$(RM) $@
X	$(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
X
saber_display:
X	#load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X
osaber_display:
X	#load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X
install:: display
X	$(INSTALL) -c $(INSTPGMFLAGS)   display $(BINDIR)
X
install.man:: display.man
X	$(INSTALL) -c $(INSTMANFLAGS) display.man $(MANDIR)/display.n
X
depend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
lint:
X	$(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
lint1:
X	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
X
clean::
X	$(RM) $(PROGRAM)
X
import: $(ImportObjects)
X	$(RM) $@
X	$(CC) -o $@ $(ImportObjects) $(LDOPTIONS)   $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
X
clean::
X	$(RM) import
X
install:: import
X	$(INSTALL) -c $(INSTPGMFLAGS)   import $(BINDIR)
X
install.man:: import.man
X	$(INSTALL) -c $(INSTMANFLAGS) import.man $(MANDIR)/import.n
X
XXtoPS: $(XtoPSObjects)
X	$(RM) $@
X	$(CC) -o $@ $(XtoPSObjects) $(LDOPTIONS)   $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
X
clean::
X	$(RM) XtoPS
X
install:: XtoPS
X	$(INSTALL) -c $(INSTPGMFLAGS)   XtoPS $(BINDIR)
X
install.man:: XtoPS.man
X	$(INSTALL) -c $(INSTMANFLAGS) XtoPS.man $(MANDIR)/XtoPS.n
X
animate: $(AnimateObjects)
X	$(RM) $@
X	$(CC) -o $@ $(AnimateObjects) $(LDOPTIONS)   $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
X
clean::
X	$(RM) animate
X
install:: animate
X	$(INSTALL) -c $(INSTPGMFLAGS)   animate $(BINDIR)
X
install.man:: animate.man
X	$(INSTALL) -c $(INSTMANFLAGS) animate.man $(MANDIR)/animate.n
X
###########################################################################
# common rules for all Makefiles - do not edit
X
emptyrule::
X
clean::
X	$(RM_CMD) \#*
X
Makefile::
X	- at if [ -f Makefile ]; then \
X	echo "	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
tags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
saber:
X	#load $(ALLDEFINES) $(SRCS)
X
osaber:
X	#load $(ALLDEFINES) $(OBJS)
X
###########################################################################
# empty rules for directories that do not have SUBDIRS - do not edit
X
install::
X	@echo "install in $(CURRENT_DIR) done"
X
install.man::
X	@echo "install.man in $(CURRENT_DIR) done"
X
Makefiles::
X
includes::
X
###########################################################################
# dependencies generated by makedepend
X
SHAR_EOF
chmod 0755 ImageMagick/Makefile ||
echo 'restore of ImageMagick/Makefile failed'
Wc_c="`wc -c < 'ImageMagick/Makefile'`"
test 10190 -eq "$Wc_c" ||
	echo 'ImageMagick/Makefile: original size 10190, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/PreR4Icccm.h ==============
if test -f 'ImageMagick/PreR4Icccm.h' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/PreR4Icccm.h (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/PreR4Icccm.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/PreR4Icccm.h' &&
/*
X  Compatability defines for pre X11R4 ICCCM.
*/
#ifdef vms
#define XMaxRequestSize(display)  16384
#endif
X
#define XInductColormap(display,colormap)  XInstallColormap(display,colormap)
#define XUninductColormap(display,colormap)  XUninstallColormap(display,colormap)
X
typedef struct _XTextProperty
{
X  unsigned char
X    *value;
X
X  Atom
X    encoding;
X
X  int
X    format;
X
X  unsigned long
X    nitems;
} XTextProperty;
X
/*
X  Pre R4 ICCCM compatibility routines.
*/
extern int
X  XWMGeometry();
X
extern Status
X  XGetRGBColormaps(),
X  XGetWMName(),
X  XReconfigureWMWindow(),
X  XSetWMProtocols(),
X  XWithdrawWindow();
X
extern XClassHint
X  *XAllocClassHint();
X
extern XIconSize
X  *XAllocIconSize();
X
extern XSizeHints
X  *XAllocSizeHints();
X
extern XStandardColormap
X  *XAllocStandardColormap();
X
extern XWMHints
X  *XAllocWMHints();
X
extern VisualID
X  XVisualIDFromVisual();
X
extern void
X  XSetWMProperties();
SHAR_EOF
chmod 0755 ImageMagick/PreR4Icccm.h ||
echo 'restore of ImageMagick/PreR4Icccm.h failed'
Wc_c="`wc -c < 'ImageMagick/PreR4Icccm.h'`"
test 904 -eq "$Wc_c" ||
	echo 'ImageMagick/PreR4Icccm.h: original size 904, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/README ==============
if test -f 'ImageMagick/README' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/README (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/README' &&
AUTHOR
X
X  The author is cristy at dupont.com.  Comments, suggestions, or bug reports
X  are welcome, but be kind.
X
X
AVAILABLILITY
X
X  Anonymous FTP at export.lcs.mit.edu, file contrib/ImageMagick.tar.Z.
X  I will post to comp.sources.x after a short testing period to assure
X  that any bugs are fixed.
X
X
UNIX COMPILATION
X
X  Type:
X
X    uncompress ImageMagick.tar.Z
X    tar xvf ImageMagick.tar
X    cd ImageMagick
X    xmkmf
X    make
X
X  If you do not have 'xmkmf', edit 'Makefile' as required by your
X  hardware environment and type 'make'.  The included Makefile is for a
X  SUN SPARC architecture.
X
X  Finally type:
X
X    display images/mandrill.miff
X    display -monochrome -dither images/mandrill.miff
X
X  You can find other example images in the 'images' directory.
X
X  Be sure to read the manual pages for the display, import, and XtoPS
X  utilities.
X
X  The X utilites read and write MIFF images.  Refer to the end of this
X  message for more information about MIFF.  You can find filters to
X  convert to and from the MIFF format in the 'filters' directory.  Change
X  directory to the 'filters' directory and type 'make' to build them.  
X
X  Two examples of using a filter follow:
X
X    GIFtoMIFF image.gif - | display -
X
X      or
X
X    TIFFtoMIFF image.tiff image.miff
X    display image.miff
X
X  The TIFFtoMIFF and MIFFtoTIFF filters require Sam Leffler's TIFF
X  software available via FTP as ucbvax.berkeley.edu:pub/tiff/v2.2.tar.Z.
X
X  The PPMtoMIFF and MIFFtoPPM filters require Jef Poskanzer's PBMPLUS
X  software available via FTP as export.lcs.mit.edu:contrib/pbmplus.tar.Z.
X
X  I could not include my color reduction algorithm because it is
X  proprietary.  But I did include Craig Kolb's.  I have not tested his
X  algorithm extensively.
X
X
VMS COMPILATION
X
X  Type
X
X    @make
X    set display/create/node=node_name::
X
X  where node_name is the DECNET X server to contact.
X
X  Finally type:
X
X    display images/mandrill.miff
X    display -monochrome -dither images/mandrill.miff
X
ANIMATION
X  
X  To prevent colormap flashing, use a Standard Colormap or a static
X  visual.  You can define a Standard Colormap with the xstdcmap
X  command.  For example, to use the "best" Standard Colormap, type:
X
X    xstdcmap -best
X    animate -map best scenes/dna.*
X
X  or use a static visual:
X
X    animate -visual staticcolor scenes/dna.*
X
X  Images filenames may appear in any order on the command line if the
X  scene keyword is specified in the MIFF image.  A scene is specified
X  when converting from another image format to MIFF by using the
X  "scene" option with any filter.  To convert a TIFF images to a MIFF
X  image as scene #2, type:
X
X    TIFFtoMIFF -scene 2 image.tiff image.miff
X
NOTES
X
X  1.  If you get a compile error on XTextProperty in PreR4Icccm.h, change it to 
X      _XTextProperty. If you get a compile error on XVisualIDFromVisual 
X      in PreR4Icccm.c, change it to _XVisualIDFromVisual.
X
X  2.  24 bit images are reduced to 244 colors on an 8 bit display to help
X      prevent colormap flashing.  If you want all 256 colors, type
X
X        display -colors 256 image.miff
X
X      To further help reduce colormap flashing, do not install the default
X      standard colormap (RGB_DEFAULT_MAP).
X
X  3.  If you have an 8 bit server and need to look at a 24 bit image
X      frequently, reduce the number of colors to 256 once and write to
X      a new image.  Then display this new image.  For example,
X
X        display -colors 256 -dither -write image.8bit image.24bit
X        display image.8bit
X
X  4.  Use the import program to read any X window into a file that the
X      display program can read.  Use the XtoPS utility to read any X
X      window and output it as Postscript.
X
X  5.  Machine dependancies:
X
X      For MacX, set the DISPLAY variable to host:0.2 for the color rootless
X      window.
X
X      I suspect all the following problems will be fixed when these
X      vendors upgrade to X11R4.  I find conditional compilation
X      statements offensive.  So if you have any of the following
X      problems, the fix must be applied manually.
X
X      HP machines using Motif do not always generate an initial
X      exposure event and therefore requires an extra XPutimage
X      immediately following the X event loop in display.c.  The code 
X      should look like this:
X
X        /*
X            Respond to events.
X        */
X        XPutImage(display,image_window.id,image_window.graphic_context,
X          image_window.ximage,0,0,0,0,image_window.width,image_window.height);
X
X      MIPS does not always generate exposure events correctly when
X      displaying a monochrome image on their color server.  Holes in the
X      image may appear when an area is blocked then exposed.  I do not
X      currently have a solution for this problem.
X
X      On the Stardent put
X
X        *installColormap:  on
X
X      in your X resource file.
X
X  6.  I never had a chance to test this on a 16 bit machine.  If someone
X      gets it working let me know and send any bug fixes.  Perhaps I
X      should change 'unsigned int' to 'unsigned long'.
X
X  7.  Scanned images may not benefit from my runlength-encoded
X      compression.  To store images uncompressed, use this command:
X
X        display +display +compress -write uncompressed.image compressed.image
X
X  8.  On occasion, a window manager (twm) may get in strange state which will 
X      cause the display program to work improperly.  Fix this by restarting the
X      window manager.
X
X  9.  If the image is displayed with incorrect colors, try using a different
X      visual.  Type xdpyinfo and choose an alternative visual (if one exists)
X      by either visual class or visual id.  For example, to specifically 
X      choose a PseudoColor visual on a server that supports it, type
X
X        display -visual pseudocolor image.miff
X
X 10.  Make sure that the include file math.h defines the function atof as
X      type double.  Otherwise the -gamma option will not work properly.
X
X
MIFF IMAGE FORMAT
X
X  MIFF is an image format, which I developed.  I like it because it
X
X    1) It is machine independant.  It can be read on virtually any computer.  
X       No byte swapping is necessary.
X
X    2) It has a text header.  Most image formats are coded in binary and you
X       cannot easily tell attributes about the image.  Use 'more' on MIFF
X       image files and the attributes are displayed in text form.
X
X    3) It can handle runlength-encoded images.  Although most scanned images
X       do not benefit from runlength-encoding, most computer-generated images
X       do.  Images of mostly uniform colors have a high compression ratio and
X       therefore take up less memory and disk space.
X
X  One way to get an image into MIFF format is to use one of the filters in
X  the 'filters' directory or read it from an X window using the
X  'import' program.  Alternatively, type the necessary header
X  information in a file with a text editor.  Next, dump the binary
X  bytes into another file.  Finally, type
X
X    cat header binary_image | display -write image.miff -
X
X  For example, suppose you have a raw red, green, blue image file on disk
X  that is 640 by 480.  The header file would look like this:
X
X    id=ImageMagick columns=640 rows=480 :
X
X  The image file would have red, green, blue tuples (rgbrgbrgb...).
X
X  Refer to the 'display' manual page for more details.
X
ACKNOWLEDGEMENTS
X
X  Stuart Kemp (cpsrk at marlin.jcu.edu.au) for discovering that the 
X  Postscript in image.c did not clear the stack properly.
X
COPYRIGHT
X
X  Copyright 1990 E. I. Dupont de Nemours & Company
X
X  Permission to use, copy, modify, distribute, and sell this software and
X  its documentation for any purpose is hereby granted without fee,
X  provided that the above copyright notice appear in all copies and that
X  both that copyright notice and this permission notice appear in
X  supporting documentation, and that the name of E. I. Dupont de Nemours
X  & Company not be used in advertising or publicity pertaining to
X  distribution of the software without specific, written prior
X  permission.  E. I. Dupont de Nemours & Company makes no representations
X  about the suitability of this software for any purpose.  It is provided
X  "as is" without express or implied warranty.
X
X  E. I. Dupont de Nemours & Company disclaims all warranties with regard
X  to this software, including all implied warranties of merchantability
X  and fitness, in no event shall E. I. Dupont de Nemours & Company be
X  liable for any special, indirect or consequential damages or any
X  damages whatsoever resulting from loss of use, data or profits, whether
X  in an action of contract, negligence or other tortious action, arising
X  out of or in connection with the use or performance of this software.
SHAR_EOF
chmod 0755 ImageMagick/README ||
echo 'restore of ImageMagick/README failed'
Wc_c="`wc -c < 'ImageMagick/README'`"
test 8665 -eq "$Wc_c" ||
	echo 'ImageMagick/README: original size 8665, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/XtoPS.c ==============
if test -f 'ImageMagick/XtoPS.c' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/XtoPS.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/XtoPS.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/XtoPS.c' &&
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                     X   X  TTTTT   OOO   PPPP   SSSSS                       %
%                      X X     T    O   O  P   P  S                           %
%                       X      T    O   O  PPPP    SSS                        %
%                      X X     T    O   O  P          S                       %
%                     X   X    T     OOO   P      SSSSS                       %
%                                                                             %
%                                                                             %
%                  Import X11 image to a Postscript format.                   %
%                                                                             %
%                                                                             %
%                           Software Design                                   %
%                             John Cristy                                     %
%                            January  1991                                    %
%                                                                             %
%                                                                             %
%  Copyright 1991 E. I. Dupont de Nemours & Company                           %
%                                                                             %
%  Permission to use, copy, modify, distribute, and sell this software and    %
%  its documentation for any purpose is hereby granted without fee,           %
%  provided that the above Copyright notice appear in all copies and that     %
%  both that Copyright notice and this permission notice appear in            %
%  supporting documentation, and that the name of E. I. Dupont de Nemours     %
%  & Company not be used in advertising or publicity pertaining to            %
%  distribution of the software without specific, written prior               %
%  permission.  E. I. Dupont de Nemours & Company makes no representations    %
%  about the suitability of this software for any purpose.  It is provided    %
%  "as is" without express or implied warranty.                               %
%                                                                             %
%  E. I. Dupont de Nemours & Company disclaims all warranties with regard     %
%  to this software, including all implied warranties of merchantability      %
%  and fitness, in no event shall E. I. Dupont de Nemours & Company be        %
%  liable for any special, indirect or consequential damages or any           %
%  damages whatsoever resulting from loss of use, data or profits, whether    %
%  in an action of contract, negligence or other tortious action, arising     %
%  out of or in connection with the use or performance of this software.      %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  XtoPS is an X Window System window dumping utility.  XtoPS reads an
%  image from any visible window on an X server and outputs it to an
%  encapsulated Postscript file.  You can view this file with any
%  Postscript compatible viewer or printer.  The image is displayed in
%  color on viewers or printers that support color Postscript, otherwise
%  it is displayed as grayscale.  The target window can be specified by id
%  or name or be selected by clicking the mouse in the desired window.
%  The keyboard bell is rung once at the beginning of the dump and twice
%  when the dump is completed.
%
%  The XtoPS program command syntax is: 
%
%  Usage: XtoPS [options ...] file
%
%  Where options include:
%    -border             include image borders in the output image
%    -display server     X server to contact
%    -frame              include window manager frame
%    -geometry geometry  preferred size and location of the image 
%    -id number          select window with this resource id
%    -monochrome         transform image to black and white
%    -name name          select window with this WM_NAME property
%    -root               select root window
%    -rotate degrees     apply Paeth rotation to the image
%    -scale geometry     preferred size factors of the image
%    -screen             select image from root window
%
%  Change '-' to '+' in any option above to reverse its effect.
%  For example, +frame means do not window manager frame.
%
%  Specify 'file' as '-' for standard input or output.
%
%
*/
X
/*
X  Include declarations.
*/
#include "display.h"
#include "image.h"
#include "X.h"
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   E r r o r                                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function Error displays an error message and then terminates the program.
%
%  The format of the Error routine is: 
%
%      Error(message,qualifier)
%
%  A description of each parameter follows: 
%
%    o message: Specifies the message to display before terminating the
%      program.
%
%    o qualifier: Specifies any qualifier to the message.
%
%
*/
void Error(message,qualifier)
char
X  *message,
X  *qualifier;
{
X  (void) fprintf(stderr,"%s: %s",application_name,message);
X  if (qualifier != (char *) NULL)
X    (void) fprintf(stderr," (%s)",qualifier);
X  (void) fprintf(stderr,".\n");
X  exit(1);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   U s a g e                                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Procedure Usage displays the program usage;
%
%  The format of the Usage routine is:
%
%      Usage(message)
%
%  A description of each parameter follows:
%
%    message:Specifies a specific message to display to the user.
%
*/
static void Usage(message)
char
X  *message;
{
X  char
X    **p;
X
X  static char
X    *options[]=
X    {
X      "-border             include image borders in the output image",
X      "-display server     X server to contact",
X      "-frame              include window manager frame",
X      "-geometry geometry  preferred size and location of the image",
X      "-id number          select window with this resource id",
X      "-monochrome         transform image to black and white",
X      "-name name          select window with this WM_NAME property",
X      "-root               select root window",
X      "-rotate degrees     apply Paeth rotation to the image",
X      "-scale geometry     preferred size factors of the image",
X      "-screen             select image from root window",
X      (char *) NULL
X    };
X  if (message != (char *) NULL)
X    (void) fprintf(stderr,"Can't continue, %s.\n\n",message);
X  (void) fprintf(stderr,"Usage: %s [options ...] file\n",application_name);
X  (void) fprintf(stderr,"\nWhere options include:\n");
X  for (p=options; *p != (char *) NULL; p++)
X    (void) fprintf(stderr,"  %s\n",*p);
X  (void) fprintf(stderr,
X    "\nChange '-' to '+' in any option above to reverse its effect.\n");
X  (void) fprintf(stderr,
X    "For example, +frame means do not include window manager frame.\n");
X  (void) fprintf(stderr,"\nSpecify 'file' as '-' for standard output.\n");
X  exit(1);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%    M a i n                                                                  %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
*/
int main(argc,argv)
int
X  argc;
X
char
X  *argv[];
{
X  char
X    *filename,
X    *image_geometry,
X    *option,
X    *scale_geometry,
X    *server_name,
X    *user_default;
X
X  Display
X    *display;
X
X  Image
X    *image;
X
X  int
X    degrees,
X    i;
X
X  unsigned int
X    borders,
X    frame,
X    j,
X    monochrome,
X    screen;
X
X  Window
X    client_window,
X    root_window,
X    target_window;
X
X  /*
X    Display usage profile if there are no command line arguments.
X  */
X  application_name=(*argv);
X  if (argc < 2)
X    Usage((char *) NULL);
X  /*
X    Connect to X server.
X  */
X  server_name=(char *) NULL;
X  for (i=1; i < argc; i++)
X  {
X    /*
X      Check command line for server name.
X    */
X    option=argv[i];
X    if ((strlen(option) > 1) && ((*option == '-') || (*option == '+')))
X      if (strncmp("dis",option+1,3) == 0)
X        {
X          /*
X            User specified server name.
X          */
X          i++;
X          if (i == argc)
X            Usage("missing server name on -display");
X          server_name=argv[i];
X          break;
X        }
X  }
X  display=XOpenDisplay(server_name);
X  if (display == (Display *) NULL)
X    Error("unable to connect to X server",XDisplayName(server_name));
X  root_window=XRootWindow(display,XDefaultScreen(display));
X  /*
X    Get X defaults.
X  */
X  user_default=XGetDefault(display,application_name,"borders");
X  borders=IsTrue(user_default);
X  user_default=XGetDefault(display,application_name,"degrees");
X  degrees=(user_default == (char *) NULL) ? 0 : atoi(user_default);
X  user_default=XGetDefault(display,application_name,"geometry");
X  if (user_default == (char *) NULL)
X    user_default=XGetDefault(display,application_name,"Geometry");
X  image_geometry=user_default;
X  user_default=XGetDefault(display,application_name,"frame");
X  frame=IsTrue(user_default);
X  user_default=XGetDefault(display,application_name,"monochrome");
X  monochrome=IsTrue(user_default);
X  user_default=XGetDefault(display,application_name,"scale");
X  if (user_default == (char *) NULL)
X    user_default=XGetDefault(display,application_name,"Scale");
X  scale_geometry=user_default;
X  user_default=XGetDefault(display,application_name,"screen");
X  screen=IsTrue(user_default);
X  /*
X    Check command syntax.
X  */
X  filename=(char *) NULL;
X  target_window=(Window) NULL;
X  for (i=1; i < argc; i++)
X  {
X    option=argv[i];
X    if ((strlen(option) < 2) || ((*option != '-') && (*option != '+')))
X      filename=argv[i];
X    else
X      switch(*(option+1))
X      {
X        case 'b':
X        {
X          borders=(*option == '-');
X          break;
X        }
X        case 'd':
X        {
X          /*
X            User specified server name.
X          */
X          i++;
X          if (i == argc)
X            Usage("missing server name on -display");
X          server_name=argv[i];
X          break;
X        }
X        case 'g':
X        {
X          /*
X            User specified server name.
X          */
X          i++;
X          if (i == argc)
X            Usage("missing geometry on -geometry");
X          image_geometry=argv[i];
X          break;
X        }
X        case 'h':
X        {
X          Usage((char *) NULL);
X          break;
X        }
X        case 'f':
X        {
X          frame=(*option == '-');
X          break;
X        }
X        case 'i':
X        {
X          i++;
X          if (i == argc)
X            Usage("missing id on -id");
X          option=argv[i];
X          target_window=(Window) strtol(option,(char **) NULL,0);
X          break;
X        }
X        case 'm':
X        {
X          monochrome=(*option == '-');
X          break;
X        }
X        case 'n':
X        {
X          i++;
X          if (i == argc)
X            Usage("missing name on -name");
X          option=argv[i]; 
X          target_window=XWindowByName(display,root_window,option);
X          if (target_window == (Window) NULL)
X            (void) fprintf(stderr,"No window with name %s exists!\n",option);
X          break;
X        }
X        case 'r': 
X        {
X          if (strncmp("roo",option+1,3) == 0)
X            target_window=root_window;
X          else
X            if (strncmp("rot",option+1,3) == 0)
X              {
X                degrees=0.0;
X                if (*option == '-')
X                  {
X                    i++;
X                    if (i == argc)
X                      Usage("missing degrees on -rotate");
X                    degrees=atoi(argv[i]);
X                  }
X              }
X            else
X              Usage(option);
X          break;
X        }
X        case 's': 
X        {
X          if (strncmp("scale",option+1,4) == 0)
X            {
X              scale_geometry=(char *) NULL;
X              if (*option == '-')
X                {
X                  i++;
X                  if (i == argc)
X                    Usage("missing scale geometry on -scale");
X                  scale_geometry=argv[i];
X                }
X              }
X            else
X              if (strncmp("screen",option+1,4) == 0)
X                screen=(*option == '-');
X              else
X                Usage((char *) NULL);
X          break;
X        }
X        default:
X          Usage((char *) NULL);
X      }
X  }
X  if (filename == (char *) NULL)
X    Usage("missing an image file name");
X  /*
X    If the window is not specified, let the user choose one with the mouse.
X  */
X  if (target_window == (Window) NULL)
X    target_window=XSelectWindow(display,root_window);
X  client_window=target_window;
X  if (target_window != root_window)
X    if (XGetGeometry(display,target_window,&root_window,&i,&i,&j,&j,&j,&j) != 0)
X      {
X        /*
X          Get client window.
X        */
X        client_window=XClientWindow(display,target_window);
X        if (!frame)
X          target_window=client_window;
X      }
X  image=XReadImage(display,root_window,target_window,client_window,screen,
X    borders);
X  if (image == (Image *) NULL)
X    exit(1);
X  if (image_geometry || scale_geometry)
X    image=TransformImage(image,(char *) NULL,image_geometry,scale_geometry);
X  if ((degrees % 360) != 0)
X    {
X      Image
X        *rotated_image;
X
X      /*
X        Rotate image.
X      */
X      rotated_image=RotateImage(image,(double) degrees,False);
X      if (rotated_image != (Image *) NULL)
X        {
X          DestroyImage(image);
X          image=rotated_image;
X        }
X    }
X  if (monochrome)
X    {
X      register unsigned int
X        bit;
X
X      /*
X        Convert image to monochrome PseudoColor class.
X      */
X      (void) QuantizeImage(image,2,0,False,True);
X      bit=Intensity(image->colormap[0]) > Intensity(image->colormap[1]);
X      image->colormap[bit].red=0;
X      image->colormap[bit].green=0;
X      image->colormap[bit].blue=0;
X      image->colormap[!bit].red=255;
X      image->colormap[!bit].green=255;
X      image->colormap[!bit].blue=255;
X    }
X  (void) strcpy(image->filename,filename);
X  (void) fprintf(stderr,"%s %dx%d\n",image->filename,image->columns,
X    image->rows);
X  (void) PrintImage(image,image_geometry);
X  DestroyImage(image);
X  return(False);
}
SHAR_EOF
chmod 0755 ImageMagick/XtoPS.c ||
echo 'restore of ImageMagick/XtoPS.c failed'
Wc_c="`wc -c < 'ImageMagick/XtoPS.c'`"
test 16185 -eq "$Wc_c" ||
	echo 'ImageMagick/XtoPS.c: original size 16185, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/XtoPS.man ==============
if test -f 'ImageMagick/XtoPS.man' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/XtoPS.man (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/XtoPS.man (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/XtoPS.man' &&
.ad l
.nh
.TH XtoPS 1 "1 January 1991" "X Version 11"
.SH NAME
XXtoPS - dump an image of an X window as encapsulated Postscript
.SH SYNOPSIS
.B "XtoPS"
[ \fIoptions\fP ... ] \fIfile\fP
.SH DESCRIPTION
.PP
.I XtoPS
is an X Window System window dumping utility.
.I XtoPS
reads an image from any visible window on an X server and outputs it to
an encapsulated Postscript file.  You can view this file with any
Postscript compatible viewer or printer.  The image is displayed in
color on Postscript viewers or printers that support color, otherwise
it is displayed as grayscale.
.pp
The target window can be specified by id or name or be selected by
clicking the mouse in the desired window.  The keyboard bell is rung
once at the beginning of the dump and twice when the dump is
completed.
.SH EXAMPLES
.PP
To select a X window and save it as encapsulated Postscript in a file on 
disk titled window.ps, use:
.PP
X     XtoPS window.ps
.PP
To select a X window and save it as encapsulated Postscript in a file on
disk titled figure.ps to include in another document, use:
.PP
X     XtoPS -geometry +0+0 figure.ps
.PP
To save the entire X server screen as encapsulated Postscript in a file on
disk titled root.ps, use:
.PP
X     XtoPS -root root.ps
.SH OPTIONS
\fIXtoPS\fP options can appear on the command line or in your X resources
file (see X(1)).  Options on the command line supercede values specified
in your X resources file.
.TP 5
.B "-border"
include image borders in the output image.
.TP 5
.B "-display \fIhost:display[.screen]\fP"
specifies the X server to contact; see \fBX(1)\fP.
.TP 5
.B "-frame"
include window manager frame.
.TP 5
.B "-geometry \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
preferred size and location of the image on the Postscript page.  
See \fBX(1)\fP for details about the geometry specification.  By default, 
the image is centered and scaled to fit on the Postscript page.
X
If the specified image size is smaller than the actual image size, the
image is first reduced to an integral of the specified image size with
an antialias digital filter.  The image is then scaled to the exact
specified image size with pixel replication.  If the specified image
size is greater than the actual image size, the image is first enlarged
to an integral of the specified image size with bilinear
interpolation.  The image is then scaled to the exact specified image
size with pixel replication.
.TP 5
.B "-id \fIvalue\fP"
select window with this resource id.
X
See \fBxwininfo(1)\fP for one way of listing window resource id's.
.TP 5
.B "-monochrome"
transform image to black and white.
.TP 5
.B "-name \fIname\fP"
select window with this WM_NAME property.
X
See \fBxprop(1)\fP for one way of listing window property's.
.TP 5
.B "-root"
select root window.
.TP 5
.B "-rotate \fIdegrees\fP"
apply Paeth image rotation to the image.
X
By default the image is output in portrait mode.  Use \fB-rotate 90\fP to
display the image in landscape mode.
.TP 5
.B "-scale \fI<width factor>x<height factor>\fP"
preferred size factors of the image.
X
This option behaves like \fB-geometry\fP except the width and height values
are relative instead of absolute.  The image size is multiplied by the
width and height factors to obtain the final image dimensions.  If only
one factor is specified, both the width and height factors assume the
value.
X
Factors may be fractional.  For example, a factor of 1.5 will increase the
image size by one and one-half.
.TP 5
.B "-screen"
This option indicates that the GetImage request used to obtain the image
should be done on the root window, rather than directly on the specified
window.  In this way, you can obtain pieces of other windows that overlap
the specified window, and more importantly, you can capture menus or other
popups that are independent windows but appear over the specified window.
.PP
Change \fI-\fP to \fI+\fP in any option above to reverse its effect.  For
example \fB+frame\fP means do not include window manager frame.
.PP
Specify \fIfile\fP as \fI-\fP for standard input or output.
.PP
.SH ENVIRONMENT
.PP
.TP 5
.B DISPLAY
To get the default host, display number, and screen.
.SH SEE ALSO
XX(1), display(1), import(1)
.SH COPYRIGHT
Copyright 1991 E. I. Dupont de Nemours & Company                           
.PP                                                                           
Permission to use, copy, modify, distribute, and sell this software and    
its documentation for any purpose is hereby granted without fee,           
provided that the above copyright notice appear in all copies and that     
both that copyright notice and this permission notice appear in            
supporting documentation, and that the name of E. I. Dupont de Nemours     
& Company not be used in advertising or publicity pertaining to            
distribution of the software without specific, written prior               
permission.  E. I. Dupont de Nemours & Company makes no representations    
about the suitability of this software for any purpose.  It is provided    
"as is" without express or implied warranty.                               
.PP
E. I. Dupont de Nemours & Company disclaims all warranties with regard     
to this software, including all implied warranties of merchantability      
and fitness, in no event shall E. I. Dupont de Nemours & Company be        
liable for any special, indirect or consequential damages or any           
damages whatsoever resulting from loss of use, data or profits, whether    
in an action of contract, negligence or other tortious action, arising     
out of or in connection with the use or performance of this software.      
.SH AUTHORS
John Cristy, E.I. DuPont De Nemours & Company Incorporated
X
SHAR_EOF
chmod 0755 ImageMagick/XtoPS.man ||
echo 'restore of ImageMagick/XtoPS.man failed'
Wc_c="`wc -c < 'ImageMagick/XtoPS.man'`"
test 5731 -eq "$Wc_c" ||
	echo 'ImageMagick/XtoPS.man: original size 5731, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/Manifest.ps ==============
if test -f 'ImageMagick/Manifest.ps' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/Manifest.ps (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/Manifest.ps (Binary)'
sed 's/^X//' << 'SHAR_EOF' > _shar_tmp_.tmp &&
begin 600 ImageMagick/Manifest.ps
M)2%04RU!9&]B92TR+C`@15!31BTR+C`*)254:71L93H@*$1I<F5C=&]R>2!M
M87`@;V8 at 26UA9V5-86=I8VLI"B4E0W)E871O<CH@<'-T<F5E+"`H0RD@,3DY
M,"!':7-L92!!87,L($Y2"B4E1&]C=6UE;G1&;VYT<SH at 5&EM97,M4F]M86X*
M)25";W5N9&EN9T)O>#H at -C`@.3(@,S`U(#<T, at HV,"XP(#`@=')A;G-L871E
M"B]S('MS:&]W?2!B:6YD(&1E9 at HO;2![;6]V971O?2!B:6YD(&1E9 at HO5&EM
M97,M4F]M86X at 9FEN9&9O;G0@,3`@<V-A;&5F;VYT('-E=&9O;G0*,"XQ('-E
M=&QI;F5W:61T:`HY,"`W,S(@;2A!;FYO=6YC92ES"CDP(#<R,B!M*$EM86ME
M9FEL92ES"CDP(#<Q,B!M*$UA:V4N8V]M*7,*.3`@-S`R(&TH36%K969I;&4I
M<PHY,"`V.3(@;2A-86YI9F5S="YP<RES"CDP(#8X,B!M*%!R95(T26-C8VTN
M8RES"CDP(#8W,B!M*%!R95(T26-C8VTN:"ES"CDP(#8V,B!M*%)%041-12ES
M"CDP(#8U,B!M*%@N8RES"CDP(#8T,B!M*%@N:"ES"CDP(#8S,B!M*%AT;U!3
M+F,I<PHY,"`V,C(@;2A8=&]04RYM86XI<PHY,"`V,3(@;2AA;FEM871E+F,I
M<PHY,"`V,#(@;2AA;FEM871E+F at I<PHY,"`U.3(@;2AA;FEM871E+FUA;BES
M"CDP(#4X,B!M*&-O;&]R<RYC*7,*.3`@-3<R(&TH8V]M<')E<W,N8RES"CDP
M(#4V,B!M*&1I<W!L87DN8RES"CDP(#4U,B!M*&1I<W!L87DN:"ES"CDP(#4T
M,B!M*&1I<W!L87DN;6%N*7,*,3 at P(#4S,B!M*$%64W1O34E&1BYC*7,*,3 at P
M(#4R,B!M*$=)1G1O34E&1BYC*7,*,3 at P(#4Q,B!M*$=205ET;TU)1D8N8RES
M"C$X,"`U,#(@;2A);6%K969I;&4I<PHQ.#`@-#DR(&TH34E&1G1O0593+F,I
M<PHQ.#`@-#@R(&TH34E&1G1O1TE&+F,I<PHQ.#`@-#<R(&TH34E&1G1O1U)!
M62YC*7,*,3 at P(#0V,B!M*$U)1D9T;TU45BYC*7,*,3 at P(#0U,B!M*$U)1D9T
M;U!032YC*7,*,3 at P(#0T,B!M*$U)1D9T;U)'0BYC*7,*,3 at P(#0S,B!M*$U)
M1D9T;U-53BYC*7,*,3 at P(#0R,B!M*$U)1D9T;U1)1D8N8RES"C$X,"`T,3(@
M;2A-249&=&]80DTN8RES"C$X,"`T,#(@;2A-249&=&]85T0N8RES"C$X,"`S
M.3(@;2A-5%9T;TU)1D8N8RES"C$X,"`S.#(@;2A-86ME9FEL92ES"C$X,"`S
M-S(@;2A04$UT;TU)1D8N8RES"C$X,"`S-C(@;2A214%$344I<PHQ.#`@,S4R
M(&TH4D="=&]-249&+F,I<PHQ.#`@,S0R(&TH4U5.=&]-249&+F,I<PHQ.#`@
M,S,R(&TH5$E&1G1O34E&1BYC*7,*,3 at P(#,R,B!M*%1)1D9T;U-53BES"C$X
M,"`S,3(@;2A4249&=&]354XN8RES"C$X,"`S,#(@;2A63U)4=&]-249&+F,I
M<PHQ.#`@,CDR(&TH6$)-=&]-249&+F,I<PHQ.#`@,C at R(&TH6%=$=&]-249&
M+F,I<PHY,"`T,#<@;2AF:6QT97)S*7,**&9I;'1E<G,I('-T<FEN9W=I9'1H
M('!O<"`Y,2XP(&%D9"`T,3`N,R!M"EL at -3,U+C, at -3(U+C, at -3$U+C, at -3`U
M+C, at -#DU+C, at -#@U+C, at -#<U+C, at -#8U+C, at -#4U+C, at -#0U+C, at -#,U+C,@
M-#(U+C, at -#$U+C, at -#`U+C,@,SDU+C,@,S at U+C,@,S<U+C,@,S8U+C,@,S4U
M+C,@,S0U+C,@,S,U+C,@,S(U+C,@,S$U+C,@,S`U+C,@,CDU+C,@,C at U+C-=
M"GMG<V%V92`Q-S8N,"!E>&-H(&QI;F5T;R!S=')O:V4 at 9W)E<W1O<F5](&9O
M<F%L;`HY,"`R-S(@;2AI;6%G92YC*7,*.3`@,C8R(&TH:6UA9V4N:"ES"C$X
M,"`R-3(@;2AD;F$N;6EF9BES"C$X,"`R-#(@;2AM86YD<FEL;"YM:69F*7,*
M,3 at P(#(S,B!M*'-W86XN;6EF9BES"C$X,"`R,C(@;2AT86)L92YM:69F*7,*
M.3`@,C,W(&TH:6UA9V5S*7,**&EM86=E<RD@<W1R:6YG=VED=&@@<&]P(#DQ
M+C`@861D(#(T,"XS(&T*6R`R-34N,R`R-#4N,R`R,S4N,R`R,C4N,UT*>V=S
M879E(#$W-BXP(&5X8V@@;&EN971O('-T<F]K92!G<F5S=&]R97T at 9F]R86QL
M"CDP(#(Q,B!M*&EM<&]R="YC*7,*.3`@,C`R(&TH:6UP;W)T+FUA;BES"CDP
M(#$Y,B!M*&MO;&(N8RES"CDP(#$X,B!M*'%U86YT:7IE+F,I<PHY,"`Q-S(@
M;2AR;W1A=&4N8RES"CDP(#$V,B!M*'-C96YE<RES"C$X,"`Q-3(@;2A);6%K
M969I;&4I<PHQ.#`@,30R(&TH36%K969I;&4I<PHQ.#`@,3,R(&TH4D5!1$U%
M*7,*,3 at P(#$R,B!M*')E9W5L87(N8RES"C$X,"`Q,3(@;2AR96=U;&%R+F at I
M<PHQ.#`@,3`R(&TH>'1P+F,I<PHQ.#`@.3(@;2AX='`N;6%N*7,*.3`@,3(R
M(&TH>'1P*7,**'AT<"D@<W1R:6YG=VED=&@@<&]P(#DQ+C`@861D(#$R-2XS
M(&T*6R`Q-34N,R`Q-#4N,R`Q,S4N,R`Q,C4N,R`Q,34N,R`Q,#4N,R`Y-2XS
M70I[9W-A=F4@,3<V+C`@97AC:"!L:6YE=&\@<W1R;VME(&=R97-T;W)E?2!F
M;W)A;&P*,"`T,C<@;2A);6%G94UA9VEC:RES"BA);6%G94UA9VEC:RD@<W1R
M:6YG=VED=&@@<&]P(#$N,"!A9&0 at -#,P+C,@;0I;(#<S-2XS(#<R-2XS(#<Q
M-2XS(#<P-2XS(#8Y-2XS(#8X-2XS(#8W-2XS(#8V-2XS(#8U-2XS(#8T-2XS
M(#8S-2XS(#8R-2XS(#8Q-2XS(#8P-2XS(#4Y-2XS(#4X-2XS(#4W-2XS(#4V
M-2XS(#4U-2XS(#4T-2XS(#0Q,"XS(#(W-2XS(#(V-2XS(#(T,"XS(#(Q-2XS
M(#(P-2XS(#$Y-2XS(#$X-2XS(#$W-2XS(#$V-2XS(#$R-2XS70I[9W-A=F4@
M.#8N,"!E>&-H(&QI;F5T;R!S=')O:V4 at 9W)E<W1O<F5](&9O<F%L;`IS:&]W
%<&%G90IE
`
end
SHAR_EOF
echo 'uudecoding file ImageMagick/Manifest.ps' &&
uudecode < _shar_tmp_.tmp && rm -f _shar_tmp_.tmp &&
chmod 0755 ImageMagick/Manifest.ps ||
echo 'restore of ImageMagick/Manifest.ps failed'
Wc_c="`wc -c < 'ImageMagick/Manifest.ps'`"
test 2570 -eq "$Wc_c" ||
	echo 'ImageMagick/Manifest.ps: original size 2570, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/colors.c ==============
if test -f 'ImageMagick/colors.c' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/colors.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/colors.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/colors.c' &&
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%                  CCCC   OOO   L       OOO   RRRR    SSSSS                   %
%                 C      O   O  L      O   O  R   R   SS                      %
%                 C      O   O  L      O   O  RRRR     SSS                    %
%                 C      O   O  L      O   O  R R        SS                   %
%                  CCCC   OOO   LLLLL   OOO   R  R    SSSSS                   %
%                                                                             %
%                                                                             %
%                       Count the Colors in an Image                          %
%                                                                             %
%                                                                             %
%                                                                             %
%                           Software Design                                   %
%                             John Cristy                                     %
%                            January  1991                                    %
%                                                                             %
%                                                                             %
%  Copyright 1991 E. I. Dupont de Nemours & Company                           %
%                                                                             %
%  Permission to use, copy, modify, distribute, and sell this software and    %
%  its documentation for any purpose is hereby granted without fee,           %
%  provided that the above Copyright notice appear in all copies and that     %
%  both that Copyright notice and this permission notice appear in            %
%  supporting documentation, and that the name of E. I. Dupont de Nemours     %
%  & Company not be used in advertising or publicity pertaining to            %
%  distribution of the software without specific, written prior               %
%  permission.  E. I. Dupont de Nemours & Company makes no representations    %
%  about the suitability of this software for any purpose.  It is provided    %
%  "as is" without express or implied warranty.                               %
%                                                                             %
%  E. I. Dupont de Nemours & Company disclaims all warranties with regard     %
%  to this software, including all implied warranties of merchantability      %
%  and fitness, in no event shall E. I. Dupont de Nemours & Company be        %
%  liable for any special, indirect or consequential damages or any           %
%  damages whatsoever resulting from loss of use, data or profits, whether    %
%  in an action of contract, negligence or other tortious action, arising     %
%  out of or in connection with the use or performance of this software.      %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%
*/
X
/*
X  Include declarations.
*/
#include "display.h"
#include "image.h"
/*
X  Define declarations.
*/
#define MaxTreeDepth  8  /* Log2(MaxRgb) */
#define NodesInAList  2047
X
/*
X  Structures.
*/
typedef struct _Node
{
X  struct _Node
X    *child[8];
X
X  unsigned char
X    mid_red,
X    mid_green,
X    mid_blue;
} Node;
X
typedef struct _Nodes
{
X  Node
X    nodes[NodesInAList];
X
X  struct _Nodes
X    *next;
} Nodes;
X
typedef struct _Cube
{
X  Node
X    *root,
X    *leaf;
X
X  unsigned int
X    colors;
X
X  unsigned int
X    free_nodes;
X
X  Node
X    *node;
X
X  Nodes
X    *node_list;
} Cube;
X
/*
X  Global variables.
*/
static Cube
X  cube;
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%  I n i t i a l i z e N o d e                                                %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function InitializeNode allocates memory for a new node in the color cube
%  tree and presets all fields to zero.
%
%  The format of the InitializeNode routine is: 
%
%      node=InitializeNode(mid_red,mid_green,mid_blue)
%
%  A description of each parameter follows.
%
%    o mid_red: Specifies the mid point of the red axis for this node.
%
%    o mid_green: Specifies the mid point of the green axis for this node.
%
%    o mid_blue: Specifies the mid point of the blue axis for this node.
%
%
*/
static Node *InitializeNode(mid_red,mid_green,mid_blue)
register unsigned char
X  mid_red,
X  mid_green,
X  mid_blue;
{
X  register int
X    i;
X
X  register Node
X    *node;
X
X  if (cube.free_nodes == 0)
X    {
X      register Nodes
X        *nodes;
X
X      /*
X        Allocate a new nodes of nodes.
X      */
X      nodes=(Nodes *) malloc(sizeof(Nodes));
X      if (nodes == (Nodes *) NULL)
X        return((Node *) NULL);
X      nodes->next=cube.node_list;
X      cube.node_list=nodes;
X      cube.node=nodes->nodes;
X      cube.free_nodes=NodesInAList;
X    }
X  cube.free_nodes--;
X  node=cube.node++;
X  for (i=0; i < 8; i++)
X    node->child[i]=(Node *) NULL;
X  node->mid_red=mid_red;
X  node->mid_green=mid_green;
X  node->mid_blue=mid_blue;
X  return(node);
}
X
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%  N u m b e r C o l o r s                                                    %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Function NumberColors returns the number of unique colors in an image.
%
%  The format of the NumberColors routine is: 
%
%      number_colors=NumberColors(image)
%
%  A description of each parameter follows.
%
%    o image: The address of a byte (8 bits) array of run-length
%      encoded pixel data of your source image.  The sum of the
%      run-length counts in the source image must be equal to or exceed
%      the number of pixels.
%
%
*/
unsigned int NumberColors(image)
Image
X  *image;
{
X  Nodes
X    *nodes;
X
X  register RunlengthPacket
X    *p;
X
X  register int
X    i;
X
X  register Node
X    *node;
X
X  register unsigned char
X    bisect,
X    id;
X
X  register unsigned int
X    level;
X
X  /*
X    Initialize color description tree.
X  */
X  cube.node_list=(Nodes *) NULL;
X  cube.colors=0;
X  cube.free_nodes=0;
X  cube.root=InitializeNode(MaxRgb >> 1,MaxRgb >> 1,MaxRgb >> 1);
X  cube.leaf=InitializeNode(0,0,0);
X  if ((cube.root == (Node *) NULL) || (cube.leaf == (Node *) NULL))
X    {
X      Warning("unable to count colors","memory allocation failed");
X      return(0);
X    }
X  p=image->pixels;
X  for (i=0; i < image->packets; i++)
X  {
X    /*
X      Start at the root and proceed level by level.
X    */
X    node=cube.root;
X    for (level=1; level < MaxTreeDepth; level++)
X    {
X      id=(p->red > node->mid_red) | (p->green > node->mid_green) << 1 |
X        (p->blue > node->mid_blue) << 2;
X      if (node->child[id] == (Node *) NULL)
X        {
X          bisect=(1 << (MaxTreeDepth-level)) >> 1;
X          node->child[id]=InitializeNode(
X            node->mid_red+(id & 1 ? bisect : -bisect),
X            node->mid_green+(id & 2 ? bisect : -bisect),
X            node->mid_blue+(id & 4 ? bisect : -bisect));
X          if (node->child[id] == (Node *) NULL)
X            {
X              Warning("unable to count colors","memory allocation failed");
X              return(0);
X            }
X        }
X      node=node->child[id];
X    }
X    id=(p->red > node->mid_red) | (p->green > node->mid_green) << 1 |
X      (p->blue > node->mid_blue) << 2;
X    if (node->child[id] == (Node *) NULL)
X      {
X        node->child[id]=cube.leaf;
X        cube.colors++;
X      }
X    p++;
X  }
X  /*
X    Release color cube tree storage.
X  */
X  do
X  {
X    nodes=cube.node_list->next;
X    (void) free((char *) cube.node_list);
X    cube.node_list=nodes;
X  }
X  while (cube.node_list != (Nodes *) NULL);
X  return(cube.colors);
}
SHAR_EOF
chmod 0755 ImageMagick/colors.c ||
echo 'restore of ImageMagick/colors.c failed'
Wc_c="`wc -c < 'ImageMagick/colors.c'`"
test 9085 -eq "$Wc_c" ||
	echo 'ImageMagick/colors.c: original size 9085, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/Make.com ==============
if test -f 'ImageMagick/Make.com' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/Make.com (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/Make.com (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/Make.com' &&
$!
$! Make ImageMagick X image utilities for VMS.
$!
$
$define/nolog X11 decw$include:
$define/nolog sys sys$library:
$link_options="/nodebug/notraceback"
$define/nolog lnk$library sys$library:vaxcrtl
$
$if ((p1.nes."").and.(p1.nes."Display")) then goto SkipDisplay
$write sys$output "Making Display..."
$call Make display
$call Make X
$call Make image
$call Make kolb
$call Make quantize
$call Make colors
$call Make rotate
$call Make compress
$call Make PreR4Icccm
$
$link'link_options' display,X,image,rotate,kolb,quantize,colors,compress,PreR4Icccm,sys$input:/opt
sys$share:decw$xlibshr.exe/share
$
$animate:==$'f$environment("default")'animate
$write sys$output "..symbol ANIMATE defined."
$
$SkipDisplay:
$if ((p1.nes."").and.(p1.nes."Display")) then goto SkipAnimate
$write sys$output "Making Animate..."
$call Make animate
$call Make X
$call Make image
$call Make kolb
$call Make quantize
$call Make colors
$call Make rotate
$call Make compress
$call Make PreR4Icccm
$
$link'link_options' animate,X,image,rotate,kolb,quantize,colors,compress,PreR4Icccm,sys$input:/opt
sys$share:decw$xlibshr.exe/share
$
$display:==$'f$environment("default")'display
$write sys$output "..symbol DISPLAY defined."
$
$SkipAnimate:
$if ((p1.nes."").and.(p1.nes."Import")) then goto SkipImport
$write sys$output "Making Import..."
$call Make import
$call Make X
$call Make image
$call Make kolb
$call Make quantize
$call Make rotate
$call Make compress
$call Make PreR4Icccm
$
$link'link_options' import,X,image,kolb,quantize,rotate,compress,PreR4Icccm,sys$input:/opt
sys$share:decw$xlibshr.exe/share
$
$import:==$'f$environment("default")'import
$write sys$output "..symbol IMPORT defined."
$SkipImport:
$
$if ((p1.nes."").and.(p1.nes."XtoPS")) then goto SkipXtoPS
$write sys$output "Making XtoPS..."
$call Make XtoPS
$call Make X
$call Make image
$call Make kolb
$call Make quantize
$call Make rotate
$call Make compress
$call Make PreR4Icccm
$
$link'link_options' XtoPS,X,image,kolb,quantize,rotate,compress,PreR4Icccm,sys$input:/opt
sys$share:decw$xlibshr.exe/share
$
$XtoPS:== $'f$environment("default")'XtoPS
$write sys$output "..symbol XTOPS defined."
$
$SkipXtoPS:
$type sys$input
X
Use this command to specify which X server to contact:
X
X  $set display/create/node=node_name::
X
This can be done automatically from your LOGIN.COM with the following 
command:
X
X  $if (f$trnlmn("sys$rem_node").nes."") then -
X  $  set display/create/node='f$trnlmn("sys$rem_node")'
$exit
$
$Make: subroutine
$!
$! A very primitive "make" (or MMS) hack for DCL.
$!
$if (p1.eqs."") then exit
$source_file=f$search(f$parse(p1,".c"))
$if (source_file.nes."")
$  then
$    object_file=f$parse(source_file,,,"name")+".obj"
$    object_file=f$search( object_file )
$    if (object_file.nes."") 
$      then
$        object_time=f$file_attribute(object_file,"cdt")
$        source_time=f$file_attribute(source_file,"cdt")
$        if (f$cvtime(object_time).lts.f$cvtime(source_time)) then -
$          object_file=""
$      endif
$    if (object_file.eqs."") 
$      then
$        write sys$output "Compiling ",p1
$        cc/nodebug/optimize 'source_file'
$      endif
$  endif
$exit
$endsubroutine
X
SHAR_EOF
chmod 0755 ImageMagick/Make.com ||
echo 'restore of ImageMagick/Make.com failed'
Wc_c="`wc -c < 'ImageMagick/Make.com'`"
test 3167 -eq "$Wc_c" ||
	echo 'ImageMagick/Make.com: original size 3167, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/display.h ==============
if test -f 'ImageMagick/display.h' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/display.h (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/display.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/display.h' &&
X
/*
X  Include declarations
*/
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#ifdef __STDC__
#include <stdlib.h>
#else
#ifndef vms
#include <malloc.h>
#include <memory.h>
X
extern long
X  strtol(),
X  time();
#endif
#endif
X
/*
X  Define declarations for the Display program.
*/
#define False  0
#define Intensity(color)  \
X  (((color).red*77+(color).green*150+(color).blue*29) >> 8)
#define Max(x,y)  (((x) > (y)) ? (x) : (y))
#define MaxColormapSize  65535
#define MaxImageSize  (4096*4096)
#define MaxRgb  255
#define MaxRunlength  255
#define Min(x,y)  (((x) < (y)) ? (x) : (y))
#define MinInfoSize (1 << 18)
#define True  1
#define Warning(message,qualifier)  \
{  \
X  (void) fprintf(stderr,"%s: %s",application_name,message);  \
X  if (qualifier != (char *) NULL)  \
X    (void) fprintf(stderr," (%s)",qualifier);  \
X  (void) fprintf(stderr,".\n");  \
}
X
/*
X  Image Id's
*/
#define UnknownId  0
#define ImageMagickId  1
/*
X  Image classes:
*/
#define UnknownClass  0
#define DirectClass  1
#define PseudoClass  2
/*
X  Image compression algorithms:
*/
#define UnknownCompression  0
#define NoCompression  1
#define RunlengthEncodedCompression  2
#define QEncodedCompression  3
X
/*
X  Typedef declarations for the Display program.
*/
typedef struct _ColorPacket
{
X  unsigned char
X    red,
X    green,
X    blue;
X
X  unsigned short
X    index;
} ColorPacket;
X
typedef struct _RunlengthPacket
{
X  unsigned char
X    red,
X    green,
X    blue,
X    length;
X
X  unsigned short
X    index;
} RunlengthPacket;
X
typedef struct _Image
{
X  FILE
X    *file;
X
X  char
X    filename[256];
X
X  char
X    *comments;
X
X  unsigned int
X    id,
X    class,
X    compression,
X    columns,
X    rows;
X
X  unsigned int
X    colors;
X
X  ColorPacket
X    *colormap;
X
X  unsigned int
X    packets,
X    runlength;
X
X  RunlengthPacket
X    *pixels;
X
X  unsigned int
X    scene;
} Image;
X
/*
X  Variable declarations.
*/
char
X  *application_name;
X
#ifndef lint
static char 
X  Version[]="@(#)ImageMagick 91/01/01 cristy at dupont.com";
#endif
SHAR_EOF
chmod 0755 ImageMagick/display.h ||
echo 'restore of ImageMagick/display.h failed'
Wc_c="`wc -c < 'ImageMagick/display.h'`"
test 1993 -eq "$Wc_c" ||
	echo 'ImageMagick/display.h: original size 1993, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= ImageMagick/display.man ==============
if test -f 'ImageMagick/display.man' -a X"$1" != X"-c"; then
	echo 'x - skipping ImageMagick/display.man (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting ImageMagick/display.man (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/display.man' &&
.ad l
.nh
.TH DISPLAY 1 "1 January 1991" "X Version 11"
.SH NAME
display - display an image on any workstation running X
.SH SYNOPSIS
.B "display" [ \fIoptions\fP ...] \fIfile\fP
[ [ \fIoptions\fP ...] \fIfile\fP ...]
.SH DESCRIPTION
\fIDisplay\fP is a machine architecture independent image processing
and display program.  It can display any image in the MIFF format on
any workstation display running an X server.  \fIDisplay\fP first
determines the hardware capabilities of the workstation.  If the number
of unique colors in the image is less than or equal to the number the
workstation can support, the image is displayed in an X window.
Otherwise the number of colors in the image is first reduced to match
the color resolution of the workstation before it is displayed.
.PP
This means that a continuous-tone 24 bits/pixel image can display on a
8 bit pseudo-color device or monochrome device.  In most instances the
reduced color image closely resembles the original.  Alternatively, a
monochrome or pseudo-color image can display on a continuous-tone 24
bits/pixels device.
.SH EXAMPLES
To scale an image of a cockatoo to exactly 640 pixels in width and 480
pixels in height and position the window at location (200,200), use:
.PP
X     display -geometry 640x480\+200\+200 cockatoo.miff
.PP
To display an image of a cockatoo without a border centered on a
backdrop, use:
.PP
X     display -backdrop -borderwidth 0 cockatoo.miff
.PP
To tile an image of a cockatoo onto the root window, use:
.PP
X     display -root cockatoo.miff
.SH OPTIONS
.TP 5
.B "-backdrop"
display the image centered on a backdrop.
X
This backdrop covers the entire workstation screen and is useful for
hiding other X window activity while viewing the image.   The color of
the backdrop is specified as the background color.  Refer to \fBX
RESOURCES\fP for details.
.TP 5
.B "-clip \fI<width>x<height>{\+-}<x offset>{\+-}<y offset>\fP"
preferred size and location of the clipped image.  See \fBX(1)\fP for details 
about the geometry specification.
X
Use clipping to apply image processing options, or display, only a
particular area of an image.  
.TP 5
.B "-colors \fIvalue\fP"
preferred number of colors in the image.  
X
The actual number of colors in the image may be less than your request,
but never more.  Note, this is a color reduction option.  Images with
less unique colors than specified with this option will remain unchanged.
Refer to \fBCOLOR REDUCTION ALGORITHM\fP for more details.
SHAR_EOF
true || echo 'restore of ImageMagick/display.man failed'
fi
echo 'End of ImageMagick part 1'
echo 'File ImageMagick/display.man is continued in part 2'
echo 2 > _shar_seq_.tmp
exit 0
--
Dan Heller
O'Reilly && Associates       Z-Code Software    Comp-sources-x:
Senior Writer                President          comp-sources-x at uunet.uu.net
argv at ora.com                 argv at zipcode.com



More information about the Comp.sources.x mailing list