v09i045: xgrabsc, Patch2, Part01/01

Bruce Schuchardt bruce at SLC.COM
Wed Sep 19 14:06:39 AEST 1990


Submitted-by: bruce at SLC.COM (Bruce Schuchardt)
Posting-number: Volume 9, Issue 45
Archive-name: xgrabsc/patch2
Patch-To: xgrabsc: Volume 8, Issue 75,76
Patch-To: xgrabsc: Volume 9, Issue 26

Here is the second patch set for xgrabsc.  See the file README.patch2
for information concerning bugs fixed and new features added in this
patch set.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Bruce Schuchardt          Ph: (503) 629-8383
  Servio Corp.              bruce at SLC.COM
  Beaverton, OR


------------------CUT HERE--------------------------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  Acks Bugs README.patch2 patch2
# Wrapped by owner at spruce on Tue Sep 18 16:20:46 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Acks' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Acks'\"
else
echo shar: Extracting \"'Acks'\" \(622 characters\)
sed "s/^X//" >'Acks' <<'END_OF_FILE'
X/*========================================================================
X*
X* Name - Acks
X*
X* Version:	1.1
X*
X* ccsid:	@(#)Acks	1.1 - 9/18/90 16:16:45
X* from: 	ccs/s.Acks
X* date: 	9/18/90 16:16:58
X*
X* Description: Thanks to the people listed below for their help in this
X*              project
X*
X*========================================================================
X
X
X    David Lawrence for the memcpy() and memset() functions
X    
X    Alan Kent for help with 4-plane problems, encapsulated postscript
X    suggestions, and for testing the patch kit
X
X    Brian C. Smith for YIQ greyscale and Floyd-Steinberg algorithms
END_OF_FILE
if test 622 -ne `wc -c <'Acks'`; then
    echo shar: \"'Acks'\" unpacked with wrong size!
fi
# end of 'Acks'
fi
if test -f 'Bugs' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Bugs'\"
else
echo shar: Extracting \"'Bugs'\" \(1479 characters\)
sed "s/^X//" >'Bugs' <<'END_OF_FILE'
X/*========================================================================
X*
X* Name - Bugs
X*
X* Version:	1.1
X*
X* ccsid:	@(#)Bugs	1.1 - 9/18/90 16:16:36
X* from: 	ccs/s.Bugs
X* date: 	9/18/90 16:16:57
X*
X* Description: Known bugs and problems.  This list does not include
X*              bugs that have been fixed.  See the patch set README
X*              files for descriptions of the bugs they fix.
X*
X*========================================================================*/
X
X1) While xgrabsc can create puzzle picture files from monochrome screens, the
X   puzzle program will not display pictures with "-picture" on monochrome
X   systems. This is not a "bug" in xgrabsc, but is a "confusing feature".
X
X2) If you run xgrabsc from a Twm menu, be sure to end your exec command with
X   "&". The program may not be able to grab the pointer or server unless you
X   do this.  This will likely happen with any window manager, but has been
X   reported onlyfor Twm.
X
X3) The xwdtoppm program appears to have problems reading xgrabsc XWD output.  I've
X   looked into this problem a bit but have no quick solution for all platforms and
X   compilers.  If "xwd | xwdtoppm | ppmtoxwd | xwud" works on your machine, you
X   may try the simple fix of correcting the color-reading loop in xwdtoppm.c to
X   terminate on reaching "ncolors" instead of "colormap-entries".  You should
X   be able to use xgrabsc output once this is done.  The ppm bugs have been
X   reported to the owner of that project.
X
END_OF_FILE
if test 1479 -ne `wc -c <'Bugs'`; then
    echo shar: \"'Bugs'\" unpacked with wrong size!
fi
# end of 'Bugs'
fi
if test -f 'README.patch2' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README.patch2'\"
else
echo shar: Extracting \"'README.patch2'\" \(2308 characters\)
sed "s/^X//" >'README.patch2' <<'END_OF_FILE'
X*========================================================================
X*
X* Name - README.patch2
X*
X* Version:	1.1
X*
X* ccsid:	@(#)README.patch2	1.1 - 9/18/90 16:16:50
X* from: 	ccs/s.README.patch2
X* date: 	9/18/90 16:16:59
X*
X* Description: notes on patch kit #2 for version 1.0
X*
X*========================================================================
X
XOPTIONS:
X
XOne new option is added in patch 02:
X
X    -F      dithers the input image with Floyd-Steinberg algorithm
X            rather than the matrix algorithm used by the -D option
X
XThe dithering code was pretty much rewritten to merge in the FS dithering
Xstuff.
X
XA bug in the matrix dithering code was causing it to fail on LSBFirst
Xmachines.
X
XA bug in window selection by ID was causing it to always select the root
Xwindow (I forgot to put on my Q/A hat after writing that one).
X
XThe greyscale calculations now use the YIQ formula that is apparently
Xcommonly used to do this sort of stuff.
X
X
X
XBUILDING:
X
XNo new build options have been added in patch set 2.  Here are the notes
Xfrom patch set 1:
X
X  The imake and make files were changed to follow accepted conventions.
X  A new target was added for man page installation (install.man).
X  
X  The compilation flag -DNO_RLE_CHECKS will eliminate a pass that xgrabsc
X  makes over the source image to determine whether compression of Postscript
X  output will actually result in size savings.
X  
X  For machines with no memcpy() or memset() routines in their standard
X  libraries, conditionally compiled routines were added to xgrabsc.c.
X  Compile with -DMEMCPY to use these routines.
X
X
X
XBUGS:
X
XDescriptions of known bugs and problems are in the new file "Bugs".
X  
XI try to respond to all problem reports.  If you do not receive a
Xresponse to e-mail, your mail either did not reach me or I could not
Xreach you with a reply after two or three attempts.
X
XNo bugs were reported in version 1.0 patch level 1.  See README.patch1
Xfor a list of persistent bugs that are not caused by xgrabsc.
X
X
X
XACKNOWLEDGMENTS:
X
XAcknowledgments have been moved to the file Acks.  Please read it.  People
Xwho contribute to free software efforts deserve to be recognized.
X
X
X
X
X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
X  Bruce Schuchardt          Ph: (503) 629-8383
X  Servio Corp.              bruce at SLC.COM
X  Beaverton, OR
X
END_OF_FILE
if test 2308 -ne `wc -c <'README.patch2'`; then
    echo shar: \"'README.patch2'\" unpacked with wrong size!
fi
# end of 'README.patch2'
fi
if test -f 'patch2' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patch2'\"
else
echo shar: Extracting \"'patch2'\" \(19310 characters\)
sed "s/^X//" >'patch2' <<'END_OF_FILE'
XPrereq: 1
X*** checkpoint/xgrabsc.c	Wed Sep 12 15:28:19 1990
X--- xgrabsc.c	Tue Sep 18 15:54:38 1990
X***************
X*** 1,12 ****
X  /*========================================================================
X   *
X!  * Name - %M%
X   *
X!  * Version:	%I%
X   *
X!  * ccsid:	%W% - %G% %U%
X!  * from: 	%F%
X!  * date: 	%H% %T%
X   *
X   * Copyright (c) 1990 Bruce Schuchardt.
X   * Read the file cpyright.h for full copyright information.
X--- 1,12 ----
X  /*========================================================================
X   *
X!  * Name - xgrabsc.c
X   *
X!  * Version:	1.9
X   *
X!  * ccsid:	@(#)xgrabsc.c	1.9 - 9/18/90 15:53:34
X!  * from: 	ccs/s.xgrabsc.c
X!  * date: 	9/18/90 15:54:11
X   *
X   * Copyright (c) 1990 Bruce Schuchardt.
X   * Read the file cpyright.h for full copyright information.
X***************
X*** 39,44 ****
X--- 39,52 ----
X  #define FALSE 0
X  
X  
X+ typedef enum {
X+   NO_DITHER=0,
X+   FS_DITHER,
X+   MATRIX_DITHER,
X+   MATRIX_HALFTONE
X+ } ditherType;
X+ 
X+ 
X  typedef unsigned char byte;
X  typedef unsigned long dw;
X  typedef unsigned int  word;
X***************
X*** 691,697 ****
X  
X  
X  #define GRAYS    17 /* ((4 * 4) + 1) patterns for a good dither */
X! #define GRAYSTEP ((dw)(65536 * 3) / GRAYS)
X  
X  static byte DitherBits[GRAYS][4] = {
X    0xf, 0xf, 0xf, 0xf,
X--- 699,705 ----
X  
X  
X  #define GRAYS    17 /* ((4 * 4) + 1) patterns for a good dither */
X! #define GRAYSTEP ((dw)(65536 / GRAYS))
X  
X  static byte DitherBits[GRAYS][4] = {
X    0xf, 0xf, 0xf, 0xf,
X***************
X*** 718,754 ****
X   */
X  pixmap2halftone(image, dither)
X    imageInfo *image;
X!   int dither;           /* if TRUE, dither instead of halftone */
X  {
X    XImage *ximage = image->ximage;
X    XImage *newImage;
X!   byte   *newBytes, *dp, *ditherBits;
X    word   dindex;  /* index into dither array */
X    dw     color;   /* pixel color */
X    word  *index;   /* index into dither array for a given pixel */
X    word   x, y;    /* random counters */
X    word   x4, y4;
X!   word   w, h;
X!   int    reversed;
X!   register byte *dp2;
X    register byte  bits;
X  
X    if (verbose) {
X!     fprintf(stderr, "%s: %sing image...", programName,
X!         dither? "dither" : "halfton");
X      fflush(stderr);
X    }
X  
X    /* create a bitmap image */
X!   w = (ximage->width + 7) / 8;
X!   if (!dither) w *= 4;
X!   h = dither? ximage->height : ximage->height * 4;
X    newBytes = (byte *)malloc(w * h);
X    memset(newBytes, 0, w * h);
X    newImage = XCreateImage(hDisplay, DefaultVisual(hDisplay, hScreen),
X                  1, XYBitmap, 0, newBytes,
X!                 ximage->width * (dither? 1 : 4),
X!                 ximage->height * (dither? 1 : 4),
X                  0, w);
X    if (!newImage) {
X      fprintf(stderr, "%s: unable to create bitmap for conversion\n",
X--- 726,783 ----
X   */
X  pixmap2halftone(image, dither)
X    imageInfo *image;
X!   ditherType dither;    /* type of dithering to perform */
X  {
X    XImage *ximage = image->ximage;
X    XImage *newImage;
X!   byte   *newBytes, *ditherBits;
X    word   dindex;  /* index into dither array */
X    dw     color;   /* pixel color */
X    word  *index;   /* index into dither array for a given pixel */
X    word   x, y;    /* random counters */
X    word   x4, y4;
X!   register word   w, h;
X    register byte  bits;
X+   char  *str;
X+   dw    intensity;
X+   int   maxIntensity, threshold;
X+   word  *fsIndex;
X+   int   err, i;
X+   int   *row1, *row2;
X  
X+   if (ximage->depth <= 1  ||  dither == NO_DITHER)
X+     return;
X+ 
X    if (verbose) {
X!     switch (dither) {
X!       case MATRIX_HALFTONE:
X!         str = "Matrix halfton";
X!         break;
X!       case MATRIX_DITHER:
X!         str = "Matrix dither";
X!         break;
X!       case FS_DITHER:
X!         str = "Floyd-Steinberg dither";
X!         break;
X!       default:
X!         fprintf(stderr, "%s: unknown type of dithering requested.  Exiting...\n",
X!             programName);
X!         exit(3);
X!     }
X!     fprintf(stderr, "%s: %sing image...", programName, str);
X      fflush(stderr);
X    }
X  
X    /* create a bitmap image */
X!   x = (dither == MATRIX_HALFTONE)? 4 : 1;
X!   w = ((ximage->width + 7) / 8) * x;
X!   h = ximage->height * x;
X    newBytes = (byte *)malloc(w * h);
X    memset(newBytes, 0, w * h);
X    newImage = XCreateImage(hDisplay, DefaultVisual(hDisplay, hScreen),
X                  1, XYBitmap, 0, newBytes,
X!                 ximage->width * x,
X!                 h,
X                  0, w);
X    if (!newImage) {
X      fprintf(stderr, "%s: unable to create bitmap for conversion\n",
X***************
X*** 757,765 ****
X      exit(3);
X    }
X  
X-   /* DitherBits is set up for MSBFirst use, so force this in the image */
X-   newImage->bitmap_bit_order = MSBFirst;
X- 
X    /* if the number of possible pixels isn't very large, build an array
X     * which we index by the pixel value to find the dither array index
X     * by color brightness.  we do this in advance so we don't have to do
X--- 786,791 ----
X***************
X*** 770,830 ****
X  
X    if (ximage->depth <= 16) {
X      index= (word *)malloc(sizeof(word) * MAX_CELLS);
X      if (index)
X        for (x= 0; x < image->numcells; x++) {
X!         index[x] =
X!           ((dw)(image->red[x])
X!            + (dw)(image->green[x])
X!            + (dw)(image->blue[x])  ) / GRAYSTEP;
X          if (index[x] >= GRAYS)
X            index[x] = GRAYS - 1;
X        }
X    }
X    else
X!     index= NULL;
X  
X!   /* dither each pixel
X!    */
X!   reversed = newImage->bitmap_bit_order == LSBFirst;
X!   for (y= 0; y < ximage->height; y++) {
X      for (x= 0; x < ximage->width; x++) {
X!       color = XGetPixel(ximage, x, y);
X!       if (index)
X! 	dindex= index[color];
X!       else {
X! 	dindex= ((dw)image->red[color]
X! 		 +(dw)image->green[color]
X! 		 +(dw)image->blue[color] ) / GRAYSTEP;
X!         if (dindex >= GRAYS)  /* catch rounding errors */
X! 	  dindex= GRAYS - 1;
X        }
X!       if (dither) {
X!         if (DitherBits[dindex][y & 3] & (1 << (x & 3)))
X!            XPutPixel(newImage, x, y, 1);
X!       }
X!       else { /* halftone */
X!         /* loop for the four Y bits in the dither pattern, putting all
X!          * four X bits in at once.  if you think this would be hard to
X!          * change to be an NxN dithering array, you're right, since we're
X!          * banking on the fact that we need only shift the mask based on
X!          * whether x is odd or not.  an 8x8 array wouldn't even need that,
X!          * but blowing an image up by 64x is probably not a feature.
X!          */
X!         ditherBits = &(DitherBits[dindex][0]);
X!         x4 = x * 4;
X!         y4 = y * 4;
X!         for (h= 0; h < 4; h++) {
X!           bits = ditherBits[h];
X!           for (w=0; w < 4; w++)
X!             XPutPixel(newImage, x4+w, y4+h, (bits >> w) & 1);
X          }
X        }
X      }
X-     if (dither)
X-       dp += newImage->bytes_per_line;
X-     else
X-       dp += 4 * newImage->bytes_per_line;
X    }
X    if (verbose)
X      fputc('\n', stderr);
X  
X--- 796,904 ----
X  
X    if (ximage->depth <= 16) {
X      index= (word *)malloc(sizeof(word) * MAX_CELLS);
X+     fsIndex= (word *)malloc(sizeof(word) * MAX_CELLS);
X      if (index)
X        for (x= 0; x < image->numcells; x++) {
X!         fsIndex[x] = (word)(0.30 * image->red[x] +
X!                           0.59 * image->green[x] +
X!                           0.11 * image->blue[x]);
X!         index[x] = fsIndex[x]/GRAYSTEP;
X          if (index[x] >= GRAYS)
X            index[x] = GRAYS - 1;
X        }
X    }
X    else
X!     index = fsIndex = NULL;
X  
X!   if (dither == FS_DITHER) {
X!     maxIntensity = 65535;
X!     threshold = maxIntensity/2;
X!     row1 = (int *)malloc(ximage->width*sizeof(int));
X!     row2 = (int *)malloc(ximage->width*sizeof(int));
X!     /* initialize row2 */
X      for (x= 0; x < ximage->width; x++) {
X!       color = XGetPixel(ximage, x, 0);
X!       row2[x] = fsIndex? fsIndex[color] :
X!                   (dw)(0.30*image->red[color] +
X!                    0.59*image->green[color] +
X!                    0.11*image->blue[color]);
X!     }
X!     for (y= 0; y < ximage->height; y++) {
X!       /* row1 := row2 */
X!       memcpy(row1, row2, ximage->width*sizeof(int));
X!       /* Fill in next row */
X!       if (y != ximage->height-1)
X!         for (x= 0; x < ximage->width; x++) {
X!           color = XGetPixel(ximage, x, y+1);
X!           row2[x] = fsIndex? fsIndex[color] :
X!                       (dw)(0.30*image->red[color] +
X!                        0.59*image->green[color] +
X!                        0.11*image->blue[color]);
X!         }
X!       for (x= 0; x < ximage->width; x++) {
X!         color = XGetPixel(ximage, x, y);
X!         intensity = fsIndex? fsIndex[color] :
X!                     (dw)(0.30*image->red[color] +
X!                      0.59*image->green[color] +
X!                      0.11*image->blue[color]);
X!         if ((i = row1[x]) > threshold)
X!           err = i - maxIntensity;
X!         else {
X!           XPutPixel(newImage, x, y, 1);
X!           err = i;
X!         }
X!         /* Diagonal gets 1/4 of error. */
X!         row2[x+1] += err/4;
X! 
X!         /* Right and below get 3/8 of error */
X!         err = err*3/8;
X!         row2[x] += err;
X!         row1[x+1] += err;
X        }
X!     }
X!     if (row1)  free(row1);
X!     if (row2)  free(row2);
X!   }
X! 
X! 
X!   else {  /* matrix dither or halftone */
X! 
X!     for (y= 0; y < ximage->height; y++) {
X!       for (x= 0; x < ximage->width; x++) {
X!         color = XGetPixel(ximage, x, y);
X!         dindex = index? index[color] :
X!                     (dw)(0.30*image->red[color] +
X!                      0.59*image->green[color] +
X!                      0.11*image->blue[color])/GRAYSTEP;
X!         if (dindex >= GRAYS)  /* catch rounding errors */
X!           dindex= GRAYS - 1;
X!         if (dither == MATRIX_DITHER) {
X!           if (DitherBits[dindex][y & 3] & (1 << (x & 3)))
X!              XPutPixel(newImage, x, y, 1);
X          }
X+         else { /* halftone */
X+           /* loop for the four Y bits in the dither pattern, putting all
X+            * four X bits in at once.  if you think this would be hard to
X+            * change to be an NxN dithering array, you're right, since we're
X+            * banking on the fact that we need only shift the mask based on
X+            * whether x is odd or not.  an 8x8 array wouldn't even need that,
X+            * but blowing an image up by 64x is probably not a feature.
X+            */
X+           ditherBits = &(DitherBits[dindex][0]);
X+           x4 = x * 4;
X+           y4 = y * 4;
X+           for (h= 0; h < 4; h++) {
X+             bits = ditherBits[h];
X+             for (w=0; w < 4; w++) {
X+               XPutPixel(newImage, x4+w, y4+h, bits & 1);
X+               bits /= 2;
X+             }
X+           }
X+         }
X        }
X      }
X    }
X+   
X    if (verbose)
X      fputc('\n', stderr);
X  
X***************
X*** 831,838 ****
X    free(ximage->data);
X    memcpy(ximage, newImage, sizeof(XImage));
X    free(newImage);
X!   if (index)
X!     free(index);
X  
X    image->numcells = 0;
X  }
X--- 905,912 ----
X    free(ximage->data);
X    memcpy(ximage, newImage, sizeof(XImage));
X    free(newImage);
X!   if (index) free(index);
X!   if (fsIndex) free(fsIndex);
X  
X    image->numcells = 0;
X  }
X***************
X*** 1513,1519 ****
X    int depth;
X    int puzzle, xWD, brighten, postscript;
X    int forceBitmap, grabServer;
X!   int dither, halftone;
X    int compress;
X    int sleepSeconds;
X    int andBits, orBits;
X--- 1587,1594 ----
X    int depth;
X    int puzzle, xWD, brighten, postscript;
X    int forceBitmap, grabServer;
X!   ditherType ditherKind;
X!   int halftone;
X    int compress;
X    int sleepSeconds;
X    int andBits, orBits;
X***************
X*** 1535,1541 ****
X    brighten    = FALSE;
X    forceBitmap = FALSE;
X    halftone    = FALSE;
X!   dither      = FALSE;
X    grabServer  = TRUE;
X    postscript  = FALSE;
X    encapsulate = FALSE;
X--- 1610,1616 ----
X    brighten    = FALSE;
X    forceBitmap = FALSE;
X    halftone    = FALSE;
X!   ditherKind      = NO_DITHER;
X    grabServer  = TRUE;
X    postscript  = FALSE;
X    encapsulate = FALSE;
X***************
X*** 1550,1556 ****
X    sourceRoot  = FALSE;
X    
X  
X!   while ((c = getopt(argc, argv, "d:no:s:v cri:w b:A:BDHO: EPWZ")) != EOF)
X      switch (c) {
X        case 'd':
X          display = optarg;
X--- 1625,1631 ----
X    sourceRoot  = FALSE;
X    
X  
X!   while ((c = getopt(argc, argv, "d:no:s:v cri:w b:A:BDFHO: EPWZ")) != EOF)
X      switch (c) {
X        case 'd':
X          display = optarg;
X***************
X*** 1624,1648 ****
X          brighten = TRUE;
X          break;
X        case 'B':
X          forceBitmap = TRUE;
X          break;
X        case 'D':
X!         dither = TRUE;
X!         if (halftone) {
X            fprintf(stderr,
X!             "%s: both dither and halftone requested.  Ignoring halftone.",
X              programName);
X!           halftone = FALSE;
X          }
X          break;
X!       case 'H':
X          halftone = TRUE;
X!         if (dither) {
X            fprintf(stderr,
X!             "%s: both dither and halftone requested.  Ignoring halftone.",
X              programName);
X!           halftone = FALSE;
X          }
X          break;
X        case 'O':
X          orBits = atoi(optarg);
X--- 1699,1753 ----
X          brighten = TRUE;
X          break;
X        case 'B':
X+         if (halftone) {
X+           fprintf(stderr,
X+             "%s: both bitmap and halftone conversion requested.  Using bitmap.\n",
X+             programName);
X+           halftone = FALSE;
X+         }
X          forceBitmap = TRUE;
X          break;
X        case 'D':
X!         if (forceBitmap) {
X            fprintf(stderr,
X!             "%s: both bitmap and halftone conversion requested.  Using halftone.\n",
X              programName);
X!           forceBitmap = FALSE;
X          }
X+         if (halftone)
X+           fprintf(stderr,
X+             "%s: multiple halftone formats requested. Using Matrix dithering.\n",
X+             programName);
X+         ditherKind = MATRIX_DITHER;
X+         halftone = TRUE;
X          break;
X!       case 'F':
X!         if (forceBitmap) {
X!           fprintf(stderr,
X!             "%s: both bitmap and halftone conversion requested.  Using halftone.\n",
X!             programName);
X!           forceBitmap = FALSE;
X!         }
X!         if (halftone)
X!           fprintf(stderr,
X!             "%s: multiple halftone formats requested. Using Floyd-Steinberg dithering.\n",
X!             programName);
X!         ditherKind = FS_DITHER;
X          halftone = TRUE;
X!         break;
X!       case 'H':
X!         if (forceBitmap) {
X            fprintf(stderr,
X!             "%s: both bitmap and halftone conversion requested.  Using halftone.\n",
X              programName);
X!           forceBitmap = FALSE;
X          }
X+         if (halftone)
X+           fprintf(stderr,
X+             "%s: multiple halftone formats requested. Using Matrix halftoning.\n",
X+             programName);
X+         ditherKind = MATRIX_HALFTONE;
X+         halftone = TRUE;
X          break;
X        case 'O':
X          orBits = atoi(optarg);
X***************
X*** 1684,1689 ****
X--- 1789,1800 ----
X          break;
X      }
X  
X+   if (verbose) {
X+     fprintf(stderr, "%s: xgrabsc version %s\n", programName, version);
X+     fprintf(stderr, "%s:         patchlevel %d\n", programName, patchLevel);
X+     fprintf(stderr, "%s:         %s\n\n", programName, Copyright);
X+   }
X+     
X    if (!display) display = (char *)getenv("DISPLAY");
X    hDisplay = XOpenDisplay(display);
X    if (!hDisplay) {
X***************
X*** 1712,1718 ****
X  
X  
X    /* get the source rectangle */
X!   sourceWindow = hRoot;
X    if (sourceRoot) {
X      xrect.x = xrect.y = 0;
X      xrect.width  = DisplayWidth(hDisplay, hScreen);
X--- 1823,1830 ----
X  
X  
X    /* get the source rectangle */
X!   if (!sourceId)
X!     sourceWindow = hRoot;
X    if (sourceRoot) {
X      xrect.x = xrect.y = 0;
X      xrect.width  = DisplayWidth(hDisplay, hScreen);
X***************
X*** 1771,1778 ****
X        pixmap2bitmap(&image);
X        depth = 1;
X      }
X!     else if (halftone | dither)
X!       pixmap2halftone(&image, dither);
X      else
X        compressColormap(&image);
X    }
X--- 1883,1890 ----
X        pixmap2bitmap(&image);
X        depth = 1;
X      }
X!     else if (halftone)
X!       pixmap2halftone(&image, ditherKind);
X      else
X        compressColormap(&image);
X    }
X*** checkpoint/xgrabsc.man	Wed Sep 12 15:28:20 1990
X--- xgrabsc.man	Tue Sep 18 15:54:44 1990
X***************
X*** 2,12 ****
X  .\"
X  .\" Name - xgrabsc.man
X  .\"
X! .\" Version:	1.3
X  .\"
X! .\" ccsid:	@(#)xgrabsc.man	1.3 - 9/4/90 16:36:48
X  .\" from: 	ccs/s.xgrabsc.man
X! .\" date: 	9/4/90 16:40:09
X  .\"
X  .\" Copyright (C) 1990, Bruce Schuchardt
X  .\" See the end of this document for full copyright information.
X--- 2,12 ----
X  .\"
X  .\" Name - xgrabsc.man
X  .\"
X! .\" Version:	1.4
X  .\"
X! .\" ccsid:	@(#)xgrabsc.man	1.4 - 9/18/90 15:43:15
X  .\" from: 	ccs/s.xgrabsc.man
X! .\" date: 	9/18/90 15:54:18
X  .\"
X  .\" Copyright (C) 1990, Bruce Schuchardt
X  .\" See the end of this document for full copyright information.
X***************
X*** 86,100 ****
X  falling below the average color intensity are mapped to black.  Others
X  are mapped to white.
X  .TP
X- -D
X- Convert the source color image to a dithered monochrome bitmap.
X- This is like halftoning, but resolution is sacrificed to keep the
X- resulting image the same size as the original.
X- .TP
X  -H
X  Convert the source color image to a halftoned monchrome bitmap.
X  Resolution is maintained by increasing the size of the image by
X  a factor of four on both axes.
X  .sp 3
X  .TP
X  -E
X--- 86,106 ----
X  falling below the average color intensity are mapped to black.  Others
X  are mapped to white.
X  .TP
X  -H
X  Convert the source color image to a halftoned monchrome bitmap.
X  Resolution is maintained by increasing the size of the image by
X  a factor of four on both axes.
X+ .TP
X+ -D
X+ Convert the source color image to a dithered monochrome bitmap.
X+ This is like halftoning, but resolution is sacrificed to keep the
X+ resulting image the same size as the original.  The matrix dithering
X+ algorithm used with this option is most suitable for line-drawings
X+ and text.  For more complex graphics the \fI-F\fR option is recommended.
X+ .TP
X+ -F
X+ Convert the source color image to a dithered monochrome bitmap with
X+ the Floyd-Steinberg algorithm.
X  .sp 3
X  .TP
X  -E
X*** checkpoint/patchlevel.h	Wed Sep 12 15:28:17 1990
X--- patchlevel.h	Tue Sep 18 15:54:33 1990
X***************
X*** 4,14 ****
X  *
X  * Name - patchlevel.h
X  *
X! * Version:	1.3
X  *
X! * ccsid:	@(#)patchlevel.h	1.3 - 9/4/90 16:41:35
X  * from: 	ccs/s.patchlevel.h
X! * date: 	9/4/90 16:41:40
X  *
X  * Copyright (C), 1990 Bruce Schuchardt
X  * See cpyright.h for full copyright information.
X--- 4,14 ----
X  *
X  * Name - patchlevel.h
X  *
X! * Version:	1.4
X  *
X! * ccsid:	@(#)patchlevel.h	1.4 - 9/18/90 15:54:03
X  * from: 	ccs/s.patchlevel.h
X! * date: 	9/18/90 15:54:06
X  *
X  * Copyright (C), 1990 Bruce Schuchardt
X  * See cpyright.h for full copyright information.
X***************
X*** 17,23 ****
X  *
X  *========================================================================*/
X  
X! #define XGRABSC_PATCHLEVEL 1
X  
X! #define XGRABSC_VERSION "1.0 9/4/90 16:41:40"
X  #endif
X--- 17,23 ----
X  *
X  *========================================================================*/
X  
X! #define XGRABSC_PATCHLEVEL 2
X  
X! #define XGRABSC_VERSION "1.0 9/18/90 15:54:06"
X  #endif
END_OF_FILE
if test 19310 -ne `wc -c <'patch2'`; then
    echo shar: \"'patch2'\" unpacked with wrong size!
fi
# end of 'patch2'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0


dan
----------------------------------------------------
O'Reilly && Associates   argv at sun.com / argv at ora.com
Opinions expressed reflect those of the author only.



More information about the Comp.sources.x mailing list