home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-12-14 | 39.3 KB | 1,113 lines |
- Newsgroups: comp.sources.misc
- Path: sparky!kent
- From: cristy@eplrx7.es.duPont.com (John Cristy)
- Subject: v34i054: imagemagick - X11 image processing and display v2.2, Part26/26
- Message-ID: <1992Dec15.040009.23278@sparky.imd.sterling.com>
- Followup-To: comp.sources.d
- X-Md4-Signature: 1b023be89139236e1f4c92935e0a9ee1
- Sender: kent@sparky.imd.sterling.com (Kent Landfield)
- Organization: Sterling Software
- References: <csm-v34i028=imagemagick.141926@sparky.IMD.Sterling.COM>
- Date: Tue, 15 Dec 1992 04:00:09 GMT
- Approved: kent@sparky.imd.sterling.com
- Lines: 1098
-
- Submitted-by: cristy@eplrx7.es.duPont.com (John Cristy)
- Posting-number: Volume 34, Issue 54
- Archive-name: imagemagick/part26
- Environment: UNIX, VMS, X11, SGI, DEC, Cray, Sun, Vax
-
- #!/bin/sh
- # this is Part.26 (part 26 of a multipart archive)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file ImageMagick/utilities/convert.man continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 26; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping ImageMagick/utilities/convert.man'
- else
- echo 'x - continuing file ImageMagick/utilities/convert.man'
- sed 's/^X//' << 'SHAR_EOF' >> 'ImageMagick/utilities/convert.man' &&
- Copyright 1992 E. I. du Pont 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. du Pont de Nemours
- & Company not be used in advertising or publicity pertaining to
- distribution of the software without specific, written prior
- permission. E. I. du Pont 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. du Pont 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. du Pont 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. du Pont De Nemours & Company Incorporated
- SHAR_EOF
- echo 'File ImageMagick/utilities/convert.man is complete' &&
- chmod 0644 ImageMagick/utilities/convert.man ||
- echo 'restore of ImageMagick/utilities/convert.man failed'
- Wc_c="`wc -c < 'ImageMagick/utilities/convert.man'`"
- test 7988 -eq "$Wc_c" ||
- echo 'ImageMagick/utilities/convert.man: original size 7988, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= ImageMagick/utilities/MIFFtoSTEREO.c ==============
- if test -f 'ImageMagick/utilities/MIFFtoSTEREO.c' -a X"$1" != X"-c"; then
- echo 'x - skipping ImageMagick/utilities/MIFFtoSTEREO.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting ImageMagick/utilities/MIFFtoSTEREO.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/MIFFtoSTEREO.c' &&
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % EEEEE X X PPPP OOO RRRR TTTTT %
- % E X X P P O O R R T %
- % EEE X PPPP O O RRRR T %
- % E X X P O O R R T %
- % EEEEE X X P OOO R R T %
- % %
- % %
- % Export MIFF image to a stereo MIFF format. %
- % %
- % %
- % %
- % Software Design %
- % John Cristy %
- % July 1992 %
- % %
- % %
- % Copyright 1992 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. %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MIFFtoSTEREO combines two images and produces a single image that is the
- % composite of a left and right image of a stereo pair. The left image is
- % converted to grayscale and written to the red channel of the stereo image.
- % The right image is converted to grayscale and written to the blue channel
- % of the stereo image. View the composite image with red-blue glasses to
- % create a stereo effect.
- %
- % Command syntax:
- %
- % export left_image.miff right_image.miff stereo_image.miff
- %
- % Specify 'left_image.miff' or 'right_image.miff' as '-' for standard input.
- % Specify 'stereo_image.miff' as '-' for standard output.
- %
- %
- */
- X
- #include "display.h"
- #include "image.h"
- #include "alien.h"
- #include "X.h"
- X
- /*
- X Global declarations.
- */
- char
- X *application_name;
- 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 if (message != (char *) NULL)
- X (void) fprintf(stderr,"Can't continue, %s\n\n",message);
- X (void) fprintf(stderr,
- X "Usage: %s left_image.miff right_image.miff stereo_image.miff\n\n",
- X application_name);
- X (void) fprintf(stderr,"Specify 'left_image.miff' or 'right_image.miff' ");
- X (void) fprintf(stderr,"as '-' for standard input.\n");
- X (void) fprintf(stderr,
- X "Specify 'stereo_image.miff' 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 Image
- X *left_image,
- X *right_image,
- X *stereo_image;
- X
- X int
- X status;
- X
- X time_t
- X start_time;
- X
- X application_name=argv[0];
- X if (argc < 4)
- X Usage((char *) NULL);
- X start_time=time((time_t *) 0);
- X left_image=ReadImage(argv[1]);
- X if (left_image == (Image *) NULL)
- X exit(1);
- X right_image=ReadImage(argv[2]);
- X if (right_image == (Image *) NULL)
- X exit(1);
- X stereo_image=StereoImage(left_image,right_image);
- X (void) strcpy(stereo_image->filename,argv[3]);
- X status=WriteAlienImage(stereo_image);
- X /*
- X Display detailed info about the image.
- X */
- X (void) fprintf(stderr,"[%d] %s %s=>%s %dx%d",stereo_image->scene,
- X left_image->filename,right_image->filename,stereo_image->filename,
- X stereo_image->columns,stereo_image->rows);
- X if (stereo_image->class == DirectClass)
- X (void) fprintf(stderr," DirectClass ");
- X else
- X (void) fprintf(stderr," PseudoClass ");
- X (void) fprintf(stderr,"%dc %s %ds\n",stereo_image->colors,
- X stereo_image->magick,time((time_t *) 0)-start_time+1);
- X return(!status);
- }
- SHAR_EOF
- chmod 0644 ImageMagick/utilities/MIFFtoSTEREO.c ||
- echo 'restore of ImageMagick/utilities/MIFFtoSTEREO.c failed'
- Wc_c="`wc -c < 'ImageMagick/utilities/MIFFtoSTEREO.c'`"
- test 8742 -eq "$Wc_c" ||
- echo 'ImageMagick/utilities/MIFFtoSTEREO.c: original size 8742, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= ImageMagick/utilities/Make.com ==============
- if test -f 'ImageMagick/utilities/Make.com' -a X"$1" != X"-c"; then
- echo 'x - skipping ImageMagick/utilities/Make.com (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting ImageMagick/utilities/Make.com (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/utilities/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."mogrify")) then goto SkipMogrify
- $write sys$output "Making Mogrify..."
- $call Make mogrify
- $
- $link'link_options' mogrify,[-]X,[-]image,[-]rotate,[-]quantize,[-]colors, -
- X [-]signature,[-]compress,[-]alien,[-]PreRvIcccm,sys$input:/opt
- sys$share:decw$xlibshr.exe/share
- $
- $mogrify:==$'f$environment("default")'mogrify
- $write sys$output "..symbol MOGRIFY defined."
- $
- $SkipMogrify:
- $if ((p1.nes."").and.(p1.nes."convert")) then goto SkipConvert
- $write sys$output "Making Convert..."
- $call Make convert
- $
- $link'link_options' convert,[-]X,[-]image,[-]rotate,[-]quantize,[-]colors, -
- X [-]signature,[-]compress,[-]alien,[-]PreRvIcccm,sys$input:/opt
- sys$share:decw$xlibshr.exe/share
- $
- $convert:==$'f$environment("default")'convert
- $write sys$output "..symbol CONVERT defined."
- $SkipConvert:
- $
- $if ((p1.nes."").and.(p1.nes."MIFFtoSTEREO")) then goto SkipMIFFtoSTEREO
- $write sys$output "Making MIFFtoSTEREO..."
- $call Make MIFFtoSTEREO
- $
- $link'link_options' MIFFtoSTEREO,[-]X,[-]image,[-]rotate,[-]quantize, -
- X [-]colors,[-]signature,[-]compress,[-]alien,[-]PreRvIcccm,sys$input:/opt
- sys$share:decw$xlibshr.exe/share
- $
- $MIFFtoSTEREO:== $'f$environment("default")'MIFFtoSTEREO
- $write sys$output "..symbol MIFFTOSTEREO defined."
- $
- $SkipMIFFtoSTEREO:
- $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/include_directory=[-] 'source_file'
- $ endif
- $ endif
- $exit
- $endsubroutine
- SHAR_EOF
- chmod 0644 ImageMagick/utilities/Make.com ||
- echo 'restore of ImageMagick/utilities/Make.com failed'
- Wc_c="`wc -c < 'ImageMagick/utilities/Make.com'`"
- test 2499 -eq "$Wc_c" ||
- echo 'ImageMagick/utilities/Make.com: original size 2499, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= ImageMagick/signature.c ==============
- if test -f 'ImageMagick/signature.c' -a X"$1" != X"-c"; then
- echo 'x - skipping ImageMagick/signature.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting ImageMagick/signature.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/signature.c' &&
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % SSSSS IIIII GGGG N N AAA TTTTT U U RRRR EEEEE %
- % SS I G NN N A A T U U R R E %
- % SSS I G GG N N N AAAAA T U U RRRR EEE %
- % SS I G G N NN A A T U U R R E %
- % SSSSS IIIII GGG N N A A T UUU R R EEEEE %
- % %
- % %
- % Compute a Digital Signature for a Image Colormap %
- % %
- % %
- % %
- % Software Design %
- % John Cristy %
- % December 1992 %
- % %
- % Copyright 1992 E. I. du Pont 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. du Pont de Nemours %
- % & Company not be used in advertising or publicity pertaining to %
- % distribution of the software without specific, written prior %
- % permission. E. I. du Pont 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. du Pont 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. du Pont 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. %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Routine ColormapSignature computes a digital signature from the image
- % colormap. This signature uniquely identifies the colormap and is convenient
- % for determining if the colormap of a sequence of images is identical when
- % animating. The digital signature is from RSA Data Security MD5 Digest
- % Algorithm described in Internet draft [MD5], July 1992.
- %
- %
- */
- X
- /*
- X Include declarations.
- */
- #include "display.h"
- #include "image.h"
- X
- /*
- X Typedef declarations.
- */
- typedef struct _MessageDigest
- {
- X unsigned long
- X number_bits[2],
- X accumulator[4];
- X
- X unsigned char
- X message[64],
- X digest[16];
- } MessageDigest;
- X
- /*
- X External declarations.
- */
- extern char
- X *application_name;
- X
- /*
- X Forward declarations.
- */
- static void
- X TransformMessageDigest _Declare((MessageDigest *,unsigned long *)),
- X UpdateMessageDigest _Declare((MessageDigest *,unsigned char *,unsigned long));
- X
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % C o m p u t e M e s s a g e D i g e s t %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Function ComputeMessageDigest computes the message digest.
- %
- % The format of the ComputeMessageDigest routine is:
- %
- % ComputeMessageDigest(message_digest,input_message,message_length)
- %
- % A description of each parameter follows:
- %
- % o message_digest: The address of a structure of type MessageDigest.
- %
- %
- */
- static void ComputeMessageDigest(message_digest)
- MessageDigest
- X *message_digest;
- {
- X int
- X number_bytes;
- X
- X register unsigned char
- X *p;
- X
- X register unsigned int
- X i;
- X
- X unsigned char
- X padding[64];
- X
- X unsigned long
- X message[16],
- X padding_length;
- X
- X /*
- X Save number of bits.
- X */
- X message[14]=message_digest->number_bits[0];
- X message[15]=message_digest->number_bits[1];
- X /*
- X Compute number of bytes mod 64.
- X */
- X number_bytes=(int) ((message_digest->number_bits[0] >> 3) & 0x3F);
- X /*
- X Pad message to 56 mod 64.
- X */
- X padding_length=(number_bytes < 56) ? (56-number_bytes) : (120-number_bytes);
- X padding[0]=0x80;
- X for (i=1; i < padding_length; i++)
- X padding[i]=(char) 0;
- X UpdateMessageDigest(message_digest,padding,padding_length);
- X /*
- X Append length in bits and transform.
- X */
- X p=message_digest->message;
- X for (i=0; i < 14; i++)
- X {
- X message[i]=(unsigned long) (*p++);
- X message[i]|=((unsigned long) (*p++)) << 8;
- X message[i]|=((unsigned long) (*p++)) << 16;
- X message[i]|=((unsigned long) (*p++)) << 24;
- X }
- X TransformMessageDigest(message_digest,message);
- X /*
- X Store message in digest.
- X */
- X p=message_digest->digest;
- X for (i=0; i < 4; i++)
- X {
- X *p++=(unsigned char) (message_digest->accumulator[i] & 0xff);
- X *p++=(unsigned char) ((message_digest->accumulator[i] >> 8) & 0xff);
- X *p++=(unsigned char) ((message_digest->accumulator[i] >> 16) & 0xff);
- X *p++=(unsigned char) ((message_digest->accumulator[i] >> 24) & 0xff);
- X }
- }
- X
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % I n i t i a l i z e M e s s a g e D i g e s t %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Function InitializeMessageDigest initializes the message digest structure.
- %
- % The format of the InitializeMessageDigest routine is:
- %
- % InitializeMessageDigest(message_digest)
- %
- % A description of each parameter follows:
- %
- % o message_digest: The address of a structure of type MessageDigest.
- %
- %
- */
- static void InitializeMessageDigest(message_digest)
- MessageDigest
- X *message_digest;
- {
- X message_digest->number_bits[0]=(unsigned long) 0;
- X message_digest->number_bits[1]=(unsigned long) 0;
- X /*
- X Load magic initialization constants.
- X */
- X message_digest->accumulator[0]=(unsigned long) 0x67452301;
- X message_digest->accumulator[1]=(unsigned long) 0xefcdab89;
- X message_digest->accumulator[2]=(unsigned long) 0x98badcfe;
- X message_digest->accumulator[3]=(unsigned long) 0x10325476;
- }
- X
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % T r a n s f o r m M e s s a g e D i g e s t %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Function TransformMessageDigest updates the message digest.
- %
- % The format of the TransformMessageDigest routine is:
- %
- % TransformMessageDigest(message_digest,message)
- %
- % A description of each parameter follows:
- %
- % o message_digest: The address of a structure of type MessageDigest.
- %
- %
- */
- static void TransformMessageDigest(message_digest,message)
- MessageDigest
- X *message_digest;
- X
- unsigned long
- X *message;
- {
- #define F(x,y,z) (((x) & (y)) | ((~x) & (z)))
- #define G(x,y,z) (((x) & (z)) | ((y) & (~z)))
- #define H(x,y,z) ((x) ^ (y) ^ (z))
- #define I(x,y,z) ((y) ^ ((x) | (~z)))
- #define RotateLeft(x,n) (((x) << (n)) | (((x) & 0xffffffff) >> (32-(n))))
- X
- X static unsigned long int
- X additive_constant[64]= /* 4294967296*abs(sin(i)), i in radians */
- X {
- X 3614090360L, 3905402710L, 606105819L, 3250441966L,
- X 4118548399L, 1200080426L, 2821735955L, 4249261313L,
- X 1770035416L, 2336552879L, 4294925233L, 2304563134L,
- X 1804603682L, 4254626195L, 2792965006L, 1236535329L,
- X 4129170786L, 3225465664L, 643717713L, 3921069994L,
- X 3593408605L, 38016083L, 3634488961L, 3889429448L,
- X 568446438L, 3275163606L, 4107603335L, 1163531501L,
- X 2850285829L, 4243563512L, 1735328473L, 2368359562L,
- X 4294588738L, 2272392833L, 1839030562L, 4259657740L,
- X 2763975236L, 1272893353L, 4139469664L, 3200236656L,
- X 681279174L, 3936430074L, 3572445317L, 76029189L,
- X 3654602809L, 3873151461L, 530742520L, 3299628645L,
- X 4096336452L, 1126891415L, 2878612391L, 4237533241L,
- X 1700485571L, 2399980690L, 4293915773L, 2240044497L,
- X 1873313359L, 4264355552L, 2734768916L, 1309151649L,
- X 4149444226L, 3173756917L, 718787259L, 3951481745L
- X };
- X
- X register int
- X i;
- X
- X register unsigned int
- X j;
- X
- X register unsigned long int
- X a,
- X b,
- X c,
- X d,
- X *p;
- X
- X /*
- X Save accumulator.
- X */
- X a=message_digest->accumulator[0];
- X b=message_digest->accumulator[1];
- X c=message_digest->accumulator[2];
- X d=message_digest->accumulator[3];
- X /*
- X a=b+((a+F(b,c,d)+X[k]+t) <<< s).
- X */
- X p=additive_constant;
- X j=0;
- X for (i=0; i < 4; i++)
- X {
- X a+=F(b,c,d)+message[j & 0x0f]+(*p++);
- X a=RotateLeft(a,7)+b;
- X j++;
- X d+=F(a,b,c)+message[j & 0x0f]+(*p++);
- X d=RotateLeft(d,12)+a;
- X j++;
- X c+=F(d,a,b)+message[j & 0x0f]+(*p++);
- X c=RotateLeft(c,17)+d;
- X j++;
- X b+=F(c,d,a)+message[j & 0x0f]+(*p++);
- X b=RotateLeft(b,22)+c;
- X j++;
- X }
- X /*
- X a=b+((a+G(b,c,d)+X[k]+t) <<< s).
- X */
- X j=1;
- X for (i=0; i < 4; i++)
- X {
- X a+=G(b,c,d)+message[j & 0x0f]+(*p++);
- X a=RotateLeft(a,5)+b;
- X j+=5;
- X d+=G(a,b,c)+message[j & 0x0f]+(*p++);
- X d=RotateLeft(d,9)+a;
- X j+=5;
- X c+=G(d,a,b)+message[j & 0x0f]+(*p++);
- X c=RotateLeft(c,14)+d;
- X j+=5;
- X b+=G(c,d,a)+message[j & 0x0f]+(*p++);
- X b=RotateLeft(b,20)+c;
- X j+=5;
- X }
- X /*
- X a=b+((a+H(b,c,d)+X[k]+t) <<< s).
- X */
- X j=5;
- X for (i=0; i < 4; i++)
- X {
- X a+=H(b,c,d)+message[j & 0x0f]+(*p++);
- X a=RotateLeft(a,4)+b;
- X j+=3;
- X d+=H(a,b,c)+message[j & 0x0f]+(*p++);
- X d=RotateLeft(d,11)+a;
- X j+=3;
- X c+=H(d,a,b)+message[j & 0x0f]+(*p++);
- X c=RotateLeft(c,16)+d;
- X j+=3;
- X b+=H(c,d,a)+message[j & 0x0f]+(*p++);
- X b=RotateLeft(b,23)+c;
- X j+=3;
- X }
- X /*
- X a=b+((a+I(b,c,d)+X[k]+t) <<< s).
- X */
- X j=0;
- X for (i=0; i < 4; i++)
- X {
- X a+=I(b,c,d)+message[j & 0x0f]+(*p++);
- X a=RotateLeft(a,6)+b;
- X j+=7;
- X d+=I(a,b,c)+message[j & 0x0f]+(*p++);
- X d=RotateLeft(d,10)+a;
- X j+=7;
- X c+=I(d,a,b)+message[j & 0x0f]+(*p++);
- X c=RotateLeft(c,15)+d;
- X j+=7;
- X b+=I(c,d,a)+message[j & 0x0f]+(*p++);
- X b=RotateLeft(b,21)+c;
- X j+=7;
- X }
- X /*
- X Increment accumulator.
- X */
- X message_digest->accumulator[0]+=a;
- X message_digest->accumulator[1]+=b;
- X message_digest->accumulator[2]+=c;
- X message_digest->accumulator[3]+=d;
- }
- X
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % U p d a t e M e s s a g e D i g e s t %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Function UpdateMessageDigest updates the message digest.
- %
- % The format of the UpdateMessageDigest routine is:
- %
- % UpdateMessageDigest(message_digest,input_message,message_length)
- %
- % A description of each parameter follows:
- %
- % o message_digest: The address of a structure of type MessageDigest.
- %
- %
- */
- static void UpdateMessageDigest(message_digest,input_message,message_length)
- MessageDigest
- X *message_digest;
- X
- unsigned char
- X *input_message;
- X
- unsigned long
- X message_length;
- {
- X int
- X number_bytes;
- X
- X register unsigned char
- X *p;
- X
- X register unsigned int
- X i;
- X
- X unsigned long
- X message[16];
- X
- X /*
- X Compute number of bytes mod 64.
- X */
- X number_bytes=(int) ((message_digest->number_bits[0] >> 3) & 0x3F);
- X /*
- X Update number of bits.
- X */
- X if (((message_digest->number_bits[0]+(message_length << 3)) & 0xffffffff) <
- X message_digest->number_bits[0])
- X message_digest->number_bits[1]++;
- X message_digest->number_bits[0]+=message_length << 3;
- X message_digest->number_bits[1]+=message_length >> 29;
- X while (message_length--)
- X {
- X /*
- X Add new character to message.
- X */
- X message_digest->message[number_bytes++]=(*input_message++);
- X if (number_bytes == 0x40)
- X {
- X /*
- X Transform message digest 64 bytes at a time.
- X */
- X p=message_digest->message;
- X for (i=0; i < 16; i++)
- X {
- X message[i]=(unsigned long) (*p++);
- X message[i]|=((unsigned long) (*p++)) << 8;
- X message[i]|=((unsigned long) (*p++)) << 16;
- X message[i]|=((unsigned long) (*p++)) << 24;
- X }
- X TransformMessageDigest(message_digest,message);
- X number_bytes=0;
- X }
- X }
- }
- X
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % C o l o r m a p S i g n a t u r e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % Fucntion ColormapSignature computes a digital signature from the image
- % colormap. This signature uniquely identifies the colormap and is convenient
- % for determining if the colormap of a sequence of images is identical when
- % animating. The digital signature is from RSA Data Security MD5 Digest
- % Algorithm described in Internet draft [MD5], July 1992.
- %
- % The format of the ColormapSignature routine is:
- %
- % ColormapSignature(image)
- %
- % A description of each parameter follows:
- %
- % o image: The address of a structure of type Image.
- %
- %
- %
- */
- void ColormapSignature(image)
- Image
- X *image;
- {
- X char
- X *hex;
- X
- X MessageDigest
- X message_digest;
- X
- X register int
- X i;
- X
- X register unsigned char
- X *p;
- X
- X unsigned char
- X *colormap;
- X
- X if (image->class != PseudoClass)
- X return;
- X /*
- X Allocate colormap.
- X */
- X colormap=(unsigned char *) malloc(3*image->colors*sizeof(unsigned char));
- X if (colormap == (unsigned char *) NULL)
- X {
- X Warning("unable to compute colormap signature",
- X "memory allocation failed");
- X return;
- X }
- X p=colormap;
- X for (i=0; i < image->colors; i++)
- X {
- X *p++=image->colormap[i].red;
- X *p++=image->colormap[i].green;
- X *p++=image->colormap[i].blue;
- X }
- X /*
- X Compute program colormap signature.
- X */
- X InitializeMessageDigest(&message_digest);
- X UpdateMessageDigest(&message_digest,colormap,
- X (unsigned long) (image->colors*3));
- X ComputeMessageDigest(&message_digest);
- X (void) free((char *) colormap);
- X /*
- X Allocate memory for signature.
- X */
- X if (image->signature != (char *) NULL)
- X (void) free((char *) image->signature);
- X image->signature=(char *) malloc(33*sizeof(char));
- X if (image->signature == (char *) NULL)
- X {
- X Warning("unable to compute colormap signature",
- X "memory allocation failed");
- X return;
- X }
- X /*
- X Convert digital signature to a 32 character hex string.
- X */
- X p=(unsigned char *) image->signature;
- X hex="0123456789abcdef";
- X for (i=0; i < 16; i++)
- X {
- X *p++=hex[(message_digest.digest[i] >> 4) & 0xf];
- X *p++=hex[message_digest.digest[i] & 0xf];
- X }
- X *p='\0';
- }
- SHAR_EOF
- chmod 0644 ImageMagick/signature.c ||
- echo 'restore of ImageMagick/signature.c failed'
- Wc_c="`wc -c < 'ImageMagick/signature.c'`"
- test 17946 -eq "$Wc_c" ||
- echo 'ImageMagick/signature.c: original size 17946, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= ImageMagick/ChangeLog ==============
- if test -f 'ImageMagick/ChangeLog' -a X"$1" != X"-c"; then
- echo 'x - skipping ImageMagick/ChangeLog (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting ImageMagick/ChangeLog (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/ChangeLog' &&
- ImageMagick 2.2
- X
- X o When displaying a composite MIFF image created with `montage',
- X button 3 no longer displays a magnify window. Instead the
- X tile at the mouse location is displayed. When the tile image is
- X exited, the composite image reappears. This is effectively a
- X visual image directory.
- X
- X o `montage' has a new gravity option for placing an image within
- X a tile of the composite, i.e. CenterGravity.
- X
- X o `montage' has a new compose option for specifying which composite
- X operation to use.
- X
- X o `montage' creates composite images with the `montage' keyword.
- X
- X o Updated MIFF manual page to reflect 'montage' image header
- X keyword.
- X
- X o Some compilers have read-only strings. ImageMagick no longer
- X writes on read-only strings.
- X
- X o For colormapped X servers, the color reduction has been sped up by
- X trading image quality for processing time. See the README for
- X details.
- X
- X o Latin1Upper was declared wrong in X.h.
- X
- X o Added unistd.h to display.h for strict ANSI compilers.
- X
- X o Changed long to time_t for calls to C time routine.
- X
- X o Multi-part GIF's can now be displayed or animated.
- X
- X o Fixed segmentation fault when reading multi-part images with
- X animate, montage, or mogrify.
- X
- X o Multi-part MIFF images have the correct file name now.
- X
- X o An expose event for the Magnify window may occur before it is
- X mapped. This caused display to fail on Solburne and HP's.
- X
- X o Using `-colorspace gray' with 'convert' correctly produces
- X grayscale images.
- X
- X o Images are sorted by intensity for shared colormapped visuals.
- X Some intensity intervals are made "more popular". This gives better
- X image results when sharing colors with other applications.
- X
- X o All utilities correctly read multi-part TIFF images.
- X
- X o Image pixmap was not being updated correctly when pan icon appears
- X (thanks to dws@ssec.wisc.edu).
- X
- X o Fixed ANSI warning on image composite code.
- X
- X o Panning uses a pixmap for faster panning speed.
- X
- X o Rotate.c now uses a table to force range limits.
- X
- X o Fixed strcasecmp to work under VMS.
- X
- X o range table in quantize.c is allocated from the heap instead of
- X the stack.
- X
- X o adjusted the sensitivity for automatic dithering. Some JPEG images
- X were not being dithered.
- SHAR_EOF
- chmod 0644 ImageMagick/ChangeLog ||
- echo 'restore of ImageMagick/ChangeLog failed'
- Wc_c="`wc -c < 'ImageMagick/ChangeLog'`"
- test 2264 -eq "$Wc_c" ||
- echo 'ImageMagick/ChangeLog: original size 2264, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= ImageMagick/Magick.tmpl ==============
- if test -f 'ImageMagick/Magick.tmpl' -a X"$1" != X"-c"; then
- echo 'x - skipping ImageMagick/Magick.tmpl (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting ImageMagick/Magick.tmpl (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ImageMagick/Magick.tmpl' &&
- /*
- X ImageMagick Imakefile info. This contains any special redefinitions.
- X
- X Copyright 1992 E. I. du Pont 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. du Pont 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. du Pont 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. du Pont 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. du Pont 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.
- */
- X
- /*
- X Uncomment the following lines if you have the JPEG or TIFF libraries.
- X See README for more details.
- X
- JPEG= -DAlienJPEG
- JPEG_INCLUDES= -Ijpeg -I../jpeg
- JPEG_LIBRARIES= -Ljpeg -L../jpeg -ljpeg
- TIFF= -DAlienTIFF
- TIFF_INCLUDES= -Itiff/libtiff -I../tiff/libtiff
- TIFF_LIBRARIES= -Ltiff/libtiff -L../tiff/libtiff -ltiff
- */
- X
- /*
- X Might need one of these for xtp to link correctly.
- X
- EXTRA_LOAD_FLAGS= -lnsl
- EXTRA_LOAD_FLAGS= -linet -lnsl_s -lrpc -lcposix
- */
- X
- DEFINES= $(JPEG) $(JPEG_INCLUDES) $(TIFF) $(TIFF_INCLUDES)
- LOCALDIR=/usr/local/bin
- SYS_LIBRARIES= $(XLIB) $(JPEG_LIBRARIES) $(TIFF_LIBRARIES) -lm
- X
- #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CC=$(CC)' \
- X 'CCOPTIONS=$(CCOPTIONS)'
- SHAR_EOF
- chmod 0644 ImageMagick/Magick.tmpl ||
- echo 'restore of ImageMagick/Magick.tmpl failed'
- Wc_c="`wc -c < 'ImageMagick/Magick.tmpl'`"
- test 2012 -eq "$Wc_c" ||
- echo 'ImageMagick/Magick.tmpl: original size 2012, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- rm -f _shar_seq_.tmp
- echo You have unpacked the last part
- exit 0
- exit 0 # Just in case...
-