home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume22 / popi / part09 < prev    next >
Encoding:
Text File  |  1991-08-22  |  56.5 KB  |  1,706 lines

  1. Newsgroups: comp.sources.misc
  2. From: Rich Burridge <richb@Aus.Sun.COM>
  3. Subject:  v22i048:  popi - The Digital Darkroom, Part09/09
  4. Message-ID: <1991Aug22.153235.16057@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 22482ffbd26278b746541d38feb3fe43
  6. Date: Thu, 22 Aug 1991 15:32:35 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Rich Burridge <richb@Aus.Sun.COM>
  10. Posting-number: Volume 22, Issue 48
  11. Archive-name: popi/part09
  12. Environment: Xlib, Xview, SunView
  13. Supersedes: popi: Volume 9, Issue 47-55
  14.  
  15. #! /bin/sh
  16. # 1. Remove everything above the #! /bin/sh line
  17. # 2. Save the resulting text in a file.
  18. # 3. Execute the file with /bin/sh to create the files:
  19. #    FILES
  20. #    MANIFEST
  21. #    CHANGES
  22. #    popi.man.text
  23. # This archive created: Wed Aug 21 10:36:13 EST 1991
  24. #
  25. #
  26. export PATH; PATH=/bin:$PATH
  27. #
  28. if [ -f FILES ]
  29. then
  30. echo shar: will not over-write existing file FILES
  31. else
  32. echo shar: extracting 'FILES',     2998 characters
  33. cat > FILES <<'Funky_Stuff'
  34.  
  35. @(#)FILES 1.2 91/01/03
  36.  
  37. This file describes all the files that make up the Reve distribution.
  38.  
  39. README                - describes what popi is, and how to get started.
  40. Makefile.dist         - master Makefile used to build popi on most systems.
  41. TODO                  - bugs and suggested enhancements. Volunteers?
  42. popi.msc              - Make file for Microsoft braindamaged make.
  43. popi.prj              - Popi project file (for PC compilers).
  44. powerc.prj            - Project file for Mix Software's Power C Compiler
  45. popitopgm.c           - small filter to convert old popi format images to pgm.
  46.  
  47. debug.c               - debug routines used by popi.
  48. expr.c                - parser routines used by popi.
  49. io.c                  - file handling routines used by popi
  50. lex.c                 - lexical routines used by popi
  51. main.c                - main routine and declarations used by popi.
  52. polar.c               - polar coordinate handling routines used by popi.
  53.  
  54. libpbm.c              - PBM/PGM/PPM routines used by popi in io.c
  55. libpbm.h              - definitions used by the PBM/PGM/PPM routines.
  56. run.c                 - run time interpreter used by popi.
  57. special.c             - special transformations used by popi.
  58. popi.icon             - popi icon used when the popi window is iconifed.
  59.  
  60. gl.c                  - special version of the gl initialisation routines.
  61. g_init.c              - graphics device driver for the gl window system.
  62.  
  63. amiga.c               - graphics device driver for the Amiga.
  64. apollo.c              - graphics device driver for the Apollo.
  65. atariterm.c           - graphics device driver for Atari TERM windows.
  66. graphics.c            - independent graphics routines used by popi.
  67. hp.c                  - graphics device driver for an HP 8+ plane display.
  68. kerterm.c             - graphics driver for kermit TERM windows.
  69.  
  70. ibmpc.c               - graphics driver for the IBM PC's.
  71. mgr.c                 - graphics driver used the MGR window system.
  72. news.c                - C wrappers for the NeWS graphics routines.
  73. next.m                - graphics driver for the NeXT machine.
  74.  
  75. nulldev.c             - device driver for a null device.
  76. sunview.c             - Sun SunView graphics routines.
  77. x11.c                 - X11 (Xlib) graphics routines.
  78. xview.c               - X11 XView toolkit graphics routines.
  79.  
  80. popi.ps               - NeWS graphics routines used by popi.
  81. popi.h                - definitions and constants used by popi.
  82. graphics.h            - optional graphics external variables and definitions.
  83. patchlevel.h          - current patchlevel for this release of popi.
  84. lex.h                 - definitions used by the popi lexical parser.
  85. popi.man              - the popi manual page (troff/nroff -man format).
  86.  
  87. FILES                 - what you're reading now.
  88. MANIFEST              - tells you what archive part each file was in.
  89. CHANGES               - change history. Updated with each new patch.
  90. popi.man.text         - plain text version of the popi manual pages.
  91. Funky_Stuff
  92. len=`wc -c < FILES`
  93. if [ $len !=     2998 ] ; then
  94. echo error: FILES was $len bytes long, should have been     2998
  95. fi
  96. fi # end of overwriting check
  97. if [ -f MANIFEST ]
  98. then
  99. echo shar: will not over-write existing file MANIFEST
  100. else
  101. echo shar: extracting 'MANIFEST',     2232 characters
  102. cat > MANIFEST <<'Funky_Stuff'
  103.  
  104. @(#)MANIFEST 1.4 91/01/03
  105.  
  106. This file tells you in which part of the popi distribution each
  107. file appeared.
  108.  
  109. Filename.                              |  Part #
  110. --------------------------------------------------
  111. README                                 |    1
  112. Makefile.dist                          |    1
  113. TODO                                   |    1
  114. popi.msc                               |    1
  115. popi.prj                               |    1
  116. powerc.prj                             |    1
  117. popitopgm.c                            |    1
  118. debug.c                                |    2
  119. expr.c                                 |    2
  120. io.c                                   |    2
  121. lex.c                                  |    2
  122. main.c                                 |    2
  123. polar.c                                |    2
  124. libpbm.c                               |    3
  125. libpbm.h                               |    3
  126. run.c                                  |    3
  127. special.c                              |    3
  128. popi.icon                              |    3
  129. gl.c                                   |    4
  130. g_init.c                               |    4
  131. amiga.c                                |    5
  132. apollo.c                               |    5
  133. atariterm.c                            |    5
  134. graphics.c                             |    5
  135. hp.c                                   |    5
  136. kerterm.c                              |    5
  137. ibmpc.c                                |    6
  138. mgr.c                                  |    6
  139. news.c                                 |    6
  140. next.m                                 |    6
  141. nulldev.c                              |    7
  142. sunview.c                              |    7
  143. x11.c                                  |    7
  144. xview.c                                |    7
  145. popi.ps                                |    8
  146. popi.h                                 |    8
  147. graphics.h                             |    8
  148. patchlevel.h                           |    8
  149. lex.h                                  |    8
  150. popi.man                               |    8
  151. FILES                                  |    9
  152. MANIFEST                               |    9
  153. CHANGES                                |    9
  154. popi.man.text                          |    9
  155. Funky_Stuff
  156. len=`wc -c < MANIFEST`
  157. if [ $len !=     2232 ] ; then
  158. echo error: MANIFEST was $len bytes long, should have been     2232
  159. fi
  160. fi # end of overwriting check
  161. if [ -f CHANGES ]
  162. then
  163. echo shar: will not over-write existing file CHANGES
  164. else
  165. echo shar: extracting 'CHANGES',    12961 characters
  166. cat > CHANGES <<'Funky_Stuff'
  167.  
  168. Popi change history.
  169. --------------------
  170.  
  171. v3.1 - patchlevel 0. - 21st August 1991.
  172. ----------------------------------------
  173.  
  174. * Added mention of the popi mailing list to the README file.
  175.  
  176. * Popi can now correctly handle the reading of compressed image files from
  177.   the command line.
  178.  
  179. * From Stephen Frede <stephenf@softway.sw.oz.au>
  180.   - trunc() in special.c is a library routine on some machines, and the
  181.     declaration in the header files conflicts. Changed name to "imtrunc".
  182.  
  183.   - signed is an ANSI keyword, and so should not be used as a function name
  184.     in special.c - I have changed it to "dosigned()".
  185.  
  186. * Added all known problems, suggestions and comments received, to the TODO
  187.   file.
  188.  
  189. * Ran the X11 version of popi through Saber-C fixing up compile time
  190.   inconsistencies.
  191.   - The color variable was being used before it was set in the oil()
  192.     routine in special.c
  193.   - various variables no longer used.
  194.  
  195. * From Adrian F. Clark <alien@essex.ac.uk>
  196.   Backspacing/deleting back pass the beginning of input, caused a core dump.
  197.  
  198. * Range checking has been added to the OP_CRVAL case in prun() in run.c. This
  199.   now allows examples like:
  200.  
  201.   -> :read "dmr"
  202.   -> new[x,y]=dmr[x,y]+(Z/2 -dmr[x+2,y+2])
  203.  
  204.   -> :r "dmr"
  205.   -> new[x,y]=dmr[x*2,y*2]
  206.  
  207.   to correctly work.
  208.  
  209. * The X11 (Xlib) and XView graphics drivers now build an image offscreen, so
  210.   that they can correctly restore the image canvas for repaint events.
  211.  
  212. * All references to revtable in x11.c and xview.c have been removed.
  213.  
  214. * Prepared popi distribution for release to comp.sources.misc.
  215.  
  216. v3.0 - patchlevel 7. - 25th March 1991.
  217. ---------------------------------------
  218.  
  219. * Fixed up the % operator in the op_op table.
  220.  
  221. * Fixed up handling of the Images array in the OP_CRVAL case in the switch
  222.   table in prun().
  223.  
  224. v3.0 - patchlevel 6. - 17th January 1991.
  225. -----------------------------------------
  226.  
  227. * From Russ Nelson <nelson@sun.soe.clarkson.edu>
  228.   Makefile.dist changes for DOS. Borland's Make doesn't grok .keep_changes,
  229.   nor the lint_*:; lint ...  lines.  I commented out .keep_changes, and split
  230.   out the line_*:; lines into more vanilla dependencies
  231.  
  232. * Fixed up color support for the XView graphics driver. Still needs to be
  233.   tested on a TrueColor display.
  234.  
  235. * Added in PBM support when reading images. PBM files are simply converted to
  236.   a grayscale image that has two values; 0 or 1. The nature of PBMPLUS is such
  237.   that ppm automatic should support pgm and pbm.
  238.  
  239. v3.0 - patchlevel 5. - 14th January 1991.
  240. -----------------------------------------
  241.  
  242. * From Rich Morin <cfcl!rdm@apple.com>
  243.  
  244.   - polar.c, main.c, popi.h
  245.  
  246.     Tidied up a bit. Couldn't find any basic speed up, unfortunately... The
  247.     calculation takes ~120 seconds on my Sun-3/60. Hypot's time could be cut
  248.     almost in half, but it takes only 25% of the time, so the gain would be
  249.     only 12.5%, and the kludge is pretty hairy.
  250.  
  251.     Set up a control flag named tcache; it controls caching of trig values
  252.     for all four quadrants in "/usr/tmp/popi.<Xsize>.<Ysize>".
  253.     Might want to save only quadrant 2 (the cache file for 512x512 is
  254.     currently 1MB).
  255.  
  256.     N.B. FREAD and FWRITE were defined in popi.h, but never used. They
  257.     conflicted with definitions in <fcntl.h>, so I killed them.
  258.  
  259.   - special.c, io.c, popi.h
  260.  
  261.     Set :ofmt up as a command, like :signed. It corresponds to the -o flag.
  262.  
  263. v3.0 - patchlevel 4. - 9th January 1991.
  264. ----------------------------------------
  265.  
  266. * popi will now attempt to read the old format image file auto-magically if
  267.   it detects that the image file is not in pgm or ppm format. Even if it read
  268.   a grayscale image in the old format, it will still write it out in pgm
  269.   format, unless the user has given the -o command line option. The manual
  270.   pages have been updated to mention all this.
  271.  
  272. * The command line options at the beginning of the manual pages have been
  273.   rearranged in alphabetical order.
  274.  
  275. v3.0 - patchlevel 3. - 3rd January 1991.
  276. ----------------------------------------
  277.  
  278. * From Rich Morin <cfcl!rdm@apple.com>
  279.   The basic SunView interface seems to be functional. The following glitches
  280.   were fixed:
  281.  
  282.   :l        -  didn't show possibilities on ambiguous abbreviations fixed:
  283.                special (special.c)
  284.  
  285.   ?         -  printed specials as #w..., not :w... fixed: HelpMsg, help
  286.                (special.c)
  287.  
  288.   ^D        -  hung popi input, generated huge error log fixed: disp_getchar
  289.                (sunview.c)
  290.  
  291.   **<<May want to check for similar bugs in other drivers>>**
  292.  
  293.   popi -\?  -  usage message was incomplete
  294.                fixes: filled out usage table a bit: UsageMsg (main.c) also
  295.                sorted option parsing switch: get_options (main.c)
  296.  
  297.   popi -d   -  dumped core if no argument was given
  298.   popi -g   -  dumped core if no argument was given kludged: get_options
  299.                (main.c)
  300.  
  301.   Fixed some minor fluff in the manual page:
  302.  
  303.   magic cookie for specials is now :, not #.
  304.   magic cookie (?) for color I/O is no longer needed.
  305.   Its "it's" was wrong, now it's "its"... CFCL is only one laboratory (if
  306.   that).
  307.  
  308.   New files:
  309.  
  310.   * popitopgm.c - a small filter to convert old format popi image files to
  311.                   pgm format. See the README and manual pages for more
  312.                   details.
  313.  
  314. v3.0 - patchlevel 2. - 31st December 1990.
  315. ------------------------------------------
  316.  
  317. * Converted the image reading/writing routines to use pgm (portable graymap)
  318.   for greyscale images, and ppm (portable pixmap) for color images. The
  319.   manuals pages have been updated to include a new section describing the
  320.   image formats. The README file had been modified to included the appropriate
  321.   copyright messages. The FILES and MANIFEST files have been modified to
  322.   mention the new files.
  323.  
  324. * From Russ Nelson <nelson@sun.soe.clarkson.edu>
  325.   The command line is now too long for DOS compilers. All DOS compilers will
  326.   have this problem: Turbo C, MS-C, MS-Quick C, and Mix C. The solution used,
  327.   has been to put all the object files but main into a library, and link using
  328.   that library. This keeps the Makefile the same for everyone, but it makes it
  329.   slightly harder to maintain because of the addition of library commands.
  330.  
  331.   New files:
  332.  
  333.   * libpbm.c - the PBM/PGM/PPM routines needed by popi. These have been
  334.                taken from the PBMPLUS package, and modified appropriately for
  335.                popi.
  336.  
  337.   * libpbm.h - definitions and declaration for the PBM/PGM/PPM routines used
  338.                by popi. Used in libpbm.c and io.c.
  339.  
  340. v3.0 - patchlevel 1. - 28th December 1990.
  341. ------------------------------------------
  342.  
  343. * The X11 (Xlib) version was creating a pixmap of the full image size every
  344.   time it was drawing a scanline. The pixmap only needed to be one pixel high.
  345.  
  346. * Rewrote the XView version in the same style as the SunView driver.
  347.  
  348. v3.0 - patchlevel 0. - Started 21st December 1990.
  349. --------------------------------------------------
  350.  
  351. * From Russ Nelson <nelson@image.soe.clarkson.edu>
  352.   Incorporated various efficiency changes.
  353.  
  354. * From Rich Morin <cfcl!rdm@apple.com>
  355.   - Added a -c flag - color (RGB) calculation, display, and I/O (NTSC luma
  356.     display on non-24-bit monitors)
  357.  
  358.   - Added a -s flag, #signed - signed I/O
  359.  
  360.   - Added 24-bit monitor support under SunView
  361.  
  362.   - Added smallest unambiguous name recognition for special commands (eg, #r)
  363.  
  364.   - Added table-driven messages about special commands in #help
  365.  
  366.   - Assorted bug fixes
  367.  
  368. * Generated a Makefile.dist, which will need to be copied over to Makefile.
  369.   This saves stomping on everybodies toes when changes to the Makefile need
  370.   to be made.
  371.  
  372. * Reversed the order of information in the CHANGES file. The latest entries
  373.   are now first.
  374.  
  375. * Created MANIFEST and FILES files for popi. Moved the troffable manual pages
  376.   to popi.man, and the plain text version to popi.man.text. Updated the TODO
  377.   file with a list of all the new problems and suggested enhancements since
  378.   the previous version was posted to the net. The README file has been
  379.   reordered into various sections, with a contents at the front.
  380.  
  381. * Indented the code in debug.c, expr.c, io.c, lex.c main.c, polar.c, run.c,
  382.   special.c and popi.h to the same style.
  383.  
  384. * Replaced the threshold half-toning with floyd-steinberg error diffusion
  385.   dithering (taken from xloadimage).
  386.  
  387. v2.1 - patchlevel 6. - Posted to comp.sources.bugs (May 1990).
  388. --------------------------------------------------------------
  389.  
  390. * From Russ Nelson <nelson@image.soe.clarkson.edu>
  391.   Previously most tokens were represented as their character equivalents.
  392.   These have been changed to numeric defines so that many compilers can
  393.   generate better code for the switch statement in prun().
  394.  
  395. * Added some debugging to help trace tokens.
  396.  
  397. * From K. Palaniappan <palani@uirvld.csl.uiuc.edu>
  398.   Fixed the out of range problem at CRVAL in prun().
  399.  
  400. v2.1 - patchlevel 5. - Posted to comp.sources.bugs (January 1990).
  401. ------------------------------------------------------------------
  402.  
  403. * There is now an optional compilation parameter. If DEF_SIZE is defined, the
  404.   image will be square and that size by default. If DEF_X and/or DEF_Y are
  405.   defined, the image will be the size given by the definitions. Makefile has
  406.   been modified to add a definition of -DDEF_SIZE=128 for the PC versions.
  407.  
  408.   New files:
  409.  
  410.   * gl.c     - a graphics driver for the public domain gl graphics package
  411.                from Glenn Geers <glenn@extro.ucc.su.oz>. Glenn has used this
  412.                to port to the 386 Xenix box.
  413.                See the comments at the beginning of the gl graphics driver
  414.                for more information on just what devices and O/S's are
  415.                supported.
  416.  
  417.   * g_init.c - a new version of the g_init.c file that comes with the gl
  418.                graphics package, which includes 386 mods.
  419.  
  420. v2.1 - patchlevel 4. Posted to comp.sources.bugs (January 1990).
  421. ----------------------------------------------------------------
  422.  
  423. * The size of the input buffer for typing has been changed from 80 to 256
  424.   characters.
  425.  
  426. * The SunView driver has been completely rewritten. It now has a scrollable
  427.   text window for command input, and a canvas window of the correct size for
  428.   displaying the images. There is a panel with a "% done" slider which is
  429.   displayed as it is generating the next image. The SunView driver therefore
  430.   no longer uses graphics.c.
  431.  
  432. * The comment for the exportable routines in each graphics driver has been
  433.   changed from "ten routines" to "the routines". There are now only nine
  434.   routines.
  435.  
  436. * The declaration for the variable total in getpix in file io.c was in the
  437.   wrong position, and prevented the file from successfully compiling. This
  438.   problem was introduced in patch #3.
  439.  
  440. * Added disp_percentdone(100) calls to the oil and tile routines in special.c.
  441.  
  442. * In disp_perecentdone in graphics.c, a check is now made that the new percent
  443.   value is different from the old one, otherwise the routine returns
  444.   immediately. This dramatically improves the performance of server based
  445.   graphics drivers.
  446.  
  447. * The routine ImgAlloc in io.c was incorrectly mallocing an area based on the
  448.   variable Xsize. This should have been Ysize.
  449.  
  450. * Two small adjustments to the HP graphics driver.
  451.  
  452. * Introduces the : operator to denote special functions. This replaces the #
  453.   operator, which is currently retained for backward compatibility, but with
  454.   no guarantee that this will always remain so. The manual page has been
  455.   updated to reflect this change.
  456.  
  457. * The popi help message has been updated to include several missing functions
  458.   plus the new functions.
  459.  
  460. * Inclusion of the :quit, :exit and :q functions. Guess what they do!
  461.  
  462.   New files:
  463.  
  464.   * next.m  - a graphics driver for the NeXT from Joe Freeman of NeXT. Note
  465.               that a different OCFLAGS value in the Makefile should be used.
  466.  
  467.   * CHANGES - documented history of the changes made with each new popi patch.
  468.  
  469. v2.1 - patchlevel 3. - Posted to comp.sources.bugs (December 1989).
  470. -------------------------------------------------------------------
  471.  
  472. * Checking has been added to prevent constructs such as: dmr[x+1,y+1]=....
  473.   causing a segmentation fault.
  474.  
  475. * The X11 driver has been fixed to correctly display on monochrome screens
  476.   where the black pixel isn't 1.
  477.  
  478. * New commands #create and #run have been added.
  479.  
  480. * ungetc is now handled in the main popi code, so the graphics routine
  481.   disp_ungetc is no longer needed.
  482.  
  483. * Fixed a few typos in the manual page.
  484.  
  485. * Adjusted a few inefficiencies found in expr.c, io.c and main.c
  486.  
  487. * Several changes to allow a potential change in the image data structure.
  488.  
  489.   New files:
  490.  
  491.   * popi.man - this is a plain text version of the popi manual page (popi.1)
  492.                for those people who do not have the ability to format popi.1.
  493.  
  494.   * hp.c     - a graphics driver for an HP display from Eric Haines - 3D/Eye
  495.                Inc, Ithaca, NY.
  496.  
  497. v2.1 - patchlevel 2. - Released to comp.sources.misc (December 1989).
  498. ---------------------------------------------------------------------
  499. Funky_Stuff
  500. len=`wc -c < CHANGES`
  501. if [ $len !=    12961 ] ; then
  502. echo error: CHANGES was $len bytes long, should have been    12961
  503. fi
  504. fi # end of overwriting check
  505. if [ -f popi.man.text ]
  506. then
  507. echo shar: will not over-write existing file popi.man.text
  508. else
  509. echo shar: extracting 'popi.man.text',    37480 characters
  510. cat > popi.man.text <<'Funky_Stuff'
  511.  
  512.  
  513.  
  514. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  515.  
  516.  
  517.  
  518. NAME
  519.      popi - perform interactive digital image transformations
  520.  
  521. SYNOPSIS
  522.      popi [option] ... [file] ...
  523.  
  524. DESCRIPTION
  525.      Popi is a program which allows arbitrary transformations  to
  526.      be  interactively applied to digital images.  It is based on
  527.      the program described in "Beyond Photography -  The  Digital
  528.      Darkroom" by Gerald J. Holzmann.  The meanings of the avail-
  529.      able command line options are as follows:
  530.  
  531.      -a-  Turn auto-display off.  Equivalent to  the  :display  -
  532.           command.  Images can still be displayed explicitly with
  533.           the :display image command.
  534.  
  535.      -a+  Turn auto-display on.  After each image transformation,
  536.           the   image  will  be  displayed.   Equivalent  to  the
  537.           :display + command (default).
  538.  
  539.      -c+  Set the colour mode flag  on.   Do  all  work  in  RGB.
  540.           Grayscale displays present NTSC Luma values.
  541.  
  542.      -c-  Turn  the  colour  mode  flag   off.    Use   grayscale
  543.           (default).
  544.  
  545.      -l[logfile]
  546.           Enables logging of all input, error messages, and  some
  547.           responses.   Logging  is done on the named file, or the
  548.           file "popi.log" if no name is given.  The :logfile com-
  549.           mand may also be used to turn logging on and off.
  550.  
  551.      -o   Save images to disk in the old popi format.
  552.  
  553.      -p[ncpus]
  554.           On a Sequent multiprocessor, use the  specified  number
  555.           of  cpus  to  perform the transform.  If this option is
  556.           given without a number, the maximum number available is
  557.           used.   This  option has no effect on uniprocessor com-
  558.           puters.
  559.  
  560.      -s+  Set the signed I/O flag on.  Do signed I/O.
  561.  
  562.      -s-  Turn  the  signed  I/O  flag  off.   Do  unsigned   I/O
  563.           (default).
  564.  
  565.      -t+  Set the trig caching flag on.   Cache  trig  values  in
  566.           /usr/tmp/popi.X.Y,  where  X  and Y are the size limits
  567.           for the current popi run.  (This speeds  up  the  first
  568.           use of polar co-ordinates in each run.)
  569.  
  570.  
  571.  
  572.  
  573. Sun Release 4.1   Last change: 20 December 1989                 1
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  581.  
  582.  
  583.  
  584.      -t-  Turn the trig caching flag off.  Don't do trig  caching
  585.           (default).
  586.  
  587.      -V   Print program version identification message and exit.
  588.  
  589.      -v+  Set the verbose flag on.  Be chatty about a  number  of
  590.           things.
  591.  
  592.      -v-  Turn the verbose flag off.  Be silent about  everything
  593.           except error messages (default).
  594.  
  595.      -xWidth
  596.           Set the image width (number of pixels per scanline)  to
  597.           Width (default 512).
  598.  
  599.      -yHeight
  600.           Set the image height (number of  scanlines)  to  Height
  601.           (default 512).
  602.  
  603. SYNTAX
  604.      An image transform is described by  a  transform  statement.
  605.      The statement basically takes the form
  606.  
  607.              dest = expression
  608.  
  609.      where dest indicates the new image and expression  describes
  610.      a transformation.  This statement is executed over the range
  611.      of image coordinates.  For a 512 x 512  image,  it  will  be
  612.      executed 262144 times.  An image is normally referenced in a
  613.      statement by its name and an index.  A  cartesian  index  is
  614.      specified  by using the x and y coordinates in square brack-
  615.      ets after the image name.  Thus dmr[0,0]  is  the  top  left
  616.      pixel  in  the  image  named  dmr.  Polar coordinates may be
  617.      specified by giving a radius and angle (in degrees) in curly
  618.      brackets.   Thus  dmr{0,0} refers to the centre pixel in the
  619.      image.  The symbols x and y  may  appear  in  the  transform
  620.      statement.   These  take  on  values corresponding to a dif-
  621.      ferent pixel each time the transform  is  executed.   Inter-
  622.      nally the algorithm is as follows
  623.  
  624.      for y varying from 0 to Y
  625.          for x varying from 0 to X
  626.              execute transform statement
  627.  
  628.  
  629.      where Y is the maximum y coordinate and X is the  maximum  x
  630.      coordinate.   The  image size can be set on the command line
  631.      as described later.  The value of a pixel varies from  0  to
  632.      255  in  the current implementation.  Any value outside this
  633.      range is treated as modulo 256 when being stored in an image
  634.      (ie.  it  wraps  around).  Low numeric values represent dark
  635.      colours, while large  values  represent  light  colours.   A
  636.  
  637.  
  638.  
  639. Sun Release 4.1   Last change: 20 December 1989                 2
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  647.  
  648.  
  649.  
  650.      simple  transform  statement  to  set an image to completely
  651.      black would be
  652.  
  653.              new[x,y] = 0        ; set image to black
  654.  
  655.      The name new is one of the two default images  always  main-
  656.      tained internally.  The other is old. The images referred to
  657.      by these names are swapped after each operation, so  a  suc-
  658.      cession  of transforms may modify the "old" image to produce
  659.      a "new" image.  Thus the statement
  660.  
  661.              new[x,y] = old[x,y] / 2      ; darken image
  662.  
  663.      will reduce all the pixel intensity values by a half,  dark-
  664.      ening  the  existing  image.   The semicolon (`;') character
  665.      introduces a comment.  Anything from this to the end of  the
  666.      line  is  ignored.   All the standard arithmetic, relational
  667.      and boolean operators from the  C  language  are  available,
  668.      with precedence generally as per the C language.  Some addi-
  669.      tional operators, predefined variables  and  math  functions
  670.      are also available.  Here is a listing of the available sym-
  671.      bols and their meanings.
  672.  
  673.      name Refers to an image name.   If  not  followed  by  index
  674.           brackets,  the  index  [x,y] is assumed.  The currently
  675.           available names are those shown by the  :list  display,
  676.           and also old and new.
  677.  
  678.      $n   Where n is a digit, this is an  alternative  method  of
  679.           referring  to  an  image.  In fact this may be the only
  680.           method if the image name contains  punctuation  charac-
  681.           ters.   The  :list  command  shows  the  correspondence
  682.           between image names and this form of reference.
  683.  
  684.      X    The maximum x coordinate value.  This is one less  than
  685.           the  number of pixels per scanline (image width), which
  686.           may be set with the -x command line option.
  687.  
  688.      Y    The maximum y coordinate value.  This is one less  than
  689.           the  number  of  scanlines  (the  height of the image),
  690.           which may be set with the -y command line option.
  691.  
  692.      x    The current cartesian  x  coordinate.   Varies  from  0
  693.           (left of image) to X (right of image).
  694.  
  695.      y    The current cartesian y coordinate.  Varies from 0 (top
  696.           of image) to Y (bottom of image).
  697.  
  698.      r    The radius component  of  the  polar  coordinate  which
  699.           corresponds  to the current cartesian (x,y) coordinate.
  700.           This is equivalent to sqrt(x*x + y*y) with  a  transla-
  701.           tion of the origin.
  702.  
  703.  
  704.  
  705. Sun Release 4.1   Last change: 20 December 1989                 3
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  713.  
  714.  
  715.  
  716.      a    The angle  component  of  the  polar  coordinate  which
  717.           corresponds  to the current cartesian (x,y) coordinate.
  718.           This is equivalent to (and a shorthand for) atan(y/x).
  719.  
  720.           Note that the first time in a popi session you  use  an
  721.           expression  with either r or a in it, you may notice an
  722.           extra delay before  the  image  transformation  begins.
  723.           This  is  due  to  precalculation  of an array of polar
  724.           coordinates that happens the first time you use one.
  725.  
  726.      R    The maximum radius value of a polar coordinate.
  727.  
  728.      A    The maximum angle value of a polar coordinate (this  is
  729.           just 360).
  730.  
  731.      Z    The maximum intensity value of a  pixel  (corresponding
  732.           to white).  Currently, this is always 255.
  733.  
  734.      **   The exponentiation (raise to the power) operator.   The
  735.           expression x ** 2 means x squared (x * x).
  736.  
  737.      *    The multiplication operator.  This has  a  higher  pre-
  738.           cedence than division to avoid underflow in expressions
  739.           with  multiplication  and  division,   since   normally
  740.           expressions are evaluated as integers.
  741.  
  742.      /    Integer division.  If the divisor is 0, the  result  is
  743.           set to Z.
  744.  
  745.      %    Modulo.  If the divisor (right hand operand) is 0,  the
  746.           result is set to 0.
  747.  
  748.      +    Addition.
  749.  
  750.      -    Subtraction.  This may be a unary or a binary operator.
  751.  
  752.      <<   Left shift.  The  left  operand  is  shifted  left  the
  753.           number of bits specified by the right operand.
  754.  
  755.      >>   Right shift.  The left operand  is  shifted  right  the
  756.           number of bits specified by the right operand.
  757.  
  758.      >    Greater than.  As with all the relational operators, if
  759.           the  specified  relation  between the operands is true,
  760.           the result is 1, otherwise the result is 0.
  761.  
  762.      <    Less than.
  763.  
  764.      >=   Greater than or equal to.
  765.  
  766.      <=   Less than or equal to.
  767.  
  768.  
  769.  
  770.  
  771. Sun Release 4.1   Last change: 20 December 1989                 4
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  779.  
  780.  
  781.  
  782.      ==   Test for equality.
  783.  
  784.      !=   Not equal to.
  785.  
  786.      &    Bitwise (arithmetic) AND operator.
  787.  
  788.      ^    Bitwise exclusive OR (XOR) operator.
  789.  
  790.      |    Bitwise (arithmetic) OR operator.
  791.  
  792.      &&   Logical AND operator.  The result is 1 if both  of  the
  793.           operands  are  true (non-zero); otherwise the result is
  794.           0.  Unlike the && operator  of  the  C  language,  this
  795.           operator  is  currently not conditional.  Both operands
  796.           are always evaluated.
  797.  
  798.      ||   Logical OR operator.  The result is 1  if  both  either
  799.           (or  both)  of the operands are true (non-zero); other-
  800.           wise the result is 0.  Unlike the || operator of the  C
  801.           language,  this  operator is currently not conditional.
  802.           Both operands are always evaluated.
  803.  
  804.      sin(expr)
  805.           This gives the value of the trigonometric sine  of  the
  806.           expression,  multiplied by Z.  This is required because
  807.           all operations are performed with integers.
  808.  
  809.      cos(expr)
  810.           This gives the value of the trigonometric cosine of the
  811.           expression,  multiplied by Z.  This is required because
  812.           all operations are performed with integers.
  813.  
  814.      atan(y-expr,x-expr)
  815.           This  returns  the  trigonometric  arctangent  (inverse
  816.           tangent)  of  y-expr/x-expr  in  degrees  (ie the value
  817.           returned will be between 0 and 360).
  818.  
  819.      hypot(x,y)
  820.           This returns the hypotenuse (x*x + y*y).
  821.  
  822.      log(expr)
  823.           Returns the natural logarithm of the expression.
  824.  
  825.      sqrt(expr)
  826.           Returns the square root of the expression.
  827.  
  828.      abs(expr)
  829.           Returns the absolute value of the expression.
  830.  
  831.      rand()
  832.           Returns a positive random number.  This will usually be
  833.           used  with  the  modulo  or  bitwise  AND  operator  to
  834.  
  835.  
  836.  
  837. Sun Release 4.1   Last change: 20 December 1989                 5
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  845.  
  846.  
  847.  
  848.           restrict the range of the result.  For example,
  849.  
  850.                   new[x,y] = old[x,y] + rand() % 20 - 10
  851.  
  852.           will adjust the brightness levels of each pixel in  the
  853.           old  image by a random amount (up to 10 levels brighter
  854.           or darker).
  855.  
  856. SPECIAL COMMANDS
  857.      Popi supports a number of special  commands,  each  starting
  858.      with  a  : character.  The current set of commands includes:
  859.      debug, display, free, genepson, genps, help, list,  logfile,
  860.      matte,  melt,  ofmt,  oil, read, shear, signed, slice, tile,
  861.      truncate, undo, verbose, version, and  write.  They  may  be
  862.      abbreviated  to  the  minimum unambiguous length (e.g., :r).
  863.      Their definitions follow:
  864.  
  865.      :read "filename" [image-name]
  866.           Read a raw data file into the named image.  If no image
  867.           name  is  specified,  the name is derived from the base
  868.           name component of the filename.  If  the  name  already
  869.           exists,  that image is overwritten in memory, otherwise
  870.           a new image is  created.   If  the  filename  does  not
  871.           exist, but the same name with a ".Z" suffix does exist,
  872.           it is assumed that  the  file  is  compressed  and  the
  873.           "zcat" program is used to read the compressed image.
  874.  
  875.           Note that when the image  name  defaults  to  the  file
  876.           name,  only  the  basename  (portion after the last '/'
  877.           character, if any) is used to name the image.  If  this
  878.           resulting  name  starts  with  a digit, or contains any
  879.           characters other than alphabetic, digits and the under-
  880.           score,  you  will not be able to reference the image by
  881.           name, but will have to use the alternative "$n" syntax.
  882.  
  883.      :write "filename" [image-name]
  884.           Write a raw data file from the named image.  The  image
  885.           name  is optional, and if not specified, image "old" is
  886.           used.  If the first character of the filename  is  `|',
  887.           the rest of the filename is interpreted as a command to
  888.           be run, with the raw image data  being  fed  to  it  as
  889.           standard input.
  890.  
  891.      :list
  892.           All the named images (other than "old"  and  "new"  are
  893.           listed).
  894.  
  895.      :genps "filename" [image-name]
  896.           Generate postscript to produce the  image.   The  image
  897.           name  is optional, and if not specified, image "old" is
  898.           used.  The image will be scaled to fit  whatever  paper
  899.           size is being used.  As with the :write command, if the
  900.  
  901.  
  902.  
  903. Sun Release 4.1   Last change: 20 December 1989                 6
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  911.  
  912.  
  913.  
  914.           first character of the filename is a  `|'  symbol,  the
  915.           rest  of  the string will be treated as a command to be
  916.           executed, with the postscript being piped to its  stan-
  917.           dard  input.  This is convenient for printing images on
  918.           a PostScript printer.
  919.  
  920.      :undo
  921.           The old and new  images  are  swapped.   This  has  the
  922.           effect  of  restoring the image that existed before the
  923.           last transformation.
  924.  
  925.      :genepson "filename" [image-name]
  926.           Generate data for an Epson (or compatible)  printer  to
  927.           produce  the image.  The image name is optional, and if
  928.           not specified, image "old" is used.  Under  MSDOS,  the
  929.           device name can be used directly (eg "PRN").
  930.  
  931.           The existing code is for a 24-pin printer such  as  the
  932.           LQ-500.  To generate data for an 8-pin printer requires
  933.           a couple of minor modifications to function  genepson()
  934.           in file special.c.
  935.  
  936.      :undo
  937.           The old and new  images  are  swapped.   This  has  the
  938.           effect  of  restoring the image that existed before the
  939.           last transformation.
  940.  
  941.      :display image-name
  942.           The named image will be displayed.  This is the fastest
  943.           way  to  display  an image, and works regardless of the
  944.           state of auto-display.
  945.  
  946.      :display +
  947.           Turn auto-display on (equivalent  to  the  command-line
  948.           option -a+ ).
  949.  
  950.      :display -
  951.           Turn auto-display off (equivalent to  the  command-line
  952.           option -a- ).
  953.  
  954.      :truncate +
  955.           All assignments to an image  with  values  outside  the
  956.           range 0 to Z will be truncated to the appropriate boun-
  957.           dary, instead of wrapping as described in the book.  An
  958.           example of using this feature would be for a simplistic
  959.           lightening of an image  by  adding  a  constant  value.
  960.           Normally, very white areas would wrap around and become
  961.           black, but enabling truncation prevents this.
  962.  
  963.      :truncate -
  964.           All assignments to an image will be done modulo  (Z+1).
  965.           This is the default.
  966.  
  967.  
  968.  
  969. Sun Release 4.1   Last change: 20 December 1989                 7
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  977.  
  978.  
  979.  
  980.      :truncate
  981.           Report whether truncation is  currently  in  effect  or
  982.           not.
  983.  
  984.      :verbose +
  985.           Turn on verbose mode.   Equivalent  to  the  -v+command
  986.           Certain  warning  messages will be printed.  This turns
  987.           on the "percent done" feature of some drivers (on  oth-
  988.           ers it is always active).
  989.  
  990.      :verbose -
  991.           Turn off verbose mode.  Equivalent to the -v-command
  992.  
  993.      :verbose
  994.           Report the state of the verbose flag.
  995.  
  996.      :signed +
  997.           All file I/O is done in signed (2's complement) mode.
  998.  
  999.      :signed -
  1000.           All file I/O is done in unsigned  mode.   This  is  the
  1001.           default.
  1002.  
  1003.      :signed
  1004.           Report the state of the signed I/O flag.
  1005.  
  1006.      :ofmt +
  1007.           The old popi format is used for output files.
  1008.  
  1009.      :ofmt -
  1010.           The new popi format is used for output files.  This  is
  1011.           the default.
  1012.  
  1013.      :ofmt
  1014.           Report the state of the output format flag.
  1015.  
  1016.      :logfile +
  1017.           Enable  logging  on  the  current  log  file   (default
  1018.           "popi.log").   If  logging is already enabled, the file
  1019.           is closed and re-opened with a new timestamp appended.
  1020.  
  1021.      :logfile -
  1022.           Disable logging"
  1023.  
  1024.      :logfile "filename"
  1025.           Enable logging on the specified file.
  1026.  
  1027.           Whenever a log file is opened, it is always  opened  in
  1028.           append mode, so existing data is never truncated.  Upon
  1029.           opening a log file, a timestamp is written.   All  user
  1030.           input  is  logged,  along  with error messages and some
  1031.           program responses.
  1032.  
  1033.  
  1034.  
  1035. Sun Release 4.1   Last change: 20 December 1989                 8
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1043.  
  1044.  
  1045.  
  1046.      :create imagename
  1047.           Memory is allocated for a new image. This image is then
  1048.           swapped  with the current image (the result of the last
  1049.           transformation).
  1050.  
  1051.      :run "filename"
  1052.           Commands are read and executed from the given filename.
  1053.  
  1054.      :free imagename
  1055.           The memory associated with the named  image  is  freed.
  1056.           Any  further  access  to this image becomes impossible.
  1057.           This command may be useful in situations  where  memory
  1058.           is very limited, such as a PC.
  1059.  
  1060. TRANSFORMATIONS
  1061.      The remaining special commands are used  to  obtain  special
  1062.      built-in  transformations,  as  described  in  Chapter  6 of
  1063.      "Beyond Photography".  In each of  these  cases,  the  image
  1064.      name  is  optional,  and  defaults  to  "old".  In each case
  1065.      (except for :melt), the result is stored in "new", and  then
  1066.      "old" and "new" are swapped as usual.  In the case of :melt,
  1067.      the transformation is done in place and no swap occurs.
  1068.  
  1069.      :oil [image-name]
  1070.  
  1071.      :shear [image-name]
  1072.  
  1073.      :slice [image-name]
  1074.  
  1075.      :tile [image-name]
  1076.  
  1077.      :melt [image-name]
  1078.  
  1079.      :matte [image-name [gamma]]
  1080.           In this case,  gamma  is  an  optional  floating  point
  1081.           number (defaults to 7.5).  See the book for details.
  1082.  
  1083. DIFFERENCES
  1084.      There are a number of differences between  the  Pico  inter-
  1085.      preter,  for which the examples in the book are written, and
  1086.      the Popi interpreter as implemented here.   Integer  evalua-
  1087.      tion  stack.   The current version of the interpreter has an
  1088.      integer evaluation stack.  For this reason,  the  sin()  and
  1089.      cos() functions, have their results multiplied by Z automat-
  1090.      ically in order to be significant.  A future version of  the
  1091.      interpreter  will  provide  the  option for a floating point
  1092.      stack, and a syntax which will  handle  both  cases.   Polar
  1093.      coordinates.   In the book, both cartesian and polar coordi-
  1094.      nates are specified with square brackets.  The  decision  of
  1095.      whether  to  interpret  the indices as polar or cartesian is
  1096.      based on context; if the symbols r and a  are  used  in  the
  1097.      index expressions, the coordinates are interpreted as polar,
  1098.  
  1099.  
  1100.  
  1101. Sun Release 4.1   Last change: 20 December 1989                 9
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1109.  
  1110.  
  1111.  
  1112.      otherwise they are interpreted  as  rectangular.   Thus,  in
  1113.      order  to  use  a  radius or angle in a cartesian coordinate
  1114.      expression, it must be cast, as is done on page  48  of  the
  1115.      book.   By  providing a separate syntax for polar and carte-
  1116.      sian coordinate references, the problem never occurs.
  1117.  
  1118. EXAMPLES
  1119.      These examples are mainly taken from the book,  with  syntax
  1120.      modifications  where  required.   The images in the book are
  1121.      usually 1000 x 1000 pixels.  To produce the same results  on
  1122.      a  smaller image, you may need to multiply any occurences of
  1123.      x, y and r by an  appropriate  scaling  factor.   The  first
  1124.      example image generation in the book is
  1125.  
  1126.              new[x,y] = x + y  ; page 17 (3.1)
  1127.  
  1128.      which produces a number of  diagonal  stripes,  each  fading
  1129.      from  black to white.  On a 512 x 512 image, to get the same
  1130.      number of stripes, use the transform
  1131.  
  1132.              new[x,y] = x*2 + y*2
  1133.  
  1134.      A series of ripples can be produced with
  1135.  
  1136.              new[x,y] = (x * y) % (Z + 1)  ; page 18 (3.2)
  1137.  
  1138.      or more simply, because all brightness values are inherently
  1139.      modulo (Z + 1) unless truncation is turned on
  1140.  
  1141.              new[x,y] = x * y
  1142.  
  1143.      A single smooth transition can be accomplished with
  1144.  
  1145.              new[x,y] = (Z * x * y) / ((X-1) * (Y-1))  ; page 18 (3.3)
  1146.  
  1147.      The transformation
  1148.  
  1149.              new[x,y] = x % y
  1150.  
  1151.      is the same as new[x,y] = x when x < 0 (ie in the lower left
  1152.      triangle  of the image, with a different effect in the upper
  1153.      right half.  The trig functions allow transforms such as
  1154.  
  1155.              new[x,y] = y + sin(x) / 2  ; page 19 (3.5)
  1156.  
  1157.      which produce a series of  sine  waves  (remember  that  the
  1158.      range  of  sin(x)  is  +-Z.  An image reminiscent of a radar
  1159.      sweep can be produced by
  1160.  
  1161.              new[x,y] = atan(y - Y/2, x - X/2) * Z / 360  ; page 19 (3.6)
  1162.  
  1163.      The atan() function has a range of 0 .. 360, so  the  *Z/360
  1164.  
  1165.  
  1166.  
  1167. Sun Release 4.1   Last change: 20 December 1989                10
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1175.  
  1176.  
  1177.  
  1178.      rescales  to 0 ..  Z. This transform is overall providing an
  1179.      intensity relative to the angle of a point in polar  coordi-
  1180.      nates.  The transform language provides the current angle as
  1181.      the variable a, so this statement can be rewritten as
  1182.  
  1183.              new[x,y] = a * Z / 360
  1184.  
  1185.      Polar coordinates can be used  to  produce  an  image  which
  1186.      varies from black in the centre to white on the outside
  1187.  
  1188.              new[x,y] = r * Z / R  ; page 21 (3.11)
  1189.  
  1190.      or a spiraling effect
  1191.  
  1192.              new[x,y] = (((a + r) % 16) - 8) * Z / 16 + Z/2  ; page 21 (3.12)
  1193.  
  1194.      The conditional operator can be used  to  provide  a  filled
  1195.      black circle
  1196.  
  1197.              new[x,y] = r > R/2 ? 0 : Z
  1198.  
  1199.      or black and white patterns such as
  1200.  
  1201.              new[x,y] = ((x % (5 + y/25)) > 5) ? 0 : Z  ; page 20 (3.9)
  1202.              new[x,y] = (Z * abs(x % sin(y)) > 10) ? 0 : Z  ; page 20 (3.10)
  1203.  
  1204.      We can also modify existing images using  these  transforms.
  1205.      The  previous  image can always be referred to as old, or an
  1206.      explicitly named image can be used.  We can  read  an  image
  1207.      (eg of Dennis Ritchie) using
  1208.  
  1209.              :read "dmr"  ; read the image in the file "dmr" and name it dmr.
  1210.  
  1211.      and then use it in a transform, such as
  1212.  
  1213.              new[x,y] = Z - dmr[x,y]  ; page 22 (3.13)
  1214.  
  1215.      This produces a negative, which can be  written  to  a  file
  1216.      with
  1217.  
  1218.              :write "dmr_neg"
  1219.  
  1220.      or converted to PostScript and printed with
  1221.  
  1222.              :genps "| lp -dalw"
  1223.  
  1224.      Since the new image built during  a  transformation  becomes
  1225.      the old image of the following transform, the negative image
  1226.      can be re-reversed to produce the original with
  1227.  
  1228.              new[x,y] = Z - old[x,y]  ; reverse the process
  1229.  
  1230.  
  1231.  
  1232.  
  1233. Sun Release 4.1   Last change: 20 December 1989                11
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1241.  
  1242.  
  1243.  
  1244.      In the following examples, we will use old in  most  of  the
  1245.      transforms,  rather  than a particular image name.  In prac-
  1246.      tice, you would probably  use  a  specifically  named  image
  1247.      instead.  Provide a circular frame for an image
  1248.  
  1249.              new[x,y] = r > R/2 ? 0 : old[x,y]
  1250.  
  1251.      A solarisation process, that fades in from left to right
  1252.  
  1253.              new[x,y] = (old[x,y] > (Z*x) / (2 * X)) ? old[x,y] : Z-old[x,y]  ; page 22 (3.16)
  1254.  
  1255.      Generate a relief map
  1256.  
  1257.              new[x,y] = old[x,y] + (Z/2 - old[x+2,y+2])  ; page 24 (3.19)
  1258.  
  1259.      Shrink an image
  1260.  
  1261.              new[x,y] = old[x*2,y*2]  ; page 25 (3.24)
  1262.  
  1263.      An interesting caricature is produced by
  1264.  
  1265.              new[x,y] = old{sqrt(r * R),a}  ; page 34
  1266.  
  1267.      Note the use of polar coordinates.   The  reverse  transform
  1268.      gives a fisheye lens effect:
  1269.  
  1270.              new[x,y] = old{(r*r)/R, a}  ; page 60
  1271.  
  1272.      The following transform illustrates how an expression can be
  1273.      used for the indices of the destination matrix.
  1274.  
  1275.              new[x, y-old[x,y]/4] = old[x,y]  ; page 40
  1276.  
  1277.      An image can be swirled about the centre with
  1278.  
  1279.              new[x,y] = old{r, a + r/3}
  1280.  
  1281.      The following transform uses polar coordinate  values  in  a
  1282.      cartesian  reference, resulting in something that looks like
  1283.      what you'd see in a cylindrical mirror
  1284.  
  1285.              new[x,y] = old[a * X/A, r * Y/R]  ; page 48
  1286.  
  1287.      The image generated by
  1288.  
  1289.              new[x,y] = old{ (r/16)*16, (a/16)*16 }  ; page 72
  1290.  
  1291.      is very interesting, in that it is completely unrecognisable
  1292.      when viewed up close, but from a distance of a few metres it
  1293.      will resolve into the original.
  1294.  
  1295.              new[x,y] = old{r, a + old{r,a}/8}  ; page 68
  1296.  
  1297.  
  1298.  
  1299.         Sun Release 4.1   Last change: 20 December 1989                12
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.         POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1307.  
  1308.  
  1309.  
  1310.      This image is a swirl, but with the skew  dependant  on  the
  1311.      brightness of the current point.
  1312.  
  1313.              new[x,y] = x < X/2 ? old[x,y] : old[X-x,y]
  1314.              new[x,y] = x > X/2 ? old[x,y] : old[X-x,y]
  1315.  
  1316.      These transformations do a horizontal mirror reversal  about
  1317.      the  centre  of  the image.  Because faces are usually close
  1318.      to, but not exactly, centered, this transform of a face  can
  1319.      be interesting.
  1320.  
  1321.              new[x,y] = old[x+(x%32)-16, y]  ; page 58
  1322.              new[x,y] = old[x+((a+r/10)%32)-16, y]
  1323.  
  1324.      These transforms applied to a face produce what  looks  like
  1325.      someone peering through a bathroom window.
  1326.  
  1327. DRIVERS
  1328.      nulldev
  1329.           The null device driver is mainly  for  people  with  no
  1330.           graphics  display  device  for  which  a driver exists.
  1331.           Using this device,  data  for  a  PostScript  or  Epson
  1332.           printer can still be generated.
  1333.  
  1334.      atariterm
  1335.           The atari driver is for use with "TERM", a multiplexing
  1336.           terminal  program  for  the  Atari ST, written by Peter
  1337.           Collinson of the University of Kent at Canterbury.   It
  1338.           is not a driver for running native on an atari.
  1339.  
  1340.      kermit
  1341.           This is a driver for MS-Kermit 2.32 on an IBM PC, which
  1342.           is capable of emulating a Tektronix 4010. This provides
  1343.           three levels of contrast (nothing, normal and bold).
  1344.  
  1345.      MGR  This driver is for the Bell Core MGR window system.  It
  1346.           is  visually  identical  to the SunView version, but is
  1347.           currently hardwired to monochrome.
  1348.  
  1349.      NeWS This is the driver that will work with  NeWS  v1.1  and
  1350.           OpenWindows v1.0.  It is also visually identical to the
  1351.           SunView version.
  1352.  
  1353.      pcturbo
  1354.           This is a driver for running popi native on a  PC  with
  1355.           Borland's  Turbo  C  compiler.   It  uses  the graphics
  1356.           library supplied with Turbo C, which auto-detects  most
  1357.           types  of  graphics  display.   No  attempt  at using a
  1358.           colourmap is done - a single display dot  is  used  for
  1359.           each image pixel, with simple dithering.  Only directly
  1360.           accesible memory is used, which  drastically  restricts
  1361.           the size of images that can be handled.
  1362.  
  1363.  
  1364.  
  1365. Sun Release 4.1   Last change: 20 December 1989                13
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1373.  
  1374.  
  1375.  
  1376.      SunView
  1377.           This driver works with  the  SunView  graphics  package
  1378.           available  on  Sun workstations. This uses a scrollable
  1379.           command window which allows line editing,  cutting  and
  1380.           pasting.  The  image canvas is a separate window on the
  1381.           correct size. The output is in colour on 24-bit  colour
  1382.           machines,  in  256  grayscale on 8-bit colour machines,
  1383.           and an 8x8 dither on monochrome screens.
  1384.  
  1385.      X11  This driver is the initial version to work  with  MIT's
  1386.           X11  window  system.   This currently has minimal func-
  1387.           tionality. The output is in 256  grayscales  on  colour
  1388.           machines, and an 8x8 dither on monochrome screens.
  1389.  
  1390.      XView
  1391.           A conversion of the original SunView graphics driver to
  1392.           use  the  XView  X11  toolkit.  This driver is visually
  1393.           identical to the  X11  version.  This  driver  will  be
  1394.           rewritten to be identical with the new SunView graphics
  1395.           driver.
  1396.  
  1397. IMAGE FORMAT
  1398.      popi use the portable graymap file format for the  grayscale
  1399.      images,  and  the  portable pixmap file format for its color
  1400.      images. These image formats are  an  integral  part  of  the
  1401.      PBMPLUS  extended portable bitmap toolkit distributed by Jef
  1402.      Poskanzer. See the README file, for  the  copyright  notices
  1403.      associated with this package.
  1404.  
  1405.      popi will automagically read images in the old  format,  but
  1406.      if  you have any such images, it is recommended that they be
  1407.      converted to pgm files  using  the  small  popitopgm  filter
  1408.      included  with this package, as this format may no longer be
  1409.      supported in future releases. It is  also  recommended  that
  1410.      you  get  a copy of the PBMPLUS toolkit.  popitopgm takes an
  1411.      old popi image on standard input, and writes a pgm  file  to
  1412.      standard  output.  There  are  two command line options that
  1413.      might be applicable for your image conversion:
  1414.  
  1415.      -x nnn  -  the width of the image in pixels.
  1416.      -y nnn  -  the height of the image in pixels.
  1417.  
  1418.      The program defaults these values  to  512  if  they  aren't
  1419.      given.
  1420.  
  1421.      The definition of the portable graymap format is as follows:
  1422.  
  1423.      - A "magic number" for identifying the  file  type.   A  pgm
  1424.        file's magic number is the two characters "P2".
  1425.  
  1426.      - Whitespace (blanks, TABs, CRs, LFs).
  1427.  
  1428.  
  1429.  
  1430.  
  1431. Sun Release 4.1   Last change: 20 December 1989                14
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1439.  
  1440.  
  1441.  
  1442.      - A width, formatted as ASCII characters in decimal.
  1443.  
  1444.      - Whitespace.
  1445.  
  1446.      - A height, again in ASCII decimal.
  1447.  
  1448.      - Whitespace.
  1449.  
  1450.      - The maximum gray value, again in ASCII decimal.
  1451.  
  1452.      - Whitespace.
  1453.  
  1454.      - Width * height gray values, each in ASCII decimal, between
  1455.        0  and  the  specified  maximum  value,  separated by whi-
  1456.        tespace, starting at the top-left corner of  the  graymap,
  1457.        proceding  in  normal English reading order.  A value of 0
  1458.        means black, and the maximum value means white.
  1459.  
  1460.      - Characters from a "#" to the next end-of-line are  ignored
  1461.        (comments).
  1462.  
  1463.      - No line should be longer than 70 characters.
  1464.  
  1465.      Here is an example of a small graymap in this format:
  1466.  
  1467.      P2
  1468.      # feep.pgm
  1469.      24 7
  1470.      15
  1471.      0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
  1472.      0  3  3  3  3  0  0  7  7  7  7  0  0 11 11 11 11  0  0 15 15 15 15  0
  1473.      0  3  0  0  0  0  0  7  0  0  0  0  0 11  0  0  0  0  0 15  0  0 15  0
  1474.      0  3  3  3  0  0  0  7  7  7  0  0  0 11 11 11  0  0  0 15 15 15 15  0
  1475.      0  3  0  0  0  0  0  7  0  0  0  0  0 11  0  0  0  0  0 15  0  0  0  0
  1476.      0  3  0  0  0  0  0  7  7  7  7  0  0 11 11 11 11  0  0 15  0  0  0  0
  1477.      0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
  1478.  
  1479.      Programs that read this format should be as lenient as  pos-
  1480.      sible,  accepting  anything that looks remotely like a gray-
  1481.      map.
  1482.  
  1483.      There is also a variant on the format, available by  setting
  1484.      the  RAWBITS  option  at compile time.  This variant is dif-
  1485.      ferent in the following ways:
  1486.  
  1487.      - The "magic number" is "P5" instead of "P2".
  1488.  
  1489.      - The gray values are stored  as  plain  bytes,  instead  of
  1490.        ASCII decimal.
  1491.  
  1492.      - No whitespace is allowed in the grays section.
  1493.  
  1494.  
  1495.  
  1496.  
  1497. Sun Release 4.1   Last change: 20 December 1989                15
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1505.  
  1506.  
  1507.  
  1508.      - The files are smaller and many times faster  to  read  and
  1509.        write.
  1510.  
  1511.      Note that this raw format can only be used for maxvals  less
  1512.      than or equal to 255.
  1513.  
  1514.      The definition of the portable pixmap format is as follows:
  1515.  
  1516.      - A "magic number" for identifying the  file  type.   A  ppm
  1517.        file's magic number is the two characters "P3".
  1518.  
  1519.      - Whitespace (blanks, TABs, CRs, LFs).
  1520.  
  1521.      - A width, formatted as ASCII characters in decimal.
  1522.  
  1523.      - Whitespace.
  1524.  
  1525.      - A height, again in ASCII decimal.
  1526.  
  1527.      - Whitespace.
  1528.  
  1529.      - The maximum color-component value, again in ASCII decimal.
  1530.  
  1531.      - Whitespace.
  1532.  
  1533.      - Width * height pixels, each  three  ASCII  decimal  values
  1534.        between 0 and the specified maximum value, starting at the
  1535.        top-left corner of the pixmap, proceding in normal English
  1536.        reading  order.  The three values for each pixel represent
  1537.        red, green, and blue, respectively; a  value  of  0  means
  1538.        that  color is off, and the maximum value means that color
  1539.        is maxxed out.
  1540.  
  1541.      - Characters from a "#" to the next end-of-line are  ignored
  1542.        (comments).
  1543.  
  1544.      - No line should be longer than 70 characters.
  1545.  
  1546.      Here is an example of a small pixmap in this format:
  1547.  
  1548.      P3
  1549.      # feep.ppm
  1550.      4 4
  1551.      15
  1552.       0  0  0    0  0  0    0  0  0   15  0 15
  1553.       0  0  0    0 15  7    0  0  0    0  0  0
  1554.       0  0  0    0  0  0    0 15  7    0  0  0
  1555.      15  0 15    0  0  0    0  0  0    0  0  0
  1556.  
  1557.      Programs that read this format should be as lenient as  pos-
  1558.      sible, accepting anything that looks remotely like a pixmap.
  1559.  
  1560.  
  1561.  
  1562.  
  1563. Sun Release 4.1   Last change: 20 December 1989                16
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1571.  
  1572.  
  1573.  
  1574.      There is also a variant on the format, available by  setting
  1575.      the  RAWBITS  option  at compile time.  This variant is dif-
  1576.      ferent in the following ways:
  1577.  
  1578.      - The "magic number" is "P6" instead of "P3".
  1579.  
  1580.      - The pixel values are stored as  plain  bytes,  instead  of
  1581.        ASCII decimal.
  1582.  
  1583.      - Whitespace is not allowed in the pixels area.
  1584.  
  1585.      - The files are smaller and many times faster  to  read  and
  1586.        write.
  1587.  
  1588.      Note that this raw format can only be used for maxvals  less
  1589.      than or equal to 255.
  1590.  
  1591. SEE ALSO
  1592.      ipscript(1L), imavg(1L).
  1593.  
  1594. AUTHOR
  1595.      Gerald J. Holzmann, AT&T Bell Laboratories, Murray Hill, New
  1596.      Jersey.
  1597.  
  1598.      Modifications  and  additional  functionality,  Atari,   PC,
  1599.      PostScript, Epson and null drivers by Stephen Frede, Softway
  1600.      Pty Ltd, Australia.
  1601.      Popi maintainance, SunView, X11, NeWS, MGR and XView  graph-
  1602.      ics drivers by Rich Burridge, Sun Microsystems, Australia.
  1603.      Kermit graphics driver by Frank Crawford, Q.H. Tours.
  1604.      Amiga graphics driver by Peter Chubb, Softway Pty Ltd,  Aus-
  1605.      tralia.
  1606.      Apollo driver by Tim Lambert, University of New South Wales.
  1607.      HP driver by Eric Haines, 3D/Eye Inc, Ithaca, NY.
  1608.      Popi efficiency changes and improvements to the PC driver by
  1609.      Russ Nelson, Clarkson University.
  1610.      Color support, signed/unsigned i/o and 24 bit  SunView  sup-
  1611.      port by Rich Morin, Canta Forda Computer Laboratory.
  1612.      Dithering code taken from xloadimage, which is copyright (c)
  1613.      1989-1990 by Kirk L. Johnson, Jim Frost and Steve Losen. See
  1614.      the README file for the copyright  notices  associated  with
  1615.      this code.
  1616.      Popi image i/o routines are based on  the  PBM/PGM/PPM  rou-
  1617.      tines  from the PBMPLUS package, which is copyright (c) 1989
  1618.      by Jef Poskanzer. See the  README  file  for  the  copyright
  1619.      notices associated with this code.
  1620.  
  1621. BUGS
  1622.      Functions  which  require  popen()  (ie  auto   reading   of
  1623.      compressed  files  and  writing  to pipes) don't work in the
  1624.      sequent  multiprocessor  version.   Reading  of   compressed
  1625.      images  in  the  old format will no longer work, because you
  1626.  
  1627.  
  1628.  
  1629. Sun Release 4.1   Last change: 20 December 1989                17
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636. POPI(1L)          MISC. REFERENCE MANUAL PAGES           POPI(1L)
  1637.  
  1638.  
  1639.  
  1640.      can't seek on the pipe from zcat.
  1641.  
  1642.      Probably more  -  please  notify  richb@Aus.Sun.COM  of  any
  1643.      found, if it's not already listed in the TODO file.
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695. Sun Release 4.1   Last change: 20 December 1989                18
  1696.  
  1697.  
  1698.  
  1699. Funky_Stuff
  1700. len=`wc -c < popi.man.text`
  1701. if [ $len !=    37480 ] ; then
  1702. echo error: popi.man.text was $len bytes long, should have been    37480
  1703. fi
  1704. fi # end of overwriting check
  1705. exit 0 # Just in case...
  1706.