home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume34 / imagemagick / patch04 < prev    next >
Text File  |  1993-01-06  |  18KB  |  566 lines

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