ColorTrixDoc.tioga
Jules Bloomenthal, January 17, 1987 0:38:15 am PST
CEDAR 6.0 — FOR INTERNAL XEROX USE ONLY
ColorTrix
a collection of programs and interfaces for the color display
Jules Bloomenthal
© Copyright 1985 Xerox Corporation. All rights reserved.
Abstract: A collection of programs and interfaces are provided. The programs emphasize interactivity through the command tool. The color display is treated simply as a frame buffer, with no regard to the placement of viewers on the display.
Keywords: color display, color map, frame buffer.
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
Software Environment
Bringover -p /Cedar/CedarChest6.0/Top/ColorTrix.df
For programming, refer to:
ColorTrixBasics.mesa low level access to the color display
ColorTrixDispatch.mesa registration of and access to command procs
ColorTrixFile.mesa file transfer to/from the color display
ColorTrixPalette.mesa palette drawing and undrawing
ColorTrixPix.mesa  creation of images on the color display
ColorTrixMod.mesa. modification of images currently on the color display
ColorTrixMap.mesa color map modification and creation procedures
Color Map Programs
The following functions are invoked by "ColorTrixMap <function>" or "Cm <function>." They all operate on the color map of the color display. In general, color map entry zero is not modified, usually remaining at [0, 0, 0]. Values for red, green, or blue color map entries should be in [0..255]. Many of the programs with optional arguments provide an interactive slider when the arguments are omitted from the command line.
Cm Edit   Edit the color map.
Cm Save <name>  Save the color map in the named file.
Cm Load <name>  Load the named color map .
Cm Mono   Set the color map to be a linear ramp from 0 through 255.
Cm Gamma [value]  Put a gamma-corrected grayscale in the color map; if no argument
   is given, then a slider is displayed for interaction.
Cm Dither  Set the color map to Imager dither.
Cm Ramp <i0 r0 g0 b0 i1 r1 g1 b1: NAT>
   Create a linear ramp from entry i0 through i1 in the color map.
Cm Print  Print the color map entries as three columns (r, g, and b).
Cm Only <red | green | blue> Enable only the specified primary in the color map.
Cm Tents [nTents: NAT] Create nTents number of linear sawtooths in the color map.
Cm Sin [nCycles: REAL] Create nCycles cycles of sine wave in the color map.
Cm Gauss  Put a gaussian curve in the color map.
Cm Color <i r g b: NAT] Set color map entry i to (r, g, b).
Cm Cycle  Continuously circularly shift the color map.
Cm NBits [nBits: NAT] Display only nBits [0..8] number of bits in the color map.
Cm Scale <s: REAL> Scale the color map entries by s; results are clipped to [0..255].
Cm Add <a: INT> Bias the color map entries by a; results are clipped to [0..255].
Cm Compose <c1 c2: name> Compose c1 with c2 (result ← c2[c1]).
Cm Interp <t: REAL, c: name> Interpolate the current color map with the named map
    (result ← (1.0-t)*name+t*current).
Cm Scramble  Randomly interchange color map entries.
Cm Random  Fill the color map with random values.
Cm Shift   Circularly shift the color map by n, if given; if not given, then
   a slider is displayed for interaction.
Cm Speckle  Randomly set color map entries to random values.
Cm Flash  Continuously fill the color map with random values.
Cm Blend <List of Cmaps> Continuously blend through the set of color maps.
Cm Ripple  Ripple some sine waves.
Cm Snake  Snake through color space.
Cm ToOthers <red|grn|blu> Copy the specified component into the other two.
Cm Contours [-power <real>] [-ncycles <real>]
   Puts a decreasing frequency, damped sine wave in the color map.
Color Display Programs
The following programs all relate to the image displayed on the color display. All color display creation and modification operations take place within the active window, as determined by the default color display dimensions or the SetWindow command. Most of the programs will accept a window argument of the form "-w x y w h" where x, y, w, and h are integers defining a window which overrides that set by SetWindow. The upper left of the screen is (0, 0).
File IO for the Color Display
Ct View <ais | interpress file> Display the named (possibly windowed) image file.
   The complete file name should be given unless the image
   is 24 bits, in which case only the base name should be give.
   Images are un-scaled, those larger than 1024 by 768 are clipped.
   Gray ramp used if bw-ais or one component of ais triplet.
   Dither colormap used if interpress or ais triplet.
   Options:
    -center   center the image on the color display
    -cmap <file>  load the specified color map.
   
Ct Gallery {pattern and/or list of filenames}
   Cycle through the specified ais files.
Ct Save <name>  Save the (possibly windowed) image to disk. If 24 bits, '-red.ais',
   '-grn.ais', '-blu.ais' are appended to name for the appropriate file.
The Color Display Window
Ct SetWindow <x y w h> Set the active window to the given values.
Ct ResetWindow  Set active window to be the default color display dimensions.
Ct PrintWindow  Print the active window dimensions.
Clearing/Drawing on the Color Display
Ct Clear [r[g[b]]]  Clear the color display; default pixelValue is 0.
Ct Line x0 y0 x1 y1 r[g[b]] Draw a line from (x0, y0) to (x1, y1).
Ct Ramp [-h|-v]  Draw a horizontal or vertical ramp (vertical is the default).
Ct Pie   Create a radially symmetric pattern, tapering outwards in intensity.
Ct Dither <value>  Dither the image.
Ct Grid [-pVal <INT>] [-spacing <INT>] [-lineWidth <INT>]
   
Display a grid on the colordisplay.
The Color Display Palette
Ct Pal [nRows: INT] [-smooth] Display the color map as a palette, excepting entry 0;
   unless -smooth, small blocks for each entry.
Ct UnPal  Remove the palette.
Processing the Color Display
Ct Lum   Convert pseudo-color to luminance.
Ct PseudoToRGB <base name> Converts an 8 bit image color map into three ais files.
Ct PVal <new><old1>[old2] ... Set those pixels equal to old1 or old2 (etc.) to new.
Ct Dif <x0,y0,x1,y1,x2,y2,w,h>Display the difference between two w by h color display regions.
   The first window starts at (x0, y0), the second at (x1, y1), and
   the difference window starts at (x2, y2).
Color Display Manipulations
Ct Copy <xywh> <xy[wh] > Copy first (source) window to second (destination) window.
   If second w or h omitted, default to first w or h.
Ct Left <nPixels: INT> Circularly shift the image to the left; if nPixels < 0, shifts right.
Ct Up <nPixels: INT> Circularly shift the image up; if nPixels < 0, shifts down.
Ct Negate  Negate the image.
Ct Reflect [-h | -v]  Reflect the image around the horizontal (h) mid-line or
   the vertical (v) mid-line. h is the default.
Ct Mirror [-l | -r | -t | -b] Mirror the image from left to right (l), right to left (r),
   top to bottom (t), or bottom to top (b). b is the default.
Miscellany
Ct Info [x y: INT]  Print pixel information for the specified pixel; if no pixel
   specified, provide interactive viewer.
Ct Text <x y> [text: ROPE] Print text starting at pixel location (x, y);
   if no rope given, create a viewer to print any selected text.
   
Ct Movie <x y w h nFrames] Sequentially display sections of the color display; each frame is
   w by h, the first frame starting at x, y and subsequent frames
   increasing in x, until edge of the frame, at which point y is
   incremented.