home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / software / unix / saoimage / saodoc.tar / color.txt < prev    next >
Text File  |  1989-11-21  |  12KB  |  214 lines

  1.  
  2. SAOimage color
  3.  
  4.  
  5. color under the X window system on color workstations
  6.  
  7. Most color workstations use an 8-bit color map, making it possible to
  8. choose a palette of 256 colors and to map each pixel on the screen to
  9. one of the 256 possible colors.  Each of the 256 colors in the palette
  10. can be any color specified by its red, green, and blue intensities. By
  11. contrast, IBM PC's commonly offer palettes of 4 or 16 colors selected
  12. from a restricted group of colors.  At the other extreme, 24 bit
  13. displays allow each pixel to be mapped directly to virtually any color,
  14. defined by its red, green, and blue intensities (using 8 bits for each).
  15.  
  16. X11 uses a color reservation system by which each application reserves a
  17. portion of the palette for its own use.  Color reservation prevents an
  18. application from changing the colors of other applications present on the
  19. screen.  Typically, SAOimage will be able to reserve as many as 240 color
  20. entries in the palette.  However, if you (or your window manager) have
  21. tailored your X environment by specifying a variety of unusual colors for
  22. terminal windows, the clock, and other commonly used applications, there
  23. will be fewer unreserved colors in the palette.  Conversely, if you are
  24. running an SAOimage which has reserved all of the available colors, you
  25. may be unable to bring up a new application which expects to be able to
  26. grab new colors of its own.  A color in the palette is often referred to
  27. as a color cell (referring to its reservation) or color level (referring
  28. to its index between 0 and 255).
  29.  
  30. SAOimage uses color cells for more than just rendering the image.  The
  31. adjustable cursor and the region cursors must also be referenced to colors
  32. in the color palette.  When the cursor is drawn, pixels in the display are
  33. set to the value of the cursor color, overwriting the original image data.
  34. If no special care was taken, the image would gradually be erased as the
  35. cursor was moved about the display.  To avoid this problem, SAOimage uses
  36. either of two strategies for tracking the cursor while it is in motion.
  37.  
  38. With one strategy, while the cursor is moving, or being adjusted, the
  39. bits in the displayed image are simply reversed to represent the cursor,
  40. and flipped back when the cursor moves away.  This doesn't draw the cursor
  41. in its correct color, but, in most cases, it produces a visible cursor.
  42. When the cursor adjustment ends (the mouse button is released), the
  43. entire image is redrawn with the cursor in its new position.  This same
  44. strategy is used to track the cursor on halftone displays.
  45.  
  46. The other strategy actually reserves half of the colors just for drawing
  47. the cursor.  In this alternative strategy, each image color level has a
  48. corresponding level in the palette which has the cursor color.  The image
  49. color levels differ from those of the cursor by one bit, which can be set
  50. and unset to represent either the cursor or the image.  Drawing the cursor
  51. simply involves manipulating the distinguishing bit in display memory.  In
  52. this mode, cursor can be tracked smoothly in its correct color without
  53. erasing the image data.  This system is analogous to reserving "planes" of
  54. display memory to be treated as overlay planes and image planes (X does
  55. not as yet recognize true hardware overlay planes).  The advantage of the
  56. "plane" reservation strategy is that cursor tracking is visually flawless.
  57. The disadvantage is that fewer than half of the color levels are available
  58. for rendering the image.  Fortunately, it is easy to switch between the
  59. two modes (using the "ovlay" button), so one can choose whichever coloring
  60. strategy is most appropriate for the current activity.
  61.  
  62.  
  63. Color mapping
  64.  
  65. In order to maximize the use of the available colors, SAOimage offers
  66. several facilities for assigning and altering colors in the palette.  The
  67. The association of a palette level with an image data value is handled by
  68. scaling and is explained in a separate section.  There are basically three
  69. ways of assigning colors in the palette: true-color, gray-scale, and
  70. pseudocolor.  SAOimage supports the latter two.  SAOimage also supports
  71. half-toning on non-color workstations and by selecting the "mono" button
  72. in the color submenu (see the halftone section).
  73.  
  74. In true color, each image data value has associated with it an actual
  75. color.  True color mapping tries to associate colors, as near as possible
  76. to the true color, with each pixel in the image display.  This is
  77. difficult where there are few colors in the palette.  There is no support
  78. in SAOimage for true-color mapping.
  79.  
  80. In gray scale, all pixels have the same color, but differ in intensity.
  81. Basically, the colors range from black to white, with shades of gray in
  82. between.  It could also be done with some other color such as shades of
  83. red.  The lowest data values appear black while the highest appear white
  84. (or visa-versa).  The image appears as a black-and-white photograph might
  85. render it.
  86.  
  87. In pseudo-color, any color can be assigned to any level, but all pixels
  88. with the same value will have the same color.  Typically, one might use
  89. an analogy with heat, mapping the low values as shades of blue, the middle
  90. values in shades of red and the highest values as yellow or white.  The
  91. idea is to use the colors to highlight differences among the data values.
  92. Depending on the levels which best distinguish the detail you wish to
  93. study, the shifts from blue to red and red to yellow can be placed at
  94. higher or lower image data values and closer together or farther apart.
  95. The changes in color can be made gradual or sharp.
  96.  
  97. Color maps may simply be a list of colors for each level, or may be
  98. created by specifying a few colors and levels and interpolating to
  99. assign colors for the in-between levels.  SAOimage uses the latter.
  100. If one were to graph the color map, having intensity of color on one
  101. axis and palette level on the other, the graph would have fixed points
  102. with ramps or steps between them.  The simplest gray scale has no
  103. intensity for any color at one end of the palette and full intensity
  104. for all colors at the other end of the palette, with a straight line
  105. representing the interpolated colors in between.  The color graph is
  106. in fact physically drawn by SAOimage in a separate window, and can be
  107. directly manipulated.
  108.  
  109. SAOimage has a basic gray scale and several pseudocolor maps available
  110. in the "cmap" page of the "Color" submenu.  Once you have selected a
  111. color map, you may choose to manipulate it, as described below.
  112. Reselecting the same color map, or selecting a new color map from
  113. "cmap" submenu, sets the selected color map, eliminating any
  114. adjustments you may have made.
  115.  
  116.  
  117. Color manipulation
  118.  
  119. The color graph window is normally not displayed.  It is summoned
  120. (and hidden again) by clicking the mouse on the color bar next to the
  121. display window.  In the graph, each color is graphed separately, with
  122. little squares to represent the fixed points in the graph.  Where two
  123. or more color lines overlap, the line (or box) appears black.  One may
  124. create a new fixed point by positioning the mouse icon in the graph and
  125. pressing a mouse button.  The three mouse buttons control red, green,
  126. and blue, respectively from left to right.  By holding the mouse button
  127. (or buttons) down, the fixed point can be dragged anywhere on the graph.
  128. An existing fixed point can be grabbed for dragging by positioning the
  129. mouse icon over it when pressing the button.
  130.  
  131. The graph can be adjusted, en mass, by moving the mouse in the main
  132. display window with a mouse button depressed.  There are two different
  133. kinds of adjustment, threshold/saturation and contrast/bias, and an
  134. intensity adjustment called gamma.
  135.  
  136. With threshold/saturation, moving the mouse horizontally moves the lower
  137. (threshold) end of the graph up or down, while moving the mouse vertically
  138. moves the upper (saturation) end of the graph up and down relative to the
  139. palette.   With contrast/bias, moving the mouse along the axis of the
  140. color bar shifts the entire graph up or down (bias) relative to the
  141. palette, while moving the mouse perpendicular to the color bar moves the
  142. ends of the graph closer together or farther apart about a middle position
  143. (contrast).  Threshold/saturation is easy to implement in software and
  144. common in pseudocolor display systems. Contrast/bias corresponds more
  145. closely to the kinds of adjustments familiar to photographers.  In both
  146. cases, the middle of the display window is the default graph position
  147. relative to the palette.
  148.  
  149. The intensities of the colors are normally given relative to voltage
  150. applied to the color guns in the monitor.  Half intensity is half of
  151. full voltage.  Unfortunately, this does not really correspond to the
  152. sensitivity of the eye.  Double the voltage does not seem like doubling
  153. the intensity.  Half voltage on a gray scale does not seem like a
  154. middle gray.  The gray scale seems to favor the darker shades.  The
  155. relationship between voltage and perception is generally thought to be
  156. an exponential one and is represented by the symbol small gamma.
  157. Changing the gamma produces a non-linear (exponential) adjustment in
  158. contrast.  A gamma of between 2 and 2.2 is considered correct for a
  159. typical monitor.  You can play with the gamma adjustment by selecting
  160. the "power" mode in the "Color" submenu.  Moving the mouse horizontally
  161. in the main display window with a mouse button down adjusts the gamma.
  162. The gamma values for each color are printed beside the color graph.
  163. Gamma of 1 (linear) is in the middle of the main window.  The intensity
  164. adjustment is applied directly to the palette colors and does not affect
  165. the points used to map the colors.  Gamma values below 1 may be useful
  166. for sharpening the contrast before making a hard copy.  You can drag
  167. beyond the main window for gamma values outside the normal range.
  168.  
  169. Normally, all adjustments are applied equally to each of the three colors.
  170. However, the adjustments can be applied to any one or two of the colors
  171. by holding down the control key.  Then the three mouse buttons control
  172. red, green, and blue, respectively, as in the graph window.
  173.  
  174. The "invert" button in the "Color" submenu inverts the intensities
  175. (minimum intensity becomes maximum intensity) without changing the graph
  176. points.
  177.  
  178.  
  179. Updating the graph and gamma display
  180.  
  181. Drawing the graph and printing the gamma values takes up computing time
  182. and may slow the response to your movement of the mouse.  Therefore,
  183. while the colors are always continuously updated, updating of the graph
  184. occurs only when you finish (release the mouse button), unless you
  185. specifically request it.  The "track" button in the "etc" submenu,
  186. controls whether the color graph is updated continuously or only upon
  187. completion of the manipulation.  Tracking may be temporarily activated
  188. (or deactivated) by pressing a "shift" key on the keyboard or toggling
  189. the "Caps" shiftlock key.
  190.  
  191.  
  192. Saving color map entries and reading them back in (color only)
  193.  
  194. The current colormap can be written to a disk file, and a previously
  195. saved colormap can be read from a disk file.  The format of the disk
  196. file is ASCII and can be edited if the format is followed.  The file
  197. can have comments on any line, starting with a '#' symbol.  The first
  198. non-comment word in the file must be 'PSEUDOCOLOR'.  Each color's
  199. table is defined separately.  Each color's table must begin with the
  200. color name 'RED', 'GREEN', or 'BLUE'.  The color name may optionally
  201. be followed by the word GAMMA, then followed by a gamma value for
  202. that color.  The vertex points in the table are defined by pairs:
  203. '(level, intensity)'.  The intensities range from 0 (minimum) to 1.0
  204. (maximum).  The levels range from 0 (lowest level) to 1.0 (highest
  205. level).  The points must be in ascending order by level.  All three
  206. colors must be described, and each color must have at least 2 points.
  207.  
  208. When a color map is being manipulated, the effective levels of points
  209. may be shifted or stretched above 1.0 or below 0.0.  These points
  210. are preserved in the disk file, and when read in, they may be shifted
  211. back into the visible range.  The novice user should remember that if
  212. one starts with the 'A' colormap, shifts it, and then writes it out,
  213. the stored colormap is the shifted map, not the original 'A' map.
  214.