Annotation of researchv10dc/vol2/graphics/cmd.ms, revision 1.1

1.1     ! root        1: .so ../ADM/mac
        !             2: .XX raster 483 "The 10th Edition Raster Graphics System"
        !             3: .fp 5 T CW     \" T for Typewriter
        !             4: .de TP \" An indented paragraph describing some command, tagged with the command name
        !             5: .IP "\\fT\\$1\\fR" 8
        !             6: .if \\w'\\fT\\$1\\fR'-7n .br
        !             7: ..
        !             8: .de CI
        !             9: .nr Sf \\n(.f
        !            10: \%\&\\$3\f(CW\\$1\fI\&\\$2\f\\n(Sf
        !            11: ..
        !            12: .TL
        !            13: The 10th Edition Raster Graphics System
        !            14: .AU
        !            15: Tom Duff
        !            16: .AI
        !            17: .MH
        !            18: .AB
        !            19: The current (late 1989) state of generating and displaying raster graphics
        !            20: in Research
        !            21: .UX
        !            22: is described.
        !            23: .AE
        !            24: .2C
        !            25: .NH
        !            26: Introduction
        !            27: .PP
        !            28: The Research
        !            29: .UX
        !            30: system contains a number of commands to capture, manipulate,
        !            31: display and record monochrome and full-color raster images.  Three groups of
        !            32: commands may be identified:
        !            33: interactive programs that operate on a frame buffer,
        !            34: commands that operate on images stored in picture
        !            35: files (see
        !            36: .I picfile (5)),
        !            37: and programs that interface to various graphical I/O devices:
        !            38: video cameras, scanners, paper plotters, film cameras and video tape
        !            39: recorders.
        !            40: .NH
        !            41: Video Facilities
        !            42: .PP
        !            43: No discussion of our raster graphics software can ignore the
        !            44: hardware on which it runs.  The hardware available at different
        !            45: sites will, of course, vary.  For definiteness, and to provide
        !            46: help for the local audience, this section will discuss the
        !            47: hardware available in Center 1127's graphics and image processing
        !            48: laboratory (MH 2C-524) and its neighborhood.  Most other environments
        !            49: will have hardware that is similar in spirit if different in detail.
        !            50: .PP
        !            51: There are seven work stations in 2C-528.  On the day this was written,
        !            52: four of them had TTY 5620 terminals, two had Gnot terminals and
        !            53: one had a SUN-3 workstation computer.  Eventually, most of the 5620's
        !            54: will be replaced with Gnots.  Each work station also has
        !            55: a Sony GDM-1901-12 video monitor that displays high-resolution
        !            56: video signals.
        !            57: .PP
        !            58: The room contains other video displays and recorders, including
        !            59: a Barco video projector in the ceiling, a 35-inch Mitsubishi monitor
        !            60: at the front of the room, a 19-inch Barco monitor at work station 6,
        !            61: two small Sony monitors in the video rack next to the audio console,
        !            62: two Panasonic Super-VHS recorders, a Sony 3/4-inch (U-MATIC) video
        !            63: player, a multi-standard (SECAM, NTSC, PAL) VHS player, a
        !            64: Sony BVH-2500 1-inch (SMPTE-C) video tape recorder and a Sony video
        !            65: camera.
        !            66: .PP
        !            67: The video equipment supports at least three incompatible video formats.
        !            68: High-resolution
        !            69: RGB video has 1024 scan lines, a 60 hz non-interlaced vertical scan rate,
        !            70: and transmits red, green and blue information on separate cables with
        !            71: synchronization pulses superimposed on the green channel.
        !            72: Low-resolution RGB video has between 480 and 488 scan lines, 30hz
        !            73: interlaced vertical scan, and separate RGB with sync on green.
        !            74: NTSC (National Television Standards Committee) video has the same timing
        !            75: characteristics as low-resolution RGB video, but encodes red, green, blue
        !            76: and sync into a single signal.
        !            77: NTSC is the encoding used by American, Canadian and Japanese television
        !            78: broadcasters, and by almost all video recording and playback equipment
        !            79: in those countries.
        !            80: .PP
        !            81: Various computer terminals generate video in other formats that our
        !            82: equipment handles with only limited success.  Gnots, 630s,
        !            83: 5620s, Sun terminals, IBM-compatible PCs and Macintoshes all generate
        !            84: mutually incompatible video.  Their vertical and horizontal scan-rates
        !            85: differ.  The voltages and impedances of the signals they produce differ.
        !            86: Their color encodings differ.  Monitors that can display video from all
        !            87: of these sources are rare, let alone hardware to convert from one format
        !            88: to another.  For example, the only reliable way to record a signal from
        !            89: any of these sources is to place a camera in front of a monitor.  The
        !            90: quality of the resulting recordings is often bad.  It is a black art
        !            91: to adjust our Barco video projector to handle non-standard signals,
        !            92: but with a few days notice it can often be done.  Again, the results
        !            93: are not often as good as one might like \(mi the projector does not
        !            94: focus as tightly as a monitor and its brightness is limited.  As better
        !            95: video displays become available our situation will improve.
        !            96: Table 1 summarizes the equipment available and the
        !            97: video formats that each supports.
        !            98: .1C
        !            99: .KF
        !           100: .TS
        !           101: center box;
        !           102: l| c| c| c| c| c| c.
        !           103: Equipment      High-res        Low-res NTSC    Gnot    IBM     PAL/SECAM
        !           104:        RGB     RGB
        !           105: =
        !           106: workstation monitors   \(bu
        !           107: _
        !           108: Barco projector        \(bu    \(bu    \(bu    \(bu    maybe   maybe
        !           109: _
        !           110: 35-inch Mitsubishi             \(bu    \(bu            \(bu
        !           111: _
        !           112: Barco  at work station 6               \(bu    \(bu
        !           113: _
        !           114: Sony rack monitors                     \(bu
        !           115: _
        !           116: Super-VHS recorders                    \(bu
        !           117: _
        !           118: U-MATIC player                 \(bu
        !           119: _
        !           120: 1-inch recorder                        \(bu
        !           121: _
        !           122: multi-standard player                  \(bu                    \(bu
        !           123: _
        !           124: camera         \(bu    \(bu
        !           125: _
        !           126: Metheus frame buffers  \(bu
        !           127: _
        !           128: ITI frame buffer               \(bu
        !           129: _
        !           130: Pixel Machine  \(bu    \(bu
        !           131: .TE
        !           132: .sp .3
        !           133: .ce
        !           134: \fBTable 1. \fRVideo devices
        !           135: .SP .5
        !           136: .KE
        !           137: .2C
        !           138: .PP
        !           139: We have several Metheus 3610 frame buffers (seven on
        !           140: .CW pipe ,
        !           141: one on
        !           142: .CW arend ,
        !           143: one on
        !           144: .CW encke )
        !           145: and an Imaging Technology, Inc. (ITI) RGB-512.  All of our
        !           146: frame buffers store 32 bits at each pixel, one byte each for red, green
        !           147: blue and alpha.  The 3610's generate high-resolution (1280\(mu1024)
        !           148: video.  The ITI generates low-resolution (512\(mu480) video that may
        !           149: be recorded on video tape after conversion to NTSC.  Connected to
        !           150: .CW pyxis ,
        !           151: a four CPU SGI 4D-240, is an AT&T Pixel Machine with
        !           152: 58 processors.  It can generate either high- or low-resolution video
        !           153: under software control; the Pixel Machine documentation can tell you how.
        !           154: .PP
        !           155: Each piece of video equipment may be connected to any other
        !           156: via a video patch bay in 2C-538 (the
        !           157: .CW alice
        !           158: room.)  Alternating
        !           159: rows of the patch bay present video outputs and inputs.  If
        !           160: an output and the input immediately below it are not plugged
        !           161: into anything, an internal connection routes one to the other.
        !           162: The patch bay has been layed out so that the most useful
        !           163: configurations require no patch cords.  The patch bay is carefully
        !           164: labelled so that its proper use ought to be obvious.
        !           165: .PP
        !           166: The Sony BVH-2500 video recorder produces very high
        !           167: quality recordings on 1" video tape.  Since it can overwrite
        !           168: arbitrary single frames of the tape, it is an ideal machine
        !           169: on which to record animation.
        !           170: .PP
        !           171: Before using a new tape,
        !           172: you must record (``grind'') time-code on it, numbering
        !           173: each frame of the tape.
        !           174: Time-code values are usually denoted by values
        !           175: of the form
        !           176: .I hh.mm.ss.ff
        !           177: (like
        !           178: .CW 02.43.17.15 ).
        !           179: The 2500's monitor output, available on the video patch bay,
        !           180: displays time-code superimposed on the 2500's
        !           181: output signal.
        !           182: .PP
        !           183: To grind time-code, use
        !           184: the patch bay
        !           185: to connect the color bar generator
        !           186: to the 2500's input, thread up a tape, and manually set the
        !           187: 2500 to record by pushing its
        !           188: .CW REC
        !           189: and
        !           190: .CW PLAY
        !           191: buttons simultaneously.  Let it go until the tape runs out.
        !           192: .PP
        !           193: The
        !           194: .I 2500
        !           195: command operates the recorder, reading instructions
        !           196: from its standard input.  Its instruction set is
        !           197: moderately complicated; for most uses the following
        !           198: subset is adequate:
        !           199: .TP "cue \fIhh.mm.ss.ff
        !           200: Cue the tape to the given time code.  The
        !           201: time-code displayed on the 2500's monitor
        !           202: output may be a few frames off,
        !           203: but the recorder will be cued to the correct point.
        !           204: .TP "still mode on
        !           205: Put the recorder in single-frame record mode.
        !           206: .TP "still mode off\fP
        !           207: Put the recorder out of single-frame record mode.
        !           208: .TP "snap [\fIn\fT]
        !           209: Record
        !           210: .I n
        !           211: frames (default 1) at the current cue point, and
        !           212: advance the cue point by
        !           213: .I n
        !           214: frames.  The recorder must be in single frame mode.
        !           215: .TP "play
        !           216: Start playing back from the current cue point.
        !           217: .TP "stop
        !           218: Stop the recorder.
        !           219: .TP "!\fIunix-command
        !           220: Run the given
        !           221: .I unix-command
        !           222: using
        !           223: .CW /bin/sh .
        !           224: .PP
        !           225: We currently have only two sources of digital video that
        !           226: may be recorded on video tape.  These are the Pixel Machine
        !           227: and the ITI frame buffer attached to
        !           228: .CW kwee .
        !           229: To use either
        !           230: one, you must patch its output to the NTSC color encoder,
        !           231: and patch the encoder's output to the video recorder.
        !           232: The ITI frame buffer is also useful as a frame-grabber,
        !           233: capturing its video input in its memory whence it may
        !           234: be saved in a picture file or otherwise manipulated.
        !           235: .PP
        !           236: The ITI is served by an ancient software regime whose
        !           237: commands all begin with the letters
        !           238: .CW iti .
        !           239: .TP "itifbinit [-x]
        !           240: Re-initialize the ITI to the state expected by the
        !           241: rest of the software.  The ITI is often unused for
        !           242: days at at time, during which its health often
        !           243: decays.
        !           244: .CW itifbinit
        !           245: is its restorative.  The
        !           246: .CW -x
        !           247: flag causes its output signal to be synchronized to the
        !           248: sync pulses of its input, instead of running from its
        !           249: internal clock.
        !           250: This is always a good idea.
        !           251: .TP itigamma
        !           252: Load the ITI's color map to correct intensities
        !           253: for display on CRT monitors.
        !           254: .TP "itigrab [-gs]
        !           255: Run the frame-grabber.  The
        !           256: .CW -g
        !           257: flag starts the frame-grabber running.
        !           258: The displayed image will track the ITI's input
        !           259: video.
        !           260: .CW -s
        !           261: stops the frame-grabber, freezing the image.
        !           262: Unadorned by flags,
        !           263: .CW grab
        !           264: starts the frame-grabber and stops it one frame
        !           265: later.
        !           266: .TP "itigit \fIpicture-file
        !           267: Copy the image stored in
        !           268: .I picture-file
        !           269: into the ITI.
        !           270: .TP "itisiv \fIpicture-file
        !           271: Save the image in the ITI in
        !           272: .I picture-file .
        !           273: .NH
        !           274: Other output devices
        !           275: .PP
        !           276: Many modern laser printers and typesetters read data in the PostScript format.
        !           277: .TP "pic2ps [-h \fIheight\fP] [\fIpicture\fP]
        !           278: converts a picture file into encapsulated PostScript, suitable for inclusion
        !           279: in any PostScript document.  The
        !           280: .CW -h
        !           281: option specifies the height, in inches, of the output image.  It is
        !           282: not often required, as document processors usually insert PostScript illustrations
        !           283: in a scale-independent manner.
        !           284: .PP
        !           285: The
        !           286: .CW alice
        !           287: room contains an Imagitex scanner that can be used to
        !           288: convert photographs to digital form.  To use it, place the image to be scanned
        !           289: under the hold-down leaves, slide the leaves to make a window around the section
        !           290: you wish to scan, and use the
        !           291: .I imscan
        !           292: command.
        !           293: .TP "imscan [-s\fIscale\fP] [-l\fIlens\fP] file" .
        !           294: The
        !           295: .CW -l
        !           296: option causes the scanner to use a lens of
        !           297: focal length
        !           298: .I lens
        !           299: inches.
        !           300: The possibilities are 5 (754 dots per inch) and 8 (480 dots per inch); 8 is the default.
        !           301: The
        !           302: .CW -s
        !           303: option sets the sub-sampling
        !           304: .I scale ,
        !           305: which can vary from 1 to 9.  One pixel in each
        !           306: .I scale
        !           307: by
        !           308: .I scale
        !           309: square will be stored.  The default is 4.  In conjunction with
        !           310: the default 8-inch lens, this causes scans to be stored at 120 dot-per-inch resolution.
        !           311: .PP
        !           312: There is a high-resolution one-bit-per-pixel Canon document scanner at the back of the graphics lab accessed through the
        !           313: .I cscan
        !           314: command.
        !           315: .TP "cscan [-f\fIx\fP,\fIy\fP] [-fL] [-s\fIseconds\fP] [-v] [\fIfile ...\fP]
        !           316: scans pages into the given files (default, one page onto standard output.)
        !           317: The
        !           318: .CW -f
        !           319: option sets the size of the scan in pixels (400 to the inch);
        !           320: .CW -fL
        !           321: sets double-letter size (11 by 17 inches, the largest possible.)
        !           322: The
        !           323: .CW -s
        !           324: option sets the number of seconds to wait before scanning each page after
        !           325: the first.
        !           326: .PP
        !           327: In the Alice room is a Matrix Instruments QCR digital film recorder.
        !           328: It will record color or black-and-white images in a variety of photographic
        !           329: formats, include 8x10 Polaroid, 4x5 and 35mm.  The
        !           330: .I qsnap (1)
        !           331: command will output an image to film.
        !           332: \ \ \ \ \ \ \ 
        !           333: .NH
        !           334: Frame buffer commands
        !           335: .PP
        !           336: A frame buffer is a large memory organized as a two-dimensional array of
        !           337: pixels.  Our Metheus 3610 frame buffers have 1024 scan lines of 1280 pixels
        !           338: each.  The ITI frame buffer has 480 lines of 512 pixels.  The coordinate
        !           339: system has (0,0) in the upper left-hand corner, with x increasing to
        !           340: the right, and y increasing down.  This apparent weirdness is fairly standard,
        !           341: since it makes video output happen in row-major order.
        !           342: .PP
        !           343: Here we will mostly discuss commands for the Metheus displays.  The corresponding
        !           344: ITI commands have the same names, but prefixed with the string
        !           345: .CW iti .
        !           346: .PP
        !           347: There are seven Metheus frame buffers attached to pipe, named
        !           348: .CW /dev/om[0-6] .
        !           349: All of the commands discussed below determine which one to use
        !           350: by examining the environment variable
        !           351: .CW FB .
        !           352: It is often hard to tell what frame buffer is displayed on which monitor
        !           353: because of connections in the patch bay.  The
        !           354: .CW fbi
        !           355: (frame buffer identification) command displays each frame buffer's name in it.
        !           356: .PP
        !           357: Our frame buffers all have 32 bits per pixel, divided into
        !           358: four 8-bit channels.  The channel values are normally thought of
        !           359: as fractions ranging from 0 to 1, although frame buffer commands perversely
        !           360: refer to them as integers between 0 and 255.
        !           361: Three of the channels specify the red, green and
        !           362: blue color components of the image.  The fourth channel, called
        !           363: .I alpha ,
        !           364: is used to indicate whether or not the image covers the pixel, and is not
        !           365: normally displayed.
        !           366: .I Alpha
        !           367: is used to control image compositing operations|reference(porter duff compositing digital images).
        !           368: Fractional values of
        !           369: .I alpha
        !           370: describe pixels that the image partly or translucently covers, and
        !           371: facilitate anti-aliased compositing.
        !           372: .PP
        !           373: Each frame buffer contains three 256 entry look-up tables that specify
        !           374: mappings from the values stored in the red, green and blue channels
        !           375: to the voltages supplied at the frame buffers' video outputs.
        !           376: A couple of commands manipulate these mappings.
        !           377: .TP "gamma [\fIpower\fP]
        !           378: command loads these tables with a function that
        !           379: inverts the power-law relation between voltage and luminous flux
        !           380: normally encountered in CRT displays.  Thus, pixel values normally
        !           381: correspond directly to displayed intensities.
        !           382: .I Power
        !           383: is the exponent of the power-law.  The default of 2.3 is adequate
        !           384: for all our displays.
        !           385: .TP "getmap \fIfile\fP [...]
        !           386: command, whose arguments are a list of files containing color maps.
        !           387: On the ITI, the argument `\fT%\fP' refers
        !           388: to the current content of the frame buffer's color map.  (The Metheuses'
        !           389: color maps are write-only.)  The functional composition of the specified
        !           390: color maps is loaded into the frame buffer's color map.
        !           391: .I Getmap
        !           392: searches for files in
        !           393: .CW . ,
        !           394: then
        !           395: .CW /fb/cmap ,
        !           396: then
        !           397: .CW /usr/td/2d/cmap/lib .
        !           398: A color map file contains 256 records of 3 bytes each, specifying the output
        !           399: values for the corresponding red, green and blue input values.
        !           400: .TP ranmap
        !           401: command loads random values into the color map.
        !           402: .PP
        !           403: The
        !           404: .I zoom
        !           405: and
        !           406: .I movie
        !           407: commands support magnification and animation of images.
        !           408: .TP "zoom [\fIamount\fP [\fIx y\fP]]
        !           409: magnifies part of the image.
        !           410: With three arguments,
        !           411: .I zoom
        !           412: magnifies by
        !           413: .I amount ,
        !           414: mapping the point
        !           415: .I x,y ) (
        !           416: (default (0,0)) to the upper left-hand corner of the screen.
        !           417: With no arguments,
        !           418: .I amount
        !           419: defaults to 1.
        !           420: The Metheuses can magnify by any integral factor from 1 to 16.
        !           421: The ITI can magnify only by 1 or 2.
        !           422: .TP "movie \fIxsize ysize nx ny\fP [\fIdelay\fP]
        !           423: views an array of images in sequence by zooming and panning.
        !           424: The arguments are the size of the individual
        !           425: frames, the number of frames in the array in each
        !           426: direction, and optionally the number of 60ths of a second
        !           427: to delay between frames.  The frames must be arranged
        !           428: boustrophedonically, with alternate rows proceeding from
        !           429: left to right and right to left.  (This is because neither
        !           430: Metheus nor ITI frame buffers can pan in x and y simultaneously
        !           431: without glitching.)
        !           432: .PP
        !           433: There are a number of commands to load simple patterns into the frame buffer:
        !           434: .TP "clr [-w \fIx0 y0 x1 y1\fT] [\fIr\fT [\fIg b\fT [\fIalpha\fT]]]
        !           435: sets all pixels to the given value.  If only
        !           436: .I r
        !           437: is given,
        !           438: .I g
        !           439: and
        !           440: .I b
        !           441: are set to
        !           442: .I r .
        !           443: If
        !           444: .I alpha
        !           445: is not given, it is set to 255 (completely opaque.)
        !           446: The
        !           447: .CW -w
        !           448: flag restricts attention to pixels inside the window whose upper-left corner is
        !           449: .I x0,y0 ) (
        !           450: and with
        !           451: .I x1,y1 ) (
        !           452: just diagonally outside the lower-right corner.
        !           453: .TP cbars
        !           454: displays a color-bars test pattern.  The 8 bars at the top exercise all combinations
        !           455: of the 3 primary colors.  The 9 patches at the bottom are a logarithmic
        !           456: (perceptually uniform) grey scale.
        !           457: .TP "ramp [-w \fIx0 y0 x1 y1\fT] [-v] [[\fIc0\fT] \fIc1\fT]
        !           458: displays a horizontal ramp whose color is
        !           459: .I c0
        !           460: at the left
        !           461: and
        !           462: .I c1
        !           463: at the right.
        !           464: Colors are specified as for
        !           465: .CW clr
        !           466: (green and blue default equal to red, alpha defaults to 255).
        !           467: .I C0
        !           468: defaults to
        !           469: .CW "0 0 0 255" .
        !           470: .CW -w
        !           471: restricts
        !           472: .CW ramp
        !           473: to the given window.
        !           474: .CW -v
        !           475: gives a vertical ramp with
        !           476: .I c0
        !           477: at the top
        !           478: and
        !           479: .I c1
        !           480: at the bottom.
        !           481: .TP "colors [-gfr]
        !           482: displays a 16 by 16 array of grey-colored (equal red, green and blue) squares in
        !           483: the middle of the screen with red, green and blue ramps at the top.  This is
        !           484: mostly useful for examining color maps.  The flags modify the display in small ways.
        !           485: .CW -r
        !           486: suppresses the ramps.
        !           487: .CW -g
        !           488: suppresses the gaps between the squares.
        !           489: .CW -f
        !           490: expands the display to fill the full screen, making the patches non-square and
        !           491: suppressing the ramps.
        !           492: .PP
        !           493: The
        !           494: .I xhair
        !           495: command can be used to examine the contents of the frame buffer.
        !           496: It is named after the cross-hair that it draws on the screen.  Single
        !           497: character commands manipulate the cross-hair, magnify the video and
        !           498: print pixel values.  The commands are
        !           499: .nf
        !           500: .ta 8n
        !           501: \fTh\fP        print the help message
        !           502: \fTlrud\fP     move left, right, up or down 1 pixel
        !           503: \fTLRUD\fP     move left, right, up or down 16 pixels
        !           504: \fT0\fP        move to center of screen (x=256, y=240)
        !           505: \fT1-8\fP      magnify \(mu1\-8
        !           506: \fT9\fP        magnify \(mu16
        !           507: \fTp\fP        print current coordinates and pixel value
        !           508: \fTP\fP        print pixel after each command (toggle)
        !           509: \fTm\fP        type coordinates to move to
        !           510: \fTx\fP        type x coordinate to move to
        !           511: \fTy\fP        type y coordinate to move to
        !           512: \fTc\fP        change the crosshair display to a rectangle
        !           513: \fTs\fP        manipulate other corner of rectangle
        !           514: \fT^D,q\fP     exit xhair and run command
        !           515: \fTQ\fP        exit xhair, don't demagnify or run command
        !           516: \fTX\fP        exit and don't run command
        !           517: .PP
        !           518: If
        !           519: .I xhair
        !           520: is given arguments, they represent a command to be executed before exiting,
        !           521: after making substitutions for any argument whose first character is
        !           522: .CW % .
        !           523: The substitutions made are:
        !           524: .ta 8n
        !           525: .nf
        !           526: \fT%r\fP       the current rectangle
        !           527: \fT%w\fP       the current rectangle
        !           528: \fT%p\fP       the upper-left corner of the rectangle
        !           529: \fT%o\fP       the upper-left corner of the rectangle
        !           530: \fT%c\fP       the lower-right corner of the rectangle
        !           531: \fT%x\fP       the x coordinate of the upper-left corner
        !           532: \fT%y\fP       the y coordinate of the upper-left corner
        !           533: \fT%X\fP       the x coordinate of the lower-right corner
        !           534: \fT%Y\fP       the y coordinate of the lower-right corner
        !           535: .PP
        !           536: The
        !           537: .I mplot
        !           538: command is a version of the standard UNIX
        !           539: .I plot (1)
        !           540: filter that produces output in a Metheus frame buffer. 
        !           541: .NH
        !           542: Picture file commands
        !           543: .PP
        !           544: Most of our raster graphics commands require no special hardware.  They synthesize
        !           545: images in picture files from textual or other descriptions, they modify images
        !           546: in picture files, producing results in picture files, or they combine the contents
        !           547: of several picture files to produce composite images, again storing the result in
        !           548: a picture file.
        !           549: .PP
        !           550: The
        !           551: .I pcp
        !           552: command takes two names of picture files or frame buffers and copies the first onto the second.
        !           553: As with all picture file commands, the special names
        !           554: .CW IN
        !           555: and
        !           556: .CW OUT
        !           557: refer to standard input and standard output.
        !           558: Frame buffers are designated by names that begin with \fT%\fP:
        !           559: .ta 8n
        !           560: .nf
        !           561: \fT%0\fP       Metheus frame buffer #0.
        !           562: \&...
        !           563: \fT%9\fP       Metheus frame buffer #9.
        !           564: .fi
        !           565: .PP
        !           566: .I Pcp
        !           567: has a number of options that alter the copied picture:
        !           568: .TP "-o\ \fIx y
        !           569: Add
        !           570: .I x,y ) (
        !           571: to the picture's window coordinates.
        !           572: .TP "-w \fIx0\ y0\ x1\ y1
        !           573: Clip the input picture's window to the given coordinates.
        !           574: If
        !           575: .CW -o
        !           576: and
        !           577: .CW -w
        !           578: are both given, the window is clipped before being offset.
        !           579: .TP "-t\ \fItype
        !           580: The output picture will have
        !           581: .CW "TYPE= \fItype" .
        !           582: .TP "-c\ \fIchannels
        !           583: The output picture will be assembled from the given
        !           584: channels of the input picture.  In many cases, a request
        !           585: for a channel not found in the input picture will be
        !           586: satisfied by standard conversions.
        !           587: For example, if
        !           588: .I channels
        !           589: includes
        !           590: .CW m ,
        !           591: but the input picture has only
        !           592: .CW rgb ,
        !           593: a monochrome channel is synthesized by computing
        !           594: NTSC luminance (\fTm=.299r+.587g+.114b\fP).
        !           595: Conversely,
        !           596: .CW rgb
        !           597: will be synthesized from
        !           598: .CW m
        !           599: by lookup in the input's color map, if it has one, or by
        !           600: .CW r=g=b
        !           601: otherwise.
        !           602: If
        !           603: .I channels
        !           604: mentions
        !           605: .CW a
        !           606: and the input has none, 255 is used.
        !           607: If
        !           608: .I channels
        !           609: mentions
        !           610: .CW z...
        !           611: and the input has none, 1.0 (floating point) is used.
        !           612: Any other channel missing in the input is set to zero.
        !           613: .TP "-C\ \fIchannels"
        !           614: Put
        !           615: .CW CHAN=\fIchannels
        !           616: in the output's header.  Without this option, the
        !           617: output's
        !           618: .CW CHAN
        !           619: attribute is taken from the
        !           620: .CW -c
        !           621: option, or failing that from the input's
        !           622: .CW CHAN
        !           623: attribute.
        !           624: .CW -C
        !           625: is useful, for example, to create a monochrome (\fTCHAN=m\fP)
        !           626: image from the red channel of a color image using
        !           627: .CW "pcp -cr -Cm" .
        !           628: .PP
        !           629: The
        !           630: .I lam
        !           631: command combines any number of images, writing a picture file whose window
        !           632: is large enough to contain all the windows of its inputs.  The input files
        !           633: are combined with pixels of later images overwriting earlier ones.
        !           634: This is only really useful if the windows of the input images differ.
        !           635: .CI -o " file
        !           636: specifies the output file name (standard output by default).
        !           637: All input images must have the same
        !           638: .CW NCHAN .
        !           639: .PP
        !           640: The
        !           641: .I posit
        !           642: and
        !           643: .I 3matte
        !           644: commands combine images using the two- and three-dimensional compositing
        !           645: operations described in |reference(porter duff compositing digital images)
        !           646: and |reference(duff composite3d).
        !           647: Each takes a list of picture file names as arguments, producing a composite
        !           648: on standard output.  The
        !           649: .CW -a
        !           650: option will cause either program to output only the
        !           651: .CW rgb
        !           652: channels, suppressing
        !           653: .CW a
        !           654: (and
        !           655: .CW z...
        !           656: in the case of
        !           657: .I 3matte ).
        !           658: .PP
        !           659: There is an army of commands to read an image and, under the control of a few
        !           660: parameters, write a modified image on standard output.  Those that read
        !           661: a single picture file by default use standard input, so they are usable
        !           662: in a pipeline.
        !           663: They include:
        !           664: .TP "lum [\fIpicture\fP]
        !           665: File
        !           666: .I picture
        !           667: (default standard input) contains a color image or a monochrome image with a color map.
        !           668: A gray-level image is written on standard output,
        !           669: using the NTSC luminance formula.
        !           670: .TP "clip [-o \fIx y\fP] \fIx0 y0 x1 y1\fP [\fIpicture\fP]
        !           671: Clip an image to have
        !           672: .CW "WINDOW=\fIx0 y0 x1 y1" .
        !           673: A picture that does not fill out the window is filled with black pixels.
        !           674: .TP "xpand [-s] [\fIpicture\fP] [\fIlo hi\fP [\fIinlo inhi\fP]]
        !           675: The input picture has its dynamic range adjusted so that pixels in the
        !           676: range
        !           677: .I inlo
        !           678: to
        !           679: inhi
        !           680: are mapped to the range
        !           681: .I lo
        !           682: to
        !           683: .I hi
        !           684: (default 0 to 255).
        !           685: The default values for
        !           686: .I inlo
        !           687: and
        !           688: .I inhi
        !           689: are determined per channel by examining the input picture.
        !           690: The
        !           691: .CW -s
        !           692: option causes all channels to be examined together.
        !           693: .I Lo ,
        !           694: .I hi ,
        !           695: .I inlo
        !           696: and
        !           697: .I inhi
        !           698: may have any values whatsoever.  If
        !           699: .I hi
        !           700: is smaller than
        !           701: .I lo ,
        !           702: pixel values will be inverted, producing a negative image.
        !           703: Any output pixel that would be mapped outside the range
        !           704: 0\-255 is set to 0 or 255.
        !           705: .TP "dither [\fIpicture\fP]
        !           706: Convert a full-color (3 channel) picture to one channel with a color map
        !           707: by dithering.
        !           708: .TP "floyd [\fIpicture\fP]
        !           709: Convert an 8-bit gray-scale picture to one bit per pixel using a version of the Floyd-Steinberg
        !           710: error-diffusion method.
        !           711: .TP "halftone \fIscreen\fP [\fIpicture\fP]
        !           712: Convert an 8-bit gray-scale picture to one bit using a given half-tone
        !           713: .I screen .
        !           714: A description of the screen is read from a file in
        !           715: .CW /usr/td/lib/screens .
        !           716: The available screens include (among others)
        !           717: .KS
        !           718: .in 2n
        !           719: .TS
        !           720: lFCW   l.
        !           721: ALLEBACH       Allebach's ordered-dither
        !           722: BAYER  Standard ordered-dither
        !           723: BLUENOISE      A pebble-screen pattern
        !           724: CLASSIC        A 3-pixel-wide dot screen
        !           725: CLASSIC2       Another 3-pixel-wide dot screen
        !           726: CLASSIC3       A 4-pixel-wide dot screen
        !           727: CLASSIC4       An 8-pixel-wide dot screen
        !           728: DIAMOND        Rao and Arce's ordered-dither
        !           729: LINE   Ulichney's line screen
        !           730: RING   A concentric ring screen
        !           731: TILT18 A tilted dot screen
        !           732: .TE
        !           733: .KE
        !           734: .TP "he [\fIpicture\fP]
        !           735: Histogram equalization: the intensity histogram
        !           736: of the input image is measured.  The output image
        !           737: has its contrast altered for maximum use of the
        !           738: output range, equalizing the histogram
        !           739: as much as possible.
        !           740: .TP "hysteresis \fIlow high\fP [\fIpicture\fP]
        !           741: Pixel values of 
        !           742: .I picture
        !           743: below
        !           744: .I low
        !           745: are mapped to zero.
        !           746: Those above
        !           747: .I high
        !           748: are mapped to 255.
        !           749: If
        !           750: .I low
        !           751: and
        !           752: .I high
        !           753: are not equal, any region
        !           754: below
        !           755: .I high
        !           756: that has any 8-connected neighbors below
        !           757: .I low
        !           758: is mapped to zero.
        !           759: .TP "picaverage \fIweight picture1 picture2
        !           760: The output picture is a weighted average of
        !           761: .I picture1
        !           762: and
        !           763: .I picture2 .
        !           764: .I Weight
        !           765: determines the fraction of the average contributed by
        !           766: .I picture1 .
        !           767: .TP "piccat \fIpicture ...
        !           768: The input
        !           769: .I picture s
        !           770: are concatenated one atop another.  The
        !           771: output has the width of the widest input.
        !           772: .TP "picjoin \fIpicture ...
        !           773: The input
        !           774: .I picture s
        !           775: are concatenated side by side.  The
        !           776: output has the height of the highest input.
        !           777: .TP "adapt [\fIpicture\fP]
        !           778: Adaptive contrast enhancement: a 7 by 7 neighborhood around each pixel
        !           779: is examined  for its minimum and maximum values.  The center pixel is
        !           780: remapped linearly in a way that would send the neighborhood's maximum to
        !           781: 255 and its minimum to 0.  That is,
        !           782: .CW "cen=255*(cen-min)/(max-min)" .
        !           783: .TP "ahe [\fIpicture\fP]
        !           784: Adaptive histogram equalization: each pixel of the output image
        !           785: is the histogram-equalized value of the center of a 17\(mu17 pixel
        !           786: window surrounding it in the input image.
        !           787: .TP "clean [\fIpicture\fP]
        !           788: Bayer-Powell noise removal filter.  If the center pixel of each 3\(mu3
        !           789: window in the input differs from the average of the other 8 pixels by
        !           790: more than 64, it is replaced by the periphery-average.  This has the
        !           791: effect of flattening isolated noise pixels.
        !           792: .TP "crispen [\fIpicture\fP]
        !           793: 3\(mu3 linear crispening filter.  Convolves the input image with
        !           794: the kernel
        !           795: .P1 20n
        !           796: -1 -1 -1
        !           797: -1  9 -1
        !           798: -1 -1 -1
        !           799: .P2
        !           800: This is a mild high-pass filter.
        !           801: .TP "edge [\fIpicture\fP]
        !           802: 3\(mu3 linear edge-detection filter.
        !           803: Convolves the input image with
        !           804: the kernel
        !           805: .P1 20n
        !           806: -1 -1 -1
        !           807: -1  8 -1
        !           808: -1 -1 -1
        !           809: .P2
        !           810: This is just the difference between the original image and the output of
        !           811: .CW crispen .
        !           812: .TP "edge2 [\fIpicture\fP]
        !           813: 3\(mu3 non-linear edge-detection (Sobel operator) filter.
        !           814: .TP "extremum [\fIpicture\fP]
        !           815: 3\(mu3 extremum filter.  Replaces the center pixel of each
        !           816: by the value in the 3\(mu3 window surrounding it that most
        !           817: differs from it.
        !           818: .TP "laplace [\fIpicture\fP]
        !           819: 3\(mu3 Laplacian filter.
        !           820: Convolves the input image with
        !           821: the kernel
        !           822: .P1 20n
        !           823:  0 -1  0
        !           824: -1  5 -1
        !           825:  0 -1  0
        !           826: .P2
        !           827: This is a fairly extreme high-pass filter.
        !           828: .TP "median [\fIpicture\fP]
        !           829: 3\(mu3 median filter.  Each pixel is replaced by the
        !           830: median of the 3\(mu3 window surrounding it.
        !           831: .TP "smooth [\fIpicture\fP]
        !           832: 3\(mu3 Bartlett filter.
        !           833: Convolves the input image with
        !           834: the kernel
        !           835: .P1 20n
        !           836: 1/16 2/16 1/16
        !           837: 2/16 4/16 2/16
        !           838: 1/16 2/16 1/16
        !           839: .P2
        !           840: This is a moderately strong low-pass filter.
        !           841: .TP "3to1 [-e] \fIcolormap\fP [\fIpicture\fP]
        !           842: Converts the input picture from full-color (\fTrgb\fP) to a single
        !           843: channel mapping each pixel to the closest entry of
        !           844: .I colormap .
        !           845: .TP "mcut [\fIpicture\fP]
        !           846: Reads a picture, and writes a color map on standard output suitable for use by
        !           847: .I 3to1 .
        !           848: .I Mcut
        !           849: uses Heckbert's median-cut algorithm to pick a color map that
        !           850: matches
        !           851: .I picture 's
        !           852: colors pretty well.
        !           853: .TP "improve \fIcolormap\fP [\fIpicture\fP]
        !           854: Given a color map and a picture file, this outputs a new color map
        !           855: that better represents the colors of the picture.  The algorithm
        !           856: is to  output the centroid of those pixel values that are closest
        !           857: to each input color map entry.  Running
        !           858: .I improve
        !           859: several times may produce better and better color maps.
        !           860: .TP "quantize [\fIpicture\fP]
        !           861: Convert a full-color picture to an 8-bit picture with color map.
        !           862: This is just a command file that calls
        !           863: .I mcut ,
        !           864: .I improve
        !           865: and
        !           866: .I 3to1 .
        !           867: It does a much better job than
        !           868: .I dither .
        !           869: .TP "remap \fIcolormap\fP [\fIpicture\fP]
        !           870: The input picture should be full color (\fTCHAN=rgb\fP).
        !           871: The output will have its pixel values will be altered
        !           872: so that when mapped through the given
        !           873: .I colormap
        !           874: they will be as close as possible to the input's pixel
        !           875: values.
        !           876: .TP "resample \fIwidth\fP [\fIpicture\fP] [\fIB C\fP]
        !           877: Resample the input image to be
        !           878: .I width
        !           879: pixels wide.
        !           880: The default filter used in resampling minimizes both
        !           881: pre- and post-aliasing.
        !           882: Numeric parameters
        !           883: .I B
        !           884: and
        !           885: .I C
        !           886: (both default to 1/3)
        !           887: pick the resampling kernel from a Mitchell and Netravali's two-parameter
        !           888: family of piecewise cubic kernels.
        !           889: .TP "transpose [-vhadrlui] [-o \fIx y\fP] [\fIpicture\fP]
        !           890: Transpose the input picture.  This is useful in conjunction with
        !           891: commands that operate on scan-lines, like
        !           892: .I resample ,
        !           893: to perform operations on columns instead of rows.
        !           894: Under control of its options,
        !           895: .I transpose
        !           896: can perform any symmetry operation of the integer lattice.
        !           897: The
        !           898: .CW -v
        !           899: option reflects through a vertical line.
        !           900: The
        !           901: .CW -h
        !           902: option reflects through a horizontal line.
        !           903: The
        !           904: .CW -a
        !           905: option reflects through an ascending diagonal line.
        !           906: The
        !           907: .CW -d
        !           908: option reflects through a descending diagonal line
        !           909: (the default).
        !           910: The
        !           911: .CW -r
        !           912: option rotates right (clockwise 90 degrees).
        !           913: The
        !           914: .CW -l
        !           915: option rotates left (counterclockwise 90 degrees).
        !           916: The
        !           917: .CW -u
        !           918: option flips the image upside down (180 degree rotation.)
        !           919: For completeness, the
        !           920: .CW -i
        !           921: option does the identity transformation.
        !           922: The
        !           923: .CW -o
        !           924: option translates the picture, adding
        !           925: .I x,y ) (
        !           926: to all coordinates.  Without this option, the upper-left
        !           927: corner of the image's window does not change.
        !           928: .TP "shear \fIangle\fP [\fIpicture\fP]
        !           929: Rotate the input image by the given
        !           930: .I angle
        !           931: (in degrees).  It's called
        !           932: .I shear
        !           933: because it operates by shearing the image 3 times
        !           934: (horizontally, then vertically, then horizontally).
        !           935: .TP "lx [-o\fIfile\fP] [-A\fIaspect\fP] [-a] [-s\fIscale\fP] [-r\fIrot\fP] [-x\fIxscale\fP] [-y\fIyscale\fP] [\fIpicture\fP]
        !           936: Perform a linear transformation on the input image.
        !           937: The
        !           938: .CW -o
        !           939: option specifies the output file name.  The default is standard output.
        !           940: The
        !           941: .CW -A
        !           942: option specifies the aspect ratio of the pixels.  The default is 1.
        !           943: The ITI frame-grabber produces images whose pixel aspect-ratio is 1.25.
        !           944: The
        !           945: .CW -a
        !           946: option suppresses the writing of an alpha channel.  Normally
        !           947: an alpha channel is computed even for input images that don't have one,
        !           948: since the output picture is often rotated and thus doesn't completely
        !           949: cover its window.
        !           950: .IP
        !           951: The transformation is specified by a sequence of options.  The specified
        !           952: transformations are combined in the order given to yield a composite transformation.
        !           953: The relevant options are:
        !           954: .nf
        !           955: .ta 8n
        !           956: \fT-s\fIscale\fR       scale by \fIscale\fR.
        !           957: \fT-r\fIrot\fR rotate by \fIrot\fR degrees clockwise.
        !           958: \fT-x\fIxscale\fR      scale in x by \fIxscale\fR.
        !           959: \fT-y\fIyscale\fR      scale in y by \fIyscale\fR.
        !           960: .PP
        !           961: There are several commands to generate images from
        !           962: three-dimensional geometric descriptions of various sorts.
        !           963: Most of these produce
        !           964: .CW CHAN=rgbaz...
        !           965: images that may be combined using
        !           966: .I 3matte .
        !           967: In their output files, points at the near clipping plane will be mapped to
        !           968: points having
        !           969: .I z=0 ,
        !           970: and points at the far clipping plane will have
        !           971: .I z=1 .
        !           972: .TP "ncpr [-a \fIaspect\fT] [-w \fIx0 y0 x1 y1\fT] [-c \fIrgbaz\fT] \fIinput\fT [\fIoutput\fT]
        !           973: New Cheezy Polygon Renderer.
        !           974: .I Output
        !           975: (default standard output) is the name of the picture file that will contain the rendered
        !           976: version of the scene described in
        !           977: .I input ,
        !           978: a text file specifying a polygonal scene.
        !           979: The
        !           980: .CW -a
        !           981: option sets the pixel aspect-ratio (default 1.)
        !           982: The
        !           983: .CW -w
        !           984: option sets the window of the output picture.
        !           985: The
        !           986: .CW -c
        !           987: option specifies which channels should be written to the output picture.
        !           988: .IP
        !           989: The input file contains a sequence of single-letter commands, each with several
        !           990: numeric parameters.  The commands are:
        !           991: .IP
        !           992: \fTv \fIfov near far ex ey ez lx ly lz ux uy uz\fR
        !           993: .br
        !           994: Set viewing parameters.
        !           995: .I Fov
        !           996: is the angle subtended vertically by the screen at the eye point.
        !           997: Points whose distance from the eye is not between
        !           998: .I near
        !           999: and
        !          1000: .I far
        !          1001: will be clipped away before drawing.  However tempted, do not set
        !          1002: .I near
        !          1003: to zero, lest underflow or divide-check occur.
        !          1004: .I ex,ey,ez ) (
        !          1005: is the coordinate of the eye, the point from which the scene is viewed
        !          1006: and the center of perspective.
        !          1007: .I lx,ly,lz ) (
        !          1008: is a vector pointing from the eye toward the center of the scene.
        !          1009: The point
        !          1010: .I lx+ex,ly+ey,lz+ez ) (
        !          1011: is mapped into the center of the screen.
        !          1012: .I ux,uy,uz ) (
        !          1013: is the up vector, the direction of the zenith.  The point
        !          1014: .I lx+ux,ly+uy,lz+uz ) (
        !          1015: is mapped into a point somewhere above the center of the screen.
        !          1016: .IP
        !          1017: \fTl \fIx y z\fR
        !          1018: .br
        !          1019: Set the direction of the light source to
        !          1020: .I x,y,z ). (
        !          1021: The light source is ``at infinity'' in the given direction.
        !          1022: .IP
        !          1023: \fTb \fIred green blue alpha\fR
        !          1024: Clear the screen to the given color.
        !          1025: .I Red ,
        !          1026: .I green ,
        !          1027: .I blue
        !          1028: and
        !          1029: .I alpha
        !          1030: should all be between 0 and 255.
        !          1031: .IP
        !          1032: \fTc \fIindex red green blue alpha\fR
        !          1033: Set a color table entry.  Indices into the color table are used
        !          1034: to specify the colors of polygons (see below.)
        !          1035: The table has 500 entries.  Unless reloaded by the
        !          1036: .CW c
        !          1037: command, the first 256 entries contain the 256 shades of gray,
        !          1038: the following 12 entries (256-267) are set to 12 logarithmically
        !          1039: spaced (perceptually equal) gray shades, and the next 20 entries
        !          1040: (268-287) to 20 logarithmically spaced gray shades.
        !          1041: .IP
        !          1042: \fTt \fIx0 y0 z0 x1 y1 z1 x2 y2 z2 c0 c1\fR
        !          1043: .br
        !          1044: Render a triangle with vertices
        !          1045: .I x0,y0,z0 ), (
        !          1046: .I x1,y1,z1 ) (
        !          1047: and
        !          1048: .I x2,y2,z2 ). (
        !          1049: The side the normal (calculated using the right hand rule) out of has color
        !          1050: .I c0 ,
        !          1051: on the other it is
        !          1052: .I c1 .
        !          1053: If
        !          1054: .I c0
        !          1055: or
        !          1056: .I c1
        !          1057: is positive, the polygon's color is found in the corresponding color
        !          1058: table entry.  If negative, the color is found by modifying the color
        !          1059: table entry as though the surface were illuminated by a light source
        !          1060: whose direction was specified by the
        !          1061: .CW l
        !          1062: command.
        !          1063: .IP
        !          1064: \fTp \fIc0 c1 x0 y0 z0 x1 y1 z1 ... xn yn zn \fT;\fR
        !          1065: .br
        !          1066: Render a polygon whose color is
        !          1067: .I c0
        !          1068: on one side and
        !          1069: .I c1
        !          1070: on the other.
        !          1071: The polygon's vertices are
        !          1072: .I x0,y0,z0 ), (
        !          1073: .I x1,y1,z1 ), (
        !          1074: \&...,
        !          1075: .I xn,yn,zn ). (
        !          1076: .in -8n
        !          1077: .TP "quad [-a] [-z] [-w \fIx0 y0 x1 y1\fP] \fIin out
        !          1078: .br
        !          1079: Compute an image of a quadric surface.  The
        !          1080: .CW -a
        !          1081: option suppresses writing out the alpha channel.
        !          1082: The
        !          1083: .CW -z
        !          1084: option suppresses writing out the z channel.
        !          1085: The
        !          1086: .CW -w
        !          1087: option specifies the output window.
        !          1088: The input file should contain 34 floating point numbers.
        !          1089: The first ten numbers are the upper triangle of the symmetric
        !          1090: matrix describing the quadratic form (in screen coordinates.)
        !          1091: The next 16 numbers are a matrix that converts screen-space
        !          1092: coordinates into world-space normals for illumination computations.
        !          1093: The next three numbers are the direction of the light source.
        !          1094: The next four numbers are the red, green, blue and alpha of the
        !          1095: surface's color.  The last number is the amount of ambient light
        !          1096: in the environment.
        !          1097: .TP "terrain \fIin out ex ey ez lx ly fov near far
        !          1098: Render a terrain image.
        !          1099: The input file
        !          1100: is a 2-channel picture file containing 16-bit elevation data on a regular grid.
        !          1101: .I ex,ey,ez ) (
        !          1102: is the eye position.
        !          1103: .I lx,ly,0 ) (
        !          1104: is a vector pointing from the eye to the center of the scene.
        !          1105: The up direction is
        !          1106: .I 0,0,1 ). (
        !          1107: .I Fov
        !          1108: is the vertical field-of-view angle.
        !          1109: .I Near
        !          1110: and
        !          1111: .I far
        !          1112: are the distances from the eye to the near and far clipping planes.
        !          1113: .TP "bg \fIr0 g0 b0 r1 g1 b1 out
        !          1114: Generate a background card whose color varies smoothly
        !          1115: from
        !          1116: .I r0,g0,b0 ) (
        !          1117: at the top to
        !          1118: .I r1,g1,b1 ) (
        !          1119: at the top.
        !          1120: Its z coordinate is set to 2, which is beyond the far clipping plane.
        !          1121: .TP "aplot [-t \fItype\fP] [-r \fIrange\fP] [-w \fIx0 y0 x1 y1\fP] \fIinput
        !          1122: Produces an anti-aliased isometric plot of a square array of binary data, read from
        !          1123: its input file.
        !          1124: The
        !          1125: .CW -r
        !          1126: option specifies the maximum absolute value of the data.
        !          1127: This may be adjusted to affect the height of the highest peaks in the plot.
        !          1128: By default, the input is examined to find its range.
        !          1129: The
        !          1130: .CW -w
        !          1131: option specifies the window in which the plot will be drawn.
        !          1132: The data file is just a binary dump of a square array.
        !          1133: It has no header, and in particular is not a picture file.
        !          1134: The
        !          1135: .CW -t
        !          1136: option (default
        !          1137: .CW -tf)
        !          1138: specifies the type of data in the array.
        !          1139: .KS
        !          1140: .TS
        !          1141: center;
        !          1142: c c
        !          1143: aFCW a.
        !          1144: _
        !          1145: option type
        !          1146: =
        !          1147: -tf    float
        !          1148: -ts    short int
        !          1149: -ti    int
        !          1150: -tl    long int
        !          1151: -td    double
        !          1152: -tc    char
        !          1153: -tu    unsigned char
        !          1154: _
        !          1155: .TE
        !          1156: .KE
        !          1157: .NH
        !          1158: Animation
        !          1159: .PP
        !          1160: To use a command-based raster graphics system as described here to
        !          1161: for animation requires writing command files to create and record
        !          1162: long sequences of images.  Typical command files contain long sequences
        !          1163: of repeated commands with slowly changing numeric parameters.  Several
        !          1164: sequences starting and ending at different times may be interleaved
        !          1165: to describe overlapping motion.  They are at best tedious and at worst
        !          1166: tricky to generate by hand or using the usual tools.
        !          1167: .PP
        !          1168: .I Moto
        !          1169: is a command generator tailored for an animator's needs.  Its input is
        !          1170: a concise description of the animation to be performed; its output is
        !          1171: a command file suitable for input to
        !          1172: .I sh ,
        !          1173: .I rc
        !          1174: or some other command interpreter.
        !          1175: Its arguments are an optional file name containing a
        !          1176: .I moto
        !          1177: program (default standard input) and list of numeric parameters
        !          1178: that are made available to the program.
        !          1179: .PP
        !          1180: A
        !          1181: .I moto
        !          1182: program consists of a list of groups of commands.  Each block is
        !          1183: guarded by a range of frames.  Here is an example:
        !          1184: .P1
        !          1185: 1,5:   pcp this %0
        !          1186:        pcp %0 that
        !          1187: .P2
        !          1188: This generates
        !          1189: .P1
        !          1190: pcp this %0
        !          1191: pcp %0 that
        !          1192: pcp this %0
        !          1193: pcp %0 that
        !          1194: pcp this %0
        !          1195: pcp %0 that
        !          1196: pcp this %0
        !          1197: pcp %0 that
        !          1198: pcp this %0
        !          1199: pcp %0 that
        !          1200: .P2
        !          1201: The command group is repeated for each of frames 1 to 5.
        !          1202: .PP
        !          1203: Groups may contain parameter ranges enclosed in brackets
        !          1204: .CW [] :
        !          1205: .P1
        !          1206: 1,5:   pcp frame.[1,5] %0
        !          1207:        echo snap|2500
        !          1208: .P2
        !          1209: This generates:
        !          1210: .P1
        !          1211: pcp frame.1 %0
        !          1212: echo snap|2500
        !          1213: pcp frame.2 %0
        !          1214: echo snap|2500
        !          1215: pcp frame.3 %0
        !          1216: echo snap|2500
        !          1217: pcp frame.4 %0
        !          1218: echo snap|2500
        !          1219: pcp frame.5 %0
        !          1220: echo snap|2500
        !          1221: .P2
        !          1222: .PP
        !          1223: Programs may have multiple groups, each guarded by
        !          1224: a separate range of frames.  For each frame,
        !          1225: .I moto
        !          1226: checks each group and processes those
        !          1227: whose guards include the current frame number.
        !          1228: .PP
        !          1229: Two special guards,
        !          1230: .CW BEGIN
        !          1231: and
        !          1232: .CW END ,
        !          1233: specify actions to be taken before an after processing frames:
        !          1234: .P1
        !          1235: BEGIN: clr
        !          1236: 1,5:   pcp section[1,5] %0
        !          1237: END:   pcp %0 composite
        !          1238: .P2
        !          1239: This generates
        !          1240: .P1
        !          1241: clr
        !          1242: pcp section1 %0
        !          1243: pcp section2 %0
        !          1244: pcp section3 %0
        !          1245: pcp section4 %0
        !          1246: pcp section5 %0
        !          1247: pcp %0 composite
        !          1248: .P2
        !          1249: .LP
        !          1250: .I Moto
        !          1251: allows complex computations inside parameter brackets:
        !          1252: .P1 0
        !          1253: 1,10:  clr [127.5*(1-cos([0,360]))]
        !          1254: .P2
        !          1255: This generates
        !          1256: .P1
        !          1257: clr 0
        !          1258: clr 29.82933350233
        !          1259: clr 105.35985734747
        !          1260: clr 191.25
        !          1261: clr 247.3108091502
        !          1262: clr 247.3108091502
        !          1263: clr 191.25
        !          1264: clr 105.35985734747
        !          1265: clr 29.82933350233
        !          1266: clr 0
        !          1267: .P2
        !          1268: .PP
        !          1269: Expressions may include constants and variables.
        !          1270: All values are double-precision floating point numbers.
        !          1271: The operators
        !          1272: .CW = ,
        !          1273: .CW / ,
        !          1274: .CW + ,
        !          1275: .CW -
        !          1276: (both unary and binary),
        !          1277: .CW < ,
        !          1278: .CW > ,
        !          1279: .CW <= ,
        !          1280: .CW >= ,
        !          1281: .CW == ,
        !          1282: .CW != ,
        !          1283: .CW "? :"
        !          1284: and
        !          1285: .CW ! ,
        !          1286: all with their meanings as in C, except that all results
        !          1287: are coerced to
        !          1288: .CW double .
        !          1289: The result of
        !          1290: .CW a%b
        !          1291: is
        !          1292: .CW a-b*(int)(a/b) .
        !          1293: The result of
        !          1294: .CW "a && b
        !          1295: is
        !          1296: .CW "a?b:a .
        !          1297: The result of
        !          1298: .CW "a || b
        !          1299: is
        !          1300: .CW "a?a:b .
        !          1301: The exponentiation operator is
        !          1302: .CW ^ ,
        !          1303: also written
        !          1304: .CW ** .
        !          1305: The expression
        !          1306: .CW [a,b]
        !          1307: varies from
        !          1308: .CW a
        !          1309: to
        !          1310: .CW b ,
        !          1311: linearly as the frame number varies between the guards of the
        !          1312: group containing the expression.
        !          1313: The expression
        !          1314: .CW a[b,c]
        !          1315: has the value
        !          1316: .CW a*b+(1-a)*c .
        !          1317: Its value varies from
        !          1318: .CW b
        !          1319: to
        !          1320: .CW c
        !          1321: as
        !          1322: .CW a
        !          1323: varies from 0 to 1.
        !          1324: The expression
        !          1325: .CW $i
        !          1326: has the value of the
        !          1327: .CW i 'th
        !          1328: parameter following the file name on
        !          1329: .I moto 's
        !          1330: command line.
        !          1331: .PP
        !          1332: The precedence of operators is, from lowest to highest:
        !          1333: .P1
        !          1334: =
        !          1335: ? :
        !          1336: ||
        !          1337: &&
        !          1338: < <= == != > >=
        !          1339: + -
        !          1340: * / %
        !          1341: [ ]
        !          1342: ^ **
        !          1343: - \fR(unary)\fP ! $
        !          1344: .P2
        !          1345: Expressions may be parenthesized to alter precedence.
        !          1346: .SP 10
        !          1347: ...........
        !          1348: .PP
        !          1349: The following math functions are available:
        !          1350: .KS
        !          1351: .TS
        !          1352: center;
        !          1353: lFCW lFCW lFCW lFCW.
        !          1354: acos   besy0   exp     log10
        !          1355: asin   besy1   fabs    sin
        !          1356: atan   besyn   floor   sinh
        !          1357: besj0  ceil    gamma   sqrt
        !          1358: besj1  cos     hypot   tan
        !          1359: besjn  cosh    log     tanh
        !          1360: .TE
        !          1361: .KE
        !          1362: All math functions are as described in the C library,
        !          1363: except that angles are measured in degrees rather than
        !          1364: radians for the trig and inverse trig functions.
        !          1365: In addition
        !          1366: .I hypot
        !          1367: may have two or three arguments,
        !          1368: .I atan
        !          1369: may take two arguments instead of one,
        !          1370: and may also be spelled
        !          1371: .I atan2 .
        !          1372: .PP
        !          1373: For parameterization, and to allow even more complex
        !          1374: computations,
        !          1375: .I moto
        !          1376: has variables, assignment and computation groups.
        !          1377: A computation group is distinguished from a command group
        !          1378: by having a double colon separating its guard from the
        !          1379: expressions to be computed:
        !          1380: .P1 0
        !          1381: BEGIN::        n=5
        !          1382: 1,n::  x=512*sin([0,90])
        !          1383: 1,n:   pcp -w 0 0 [x] 488 pic.[1,n] %0
        !          1384: .P2
        !          1385: This generates
        !          1386: .P1 0
        !          1387: pcp -w 0 0 0 488 pic.1 %0
        !          1388: pcp -w 0 0 195.93391737093 488 pic.2 %0
        !          1389: pcp -w 0 0 362.03867196751 488 pic.3 %0
        !          1390: pcp -w 0 0 473.02632064578 488 pic.4 %0
        !          1391: pcp -w 0 0 512 488 pic.5 %0
        !          1392: .P2
        !          1393: .1C
        !          1394: .KF bottom
        !          1395: .sp 4
        !          1396: .P1
        !          1397: BEGIN::         nchase=108
        !          1398:         nrun=195
        !          1399:         d1=12
        !          1400:         d2=32
        !          1401:         end=nrun+d2
        !          1402:         chase=end-nchase+1
        !          1403: 1,end: inputs=                         # empty the input list
        !          1404: 1,nrun:        inputs="$inputs run.[1,nrun]"   # add the first saucer to the input list
        !          1405: 1+d1,nrun+d1:
        !          1406:        inp="$inputs run.[1,nrun]"      # add the second saucer
        !          1407: chase,end:
        !          1408:        inp="$inputs chase.[1,nchase]"  # add the chasing saucer
        !          1409: 1,end:
        !          1410:        3matte -a $inp bg frame.[1,end] # create the composite
        !          1411: .P2
        !          1412: .SP
        !          1413: .ce
        !          1414: \fBFigure 1.\fP  Flying saucer script
        !          1415: .KE
        !          1416: .2C
        !          1417: .PP
        !          1418: Upon occasion it is useful to split
        !          1419: .I moto 's
        !          1420: output into several files, under program control.
        !          1421: A group that is separated from its guards by an at-sign
        !          1422: .CW @
        !          1423: instead of a colon names a file into which
        !          1424: subsequent output is to be written.  For example,
        !          1425: .P1
        !          1426: 1,5@   file.[1,5]
        !          1427: 1,5:   This is file.[1,5].
        !          1428: .P2
        !          1429: creates 5 files, with names
        !          1430: \fTfile.1\fR,...,\fTfile.5\fR.
        !          1431: Each file's contents will announce its name.
        !          1432: .PP
        !          1433: As is true for all sufficiently large programs,
        !          1434: .I moto
        !          1435: has a shell escape.  A group separated from its
        !          1436: guards by an exclamation point
        !          1437: .CW !
        !          1438: instead of a colon has its result text interpreted
        !          1439: by a subshell.
        !          1440: .PP
        !          1441: Finally, Figure 1 shows an example taken from a real application.
        !          1442: This
        !          1443: .I moto
        !          1444: program composites the frames of a short movie showing
        !          1445: two flying saucers, flying in formation, chased by a third,
        !          1446: racing over New Jersey.  The flying
        !          1447: saucer images (files
        !          1448: .CW run.*
        !          1449: and
        !          1450: .CW chase.* )
        !          1451: and the background (file
        !          1452: .CW bg )
        !          1453: have been computed in advance.  In the composite, the
        !          1454: .CW run.*
        !          1455: images are re-used, staggered in time, to do the
        !          1456: first two saucers.
        !          1457: .NH
        !          1458: References
        !          1459: .PP
        !          1460: |reference_placement
        !          1461: .BP
        !          1462: photo page
        !          1463: .BP
        !          1464: divider with title
        !          1465: .sp
        !          1466: .ce
        !          1467: Implementation and Maintenance

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.