home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sources / misc / 4240 < prev    next >
Encoding:
Text File  |  1993-01-06  |  17.4 KB  |  574 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: cristy@eplrx7.es.duPont.com (Cristy)
  4. Subject: v34i098: imagemagick - X11 image processing and display v2.2, Patch04
  5. Message-ID: <1993Jan7.042714.15882@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. Summary: X11 image processing and display utilities
  8. X-Md4-Signature: 25418f9de6626460535ee87d2132c059
  9. Keywords: UNIX VMS X11 SGI DEC Cray Sun Vax
  10. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  11. Organization: DuPont Engineering Physics Laboratory
  12. References: <csm-v34i028=imagemagick.141926@sparky.IMD.Sterling.COM>
  13. Date: Thu, 7 Jan 1993 04:27:14 GMT
  14. Approved: kent@sparky.imd.sterling.com
  15. Lines: 557
  16.  
  17. Submitted-by: cristy@dupont.com (Cristy)
  18. Posting-number: Volume 34, Issue 98
  19. Archive-name: imagemagick/patch04
  20. Environment: UNIX, VMS, X11, SGI, DEC, Cray, Sun, Vax
  21. Patch-To: imagemagick: Volume 34, Issue 28-54
  22.  
  23.                     ImageMagick 2.2 Patch #4
  24.  
  25. To apply this patch:
  26.  
  27. cd to the top of the source tree (to the directory containing the
  28. "ImageMagick" subdirectories) and do:
  29.  
  30.   patch -p < ThisFile
  31.  
  32. Prereq - ImageMagick 2.2.2 (posted from comp.sources.misc, Volume 34,
  33. Issue 28 + Patch 1 - 3).
  34.  
  35. Alternatively get the entire distribution as contrib/ImageMagick.tar.Z
  36. on export.lcs.mit.edu.
  37. -------------------
  38. diff -r -c ImageMagick/ChangeLog ImageMagick2.2.4/ChangeLog
  39. *** ImageMagick/ChangeLog    Wed Dec 23 18:10:05 1992
  40. --- ImageMagick2.2.4/ChangeLog    Wed Jan  6 17:57:53 1993
  41. ***************
  42. *** 1,3 ****
  43. --- 1,13 ----
  44. + ImageMagick 2.2.4
  45. +   o time between images did not always match the value specified on
  46. +     -delay.
  47. +   o Sped up and reduced memory requirement of dithering.
  48. +   o GIF files were corrupted on SVR4.
  49.   ImageMagick 2.2.3
  50.   
  51.     o Non-color reduced images were being written even though the color
  52. diff -r -c ImageMagick/X.c ImageMagick2.2.4/X.c
  53. *** ImageMagick/X.c    Wed Dec 23 18:10:01 1992
  54. --- ImageMagick2.2.4/X.c    Wed Jan  6 17:56:06 1993
  55. ***************
  56. *** 656,663 ****
  57.       *image;
  58.   
  59.     int
  60. -     display_width,
  61.       display_height,
  62.       number_colors,
  63.       status,
  64.       x,
  65. --- 656,663 ----
  66.       *image;
  67.   
  68.     int
  69.       display_height,
  70. +     display_width,
  71.       number_colors,
  72.       status,
  73.       x,
  74. ***************
  75. *** 4634,4639 ****
  76. --- 4634,4640 ----
  77.   #define MinWindowSize  64
  78.   
  79.     int
  80. +     mask,
  81.       status;
  82.   
  83.     XSizeHints
  84. ***************
  85. *** 4714,4722 ****
  86.       window_info->id=XCreateWindow(display,parent,window_info->x,window_info->y,
  87.         window_info->width,window_info->height,window_info->border_width,
  88.         window_info->depth,InputOutput,window_info->visual_info->visual,
  89. !       CWBackingStore | CWBackPixel | CWBackPixmap | CWBitGravity |
  90. !       CWBorderPixel | CWColormap | CWCursor | CWDontPropagate | CWEventMask |
  91. !       CWOverrideRedirect | CWSaveUnder | CWWinGravity,&window_info->attributes);
  92.     else
  93.       {
  94.         unsigned int
  95. --- 4715,4721 ----
  96.       window_info->id=XCreateWindow(display,parent,window_info->x,window_info->y,
  97.         window_info->width,window_info->height,window_info->border_width,
  98.         window_info->depth,InputOutput,window_info->visual_info->visual,
  99. !       window_info->mask,&window_info->attributes);
  100.     else
  101.       {
  102.         unsigned int
  103. ***************
  104. *** 4731,4740 ****
  105.         /*
  106.           Window already exists;  change relevant attributes.
  107.         */
  108. !       XChangeWindowAttributes(display,window_info->id,CWBackingStore |
  109. !         CWBackPixel | CWBackPixmap | CWBitGravity | CWBorderPixel |
  110. !         CWColormap | CWCursor | CWDontPropagate | CWEventMask |
  111. !         CWOverrideRedirect | CWSaveUnder | CWWinGravity,
  112.           &window_info->attributes);
  113.         XSync(display,False);
  114.         while (XCheckTypedWindowEvent(display,window_info->id,ConfigureNotify,
  115. --- 4730,4736 ----
  116.         /*
  117.           Window already exists;  change relevant attributes.
  118.         */
  119. !       XChangeWindowAttributes(display,window_info->id,window_info->mask,
  120.           &window_info->attributes);
  121.         XSync(display,False);
  122.         while (XCheckTypedWindowEvent(display,window_info->id,ConfigureNotify,
  123. diff -r -c ImageMagick/X.h ImageMagick2.2.4/X.h
  124. *** ImageMagick/X.h    Wed Dec 23 18:10:04 1992
  125. --- ImageMagick2.2.4/X.h    Wed Jan  6 17:56:09 1993
  126. ***************
  127. *** 222,227 ****
  128. --- 222,230 ----
  129.       pixmap,
  130.       *pixmaps;
  131.   
  132. +   int
  133. +     mask;
  134.     XSetWindowAttributes
  135.       attributes;
  136.   } XWindowInfo;
  137. diff -r -c ImageMagick/animate.c ImageMagick2.2.4/animate.c
  138. *** ImageMagick/animate.c    Wed Dec 23 18:10:02 1992
  139. --- ImageMagick2.2.4/animate.c    Wed Jan  6 17:56:07 1993
  140. ***************
  141. *** 810,815 ****
  142. --- 810,818 ----
  143.     window->superclass.immutable=True;
  144.     window->superclass.ximage=(XImage *) NULL;
  145.     window->superclass.pixmap=(Pixmap) NULL;
  146. +   window->superclass.mask=CWBackingStore | CWBackPixel | CWBackPixmap |
  147. +     CWBitGravity | CWBorderPixel | CWColormap | CWCursor | CWDontPropagate |
  148. +     CWEventMask | CWOverrideRedirect | CWSaveUnder | CWWinGravity;
  149.     window->superclass.attributes.background_pixel=
  150.       pixel_info.background_color.pixel;
  151.     window->superclass.attributes.background_pixmap=(Pixmap) NULL;
  152. diff -r -c ImageMagick/compress.c ImageMagick2.2.4/compress.c
  153. *** ImageMagick/compress.c    Wed Dec 23 18:10:02 1992
  154. --- ImageMagick2.2.4/compress.c    Wed Jan  6 17:56:07 1993
  155. ***************
  156. *** 967,976 ****
  157.   unsigned int
  158.     data_size;
  159.   {
  160. ! #define MaxCode(number_bits)  (((short int) (1 << (number_bits)))-1)
  161.   #define MaxHashTable  5003
  162.   #define MaxLZWBits  12
  163. ! #define MaxLZWTable  ((short int) 1 << MaxLZWBits)
  164.   #define LZWOutputCode(code) \
  165.   { \
  166.     /*  \
  167. --- 967,976 ----
  168.   unsigned int
  169.     data_size;
  170.   {
  171. ! #define MaxCode(number_bits)  ((1 << (number_bits))-1)
  172.   #define MaxHashTable  5003
  173.   #define MaxLZWBits  12
  174. ! #define MaxLZWTable  (1 << MaxLZWBits)
  175.   #define LZWOutputCode(code) \
  176.   { \
  177.     /*  \
  178. ***************
  179. *** 979,985 ****
  180.     if (bits > 0) \
  181.       datum|=((long int) code << bits); \
  182.     else \
  183. !     datum=code; \
  184.     bits+=number_bits; \
  185.     while (bits >= 8)  \
  186.     { \
  187. --- 979,985 ----
  188.     if (bits > 0) \
  189.       datum|=((long int) code << bits); \
  190.     else \
  191. !     datum=(long int) code; \
  192.     bits+=number_bits; \
  193.     while (bits >= 8)  \
  194.     { \
  195. ***************
  196. *** 1031,1036 ****
  197. --- 1031,1037 ----
  198.       free_code,
  199.       *hash_code,
  200.       *hash_prefix,
  201. +     index,
  202.       max_code,
  203.       waiting_code;
  204.   
  205. ***************
  206. *** 1067,1073 ****
  207.       Encode pixels.
  208.     */
  209.     p=image->pixels;
  210. !   waiting_code=(short int) (p->index & 0xff);
  211.     for (i=0; i < image->packets; i++)
  212.     {
  213.       for (j=0; j <= ((int) p->length); j++)
  214. --- 1068,1074 ----
  215.       Encode pixels.
  216.     */
  217.     p=image->pixels;
  218. !   waiting_code=p->index;
  219.     for (i=0; i < image->packets; i++)
  220.     {
  221.       for (j=0; j <= ((int) p->length); j++)
  222. ***************
  223. *** 1075,1087 ****
  224.         /*
  225.           Probe hash table.
  226.         */
  227. !       k=((int) (p->index) << (MaxLZWBits-8))+waiting_code;
  228.         if (k >= MaxHashTable)
  229.           k-=MaxHashTable;
  230. !       if (hash_code[k] >= 0)
  231.           {
  232. !           if ((hash_prefix[k] == waiting_code) &&
  233. !               (hash_suffix[k] == (unsigned char) (p->index & 0xff)))
  234.               {
  235.                 waiting_code=hash_code[k];
  236.                 continue;
  237. --- 1076,1088 ----
  238.         /*
  239.           Probe hash table.
  240.         */
  241. !       index=p->index & 0xff;
  242. !       k=(int) ((int) index << (MaxLZWBits-8))+waiting_code;
  243.         if (k >= MaxHashTable)
  244.           k-=MaxHashTable;
  245. !       if (hash_code[k] > 0)
  246.           {
  247. !           if ((hash_prefix[k] == waiting_code) && (hash_suffix[k] == index))
  248.               {
  249.                 waiting_code=hash_code[k];
  250.                 continue;
  251. ***************
  252. *** 1098,1105 ****
  253.                 k+=MaxHashTable;
  254.               if (hash_code[k] == 0)
  255.                 break;
  256. !             if ((hash_prefix[k] == waiting_code) &&
  257. !                 (hash_suffix[k] == (unsigned char) (p->index & 0xff)))
  258.                 {
  259.                   waiting_code=hash_code[k];
  260.                   next_pixel=True;
  261. --- 1099,1105 ----
  262.                 k+=MaxHashTable;
  263.               if (hash_code[k] == 0)
  264.                 break;
  265. !             if ((hash_prefix[k] == waiting_code) && (hash_suffix[k] == index))
  266.                 {
  267.                   waiting_code=hash_code[k];
  268.                   next_pixel=True;
  269. ***************
  270. *** 1114,1120 ****
  271.           {
  272.             hash_code[k]=free_code++;
  273.             hash_prefix[k]=waiting_code;
  274. !           hash_suffix[k]=(unsigned char) (p->index & 0xff);
  275.           }
  276.         else
  277.           {
  278. --- 1114,1120 ----
  279.           {
  280.             hash_code[k]=free_code++;
  281.             hash_prefix[k]=waiting_code;
  282. !           hash_suffix[k]=index;
  283.           }
  284.         else
  285.           {
  286. ***************
  287. *** 1131,1137 ****
  288.             number_bits=data_size;
  289.             max_code=MaxCode(number_bits);
  290.           }
  291. !       waiting_code=(short int) (p->index & 0xff);
  292.       }
  293.       p++;
  294.     }
  295. --- 1131,1137 ----
  296.             number_bits=data_size;
  297.             max_code=MaxCode(number_bits);
  298.           }
  299. !       waiting_code=index;
  300.       }
  301.       p++;
  302.     }
  303. diff -r -c ImageMagick/display.c ImageMagick2.2.4/display.c
  304. *** ImageMagick/display.c    Wed Dec 23 18:10:03 1992
  305. --- ImageMagick2.2.4/display.c    Wed Jan  6 17:56:08 1993
  306. ***************
  307. *** 2649,2654 ****
  308. --- 2649,2657 ----
  309.     window->superclass.immutable=True;
  310.     window->superclass.ximage=(XImage *) NULL;
  311.     window->superclass.pixmap=(Pixmap) NULL;
  312. +   window->superclass.mask=CWBackingStore | CWBackPixel | CWBackPixmap |
  313. +     CWBitGravity | CWBorderPixel | CWColormap | CWCursor | CWDontPropagate |
  314. +     CWEventMask | CWOverrideRedirect | CWSaveUnder | CWWinGravity;
  315.     window->superclass.attributes.background_pixel=
  316.       pixel_info.background_color.pixel;
  317.     window->superclass.attributes.background_pixmap=(Pixmap) NULL;
  318. ***************
  319. *** 2928,2937 ****
  320.     *state&=(~LastImageState);
  321.     *state&=(~NextImageState);
  322.     *state&=(~TileImageState);
  323. !   if (resource_info->delay == 0)
  324. !     timeout=(unsigned long) (~0);
  325. !   else
  326. !     timeout=(unsigned long) time((time_t *) 0)+resource_info->delay;
  327.     do
  328.     {
  329.       /*
  330. --- 2931,2937 ----
  331.     *state&=(~LastImageState);
  332.     *state&=(~NextImageState);
  333.     *state&=(~TileImageState);
  334. !   timeout=(unsigned long) (~0);
  335.     do
  336.     {
  337.       /*
  338. ***************
  339. *** 3181,3189 ****
  340.                 /*
  341.                   Reset timeout after expose.
  342.                 */
  343. !               if (resource_info->delay == 0)
  344. !                 timeout=(unsigned long) (~0);
  345. !               else
  346.                   timeout=(unsigned long) time((time_t *) 0)+resource_info->delay;
  347.                 break;
  348.               }
  349. --- 3181,3187 ----
  350.                 /*
  351.                   Reset timeout after expose.
  352.                 */
  353. !               if (resource_info->delay != 0)
  354.                   timeout=(unsigned long) time((time_t *) 0)+resource_info->delay;
  355.                 break;
  356.               }
  357. diff -r -c ImageMagick/image.c ImageMagick2.2.4/image.c
  358. *** ImageMagick/image.c    Wed Dec 23 18:10:03 1992
  359. --- ImageMagick2.2.4/image.c    Wed Jan  6 17:56:08 1993
  360. ***************
  361. *** 5189,5195 ****
  362.   {
  363.     register int
  364.       i,
  365. !     j;
  366.   
  367.     register RunlengthPacket
  368.       *p,
  369. --- 5189,5196 ----
  370.   {
  371.     register int
  372.       i,
  373. !     j,
  374. !     length;
  375.   
  376.     register RunlengthPacket
  377.       *p,
  378. ***************
  379. *** 5203,5217 ****
  380.     /*
  381.       Uncompress runlength-encoded packets.
  382.     */
  383. !   uncompressed_pixels=(RunlengthPacket *)
  384. !     malloc(image->columns*image->rows*sizeof(RunlengthPacket));
  385.     if (uncompressed_pixels == (RunlengthPacket *) NULL)
  386.       return(False);
  387. !   p=image->pixels;
  388. !   q=uncompressed_pixels;
  389.     for (i=0; i < image->packets; i++)
  390.     {
  391. !     for (j=0; j <= ((int) p->length); j++)
  392.       {
  393.         q->red=p->red;
  394.         q->green=p->green;
  395. --- 5204,5220 ----
  396.     /*
  397.       Uncompress runlength-encoded packets.
  398.     */
  399. !   uncompressed_pixels=(RunlengthPacket *) realloc((char *) image->pixels,
  400. !     image->columns*image->rows*sizeof(RunlengthPacket));
  401.     if (uncompressed_pixels == (RunlengthPacket *) NULL)
  402.       return(False);
  403. !   image->pixels=uncompressed_pixels;
  404. !   p=image->pixels+image->packets-1;
  405. !   q=uncompressed_pixels+image->columns*image->rows-1;
  406.     for (i=0; i < image->packets; i++)
  407.     {
  408. !     length=p->length;
  409. !     for (j=0; j <= length; j++)
  410.       {
  411.         q->red=p->red;
  412.         q->green=p->green;
  413. ***************
  414. *** 5218,5229 ****
  415.         q->blue=p->blue;
  416.         q->index=p->index;
  417.         q->length=0;
  418. !       q++;
  419.       }
  420. !     p++;
  421.     }
  422. -   (void) free((char *) image->pixels);
  423. -   image->pixels=uncompressed_pixels;
  424.     image->packets=image->columns*image->rows;
  425.     return(True);
  426.   }
  427. --- 5221,5230 ----
  428.         q->blue=p->blue;
  429.         q->index=p->index;
  430.         q->length=0;
  431. !       q--;
  432.       }
  433. !     p--;
  434.     }
  435.     image->packets=image->columns*image->rows;
  436.     return(True);
  437.   }
  438. Common subdirectories: ImageMagick/images and ImageMagick2.2.4/images
  439. diff -r -c ImageMagick/montage.c ImageMagick2.2.4/montage.c
  440. *** ImageMagick/montage.c    Wed Dec 23 18:10:04 1992
  441. --- ImageMagick2.2.4/montage.c    Wed Jan  6 17:56:08 1993
  442. ***************
  443. *** 1297,1303 ****
  444.               malloc(((strlen(image->filename)+2048)*sizeof(char)));
  445.             if (image->label == (char *) NULL)
  446.               Error("unable to montage images","memory allocation failed");
  447. !           (void) sprintf(image->label,"%s %ux%u\0",image->filename,
  448.               image->columns,image->rows);
  449.             /*
  450.               Tile size maintains the aspect ratio of the image.
  451. --- 1297,1303 ----
  452.               malloc(((strlen(image->filename)+2048)*sizeof(char)));
  453.             if (image->label == (char *) NULL)
  454.               Error("unable to montage images","memory allocation failed");
  455. !           (void) sprintf(image->label,"%s  %ux%u\0",image->filename,
  456.               image->columns,image->rows);
  457.             /*
  458.               Tile size maintains the aspect ratio of the image.
  459. diff -r -c ImageMagick/quantize.c ImageMagick2.2.4/quantize.c
  460. *** ImageMagick/quantize.c    Wed Dec 23 18:10:04 1992
  461. --- ImageMagick2.2.4/quantize.c    Wed Jan  6 17:56:08 1993
  462. ***************
  463. *** 1545,1558 ****
  464.     if (number_colors > MaxColormapSize)
  465.       number_colors=MaxColormapSize;
  466.     InitializeCube(number_colors,tree_depth,image->columns*image->rows,optimal);
  467. !   if ((image->compression == RunlengthEncodedCompression) &&
  468. !       (image->packets == (image->columns*image->rows)))
  469. !     CompressImage(image);
  470.     if (colorspace != RGBColorspace)
  471.       RGBTransformImage(image,colorspace);
  472.     Classification(image);
  473. -   if (!optimal)
  474. -     dither|=(cube.colors > (1 << (cube.depth-1)));
  475.     Reduction(number_colors);
  476.     Assignment(image,dither,optimal);
  477.     if (colorspace != RGBColorspace)
  478. --- 1545,1558 ----
  479.     if (number_colors > MaxColormapSize)
  480.       number_colors=MaxColormapSize;
  481.     InitializeCube(number_colors,tree_depth,image->columns*image->rows,optimal);
  482. !   if (!optimal)
  483. !     dither|=cube.depth > 3;
  484. !   if (!dither)
  485. !     if (image->packets == (image->columns*image->rows))
  486. !       CompressImage(image);
  487.     if (colorspace != RGBColorspace)
  488.       RGBTransformImage(image,colorspace);
  489.     Classification(image);
  490.     Reduction(number_colors);
  491.     Assignment(image,dither,optimal);
  492.     if (colorspace != RGBColorspace)
  493. ***************
  494. *** 1662,1676 ****
  495.       Reduce the number of colors in the continuous tone image sequence.
  496.     */
  497.     InitializeCube(number_colors,tree_depth,~0,optimal);
  498.     if (colormap_image != (Image *) NULL)
  499.       {
  500.         /*
  501.           Reduce images to a set of colors represented by the colormap image.
  502.         */
  503. !       if ((colormap_image->compression == RunlengthEncodedCompression) &&
  504. !           (colormap_image->packets ==
  505. !            (colormap_image->columns*colormap_image->rows)))
  506. !         CompressImage(colormap_image);
  507.         if (colorspace != RGBColorspace)
  508.           RGBTransformImage(colormap_image,colorspace);
  509.         Classification(colormap_image);
  510. --- 1662,1678 ----
  511.       Reduce the number of colors in the continuous tone image sequence.
  512.     */
  513.     InitializeCube(number_colors,tree_depth,~0,optimal);
  514. +   if (!optimal)
  515. +     dither|=cube.depth > 3;
  516.     if (colormap_image != (Image *) NULL)
  517.       {
  518.         /*
  519.           Reduce images to a set of colors represented by the colormap image.
  520.         */
  521. !       if (!dither)
  522. !         if (colormap_image->packets ==
  523. !              (colormap_image->columns*colormap_image->rows))
  524. !           CompressImage(colormap_image);
  525.         if (colorspace != RGBColorspace)
  526.           RGBTransformImage(colormap_image,colorspace);
  527.         Classification(colormap_image);
  528. ***************
  529. *** 1680,1695 ****
  530.       }
  531.     for (i=0; i < number_images; i++)
  532.     {
  533. !     if ((images[i]->compression == RunlengthEncodedCompression) &&
  534. !         (images[i]->packets == (images[i]->columns*images[i]->rows)))
  535. !       CompressImage(images[i]);
  536.       if (colorspace != RGBColorspace)
  537.         RGBTransformImage(images[i],colorspace);
  538.       if (colormap_image == (Image *) NULL)
  539.         Classification(images[i]);
  540.     }
  541. -   if (!optimal)
  542. -     dither|=(cube.colors > (1 << (cube.depth-1)));
  543.     Reduction(number_colors);
  544.     for (i=0; i < number_images; i++)
  545.     {
  546. --- 1682,1695 ----
  547.       }
  548.     for (i=0; i < number_images; i++)
  549.     {
  550. !     if (!dither)
  551. !       if (images[i]->packets == (images[i]->columns*images[i]->rows))
  552. !         CompressImage(images[i]);
  553.       if (colorspace != RGBColorspace)
  554.         RGBTransformImage(images[i],colorspace);
  555.       if (colormap_image == (Image *) NULL)
  556.         Classification(images[i]);
  557.     }
  558.     Reduction(number_colors);
  559.     for (i=0; i < number_images; i++)
  560.     {
  561. Common subdirectories: ImageMagick/scenes and ImageMagick2.2.4/scenes
  562. Common subdirectories: ImageMagick/utilities and ImageMagick2.2.4/utilities
  563. Common subdirectories: ImageMagick/xtp and ImageMagick2.2.4/xtp
  564. -- 
  565. cristy@dupont.com
  566.  
  567. exit 0 # Just in case...
  568.