home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume26 / pbmplus / patch10dec91 / part02 < prev    next >
Encoding:
Text File  |  1991-12-14  |  55.2 KB  |  2,000 lines

  1. Newsgroups: comp.sources.misc
  2. From: jef@well.sf.ca.us (Jef Poskanzer)
  3. Subject:  v26i107:  pbmplus - Extended Portable Bitmap Toolkit, Patch10dec91, Part02/05
  4. Message-ID: <1991Dec15.014542.20374@sparky.imd.sterling.com>
  5. X-Md4-Signature: abfe7210d50de8e32a89e8bdddc36db6
  6. Date: Sun, 15 Dec 1991 01:45:42 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jef@well.sf.ca.us (Jef Poskanzer)
  10. Posting-number: Volume 26, Issue 107
  11. Archive-name: pbmplus/patch10dec91/part02
  12. Environment: UNIX
  13. Patch-To: pbmplus: Volume 23, Issue 36-59
  14.  
  15. #!/bin/sh
  16. # do not concatenate these parts, unpack them in order with /bin/sh
  17. # file p121091.diffs continued
  18. #
  19. if test ! -r _shar_seq_.tmp; then
  20.     echo 'Please unpack part 1 first!'
  21.     exit 1
  22. fi
  23. (read Scheck
  24.  if test "$Scheck" != 2; then
  25.     echo Please unpack part "$Scheck" next!
  26.     exit 1
  27.  else
  28.     exit 0
  29.  fi
  30. ) < _shar_seq_.tmp || exit 1
  31. if test ! -f _shar_wnt_.tmp; then
  32.     echo 'x - still skipping p121091.diffs'
  33. else
  34. echo 'x - continuing file p121091.diffs'
  35. sed 's/^X//' << 'SHAR_EOF' >> 'p121091.diffs' &&
  36. X          ppmtopj ppmtopuzz ppmtorgb3 ppmtosixel \
  37. X          ppmtotga ppmtouil ppmtoxpm ppmtoyuv qrttoppm \
  38. !         rawtoppm rgb3toppm sldtoppm spctoppm sputoppm \
  39. X          tgatoppm ximtoppm xpmtoppm yuvtoppm
  40. ! MATHBINARIES =    ppmforge ppmpat
  41. X  BINARIES =    $(PORTBINARIES) $(MATHBINARIES)
  42. X  SCRIPTS =    ppmquantall
  43. X  
  44. X  OBJECTS =    giftoppm.o gouldtoppm.o ilbmtoppm.o imgtoppm.o mtvtoppm.o \
  45. X          pcxtoppm.o pgmtoppm.o pi1toppm.o picttoppm.o \
  46. !         pjtoppm.o ppmdither.o ppmhist.o ppmmake.o \
  47. !         ppmquant.o ppmrelief.o ppmtoacad.o ppmtogif.o ppmtoicr.o \
  48. !         ppmtoilbm.o ppmtopcx.o ppmtopgm.o ppmtopi1.o ppmtopict.o \
  49. X          ppmtopj.o ppmtopuzz.o ppmtorgb3.o ppmtosixel.o \
  50. X          ppmtotga.o ppmtouil.o ppmtoxpm.o ppmtoyuv.o qrttoppm.o \
  51. !         rawtoppm.o rgb3toppm.o sldtoppm.o spctoppm.o sputoppm.o \
  52. X          tgatoppm.o ximtoppm.o xpmtoppm.o yuvtoppm.o \
  53. !         ppmforge.o ppmpat.o
  54. X  
  55. X  MANUALS1 =    $(BINARIES) $(SCRIPTS)
  56. X  MANUALS3 =    libppm
  57. ***************
  58. *** 167,177 ****
  59. --- 167,179 ----
  60. X  picttoppm picttoppm.o:        picttoppm.c
  61. X  pjtoppm pjtoppm.o:        pjtoppm.c
  62. X  ppmdither ppmdither.o:        ppmdither.c
  63. + ppmforge ppmforge.o:        ppmforge.c
  64. X  ppmhist ppmhist.o:        ppmhist.c ppmcmap.h
  65. X  ppmmake ppmmake.o:        ppmmake.c
  66. X  ppmpat ppmpat.o:        ppmpat.c ppmdraw.h
  67. X  ppmquant ppmquant.o:        ppmquant.c $(PGMDIR)/dithers.h ppmcmap.h
  68. X  ppmrelief ppmrelief.o:        ppmrelief.c
  69. + ppmtoacad ppmtoacad.o:        ppmtoacad.c ppmcmap.h autocad.h
  70. X  ppmtogif ppmtogif.o:        ppmtogif.c ppmcmap.h
  71. X  ppmtoicr ppmtoicr.o:        ppmtoicr.c ppmcmap.h
  72. X  ppmtoilbm ppmtoilbm.o:        ppmtoilbm.c ilbm.h ppmcmap.h
  73. ***************
  74. *** 190,195 ****
  75. --- 192,198 ----
  76. X  qrttoppm qrttoppm.o:        qrttoppm.c
  77. X  rawtoppm rawtoppm.o:        rawtoppm.c
  78. X  rgb3toppm rgb3toppm.o:        rgb3toppm.c
  79. + sldtoppm sldtoppm.o:        sldtoppm.c ppmdraw.h autocad.h
  80. X  spctoppm spctoppm.o:        spctoppm.c
  81. X  sputoppm sputoppm.o:        sputoppm.c
  82. X  tgatoppm tgatoppm.o:        tgatoppm.c tga.h
  83. diff -cr pbmplus30oct91/ppm/giftoppm.c ppm/giftoppm.c
  84. *** pbmplus30oct91/ppm/giftoppm.c    Sat Oct  5 22:36:46 1991
  85. --- ppm/giftoppm.c    Tue Dec 10 16:55:36 1991
  86. ***************
  87. *** 104,109 ****
  88. --- 104,110 ----
  89. X  
  90. X      ReadGIF(in, imageNumber);
  91. X      pm_close(in);
  92. +     pm_close(stdout);
  93. X      exit(0);
  94. X  }
  95. X  
  96. ***************
  97. *** 286,293 ****
  98. X          break;
  99. X      }
  100. X  
  101. !     pm_message("got a '%s' extension - please report this to koblas@mips.com",
  102. !                     str );
  103. X  
  104. X      while (GetDataBlock(fd, (unsigned char*) buf) != 0)
  105. X          ;
  106. --- 287,293 ----
  107. X          break;
  108. X      }
  109. X  
  110. !     pm_message("got a '%s' extension", str );
  111. X  
  112. X      while (GetDataBlock(fd, (unsigned char*) buf) != 0)
  113. X          ;
  114. diff -cr pbmplus30oct91/ppm/gouldtoppm.c ppm/gouldtoppm.c
  115. *** pbmplus30oct91/ppm/gouldtoppm.c    Fri Jun 28 14:35:23 1991
  116. --- ppm/gouldtoppm.c    Tue Dec 10 16:56:34 1991
  117. ***************
  118. *** 84,89 ****
  119. --- 84,90 ----
  120. X      }
  121. X  
  122. X      pm_close(ifp);
  123. +     pm_close(stdout);
  124. X  
  125. X      exit(0);
  126. X  }
  127. diff -cr pbmplus30oct91/ppm/ilbmtoppm.c ppm/ilbmtoppm.c
  128. *** pbmplus30oct91/ppm/ilbmtoppm.c    Fri Sep 27 01:25:46 1991
  129. --- ppm/ilbmtoppm.c    Tue Dec 10 16:55:39 1991
  130. ***************
  131. *** 364,369 ****
  132. --- 364,371 ----
  133. X      ppm_writeppmrow( stdout, pixelrow, cols, (pixval) maxval, 0 );
  134. X      }
  135. X  
  136. +     pm_close( stdout );
  137. X      exit( 0 );
  138. X      }
  139. X  
  140. diff -cr pbmplus30oct91/ppm/imgtoppm.c ppm/imgtoppm.c
  141. *** pbmplus30oct91/ppm/imgtoppm.c    Fri Jun 28 14:30:24 1991
  142. --- ppm/imgtoppm.c    Tue Dec 10 16:56:00 1991
  143. ***************
  144. *** 122,127 ****
  145. --- 122,128 ----
  146. X          ppm_writeppmrow( stdout, pixelrow, cols, maxval, 0 );
  147. X          }
  148. X          pm_close( ifp );
  149. +         pm_close( stdout );
  150. X          exit( 0 );
  151. X          }
  152. X      }
  153. diff -cr pbmplus30oct91/ppm/libppm2.c ppm/libppm2.c
  154. *** pbmplus30oct91/ppm/libppm2.c    Fri Jun 28 14:30:27 1991
  155. --- ppm/libppm2.c    Tue Dec 10 16:55:23 1991
  156. ***************
  157. *** 41,55 ****
  158. X  #endif /*PBMPLUS_RAWBITS*/
  159. X      }
  160. X  
  161. ! static int
  162. X  putus( n, file )
  163. X      unsigned short n;
  164. X      FILE* file;
  165. X      {
  166. X      if ( n >= 10 )
  167. !     if ( putus( n / 10, file ) == EOF )
  168. !         return EOF;
  169. !     return putc( n % 10 + '0', file );
  170. X      }
  171. X  
  172. X  #ifdef PBMPLUS_RAWBITS
  173. --- 41,54 ----
  174. X  #endif /*PBMPLUS_RAWBITS*/
  175. X      }
  176. X  
  177. ! static void
  178. X  putus( n, file )
  179. X      unsigned short n;
  180. X      FILE* file;
  181. X      {
  182. X      if ( n >= 10 )
  183. !     putus( n / 10, file );
  184. !     (void) putc( n % 10 + '0', file );
  185. X      }
  186. X  
  187. X  #ifdef PBMPLUS_RAWBITS
  188. ***************
  189. *** 71,92 ****
  190. X      if ( val > maxval )
  191. X          pm_error( "r value out of bounds (%u > %u)", val, maxval );
  192. X  #endif /*DEBUG*/
  193. !     if ( putc( val, file ) == EOF )
  194. !         pm_error( "write error" );
  195. X      val = PPM_GETG( *pP );
  196. X  #ifdef DEBUG
  197. X      if ( val > maxval )
  198. X          pm_error( "g value out of bounds (%u > %u)", val, maxval );
  199. X  #endif /*DEBUG*/
  200. !     if ( putc( val, file ) == EOF )
  201. !         pm_error( "write error" );
  202. X      val = PPM_GETB( *pP );
  203. X  #ifdef DEBUG
  204. X      if ( val > maxval )
  205. X          pm_error( "b value out of bounds (%u > %u)", val, maxval );
  206. X  #endif /*DEBUG*/
  207. !     if ( putc( val, file ) == EOF )
  208. !         pm_error( "write error" );
  209. X          }
  210. X      }
  211. X  #endif /*PBMPLUS_RAWBITS*/
  212. --- 70,88 ----
  213. X      if ( val > maxval )
  214. X          pm_error( "r value out of bounds (%u > %u)", val, maxval );
  215. X  #endif /*DEBUG*/
  216. !     (void) putc( val, file );
  217. X      val = PPM_GETG( *pP );
  218. X  #ifdef DEBUG
  219. X      if ( val > maxval )
  220. X          pm_error( "g value out of bounds (%u > %u)", val, maxval );
  221. X  #endif /*DEBUG*/
  222. !     (void) putc( val, file );
  223. X      val = PPM_GETB( *pP );
  224. X  #ifdef DEBUG
  225. X      if ( val > maxval )
  226. X          pm_error( "b value out of bounds (%u > %u)", val, maxval );
  227. X  #endif /*DEBUG*/
  228. !     (void) putc( val, file );
  229. X          }
  230. X      }
  231. X  #endif /*PBMPLUS_RAWBITS*/
  232. ***************
  233. *** 107,122 ****
  234. X      {
  235. X      if ( charcount >= 65 )
  236. X          {
  237. !         if ( putc( '\n', file ) == EOF )
  238. !         pm_error( "write error" );
  239. X          charcount = 0;
  240. X          }
  241. X      else if ( charcount > 0 )
  242. X          {
  243. !         if ( putc( ' ', file ) == EOF )
  244. !         pm_error( "write error" );
  245. !         if ( putc( ' ', file ) == EOF )
  246. !         pm_error( "write error" );
  247. X          charcount += 2;
  248. X          }
  249. X      val = PPM_GETR( *pP );
  250. --- 103,115 ----
  251. X      {
  252. X      if ( charcount >= 65 )
  253. X          {
  254. !         (void) putc( '\n', file );
  255. X          charcount = 0;
  256. X          }
  257. X      else if ( charcount > 0 )
  258. X          {
  259. !         (void) putc( ' ', file );
  260. !         (void) putc( ' ', file );
  261. X          charcount += 2;
  262. X          }
  263. X      val = PPM_GETR( *pP );
  264. ***************
  265. *** 124,154 ****
  266. X      if ( val > maxval )
  267. X          pm_error( "r value out of bounds (%u > %u)", val, maxval );
  268. X  #endif /*DEBUG*/
  269. !     if ( putus( val, file ) == EOF )
  270. !         pm_error( "write error" );
  271. !     if ( putc( ' ', file ) == EOF )
  272. !         pm_error( "write error" );
  273. X      val = PPM_GETG( *pP );
  274. X  #ifdef DEBUG
  275. X      if ( val > maxval )
  276. X          pm_error( "g value out of bounds (%u > %u)", val, maxval );
  277. X  #endif /*DEBUG*/
  278. !     if ( putus( val, file ) == EOF )
  279. !         pm_error( "write error" );
  280. !     if ( putc( ' ', file ) == EOF )
  281. !         pm_error( "write error" );
  282. X      val = PPM_GETB( *pP );
  283. X  #ifdef DEBUG
  284. X      if ( val > maxval )
  285. X          pm_error( "b value out of bounds (%u > %u)", val, maxval );
  286. X  #endif /*DEBUG*/
  287. !     if ( putus( val, file ) == EOF )
  288. !         pm_error( "write error" );
  289. X      charcount += 11;
  290. X      }
  291. X      if ( charcount > 0 )
  292. !     if ( putc( '\n', file ) == EOF )
  293. !         pm_error( "write error" );
  294. X      }
  295. X  
  296. X  #if __STDC__
  297. --- 117,141 ----
  298. X      if ( val > maxval )
  299. X          pm_error( "r value out of bounds (%u > %u)", val, maxval );
  300. X  #endif /*DEBUG*/
  301. !     putus( val, file );
  302. !     (void) putc( ' ', file );
  303. X      val = PPM_GETG( *pP );
  304. X  #ifdef DEBUG
  305. X      if ( val > maxval )
  306. X          pm_error( "g value out of bounds (%u > %u)", val, maxval );
  307. X  #endif /*DEBUG*/
  308. !     putus( val, file );
  309. !     (void) putc( ' ', file );
  310. X      val = PPM_GETB( *pP );
  311. X  #ifdef DEBUG
  312. X      if ( val > maxval )
  313. X          pm_error( "b value out of bounds (%u > %u)", val, maxval );
  314. X  #endif /*DEBUG*/
  315. !     putus( val, file );
  316. X      charcount += 11;
  317. X      }
  318. X      if ( charcount > 0 )
  319. !     (void) putc( '\n', file );
  320. X      }
  321. X  
  322. X  #if __STDC__
  323. diff -cr pbmplus30oct91/ppm/mtvtoppm.c ppm/mtvtoppm.c
  324. *** pbmplus30oct91/ppm/mtvtoppm.c    Fri Jun 28 14:30:33 1991
  325. --- ppm/mtvtoppm.c    Tue Dec 10 16:55:34 1991
  326. ***************
  327. *** 61,66 ****
  328. --- 61,67 ----
  329. X      }
  330. X  
  331. X      pm_close( ifp );
  332. +     pm_close( stdout );
  333. X  
  334. X      exit( 0 );
  335. X      }
  336. diff -cr pbmplus30oct91/ppm/pcxtoppm.c ppm/pcxtoppm.c
  337. *** pbmplus30oct91/ppm/pcxtoppm.c    Wed Sep 25 19:57:52 1991
  338. --- ppm/pcxtoppm.c    Tue Dec 10 16:56:24 1991
  339. ***************
  340. *** 187,192 ****
  341. --- 187,194 ----
  342. X  
  343. X      ppm_writeppm(stdout, pixels, Width, Height, (pixval) 255, 0 );
  344. X  
  345. +     pm_close(stdout);
  346. X      exit(0);
  347. X  }
  348. X  
  349. diff -cr pbmplus30oct91/ppm/pgmtoppm.c ppm/pgmtoppm.c
  350. *** pbmplus30oct91/ppm/pgmtoppm.c    Fri Jun 28 14:30:38 1991
  351. --- ppm/pgmtoppm.c    Tue Dec 10 16:56:32 1991
  352. ***************
  353. *** 143,148 ****
  354. --- 143,149 ----
  355. X      }
  356. X  
  357. X      pm_close( ifp );
  358. +     pm_close( stdout );
  359. X  
  360. X      exit( 0 );
  361. X      }
  362. diff -cr pbmplus30oct91/ppm/pi1toppm.c ppm/pi1toppm.c
  363. *** pbmplus30oct91/ppm/pi1toppm.c    Fri Sep 27 17:01:29 1991
  364. --- ppm/pi1toppm.c    Tue Dec 10 16:56:15 1991
  365. ***************
  366. *** 84,88 ****
  367. --- 84,90 ----
  368. X      ppm_writeppmrow( stdout, pixelrow, COLS, (pixval) MAXVAL, 0 );
  369. X      }
  370. X  
  371. +     pm_close( stdout );
  372. X      exit( 0 );
  373. X      }
  374. diff -cr pbmplus30oct91/ppm/picttoppm.c ppm/picttoppm.c
  375. *** pbmplus30oct91/ppm/picttoppm.c    Thu Sep 26 20:28:02 1991
  376. --- ppm/picttoppm.c    Tue Dec 10 16:56:09 1991
  377. ***************
  378. *** 525,530 ****
  379. --- 525,531 ----
  380. X  
  381. X          ppm_writeppmrow(stdout, pixelrow, width, (pixval) 255, 0 );
  382. X      }
  383. +     pm_close(stdout);
  384. X  }
  385. X  
  386. X  /*
  387. diff -cr pbmplus30oct91/ppm/pjtoppm.c ppm/pjtoppm.c
  388. *** pbmplus30oct91/ppm/pjtoppm.c    Thu Sep 26 16:33:15 1991
  389. --- ppm/pjtoppm.c    Tue Dec 10 16:56:43 1991
  390. ***************
  391. *** 245,249 ****
  392. --- 245,250 ----
  393. X          }
  394. X          ppm_writeppmrow(stdout, pixrow, cols, (pixval) 255, 0);
  395. X      }
  396. +     pm_close(stdout);
  397. X      exit(0);
  398. X  }
  399. diff -cr pbmplus30oct91/ppm/ppm.5 ppm/ppm.5
  400. *** pbmplus30oct91/ppm/ppm.5    Fri Sep 27 01:41:17 1991
  401. --- ppm/ppm.5    Tue Dec 10 16:55:29 1991
  402. ***************
  403. *** 75,87 ****
  404. X  .SH "SEE ALSO"
  405. X  giftoppm(1), gouldtoppm(1), ilbmtoppm(1), imgtoppm(1), mtvtoppm(1),
  406. X  pcxtoppm(1), pgmtoppm(1), pi1toppm(1), picttoppm(1), pjtoppm(1), qrttoppm(1),
  407. ! rawtoppm(1), rgb3toppm(1), spctoppm(1), sputoppm(1), tgatoppm(1),
  408. X  ximtoppm(1), xpmtoppm(1), yuvtoppm(1),
  409. ! ppmtogif(1), ppmtoicr(1), ppmtoilbm(1), ppmtopcx(1), ppmtopgm(1),
  410. X  ppmtopi1(1), ppmtopict(1), ppmtopj(1), ppmtopuzz(1), ppmtorgb3(1),
  411. X  ppmtosixel(1), ppmtotga(1), ppmtouil(1), ppmtoxpm(1), ppmtoyuv(1),
  412. ! ppmdither(1), ppmhist(1), ppmmake(1), ppmpat(1), ppmquant(1), ppmquantall(1),
  413. ! ppmrelief(1),
  414. X  pnm(5), pgm(5), pbm(5)
  415. X  .SH AUTHOR
  416. X  Copyright (C) 1989, 1991 by Jef Poskanzer.
  417. --- 75,87 ----
  418. X  .SH "SEE ALSO"
  419. X  giftoppm(1), gouldtoppm(1), ilbmtoppm(1), imgtoppm(1), mtvtoppm(1),
  420. X  pcxtoppm(1), pgmtoppm(1), pi1toppm(1), picttoppm(1), pjtoppm(1), qrttoppm(1),
  421. ! rawtoppm(1), rgb3toppm(1), sldtoppm(1), spctoppm(1), sputoppm(1), tgatoppm(1),
  422. X  ximtoppm(1), xpmtoppm(1), yuvtoppm(1),
  423. ! ppmtoacad(1), ppmtogif(1), ppmtoicr(1), ppmtoilbm(1), ppmtopcx(1), ppmtopgm(1),
  424. X  ppmtopi1(1), ppmtopict(1), ppmtopj(1), ppmtopuzz(1), ppmtorgb3(1),
  425. X  ppmtosixel(1), ppmtotga(1), ppmtouil(1), ppmtoxpm(1), ppmtoyuv(1),
  426. ! ppmdither(1), ppmforge(1), ppmhist(1), ppmmake(1), ppmpat(1), ppmquant(1),
  427. ! ppmquantall(1), ppmrelief(1),
  428. X  pnm(5), pgm(5), pbm(5)
  429. X  .SH AUTHOR
  430. X  Copyright (C) 1989, 1991 by Jef Poskanzer.
  431. diff -cr pbmplus30oct91/ppm/ppm.h ppm/ppm.h
  432. *** pbmplus30oct91/ppm/ppm.h    Tue Jan 22 19:43:59 1991
  433. --- ppm/ppm.h    Tue Dec 10 16:55:30 1991
  434. ***************
  435. *** 79,87 ****
  436. X  
  437. X  #define PPM_DEPTH(newp,p,oldmaxval,newmaxval) \
  438. X      PPM_ASSIGN( (newp), \
  439. !             (int) PPM_GETR(p) * (newmaxval) / (oldmaxval), \
  440. !             (int) PPM_GETG(p) * (newmaxval) / (oldmaxval), \
  441. !             (int) PPM_GETB(p) * (newmaxval) / (oldmaxval) )
  442. X  
  443. X  
  444. X  /* Luminance macro. */
  445. --- 79,87 ----
  446. X  
  447. X  #define PPM_DEPTH(newp,p,oldmaxval,newmaxval) \
  448. X      PPM_ASSIGN( (newp), \
  449. !     ( (int) PPM_GETR(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \
  450. !     ( (int) PPM_GETG(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \
  451. !     ( (int) PPM_GETB(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval) )
  452. X  
  453. X  
  454. X  /* Luminance macro. */
  455. diff -cr pbmplus30oct91/ppm/ppmdither.c ppm/ppmdither.c
  456. *** pbmplus30oct91/ppm/ppmdither.c    Thu Sep 26 16:46:46 1991
  457. --- ppm/ppmdither.c    Tue Dec 10 16:56:47 1991
  458. ***************
  459. *** 250,254 ****
  460. --- 250,255 ----
  461. X      dith_setup(dith_dim, dith_nr, dith_ng, dith_nb, ptab);
  462. X      dith_dither(cols, rows, ptab, &ipixels[0][0], &opixels[0][0]);
  463. X      ppm_writeppm(stdout, opixels, cols, rows, maxval, 0);
  464. +     pm_close(stdout);
  465. X      exit(0);
  466. X  }
  467. diff -cr pbmplus30oct91/ppm/ppmmake.1 ppm/ppmmake.1
  468. *** pbmplus30oct91/ppm/ppmmake.1    Wed Sep 25 22:35:35 1991
  469. --- ppm/ppmmake.1    Tue Dec 10 16:56:17 1991
  470. ***************
  471. *** 1,7 ****
  472. X  .TH ppmmake 1 "24 September 1991"
  473. X  .IX ppmmake
  474. X  .SH NAME
  475. ! ppmmake - create a pixmap of a specified size
  476. X  .SH SYNOPSIS
  477. X  .B ppmmake
  478. X  .I color width height
  479. --- 1,7 ----
  480. X  .TH ppmmake 1 "24 September 1991"
  481. X  .IX ppmmake
  482. X  .SH NAME
  483. ! ppmmake - create a pixmap of a specified size and color
  484. X  .SH SYNOPSIS
  485. X  .B ppmmake
  486. X  .I color width height
  487. diff -cr pbmplus30oct91/ppm/ppmmake.c ppm/ppmmake.c
  488. *** pbmplus30oct91/ppm/ppmmake.c    Fri Jun 28 14:30:43 1991
  489. --- ppm/ppmmake.c    Tue Dec 10 16:56:16 1991
  490. ***************
  491. *** 56,60 ****
  492. --- 56,61 ----
  493. X      ppm_writeppmrow( stdout, pixrow, cols, PPM_MAXMAXVAL, 0 );
  494. X      }
  495. X  
  496. +     pm_close( stdout );
  497. X      exit( 0 );
  498. X      }
  499. diff -cr pbmplus30oct91/ppm/ppmmerge.c ppm/ppmmerge.c
  500. *** pbmplus30oct91/ppm/ppmmerge.c    Fri Sep 27 01:41:35 1991
  501. --- ppm/ppmmerge.c    Tue Dec 10 16:56:02 1991
  502. ***************
  503. *** 32,38 ****
  504. X      goto again;
  505. X      }
  506. X  
  507. ! #define TRY(s,m) { if ( strcmp( cp, s ) == 0 ) m( argc, argv ); }
  508. X  
  509. X      TRY("giftoppm", giftoppm_main);
  510. X      TRY("gouldtoppm", gouldtoppm_main);
  511. --- 32,38 ----
  512. X      goto again;
  513. X      }
  514. X  
  515. ! #define TRY(s,m) { if ( strcmp( cp, s ) == 0 ) exit( m( argc, argv ) ); }
  516. X  
  517. X      TRY("giftoppm", giftoppm_main);
  518. X      TRY("gouldtoppm", gouldtoppm_main);
  519. ***************
  520. *** 45,55 ****
  521. --- 45,57 ----
  522. X      TRY("picttoppm", picttoppm_main);
  523. X      TRY("pjtoppm", pjtoppm_main);
  524. X      TRY("ppmdither", ppmdither_main);
  525. +     TRY("ppmforge", ppmforge_main);
  526. X      TRY("ppmhist", ppmhist_main);
  527. X      TRY("ppmmake", ppmmake_main);
  528. X      TRY("ppmpat", ppmpat_main);
  529. X      TRY("ppmquant", ppmquant_main);
  530. X      TRY("ppmrelief", ppmrelief_main);
  531. +     TRY("ppmtoacad", ppmtoacad_main);
  532. X      TRY("ppmtogif", ppmtogif_main);
  533. X      TRY("ppmtoicr", ppmtoicr_main);
  534. X      TRY("ppmtoilbm", ppmtoilbm_main);
  535. ***************
  536. *** 68,73 ****
  537. --- 70,76 ----
  538. X      TRY("qrttoppm", qrttoppm_main);
  539. X      TRY("rawtoppm", rawtoppm_main);
  540. X      TRY("rgb3toppm", rgb3toppm_main);
  541. +     TRY("sldtoppm", sldtoppm_main);
  542. X      TRY("spctoppm", spctoppm_main);
  543. X      TRY("sputoppm", sputoppm_main);
  544. X      TRY("tgatoppm", tgatoppm_main);
  545. diff -cr pbmplus30oct91/ppm/ppmpat.c ppm/ppmpat.c
  546. *** pbmplus30oct91/ppm/ppmpat.c    Sun Jul  7 17:29:15 1991
  547. --- ppm/ppmpat.c    Tue Dec 10 16:55:44 1991
  548. ***************
  549. *** 187,192 ****
  550. --- 187,193 ----
  551. X  
  552. X      /* All done, write it out. */
  553. X      ppm_writeppm( stdout, pixels, cols, rows, PPM_MAXMAXVAL, 0 );
  554. +     pm_close( stdout );
  555. X  
  556. X      exit( 0 );
  557. X      }
  558. diff -cr pbmplus30oct91/ppm/ppmquant.c ppm/ppmquant.c
  559. *** pbmplus30oct91/ppm/ppmquant.c    Fri Sep 27 17:09:57 1991
  560. --- ppm/ppmquant.c    Tue Dec 10 16:55:41 1991
  561. ***************
  562. *** 350,355 ****
  563. --- 350,357 ----
  564. X      ppm_writeppmrow( stdout, pixels[row], cols, maxval, 0 );
  565. X      }
  566. X  
  567. +     pm_close( stdout );
  568. X      exit( 0 );
  569. X      }
  570. X  
  571. diff -cr pbmplus30oct91/ppm/ppmrelief.c ppm/ppmrelief.c
  572. *** pbmplus30oct91/ppm/ppmrelief.c    Sat Oct  5 22:38:29 1991
  573. --- ppm/ppmrelief.c    Tue Dec 10 16:56:36 1991
  574. ***************
  575. *** 89,94 ****
  576. --- 89,95 ----
  577. X      ppm_writeppmrow( stdout, outputrow, cols, maxval, 0 );
  578. X  
  579. X      pm_close( ifp );
  580. +     pm_close( stdout );
  581. X  
  582. X      exit( 0 );
  583. X      }
  584. diff -cr pbmplus30oct91/ppm/ppmtoilbm.c ppm/ppmtoilbm.c
  585. *** pbmplus30oct91/ppm/ppmtoilbm.c    Fri Jun 28 14:43:02 1991
  586. --- ppm/ppmtoilbm.c    Tue Dec 10 16:55:52 1991
  587. ***************
  588. *** 350,355 ****
  589. X      unsigned char b;
  590. X  #endif /*__STDC__*/
  591. X      {
  592. !     if ( putc( b, stdout ) == EOF )
  593. !     pm_error( "write error" );
  594. X      }
  595. --- 350,354 ----
  596. X      unsigned char b;
  597. X  #endif /*__STDC__*/
  598. X      {
  599. !     (void) putc( b, stdout );
  600. X      }
  601. diff -cr pbmplus30oct91/ppm/ppmtopgm.c ppm/ppmtopgm.c
  602. *** pbmplus30oct91/ppm/ppmtopgm.c    Fri Jun 28 14:30:55 1991
  603. --- ppm/ppmtopgm.c    Tue Dec 10 16:55:46 1991
  604. ***************
  605. *** 164,169 ****
  606. --- 164,170 ----
  607. X      }
  608. X  
  609. X      pm_close( ifp );
  610. +     pm_close( stdout );
  611. X  
  612. X      exit( 0 );
  613. X      }
  614. diff -cr pbmplus30oct91/ppm/ppmtopict.c ppm/ppmtopict.c
  615. *** pbmplus30oct91/ppm/ppmtopict.c    Fri Jun 28 15:34:21 1991
  616. --- ppm/ppmtopict.c    Tue Dec 10 16:56:11 1991
  617. ***************
  618. *** 252,258 ****
  619. X  
  620. X      /* if we wrote an odd number of pixdata bytes, pad */
  621. X      if (oc & 1)
  622. !         putc(0, stdout);
  623. X      putShort(stdout, PICT_EndOfPicture);
  624. X  
  625. X      lmaxval = ftell(stdout) - HEADER_SIZE;
  626. --- 252,258 ----
  627. X  
  628. X      /* if we wrote an odd number of pixdata bytes, pad */
  629. X      if (oc & 1)
  630. !         (void) putc(0, stdout);
  631. X      putShort(stdout, PICT_EndOfPicture);
  632. X  
  633. X      lmaxval = ftell(stdout) - HEADER_SIZE;
  634. ***************
  635. *** 270,276 ****
  636. X      register int i;
  637. X  
  638. X      for (i = 0; i < n; i++)
  639. !         putc(0, fd);
  640. X  }
  641. X  
  642. X  static void
  643. --- 270,276 ----
  644. X      register int i;
  645. X  
  646. X      for (i = 0; i < n; i++)
  647. !         (void) putc(0, fd);
  648. X  }
  649. X  
  650. X  static void
  651. ***************
  652. *** 278,285 ****
  653. X  FILE *fd;
  654. X  int i;
  655. X  {
  656. !     putc((i >> 8) & 0xff, fd);
  657. !     putc(i & 0xff, fd);
  658. X  }
  659. X  
  660. X  #if __STDC__
  661. --- 278,285 ----
  662. X  FILE *fd;
  663. X  int i;
  664. X  {
  665. !     (void) putc((i >> 8) & 0xff, fd);
  666. !     (void) putc(i & 0xff, fd);
  667. X  }
  668. X  
  669. X  #if __STDC__
  670. ***************
  671. *** 292,301 ****
  672. X  long i;
  673. X  #endif /*__STDC__*/
  674. X  {
  675. !     putc((int)((i >> 24) & 0xff), fd);
  676. !     putc(((int)(i >> 16) & 0xff), fd);
  677. !     putc(((int)(i >> 8) & 0xff), fd);
  678. !     putc((int)(i & 0xff), fd);
  679. X  }
  680. X  
  681. X  static void
  682. --- 292,301 ----
  683. X  long i;
  684. X  #endif /*__STDC__*/
  685. X  {
  686. !     (void) putc((int)((i >> 24) & 0xff), fd);
  687. !     (void) putc(((int)(i >> 16) & 0xff), fd);
  688. !     (void) putc(((int)(i >> 8) & 0xff), fd);
  689. !     (void) putc((int)(i & 0xff), fd);
  690. X  }
  691. X  
  692. X  static void
  693. ***************
  694. *** 412,418 ****
  695. X      }
  696. X      else
  697. X      {
  698. !         putc(packcols, fd);
  699. X          oc = packcols + 1;
  700. X      }
  701. X  
  702. --- 412,418 ----
  703. X      }
  704. X      else
  705. X      {
  706. !         (void) putc(packcols, fd);
  707. X          oc = packcols + 1;
  708. X      }
  709. X  
  710. ***************
  711. *** 420,426 ****
  712. X      while(p != packed)
  713. X      {
  714. X          --p;
  715. !         putc(*p, fd);
  716. X      }
  717. X  
  718. X      return (oc);
  719. --- 420,426 ----
  720. X      while(p != packed)
  721. X      {
  722. X          --p;
  723. !         (void) putc(*p, fd);
  724. X      }
  725. X  
  726. X      return (oc);
  727. ***************
  728. *** 450,456 ****
  729. X      }
  730. X      else
  731. X      {
  732. !         putc(bc, fd);
  733. X          oc = bc + 1;
  734. X      }
  735. X      for (i = 0, pP = rowpixels; i < cols;)
  736. --- 450,456 ----
  737. X      }
  738. X      else
  739. X      {
  740. !         (void) putc(bc, fd);
  741. X          oc = bc + 1;
  742. X      }
  743. X      for (i = 0, pP = rowpixels; i < cols;)
  744. ***************
  745. *** 457,466 ****
  746. X      {
  747. X          if (cols - i > MAX_COUNT)
  748. X          {
  749. !             putc(MAX_COUNT - 1, fd);
  750. X              for (j = 0; j < MAX_COUNT; j++)
  751. X              {
  752. !                 putc(ppm_lookupcolor(cht, pP), fd);
  753. X                  pP++;
  754. X              }
  755. X              i += MAX_COUNT;
  756. --- 457,466 ----
  757. X      {
  758. X          if (cols - i > MAX_COUNT)
  759. X          {
  760. !             (void) putc(MAX_COUNT - 1, fd);
  761. X              for (j = 0; j < MAX_COUNT; j++)
  762. X              {
  763. !                 (void) putc(ppm_lookupcolor(cht, pP), fd);
  764. X                  pP++;
  765. X              }
  766. X              i += MAX_COUNT;
  767. ***************
  768. *** 467,476 ****
  769. X          }
  770. X          else
  771. X          {
  772. !             putc(cols - i - 1, fd);
  773. X              for (j = 0; j < cols - i; j++)
  774. X              {
  775. !                 putc(ppm_lookupcolor(cht, pP), fd);
  776. X                  pP++;
  777. X              }
  778. X              i = cols;
  779. --- 467,476 ----
  780. X          }
  781. X          else
  782. X          {
  783. !             (void) putc(cols - i - 1, fd);
  784. X              for (j = 0; j < cols - i; j++)
  785. X              {
  786. !                 (void) putc(ppm_lookupcolor(cht, pP), fd);
  787. X                  pP++;
  788. X              }
  789. X              i = cols;
  790. diff -cr pbmplus30oct91/ppm/ppmtotga.c ppm/ppmtotga.c
  791. *** pbmplus30oct91/ppm/ppmtotga.c    Wed Oct 30 10:56:22 1991
  792. --- ppm/ppmtotga.c    Tue Dec 10 16:56:49 1991
  793. ***************
  794. *** 212,217 ****
  795. --- 212,218 ----
  796. X      tgaHeader.AttBits = 0;
  797. X      tgaHeader.Rsrvd = 0;
  798. X      tgaHeader.IntrLve = 0;
  799. +     tgaHeader.OrgBit = 0;
  800. X  
  801. X      /* Write out the Targa header. */
  802. X      writetga( &tgaHeader, (char*) 0 );
  803. diff -cr pbmplus30oct91/ppm/ppmtouil.c ppm/ppmtouil.c
  804. *** pbmplus30oct91/ppm/ppmtouil.c    Tue Jul 23 10:36:32 1991
  805. --- ppm/ppmtouil.c    Tue Dec 10 16:56:22 1991
  806. ***************
  807. *** 86,93 ****
  808. X          (void) strcpy( out_name, "noname" );
  809. X          /* Remove trailing _icon in name. */
  810. X          cp = rindex( out_name, '_' );
  811. !         if ( cp[1] == 'i' && cp[2] == 'c' && cp[3] == 'o' && cp[4] == 'n' &&
  812. !          cp[5] == '\0' )
  813. X          *cp = '\0';
  814. X          }
  815. X      ++argn;
  816. --- 86,94 ----
  817. X          (void) strcpy( out_name, "noname" );
  818. X          /* Remove trailing _icon in name. */
  819. X          cp = rindex( out_name, '_' );
  820. !         if ( cp != (char*) 0 &&
  821. !          cp[1] == 'i' && cp[2] == 'c' && cp[3] == 'o' &&
  822. !          cp[4] == 'n' && cp[5] == '\0' )
  823. X          *cp = '\0';
  824. X          }
  825. X      ++argn;
  826. diff -cr pbmplus30oct91/ppm/qrttoppm.c ppm/qrttoppm.c
  827. *** pbmplus30oct91/ppm/qrttoppm.c    Fri Jun 28 14:31:05 1991
  828. --- ppm/qrttoppm.c    Tue Dec 10 16:55:48 1991
  829. ***************
  830. *** 62,67 ****
  831. --- 62,68 ----
  832. X      }
  833. X  
  834. X      pm_close( ifp );
  835. +     pm_close( stdout );
  836. X  
  837. X      exit( 0 );
  838. X      }
  839. diff -cr pbmplus30oct91/ppm/rawtoppm.c ppm/rawtoppm.c
  840. *** pbmplus30oct91/ppm/rawtoppm.c    Fri Jun 28 14:31:07 1991
  841. --- ppm/rawtoppm.c    Tue Dec 10 16:55:54 1991
  842. ***************
  843. *** 220,226 ****
  844. --- 220,228 ----
  845. X          }
  846. X      ppm_writeppmrow( stdout, pixrow, cols, (pixval) 255, 0 );
  847. X      }
  848. X      pm_close( ifp );
  849. +     pm_close( stdout );
  850. X  
  851. X      exit( 0 );
  852. X      }
  853. diff -cr pbmplus30oct91/ppm/rgb3toppm.c ppm/rgb3toppm.c
  854. *** pbmplus30oct91/ppm/rgb3toppm.c    Fri Jun 28 14:31:08 1991
  855. --- ppm/rgb3toppm.c    Tue Dec 10 16:56:03 1991
  856. ***************
  857. *** 81,86 ****
  858. --- 81,87 ----
  859. X      pm_close( rfd );
  860. X      pm_close( gfd );
  861. X      pm_close( bfd );
  862. +     pm_close( stdout );
  863. X  
  864. X      exit( 0 );
  865. X      }
  866. diff -cr pbmplus30oct91/ppm/spctoppm.c ppm/spctoppm.c
  867. *** pbmplus30oct91/ppm/spctoppm.c    Fri Sep 27 17:21:41 1991
  868. --- ppm/spctoppm.c    Tue Dec 10 16:56:39 1991
  869. ***************
  870. *** 107,112 ****
  871. --- 107,114 ----
  872. X      ppm_writeppmrow( stdout, pixelrow, COLS, (pixval) MAXVAL, 0 );
  873. X      }
  874. X  
  875. +     pm_close( stdout );
  876. X      exit( 0 );
  877. X      }
  878. X  
  879. diff -cr pbmplus30oct91/ppm/sputoppm.c ppm/sputoppm.c
  880. *** pbmplus30oct91/ppm/sputoppm.c    Fri Sep 27 17:23:57 1991
  881. --- ppm/sputoppm.c    Tue Dec 10 16:56:41 1991
  882. ***************
  883. *** 100,104 ****
  884. --- 100,106 ----
  885. X      ppm_writeppmrow( stdout, pixelrow, COLS, (pixval) MAXVAL, 0 );
  886. X      }
  887. X  
  888. +     pm_close( stdout );
  889. X      exit( 0 );
  890. X      }
  891. diff -cr pbmplus30oct91/ppm/tgatoppm.c ppm/tgatoppm.c
  892. *** pbmplus30oct91/ppm/tgatoppm.c    Wed Oct 30 09:38:05 1991
  893. --- ppm/tgatoppm.c    Tue Dec 10 16:55:56 1991
  894. ***************
  895. *** 208,213 ****
  896. --- 208,214 ----
  897. X      pm_close( ifp );
  898. X  
  899. X      ppm_writeppm( stdout, pixels, cols, rows, (pixval) maxval, 0 );
  900. +     pm_close( stdout );
  901. X  
  902. X      exit( 0 );
  903. X      }
  904. diff -cr pbmplus30oct91/ppm/ximtoppm.c ppm/ximtoppm.c
  905. *** pbmplus30oct91/ppm/ximtoppm.c    Fri Jun 28 14:43:15 1991
  906. --- ppm/ximtoppm.c    Tue Dec 10 16:56:06 1991
  907. ***************
  908. *** 104,109 ****
  909. --- 104,110 ----
  910. X      ppm_writeppmrow( stdout, pixelrow, cols, maxval, 0 );
  911. X      }
  912. X      pm_close( ifp );
  913. +     pm_close( stdout );
  914. X      exit( 0 );
  915. X      }
  916. X  
  917. diff -cr pbmplus30oct91/ppm/xpmtoppm.c ppm/xpmtoppm.c
  918. *** pbmplus30oct91/ppm/xpmtoppm.c    Fri Jun 28 14:43:17 1991
  919. --- ppm/xpmtoppm.c    Tue Dec 10 16:56:18 1991
  920. ***************
  921. *** 56,61 ****
  922. --- 56,63 ----
  923. X      ppm_writeppmrow( stdout, pixrow, cols, (pixval) PPM_MAXMAXVAL, 0 );
  924. X      }
  925. X  
  926. +     pm_close( stdout );
  927. X      exit( 0 );
  928. X      }
  929. X  
  930. diff -cr pbmplus30oct91/ppm/yuvtoppm.c ppm/yuvtoppm.c
  931. *** pbmplus30oct91/ppm/yuvtoppm.c    Fri Sep 27 01:38:13 1991
  932. --- ppm/yuvtoppm.c    Tue Dec 10 16:56:54 1991
  933. ***************
  934. *** 95,100 ****
  935. --- 95,101 ----
  936. X          ppm_writeppmrow(stdout, pixrow, cols, (pixval) 255, 0);
  937. X      }
  938. X      pm_close(ifp);
  939. +     pm_close(stdout);
  940. X  
  941. X      exit(0);
  942. X  }
  943. diff -cr pbmplus30oct91/pnm/pnmarith.c pnm/pnmarith.c
  944. *** pbmplus30oct91/pnm/pnmarith.c    Mon Sep 23 15:12:06 1991
  945. --- pnm/pnmarith.c    Tue Dec 10 16:55:01 1991
  946. ***************
  947. *** 189,194 ****
  948. --- 189,195 ----
  949. X  
  950. X      pm_close( ifp1 );
  951. X      pm_close( ifp2 );
  952. +     pm_close( stdout );
  953. X  
  954. X      exit( 0 );
  955. X      }
  956. diff -cr pbmplus30oct91/pnm/pnmcat.c pnm/pnmcat.c
  957. *** pbmplus30oct91/pnm/pnmcat.c    Fri Jun 28 14:29:45 1991
  958. --- pnm/pnmcat.c    Tue Dec 10 16:54:24 1991
  959. ***************
  960. *** 240,245 ****
  961. --- 240,246 ----
  962. X  
  963. X      for ( i = 0; i < nfiles; ++i )
  964. X      pm_close( ifp[i] );
  965. +     pm_close( stdout );
  966. X  
  967. X      exit( 0 );
  968. X      }
  969. diff -cr pbmplus30oct91/pnm/pnmconvol.1 pnm/pnmconvol.1
  970. *** pbmplus30oct91/pnm/pnmconvol.1    Tue Jun  4 14:08:20 1991
  971. --- pnm/pnmconvol.1    Tue Dec 10 16:55:03 1991
  972. ***************
  973. *** 20,26 ****
  974. X  convolution file are only relative.
  975. X  .PP
  976. X  Here is a sample convolution file;
  977. ! it does a simple average of the immediate neighbors, resulting
  978. X  in a smoothed image:
  979. X  .nf
  980. X      P2
  981. --- 20,26 ----
  982. X  convolution file are only relative.
  983. X  .PP
  984. X  Here is a sample convolution file;
  985. ! it does a simple average of the nine immediate neighbors, resulting
  986. X  in a smoothed image:
  987. X  .nf
  988. X      P2
  989. ***************
  990. *** 31,42 ****
  991. X      10 10 10
  992. X  .fi
  993. X  .PP
  994. ! The convolution file will usually be a bitmap or graymap instead of a pixmap,
  995. X  so that the same convolution gets applied to each color component.
  996. X  However, if you want to use a pixmap and do a different convolution to
  997. X  different colors, you can certainly do that.
  998. X  .SH "SEE ALSO"
  999. ! pnm(5)
  1000. X  .SH AUTHOR
  1001. X  Copyright (C) 1989, 1991 by Jef Poskanzer.
  1002. X  .\" Permission to use, copy, modify, and distribute this software and its
  1003. --- 31,50 ----
  1004. X      10 10 10
  1005. X  .fi
  1006. X  .PP
  1007. ! To see how this works, do the above-mentioned offset: 10 - 18/2 gives 1.
  1008. ! The possible range of values is from 0 to 18, and after the offset
  1009. ! that's -9 to 9.  The normalization step makes the range -1 to 1, and
  1010. ! the values get scaled correspondingly so they become 1/9 - exactly what
  1011. ! you want.
  1012. ! The equivalent matrix for 5x5 smoothing would have maxval 50 and be
  1013. ! filled with 26.
  1014. ! .PP
  1015. ! The convolution file will usually be a graymap,
  1016. X  so that the same convolution gets applied to each color component.
  1017. X  However, if you want to use a pixmap and do a different convolution to
  1018. X  different colors, you can certainly do that.
  1019. X  .SH "SEE ALSO"
  1020. ! pnmsmooth(1), pnm(5)
  1021. X  .SH AUTHOR
  1022. X  Copyright (C) 1989, 1991 by Jef Poskanzer.
  1023. X  .\" Permission to use, copy, modify, and distribute this software and its
  1024. diff -cr pbmplus30oct91/pnm/pnmconvol.c pnm/pnmconvol.c
  1025. *** pbmplus30oct91/pnm/pnmconvol.c    Mon Sep 23 15:13:44 1991
  1026. --- pnm/pnmconvol.c    Tue Dec 10 16:55:03 1991
  1027. ***************
  1028. *** 214,218 ****
  1029. --- 214,219 ----
  1030. X      pnm_writepnmrow(
  1031. X              stdout, xelbuf[(row-crowso2) % crows], cols, maxval, newformat, 0 );
  1032. X  
  1033. +     pm_close( stdout );
  1034. X      exit( 0 );
  1035. X      }
  1036. diff -cr pbmplus30oct91/pnm/pnmcrop.c pnm/pnmcrop.c
  1037. *** pbmplus30oct91/pnm/pnmcrop.c    Fri Jun 28 14:29:47 1991
  1038. --- pnm/pnmcrop.c    Tue Dec 10 16:54:57 1991
  1039. ***************
  1040. *** 131,136 ****
  1041. --- 131,137 ----
  1042. X      pnm_writepnminit( stdout, newcols, newrows, maxval, format, 0 );
  1043. X      for ( row = top; row <= bottom; row++ )
  1044. X      pnm_writepnmrow( stdout, &(xels[row][left]), newcols, maxval, format, 0 );
  1045. +     pm_close( stdout );
  1046. X  
  1047. X      exit( 0 );
  1048. X      }
  1049. diff -cr pbmplus30oct91/pnm/pnmcut.c pnm/pnmcut.c
  1050. *** pbmplus30oct91/pnm/pnmcut.c    Fri Jun 28 14:42:30 1991
  1051. --- pnm/pnmcut.c    Tue Dec 10 16:54:27 1991
  1052. ***************
  1053. *** 84,89 ****
  1054. --- 84,90 ----
  1055. X      }
  1056. X  
  1057. X      pm_close( ifp );
  1058. +     pm_close( stdout );
  1059. X  
  1060. X      exit( 0 );
  1061. X      }
  1062. diff -cr pbmplus30oct91/pnm/pnmdepth.c pnm/pnmdepth.c
  1063. *** pbmplus30oct91/pnm/pnmdepth.c    Mon Sep 23 15:14:12 1991
  1064. --- pnm/pnmdepth.c    Tue Dec 10 16:55:16 1991
  1065. ***************
  1066. *** 24,30 ****
  1067. X      register xel* xP;
  1068. X      int argn, rows, cols, format, newformat, row;
  1069. X      register int col;
  1070. !     xelval maxval, newmaxval;
  1071. X      int i;
  1072. X      char* usage = "newmaxval [pnmfile]";
  1073. X  
  1074. --- 24,31 ----
  1075. X      register xel* xP;
  1076. X      int argn, rows, cols, format, newformat, row;
  1077. X      register int col;
  1078. !     xelval maxval;
  1079. !     int newmaxval;
  1080. X      int i;
  1081. X      char* usage = "newmaxval [pnmfile]";
  1082. X  
  1083. ***************
  1084. *** 34,45 ****
  1085. X  
  1086. X      if ( argn == argc )
  1087. X      pm_usage( usage );
  1088. !     if ( sscanf( argv[argn], "%d", &i ) != 1 )
  1089. X      pm_usage( usage );
  1090. -     newmaxval = i;
  1091. X      ++argn;
  1092. X      if ( newmaxval < 1 )
  1093. !     pm_error( "newmaxval must be > 1" );
  1094. X  
  1095. X      if ( argn != argc )
  1096. X      {
  1097. --- 35,48 ----
  1098. X  
  1099. X      if ( argn == argc )
  1100. X      pm_usage( usage );
  1101. !     if ( sscanf( argv[argn], "%d", &newmaxval ) != 1 )
  1102. X      pm_usage( usage );
  1103. X      ++argn;
  1104. X      if ( newmaxval < 1 )
  1105. !     pm_error( "newmaxval must be >= 1" );
  1106. !     if ( newmaxval > PNM_MAXMAXVAL )
  1107. !     pm_error(
  1108. ! "newmaxval is too large - try reconfiguring with PGM_BIGGRAYS\n    or without PPM_PACKCOLORS" );
  1109. X  
  1110. X      if ( argn != argc )
  1111. X      {
  1112. ***************
  1113. *** 65,71 ****
  1114. X          newformat = format;
  1115. X  
  1116. X      for ( i = 0; i <= maxval; ++i )
  1117. !     newvals[i] = i * newmaxval / maxval;
  1118. X  
  1119. X      pnm_writepnminit( stdout, cols, rows, newmaxval, newformat, 0 );
  1120. X  
  1121. --- 68,74 ----
  1122. X          newformat = format;
  1123. X  
  1124. X      for ( i = 0; i <= maxval; ++i )
  1125. !     newvals[i] = ( i * newmaxval + maxval / 2 ) / maxval;
  1126. X  
  1127. X      pnm_writepnminit( stdout, cols, rows, newmaxval, newformat, 0 );
  1128. X  
  1129. ***************
  1130. *** 92,97 ****
  1131. --- 95,101 ----
  1132. X      }
  1133. X  
  1134. X      pm_close( ifp );
  1135. +     pm_close( stdout );
  1136. X  
  1137. X      exit( 0 );
  1138. X      }
  1139. diff -cr pbmplus30oct91/pnm/pnmenlarge.c pnm/pnmenlarge.c
  1140. *** pbmplus30oct91/pnm/pnmenlarge.c    Fri Jun 28 14:29:50 1991
  1141. --- pnm/pnmenlarge.c    Tue Dec 10 16:54:36 1991
  1142. ***************
  1143. *** 71,76 ****
  1144. --- 71,77 ----
  1145. X      }
  1146. X  
  1147. X      pm_close( ifp );
  1148. +     pm_close( stdout );
  1149. X  
  1150. X      exit( 0 );
  1151. X      }
  1152. diff -cr pbmplus30oct91/pnm/pnmflip.c pnm/pnmflip.c
  1153. *** pbmplus30oct91/pnm/pnmflip.c    Fri Jun 28 14:29:53 1991
  1154. --- pnm/pnmflip.c    Tue Dec 10 16:54:29 1991
  1155. ***************
  1156. *** 190,195 ****
  1157. --- 190,196 ----
  1158. X      }
  1159. X  
  1160. X      pm_close( ifp );
  1161. +     pm_close( stdout );
  1162. X  
  1163. X      exit( 0 );
  1164. X      }
  1165. diff -cr pbmplus30oct91/pnm/pnmgamma.c pnm/pnmgamma.c
  1166. *** pbmplus30oct91/pnm/pnmgamma.c    Mon Sep 23 15:17:45 1991
  1167. --- pnm/pnmgamma.c    Tue Dec 10 16:54:59 1991
  1168. ***************
  1169. *** 147,152 ****
  1170. --- 147,153 ----
  1171. X      }
  1172. X  
  1173. X      pm_close( ifp );
  1174. +     pm_close( stdout );
  1175. X  
  1176. X      exit( 0 );
  1177. X      }
  1178. diff -cr pbmplus30oct91/pnm/pnminvert.c pnm/pnminvert.c
  1179. *** pbmplus30oct91/pnm/pnminvert.c    Fri Jun 28 14:29:55 1991
  1180. --- pnm/pnminvert.c    Tue Dec 10 16:54:31 1991
  1181. ***************
  1182. *** 47,52 ****
  1183. --- 47,53 ----
  1184. X      }
  1185. X  
  1186. X      pm_close( ifp );
  1187. +     pm_close( stdout );
  1188. X  
  1189. X      exit( 0 );
  1190. X      }
  1191. diff -cr pbmplus30oct91/pnm/pnmmerge.c pnm/pnmmerge.c
  1192. *** pbmplus30oct91/pnm/pnmmerge.c    Wed Sep 25 23:57:35 1991
  1193. --- pnm/pnmmerge.c    Tue Dec 10 16:54:37 1991
  1194. ***************
  1195. *** 32,38 ****
  1196. X      goto again;
  1197. X      }
  1198. X  
  1199. ! #define TRY(s,m) { if ( strcmp( cp, s ) == 0 ) m( argc, argv ); }
  1200. X  
  1201. X      TRY("pnmarith", pnmarith_main);
  1202. X      TRY("pnmcat", pnmcat_main);
  1203. --- 32,38 ----
  1204. X      goto again;
  1205. X      }
  1206. X  
  1207. ! #define TRY(s,m) { if ( strcmp( cp, s ) == 0 ) exit( m( argc, argv ) ); }
  1208. X  
  1209. X      TRY("pnmarith", pnmarith_main);
  1210. X      TRY("pnmcat", pnmcat_main);
  1211. diff -cr pbmplus30oct91/pnm/pnmnoraw.c pnm/pnmnoraw.c
  1212. *** pbmplus30oct91/pnm/pnmnoraw.c    Fri Jun 28 14:29:58 1991
  1213. --- pnm/pnmnoraw.c    Tue Dec 10 16:54:38 1991
  1214. ***************
  1215. *** 43,48 ****
  1216. --- 43,49 ----
  1217. X      }
  1218. X  
  1219. X      pm_close( ifp );
  1220. +     pm_close( stdout );
  1221. X  
  1222. X      exit( 0 );
  1223. X      }
  1224. diff -cr pbmplus30oct91/pnm/pnmpaste.c pnm/pnmpaste.c
  1225. *** pbmplus30oct91/pnm/pnmpaste.c    Fri Jun 28 15:58:04 1991
  1226. --- pnm/pnmpaste.c    Tue Dec 10 16:54:33 1991
  1227. ***************
  1228. *** 178,183 ****
  1229. --- 178,184 ----
  1230. X      
  1231. X      pm_close( ifp1 );
  1232. X      pm_close( ifp2 );
  1233. +     pm_close( stdout );
  1234. X  
  1235. X      exit( 0 );
  1236. X      }
  1237. diff -cr pbmplus30oct91/pnm/pnmrotate.c pnm/pnmrotate.c
  1238. *** pbmplus30oct91/pnm/pnmrotate.c    Mon Sep 23 15:19:49 1991
  1239. --- pnm/pnmrotate.c    Tue Dec 10 16:55:10 1991
  1240. ***************
  1241. *** 326,330 ****
  1242. --- 326,332 ----
  1243. X      pnm_writepnmrow( stdout, newxelrow, newcols, maxval, newformat, 0 );
  1244. X      }
  1245. X  
  1246. +     pm_close( stdout );
  1247. X      exit( 0 );
  1248. X      }
  1249. diff -cr pbmplus30oct91/pnm/pnmscale.c pnm/pnmscale.c
  1250. *** pbmplus30oct91/pnm/pnmscale.c    Mon Sep 23 15:21:15 1991
  1251. --- pnm/pnmscale.c    Tue Dec 10 16:55:12 1991
  1252. ***************
  1253. *** 428,433 ****
  1254. --- 428,434 ----
  1255. X      }
  1256. X  
  1257. X      pm_close( ifp );
  1258. +     pm_close( stdout );
  1259. X  
  1260. X      exit( 0 );
  1261. X      }
  1262. diff -cr pbmplus30oct91/pnm/pnmshear.c pnm/pnmshear.c
  1263. *** pbmplus30oct91/pnm/pnmshear.c    Mon Sep 23 15:22:00 1991
  1264. --- pnm/pnmshear.c    Tue Dec 10 16:55:14 1991
  1265. ***************
  1266. *** 168,173 ****
  1267. --- 168,174 ----
  1268. X      }
  1269. X  
  1270. X      pm_close( ifp );
  1271. +     pm_close( stdout );
  1272. X  
  1273. X      exit( 0 );
  1274. X      }
  1275. diff -cr pbmplus30oct91/pnm/pnmtile.c pnm/pnmtile.c
  1276. *** pbmplus30oct91/pnm/pnmtile.c    Fri Jun 28 14:30:06 1991
  1277. --- pnm/pnmtile.c    Tue Dec 10 16:54:34 1991
  1278. ***************
  1279. *** 57,61 ****
  1280. --- 57,63 ----
  1281. X      pnm_writepnmrow( stdout, xelrow, width, maxval, format, 0 );
  1282. X      }
  1283. X  
  1284. +     pm_close( stdout );
  1285. X      exit( 0 );
  1286. X      }
  1287. diff -cr pbmplus30oct91/pnm/pnmtotiff.c pnm/pnmtotiff.c
  1288. *** pbmplus30oct91/pnm/pnmtotiff.c    Wed Sep 25 23:43:22 1991
  1289. --- pnm/pnmtotiff.c    Tue Dec 10 16:55:08 1991
  1290. ***************
  1291. *** 140,145 ****
  1292. --- 140,146 ----
  1293. X          pm_message(
  1294. X          "If you want an 8-bit palette file, try doing a 'ppmquant %d'.",
  1295. X          MAXCOLORS );
  1296. +         grayscale = 0;
  1297. X          }
  1298. X      else
  1299. X          {
  1300. ***************
  1301. *** 162,167 ****
  1302. --- 163,169 ----
  1303. X      break;
  1304. X  
  1305. X      default:
  1306. +     chv = (colorhist_vector) 0;
  1307. X      grayscale = 1;
  1308. X      break;
  1309. X      }
  1310. diff -cr pbmplus30oct91/pnm/pnmtoxwd.c pnm/pnmtoxwd.c
  1311. *** pbmplus30oct91/pnm/pnmtoxwd.c    Sat Oct  5 23:13:09 1991
  1312. --- pnm/pnmtoxwd.c    Tue Dec 10 16:54:54 1991
  1313. ***************
  1314. *** 255,262 ****
  1315. X          pm_writebigshort( stdout, color.red );
  1316. X          pm_writebigshort( stdout, color.green );
  1317. X          pm_writebigshort( stdout, color.blue );
  1318. !         putc( color.flags, stdout );
  1319. !         putc( color.pad, stdout );
  1320. X          }
  1321. X      }
  1322. X  
  1323. --- 255,262 ----
  1324. X          pm_writebigshort( stdout, color.red );
  1325. X          pm_writebigshort( stdout, color.green );
  1326. X          pm_writebigshort( stdout, color.blue );
  1327. !         (void) putc( color.flags, stdout );
  1328. !         (void) putc( color.pad, stdout );
  1329. X          }
  1330. X      }
  1331. X  
  1332. diff -cr pbmplus30oct91/pnm/rasttopnm.c pnm/rasttopnm.c
  1333. *** pbmplus30oct91/pnm/rasttopnm.c    Sat Oct  5 23:02:38 1991
  1334. --- pnm/rasttopnm.c    Tue Dec 10 16:54:49 1991
  1335. ***************
  1336. *** 254,258 ****
  1337. --- 254,260 ----
  1338. X      pnm_writepnmrow( stdout, xelrow, cols, maxval, format, 0 );
  1339. X      }
  1340. X  
  1341. +     pm_close( stdout );
  1342. X      exit( 0 );
  1343. X      }
  1344. diff -cr pbmplus30oct91/pnm/tifftopnm.c pnm/tifftopnm.c
  1345. *** pbmplus30oct91/pnm/tifftopnm.c    Thu Oct 24 16:10:55 1991
  1346. --- pnm/tifftopnm.c    Tue Dec 10 16:55:06 1991
  1347. ***************
  1348. *** 271,275 ****
  1349. --- 271,276 ----
  1350. X      pnm_writepnmrow( stdout, xelrow, cols, (xelval) maxval, format, 0 );
  1351. X      }
  1352. X  
  1353. +     pm_close( stdout );
  1354. X      exit( 0 );
  1355. X      }
  1356. diff -cr pbmplus30oct91/pnm/xwdtopnm.c pnm/xwdtopnm.c
  1357. *** pbmplus30oct91/pnm/xwdtopnm.c    Thu Sep 26 19:33:50 1991
  1358. --- pnm/xwdtopnm.c    Tue Dec 10 16:54:52 1991
  1359. ***************
  1360. *** 19,24 ****
  1361. --- 19,33 ----
  1362. X  static short bs_short ARGS(( short s ));
  1363. X  static long bs_long ARGS(( long l ));
  1364. X  
  1365. + static unsigned long red_mask, green_mask, blue_mask;
  1366. + static int bits_per_item, bits_used, bit_shift, bits_per_pixel;
  1367. + static char buf[4];
  1368. + static char* byteP;
  1369. + static short* shortP;
  1370. + static long* longP;
  1371. + static unsigned long pixel_mask;
  1372. + static int byte_swap, byte_order, bit_order;
  1373. X  void
  1374. X  main( argc, argv )
  1375. X      int argc;
  1376. ***************
  1377. *** 83,91 ****
  1378. X          register unsigned long ul;
  1379. X  
  1380. X          ul = getpixnum( ifp );
  1381. !         PPM_ASSIGN( *xP, ( ( ul & 0xff0000 ) >> 16 ),
  1382. !                                  ( ( ul & 0xff00 ) >> 8 ),
  1383. !                                  ( ul & 0xff ) );
  1384. X          }
  1385. X          break;
  1386. X  
  1387. --- 92,116 ----
  1388. X          register unsigned long ul;
  1389. X  
  1390. X          ul = getpixnum( ifp );
  1391. !         switch ( bits_per_pixel )
  1392. !             {
  1393. !             case 16:
  1394. !             PPM_ASSIGN( *xP,
  1395. !             ( ( ul & red_mask ) >> 0 ),
  1396. !             ( ( ul & green_mask ) >> 5 ),
  1397. !             ( ( ul & blue_mask ) >> 10 ) );
  1398. !             break;
  1399. !             case 24:
  1400. !             case 32:
  1401. !             PPM_ASSIGN( *xP, ( ( ul & 0xff0000 ) >> 16 ),
  1402. !             ( ( ul & 0xff00 ) >> 8 ),
  1403. !             ( ul & 0xff ) );
  1404. !             break;
  1405. !             default:
  1406. !             pm_error( "True/Direct only supports 16, 24, and 32 bits" );
  1407. !             }
  1408. X          }
  1409. X          break;
  1410. X  
  1411. ***************
  1412. *** 98,115 ****
  1413. X      }
  1414. X  
  1415. X      pm_close( ifp );
  1416. X  
  1417. X      exit( 0 );
  1418. X      }
  1419. X  
  1420. - static char buf[4];
  1421. - static char* byteP;
  1422. - static short* shortP;
  1423. - static long* longP;
  1424. - static int bits_per_item, bits_used, bit_shift, bits_per_pixel;
  1425. - static unsigned long pixel_mask;
  1426. - static int byte_swap, byte_order, bit_order;
  1427. X  static void
  1428. X  getinit( file, colsP, rowsP, padrightP, maxvalP, visualclassP, formatP, colorsP )
  1429. X      FILE* file;
  1430. --- 123,133 ----
  1431. X      }
  1432. X  
  1433. X      pm_close( ifp );
  1434. +     pm_close( stdout );
  1435. X  
  1436. X      exit( 0 );
  1437. X      }
  1438. X  
  1439. X  static void
  1440. X  getinit( file, colsP, rowsP, padrightP, maxvalP, visualclassP, formatP, colorsP )
  1441. X      FILE* file;
  1442. ***************
  1443. *** 363,369 ****
  1444. X      if ( *visualclassP == TrueColor || *visualclassP == DirectColor )
  1445. X          {
  1446. X          *formatP = PPM_TYPE;
  1447. !         *maxvalP = 255;
  1448. X          }
  1449. X      else if ( *visualclassP == StaticGray && h11P->bits_per_pixel == 1 )
  1450. X          {
  1451. --- 381,390 ----
  1452. X      if ( *visualclassP == TrueColor || *visualclassP == DirectColor )
  1453. X          {
  1454. X          *formatP = PPM_TYPE;
  1455. !         if ( h11P->bits_per_pixel == 16 )
  1456. !             *maxvalP = 31;
  1457. !             else
  1458. !         *maxvalP = 255;
  1459. X          }
  1460. X      else if ( *visualclassP == StaticGray && h11P->bits_per_pixel == 1 )
  1461. X          {
  1462. ***************
  1463. *** 414,419 ****
  1464. --- 435,443 ----
  1465. X          pixel_mask = -1;
  1466. X      else
  1467. X          pixel_mask = ( 1 << bits_per_pixel ) - 1;
  1468. +         red_mask = h11P->red_mask;
  1469. +         green_mask = h11P->green_mask;
  1470. +         blue_mask = h11P->blue_mask;
  1471. X      }
  1472. X      else
  1473. X      pm_error( "unknown XWD file version: %d", h11P->file_version );
  1474. SHAR_EOF
  1475. echo 'File p121091.diffs is complete' &&
  1476. chmod 0664 p121091.diffs ||
  1477. echo 'restore of p121091.diffs failed'
  1478. Wc_c="`wc -c < 'p121091.diffs'`"
  1479. test 77113 -eq "$Wc_c" ||
  1480.     echo 'p121091.diffs: original size 77113, current size' "$Wc_c"
  1481. rm -f _shar_wnt_.tmp
  1482. fi
  1483. # ============= pbm/Imakefile ==============
  1484. if test ! -d 'pbm'; then
  1485.     echo 'x - creating directory pbm'
  1486.     mkdir 'pbm'
  1487. fi
  1488. if test -f 'pbm/Imakefile' -a X"$1" != X"-c"; then
  1489.     echo 'x - skipping pbm/Imakefile (File already exists)'
  1490.     rm -f _shar_wnt_.tmp
  1491. else
  1492. > _shar_wnt_.tmp
  1493. echo 'x - extracting pbm/Imakefile (Text)'
  1494. sed 's/^X//' << 'SHAR_EOF' > 'pbm/Imakefile' &&
  1495. /* Imakefile for pbm tools
  1496. X *
  1497. X * Copyright (C) 1991 Rainer Klute
  1498. X *
  1499. X * Permission to use, copy, modify, distribute, and sell this software and
  1500. X * its documentation for any purpose is hereby granted without fee, provided
  1501. X * that the above copyright notice appear in all copies and that both that
  1502. X * copyright notice and this permission notice appear in supporting
  1503. X * documentation, and that the copyright holder's name not be used in
  1504. X * advertising or publicity pertaining to distribution of the software
  1505. X * without specific, written prior permission. The copyright holder makes
  1506. X * no representations about the suitability of this software for any
  1507. X * purpose. It is provided "as is" without express or implied warranty.
  1508. X */
  1509. X
  1510. #define LibPbm libpbm.a
  1511. #define DepLibPbm LibPbm
  1512. #include <../Pbmplus.tmpl>
  1513. X
  1514. X   CURRENTLIBS = $(LIBPBM)
  1515. CURRENTDEPLIBS = $(DEPLIBPBM)
  1516. X      INCLUDES = -I..
  1517. #if BuildLibTiff
  1518. X       DEFINES = -DRGB_DB=\"DefaultRGBDatabase\" -DLIBTIFF
  1519. #else
  1520. X       DEFINES = -DRGB_DB=\"DefaultRGBDatabase\"
  1521. #endif
  1522. X         MERGE = pbmmerge
  1523. X
  1524. X          MAN1 = atktopbm.1 brushtopbm.1 cmuwmtopbm.1 g3topbm.1 \
  1525. X         icontopbm.1 gemtopbm.1 macptopbm.1 mgrtopbm.1 \
  1526. X         pbmlife.1 pbmmake.1 pbmmask.1 pbmreduce.1 \
  1527. X         pbmtext.1 pbmto10x.1 pbmtoascii.1 pbmtoatk.1 \
  1528. X         pbmtobbnbg.1 pbmtocmuwm.1 pbmtoepson.1 pbmtog3.1 \
  1529. X         pbmtogem.1 pbmtogo.1 pbmtoicon.1 pbmtolj.1 pbmtomacp.1 \
  1530. X         pbmtomgr.1 pbmtopi3.1 pbmtoplot.1 pbmtoptx.1 \
  1531. X         pbmtox10bm.1 pbmtoxbm.1 pbmtoybm.1 pbmtozinc.1 \
  1532. X         pbmupc.1 pi3topbm.1 xbmtopbm.1 ybmtopbm.1
  1533. X          MAN3 = libpbm.3
  1534. X          MAN5 = pbm.5
  1535. X
  1536. X          SRCS = atktopbm.c brushtopbm.c cmuwmtopbm.c g3topbm.c \
  1537. X             icontopbm.c gemtopbm.c macptopbm.c mgrtopbm.c \
  1538. X         pbmlife.c pbmmake.c pbmmask.c pbmreduce.c \
  1539. X         pbmtext.c pbmto10x.c pbmtoascii.c pbmtoatk.c \
  1540. X         pbmtobbnbg.c pbmtocmuwm.c pbmtoepson.c pbmtog3.c \
  1541. X         pbmtogem.c pbmtogo.c pbmtoicon.c pbmtolj.c pbmtomacp.c \
  1542. X         pbmtomgr.c pbmtopi3.c pbmtoplot.c pbmtoptx.c \
  1543. X         pbmtox10bm.c pbmtoxbm.c pbmtoybm.c pbmtozinc.c \
  1544. X         pbmupc.c pi3topbm.c xbmtopbm.c ybmtopbm.c
  1545. X
  1546. X          OBJS = atktopbm.o brushtopbm.o cmuwmtopbm.o g3topbm.o \
  1547. X         icontopbm.o gemtopbm.o macptopbm.o mgrtopbm.o \
  1548. X         pbmlife.o pbmmake.o pbmmask.o pbmreduce.o \
  1549. X         pbmtext.o pbmto10x.o pbmtoascii.o pbmtoatk.o \
  1550. X         pbmtobbnbg.o pbmtocmuwm.o pbmtoepson.o pbmtog3.o \
  1551. X         pbmtogem.o pbmtogo.o pbmtoicon.o pbmtolj.o pbmtomacp.o \
  1552. X         pbmtomgr.o pbmtopi3.o pbmtoplot.o pbmtoptx.o \
  1553. X         pbmtox10bm.o pbmtoxbm.o pbmtoybm.o pbmtozinc.o \
  1554. X         pbmupc.o pi3topbm.o xbmtopbm.o ybmtopbm.o
  1555. X
  1556. X          BINS = atktopbm brushtopbm cmuwmtopbm g3topbm \
  1557. X         icontopbm gemtopbm macptopbm mgrtopbm \
  1558. X         pbmlife pbmmake pbmmask pbmreduce \
  1559. X         pbmtext pbmto10x pbmtoascii pbmtoatk \
  1560. X         pbmtobbnbg pbmtocmuwm pbmtoepson pbmtog3 \
  1561. X         pbmtogem pbmtogo pbmtoicon pbmtolj pbmtomacp \
  1562. X         pbmtomgr pbmtopi3 pbmtoplot pbmtoptx \
  1563. X         pbmtox10bm pbmtoxbm pbmtoybm pbmtozinc \
  1564. X         pbmupc pi3topbm xbmtopbm ybmtopbm
  1565. X
  1566. AllTarget($(LIBPBM) $(BINS))
  1567. X
  1568. DependTarget()
  1569. X
  1570. NormalPbmplusProgramTarget(atktopbm)
  1571. NormalPbmplusProgramTarget(brushtopbm)
  1572. NormalPbmplusProgramTarget(cmuwmtopbm)
  1573. NormalPbmplusProgramTarget(g3topbm)
  1574. NormalPbmplusProgramTarget(icontopbm)
  1575. NormalPbmplusProgramTarget(gemtopbm)
  1576. NormalPbmplusProgramTarget(macptopbm)
  1577. NormalPbmplusProgramTarget(mgrtopbm)
  1578. NormalPbmplusProgramTarget(pbmlife)
  1579. NormalPbmplusProgramTarget(pbmmake)
  1580. NormalPbmplusProgramTarget(pbmmask)
  1581. NormalPbmplusProgramTarget(pbmreduce)
  1582. NormalPbmplusProgramTarget(pbmtext)
  1583. NormalPbmplusProgramTarget(pbmto10x)
  1584. NormalPbmplusProgramTarget(pbmtoascii)
  1585. NormalPbmplusProgramTarget(pbmtoatk)
  1586. NormalPbmplusProgramTarget(pbmtobbnbg)
  1587. NormalPbmplusProgramTarget(pbmtocmuwm)
  1588. NormalPbmplusProgramTarget(pbmtoepson)
  1589. NormalPbmplusProgramTarget(pbmtog3)
  1590. NormalPbmplusProgramTarget(pbmtogem)
  1591. NormalPbmplusProgramTarget(pbmtogo)
  1592. NormalPbmplusProgramTarget(pbmtoicon)
  1593. NormalPbmplusProgramTarget(pbmtolj)
  1594. NormalPbmplusProgramTarget(pbmtomacp)
  1595. NormalPbmplusProgramTarget(pbmtomgr)
  1596. NormalPbmplusProgramTarget(pbmtopi3)
  1597. NormalPbmplusProgramTarget(pbmtoplot)
  1598. NormalPbmplusProgramTarget(pbmtoptx)
  1599. NormalPbmplusProgramTarget(pbmtox10bm)
  1600. NormalPbmplusProgramTarget(pbmtoxbm)
  1601. NormalPbmplusProgramTarget(pbmtoybm)
  1602. NormalPbmplusProgramTarget(pbmtozinc)
  1603. NormalPbmplusProgramTarget(pbmupc)
  1604. NormalPbmplusProgramTarget(pi3topbm)
  1605. NormalPbmplusProgramTarget(xbmtopbm)
  1606. NormalPbmplusProgramTarget(ybmtopbm)
  1607. X
  1608. NormalLibraryObjectRule()
  1609. NormalLibraryTarget(pbm,libpbm1.o libpbm2.o libpbm3.o libpbm4.o libpbm5.o)
  1610. X
  1611. #if InstallMerged
  1612. NormalProgramTarget($(MERGE),$(MERGE).o $(OBJS),$(CURRENTDEPLIBS),$(CURRENTLIBS),-lm)
  1613. #if InstallBinaries
  1614. InstallProgram($(MERGE),$(PBMPLUSDIR)$(PBMPLUSBINDIR))
  1615. #endif
  1616. #endif
  1617. X
  1618. #if InstallBinaries
  1619. InstallPbmplusPrograms($(BINS),$(PBMPLUSDIR)$(PBMPLUSBINDIR),$(INSTPGMFLAGS))
  1620. #endif
  1621. X
  1622. #if InstallManuals
  1623. InstallMultipleMan($(MAN1),$(PBMPLUSDIR)$(PBMPLUSMANDIR)/man1)
  1624. InstallMultipleMan($(MAN3),$(PBMPLUSDIR)$(PBMPLUSMANDIR)/man3)
  1625. InstallMultipleMan($(MAN5),$(PBMPLUSDIR)$(PBMPLUSMANDIR)/man5)
  1626. #endif
  1627. X
  1628. #if InstallLibraries
  1629. InstallLibrary(pbm,$(PBMPLUSDIR)$(PBMPLUSLIBDIR))
  1630. #endif
  1631. X
  1632. #if InstallIncludes
  1633. InstallMultipleFlags(pbm.h,$(PBMPLUSDIR)$(PBMPLUSINCDIR),$(INSTINCFLAGS))
  1634. #endif
  1635. SHAR_EOF
  1636. chmod 0664 pbm/Imakefile ||
  1637. echo 'restore of pbm/Imakefile failed'
  1638. Wc_c="`wc -c < 'pbm/Imakefile'`"
  1639. test 5156 -eq "$Wc_c" ||
  1640.     echo 'pbm/Imakefile: original size 5156, current size' "$Wc_c"
  1641. rm -f _shar_wnt_.tmp
  1642. fi
  1643. # ============= pgm/Imakefile ==============
  1644. if test ! -d 'pgm'; then
  1645.     echo 'x - creating directory pgm'
  1646.     mkdir 'pgm'
  1647. fi
  1648. if test -f 'pgm/Imakefile' -a X"$1" != X"-c"; then
  1649.     echo 'x - skipping pgm/Imakefile (File already exists)'
  1650.     rm -f _shar_wnt_.tmp
  1651. else
  1652. > _shar_wnt_.tmp
  1653. echo 'x - extracting pgm/Imakefile (Text)'
  1654. sed 's/^X//' << 'SHAR_EOF' > 'pgm/Imakefile' &&
  1655. /* Imakefile for pgm tools
  1656. X *
  1657. X * Copyright (C) 1991 Rainer Klute
  1658. X *
  1659. X * Permission to use, copy, modify, distribute, and sell this software and
  1660. X * its documentation for any purpose is hereby granted without fee, provided
  1661. X * that the above copyright notice appear in all copies and that both that
  1662. X * copyright notice and this permission notice appear in supporting
  1663. X * documentation, and that the copyright holder's name not be used in
  1664. X * advertising or publicity pertaining to distribution of the software
  1665. X * without specific, written prior permission. The copyright holder makes
  1666. X * no representations about the suitability of this software for any
  1667. X * purpose. It is provided "as is" without express or implied warranty.
  1668. X */
  1669. X
  1670. #define LibPgm libpgm.a
  1671. #define DepLibPgm LibPgm
  1672. #include <../Pbmplus.tmpl>
  1673. X
  1674. X   CURRENTLIBS = $(LIBPGM) $(LIBPBM)
  1675. CURRENTDEPLIBS = $(DEPLIBPGM) $(DEPLIBPBM)
  1676. X     INCLUDES  = -I.. -I$(PBMDIR)
  1677. X         MERGE = pgmmerge
  1678. X
  1679. X          MAN1 = fitstopgm.1 fstopgm.1 hipstopgm.1 lispmtopgm.1 pgmbentley.1 \
  1680. X                 pgmenhance.1 pgmhist.1 pgmnorm.1 pgmoil.1 pgmramp.1 \
  1681. X                 pgmtofits.1 pgmtofs.1 pgmtolispm.1 pgmtopbm.1 \
  1682. X         psidtopgm.1 rawtopgm.1 \
  1683. X         pgmcrater.1 pgmedge.1 pgmtexture.1
  1684. X          MAN3 = libpgm.3
  1685. X          MAN5 = pgm.5
  1686. X
  1687. X          SRCS = fitstopgm.c fstopgm.c hipstopgm.c lispmtopgm.c pgmbentley.c \
  1688. X         pgmenhance.c pgmhist.c pgmnorm.c pgmoil.c pgmramp.c \
  1689. X         pgmtofits.c pgmtofs.c pgmtolispm.c pgmtopbm.c \
  1690. X         psidtopgm.c rawtopgm.c \
  1691. X         pgmcrater.c pgmedge.c pgmtexture.c
  1692. X
  1693. X          OBJS = fitstopgm.o fstopgm.o hipstopgm.o lispmtopgm.o pgmbentley.o \
  1694. X         pgmenhance.o pgmhist.o pgmnorm.o pgmoil.o pgmramp.o \
  1695. X         pgmtofits.o pgmtofs.o pgmtolispm.o pgmtopbm.o \
  1696. X         psidtopgm.o rawtopgm.o \
  1697. X         pgmcrater.o pgmedge.o pgmtexture.o
  1698. X
  1699. X          BINS = fitstopgm fstopgm hipstopgm lispmtopgm pgmbentley \
  1700. X         pgmenhance pgmhist pgmnorm pgmoil pgmramp \
  1701. X         pgmtofits pgmtofs pgmtolispm pgmtopbm \
  1702. X         psidtopgm rawtopgm \
  1703. X         pgmcrater pgmedge pgmtexture
  1704. X
  1705. AllTarget($(LIBPGM) $(BINS))
  1706. X
  1707. DependTarget()
  1708. X
  1709. NormalPbmplusProgramTarget(fitstopgm)
  1710. NormalPbmplusProgramTarget(fstopgm)
  1711. NormalPbmplusProgramTarget(hipstopgm)
  1712. NormalPbmplusProgramTarget(lispmtopgm)
  1713. NormalPbmplusProgramTarget(pgmbentley)
  1714. NormalPbmplusProgramTarget(pgmenhance)
  1715. NormalPbmplusProgramTarget(pgmhist)
  1716. NormalPbmplusProgramTarget(pgmnorm)
  1717. NormalPbmplusProgramTarget(pgmoil)
  1718. NormalPbmplusProgramTarget(pgmramp)
  1719. NormalPbmplusProgramTarget(pgmtofits)
  1720. NormalPbmplusProgramTarget(pgmtofs)
  1721. NormalPbmplusProgramTarget(pgmtolispm)
  1722. NormalPbmplusProgramTarget(pgmtopbm)
  1723. NormalPbmplusProgramTarget(psidtopgm)
  1724. NormalPbmplusProgramTarget(rawtopgm)
  1725. NormalPbmplusMathProgramTarget(pgmcrater)
  1726. NormalPbmplusMathProgramTarget(pgmedge)
  1727. NormalPbmplusMathProgramTarget(pgmtexture)
  1728. X
  1729. NormalLibraryObjectRule()
  1730. NormalLibraryTarget(pgm,libpgm1.o libpgm2.o)
  1731. X
  1732. #if InstallMerged
  1733. NormalProgramTarget($(MERGE),$(MERGE).o $(OBJS),$(CURRENTDEPLIBS),$(CURRENTLIBS),-lm)
  1734. #if InstallBinaries
  1735. InstallProgram($(MERGE),$(PBMPLUSDIR)$(PBMPLUSBINDIR))
  1736. #endif
  1737. #endif
  1738. X
  1739. #if InstallBinaries
  1740. InstallPbmplusPrograms($(BINS),$(PBMPLUSDIR)$(PBMPLUSBINDIR),$(INSTPGMFLAGS))
  1741. #endif
  1742. X
  1743. #if InstallManuals
  1744. InstallMultipleMan($(MAN1),$(PBMPLUSDIR)$(PBMPLUSMANDIR)/man1)
  1745. InstallMultipleMan($(MAN3),$(PBMPLUSDIR)$(PBMPLUSMANDIR)/man3)
  1746. InstallMultipleMan($(MAN5),$(PBMPLUSDIR)$(PBMPLUSMANDIR)/man5)
  1747. #endif
  1748. X
  1749. #if InstallLibraries
  1750. InstallLibrary(pgm,$(PBMPLUSDIR)$(PBMPLUSLIBDIR))
  1751. #endif
  1752. X
  1753. #if InstallIncludes
  1754. InstallMultipleFlags(pgm.h,$(PBMPLUSDIR)$(PBMPLUSINCDIR),$(INSTINCFLAGS))
  1755. #endif
  1756. SHAR_EOF
  1757. chmod 0664 pgm/Imakefile ||
  1758. echo 'restore of pgm/Imakefile failed'
  1759. Wc_c="`wc -c < 'pgm/Imakefile'`"
  1760. test 3534 -eq "$Wc_c" ||
  1761.     echo 'pgm/Imakefile: original size 3534, current size' "$Wc_c"
  1762. rm -f _shar_wnt_.tmp
  1763. fi
  1764. # ============= pgm/pgmcrater.1 ==============
  1765. if test -f 'pgm/pgmcrater.1' -a X"$1" != X"-c"; then
  1766.     echo 'x - skipping pgm/pgmcrater.1 (File already exists)'
  1767.     rm -f _shar_wnt_.tmp
  1768. else
  1769. > _shar_wnt_.tmp
  1770. echo 'x - extracting pgm/pgmcrater.1 (Text)'
  1771. sed 's/^X//' << 'SHAR_EOF' > 'pgm/pgmcrater.1' &&
  1772. .TH pgmcrater 1 "15 October 1991"
  1773. .IX pgmcrater
  1774. .IX fractals
  1775. .IX craters
  1776. .SH NAME
  1777. pgmcrater - create cratered terrain by fractal forgery
  1778. .SH SYNOPSIS
  1779. .na
  1780. .B pgmcrater
  1781. 'ti 15
  1782. .RB [ -number
  1783. .IR n ]
  1784. .RB [ -height | -ysize
  1785. .IR s ]
  1786. .RB [ -width | -xsize
  1787. .IR s ]
  1788. .RB [ -gamma
  1789. .IR g ]
  1790. .ad
  1791. .SH DESCRIPTION
  1792. .B pgmcrater
  1793. creates a portable graymap which mimics cratered terrain.  The graymap
  1794. is created by simulating the impact of a given number of craters with
  1795. random position and size, then rendering the resulting terrain
  1796. elevations based on a light source shining from one side of the
  1797. screen.  The size distribution of the craters is based on a power law
  1798. which results in many more small craters than large ones.  The number
  1799. of craters of a given size varies as the reciprocal of the area as
  1800. described on pages 31 and 32 of Peitgen and Saupe[1]; cratered bodies
  1801. in the Solar System are observed to obey this relationship.  The
  1802. formula used to obtain crater radii governed by this law from a
  1803. uniformly distributed pseudorandom sequence was developed by Rudy
  1804. Rucker.
  1805. .PP
  1806. High resolution images with large numbers of craters often benefit
  1807. from being piped through
  1808. .BR pnmsmooth .
  1809. The averaging performed by this process eliminates some of the jagged
  1810. pixels and lends a mellow ``telescopic image'' feel to the overall
  1811. picture.
  1812. .SH OPTIONS
  1813. .TP 10
  1814. .BI -number " n"
  1815. Causes
  1816. .I n
  1817. craters to be generated.  If no
  1818. .B -number
  1819. specification is given, 50000 craters will be generated.  Don't expect
  1820. to see them all!  For every large crater there are many, many more
  1821. tiny ones which tend simply to erode the landscape.  In general, the
  1822. more craters you specify the more realistic the result; ideally you
  1823. want the entire terrain to have been extensively turned over again and
  1824. again by cratering.  High resolution images containing five to ten
  1825. million craters are stunning but take quite a while to create.
  1826. .TP
  1827. .BI -height " height"
  1828. Sets the height of the generated image to
  1829. .I height
  1830. pixels.  The default height is 256 pixels.
  1831. .TP
  1832. .BI -width " width"
  1833. Sets the width of the generated image to
  1834. .I width
  1835. pixels.  The default width is 256 pixels.
  1836. .TP
  1837. .BI -xsize " width"
  1838. Sets the width of the generated image to
  1839. .I width
  1840. pixels.  The default width is 256 pixels.
  1841. .TP
  1842. .BI -ysize " height"
  1843. Sets the height of the generated image to
  1844. .I height
  1845. pixels.  The default height is 256 pixels.
  1846. .TP
  1847. .BI -gamma " factor"
  1848. The specified
  1849. .I factor
  1850. is used to gamma correct the graymap in the same manner as performed
  1851. by
  1852. .BR pnmgamma .
  1853. The default value is 1.0, which results in a medium contrast image.
  1854. Values larger than 1 lighten the image and reduce contrast, while
  1855. values less than 1 darken the image, increasing contrast.
  1856. .PP
  1857. All flags can be abbreviated to their shortest unique prefix.
  1858. .SH BUGS
  1859. The
  1860. .B -gamma
  1861. option isn't really necessary since you can achieve the same
  1862. effect by piping the output from
  1863. .B pgmcrater
  1864. through
  1865. .BR pnmgamma .
  1866. However,
  1867. .B pgmcrater
  1868. performs an internal gamma map anyway in the process of rendering the
  1869. elevation array into a graymap, so there's no additional overhead in
  1870. allowing a user-specified gamma.
  1871. .PP
  1872. Real craters have two distinct morphologies.
  1873. .B pgmcrater
  1874. simulates only small craters, which are hemispherical in shape
  1875. (regardless of the incidence angle of the impacting body, as long as the
  1876. velocity is sufficiently high).  Large craters, such as Copernicus and
  1877. Tycho on the Moon, have a ``walled plain'' shape with a cross-section more
  1878. like:
  1879. .nf
  1880. .ne 2
  1881. .cs R 18
  1882. X                /\\                            /\\
  1883. .br
  1884. X          _____/  \\____________/\\____________/  \\_____
  1885. .cs R
  1886. .fi
  1887. .ss 12
  1888. Larger craters should really use this profile, including the central
  1889. peak, and totally obliterate the pre-existing terrain.
  1890. .SH "SEE ALSO"
  1891. .PD
  1892. .BR pgm (5),
  1893. .BR pnmgamma (1),
  1894. .BR pnmsmooth (1)
  1895. .TP 5
  1896. [1]
  1897. Peitgen, H.-O., and Saupe, D. eds., The Science Of Fractal Images,
  1898. New York: Springer Verlag, 1988.
  1899. .ne 10
  1900. .SH AUTHOR
  1901. .RS 5
  1902. .nf
  1903. John Walker
  1904. Autodesk SA
  1905. Avenue des Champs-Montants 14b
  1906. CH-2074 MARIN
  1907. Suisse/Schweiz/Svizzera/Svizra/Switzerland
  1908. .PD 0
  1909. .TP 9
  1910. Usenet:
  1911. kelvin@Autodesk.com
  1912. .TP
  1913. Fax:
  1914. 038/33 88 15
  1915. .TP
  1916. Voice:
  1917. 038/33 76 33
  1918. .fi
  1919. .RE
  1920. .PD
  1921. .PP
  1922. Permission to use, copy, modify, and distribute this software and its
  1923. documentation for any purpose and without fee is hereby granted,
  1924. without any conditions or restrictions.  This software is provided ``as
  1925. is'' without express or implied warranty.
  1926. .PP
  1927. .B PLUGWARE!
  1928. If you like this kind of stuff, you may also enjoy ``James Gleick's
  1929. Chaos--The Software'' for MS-DOS, available for $59.95 from your
  1930. local software store or directly from Autodesk, Inc., Attn: Science
  1931. Series, 2320 Marinship Way, Sausalito, CA 94965, USA.  Telephone:
  1932. (800) 688-2344 toll-free or, outside the U.S. (415) 332-2344 Ext
  1933. 4886.  Fax: (415) 289-4718.  ``Chaos--The Software'' includes a more
  1934. comprehensive fractal forgery generator which creates
  1935. three-dimensional landscapes as well as clouds and planets, plus five
  1936. more modules which explore other aspects of Chaos.  The user guide of
  1937. more than 200 pages includes an introduction by James Gleick and
  1938. detailed explanations by Rudy Rucker of the mathematics and algorithms
  1939. used by each program.
  1940. SHAR_EOF
  1941. chmod 0664 pgm/pgmcrater.1 ||
  1942. echo 'restore of pgm/pgmcrater.1 failed'
  1943. Wc_c="`wc -c < 'pgm/pgmcrater.1'`"
  1944. test 5160 -eq "$Wc_c" ||
  1945.     echo 'pgm/pgmcrater.1: original size 5160, current size' "$Wc_c"
  1946. rm -f _shar_wnt_.tmp
  1947. fi
  1948. # ============= pgm/pgmcrater.c ==============
  1949. if test -f 'pgm/pgmcrater.c' -a X"$1" != X"-c"; then
  1950.     echo 'x - skipping pgm/pgmcrater.c (File already exists)'
  1951.     rm -f _shar_wnt_.tmp
  1952. else
  1953. > _shar_wnt_.tmp
  1954. echo 'x - extracting pgm/pgmcrater.c (Text)'
  1955. sed 's/^X//' << 'SHAR_EOF' > 'pgm/pgmcrater.c' &&
  1956. /*
  1957. X
  1958. X              Fractal cratering
  1959. X
  1960. X       Designed and implemented in November of 1989 by:
  1961. X
  1962. X        John Walker
  1963. X        Autodesk SA
  1964. X        Avenue des Champs-Montants 14b
  1965. X        CH-2074 MARIN
  1966. X        Switzerland
  1967. X        Usenet: kelvin@Autodesk.com
  1968. X        Fax:    038/33 88 15
  1969. X        Voice:  038/33 76 33
  1970. X
  1971. X    The  algorithm  used  to  determine crater size is as described on
  1972. SHAR_EOF
  1973. true || echo 'restore of pgm/pgmcrater.c failed'
  1974. fi
  1975. echo 'End of  part 2'
  1976. echo 'File pgm/pgmcrater.c is continued in part 3'
  1977. echo 3 > _shar_seq_.tmp
  1978. exit 0
  1979. exit 0 # Just in case...
  1980. -- 
  1981. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1982. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1983. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1984. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1985.