home *** CD-ROM | disk | FTP | other *** search
/ GRIPS 2: Government Rast…rocessing Software & Data / GRIPS_2.cdr / dos / seq / readme.rev < prev    next >
Encoding:
Text File  |  1990-01-06  |  8.9 KB  |  193 lines

  1. RASTER GRAHPICS ON IBM PCS
  2.  
  3. Introduction
  4.  
  5. The IBM PC raster graphics package consists of separate programs for
  6. three different PC display adapters.  The Revolution 512x8 board from
  7. Number Nine Computer Corp. offers the best aspect ratio and 256 colors
  8. out of a full palette of 24 bits (16.7 million colors) on a roughly
  9. 512x480 screen.  IBM's Professional Graphics Adapter has the best
  10. resolution of 640x480 and can display 256 colors from a palette of 12
  11. bits (4096 colors).  The IBM Enhanced Graphics Adapter is a much better
  12. choice for software compatibility, cost, and text mode work, but only
  13. 16 colors out of a palette of 6 bits (64 colors).
  14.  
  15. Source Code Files
  16.  
  17. Programs are available to display raster images, clear the graphics
  18. screen, set individual palette entries, and load the entire palette from a
  19. file.  Different source code is available for the different display adapters
  20. that we support.  The source code's base file name (not the extension) is
  21. suffixed by a character indicating the display adapter that it uses.   For
  22. example, seqe.c is the image display routine for the EGA and seq9.c is the
  23. display routine for the No. 9 card.  Each display adapter also has an assembly
  24. language driver routine.  These are called no9.asm, pga.asm and ega.asm for
  25. the No. 9 card, the PGA and the EGA respectively.
  26.  
  27. Raw Image File Format
  28.  
  29. Image files are raw binary files, one byte per pixel indicating a color value
  30. from 0-255.  They are interpreted as a continuous stream of bytes, i.e. the
  31. second line immediately follows the first line with no end of line or end of
  32. record marker.  Note that this matches the "de facto" standard used on the
  33. Sun systems.
  34.  
  35. Color map files
  36.  
  37. Raw palette files that we use consists of 256 bytes of the red entries
  38. followed by 256 bytes of the green entries and then 256 bytes of the blue
  39. entries.  Each entry in the color lookup table is composed of one byte from
  40. each of the three component areas.  To get the Nth entry, the Nth
  41. element(red), the (N+256)th element and the (N+512)th element are
  42. combined to get the desired RGB value for the Nth color register.
  43.  
  44. Each display adapter handles color differently.  The [-m mapfile] parameter
  45. causes seq to load the set of palette registers before displaying the image, 
  46. but color map files are interpreted differently for each display.
  47.  
  48. The No. 9 board uses a separate monitor, so the palette registers only
  49. change when they are explicitly set.  Therefore, a program called 'paload'
  50. is available, independent of seq9, to load palette files. Paload uses the
  51. raw palette file format.  It takes one parameter, the name of the palette 
  52. file, and loads that data into the board's registers.  Color map loading can
  53. take place before or after an image is displayed, allowing the user to change
  54. color maps without re-displaying the image.
  55.  
  56. The PGA palette registers can only take entries from 0-15 for each of the 
  57. RGB components rather that the 0-255 range provide by the raw palette file
  58. format.  For compatibility with the higher-end systems and the No. 9, the
  59. color map files are identical to the ones used on the No. 9.  To handle the
  60. lesser color capability of the PGA, each table entry is divided by 16 (retain
  61. high order 4 bits) before being used.  There is no independent 'paload'
  62. program for the PGA because the screen is continually getting reset to be used
  63. as a console.  Instead, the color map can only be loaded by specifying a file
  64. name on the command line of seqp with the [-m mapfile] parameter.
  65.  
  66. The EGA requires a very special color map file.  Our goal is to have all
  67. the display programs use data which is one byte per pixel (0-255), but the
  68. EGA can only display 16 colors.  To accomplish this, both a palette and
  69. a special translation table is used.  On the command line, specification
  70. of the palette file is the same as the others: [-m egamapfile].
  71.  
  72. The EGA palette file is an ASCII card image file containing a list of
  73. 272 numbers, one per line.  The first 16 numbers are the color map settings
  74. as per IBM specifications.  Each number represents a palette register byte
  75. meaning:  xxRGBrgb  to the EGA palette of 64 colors.  The next 256 numbers
  76. make up the translation table.  Each number is in the range 0-15 and
  77. corresponds to the EGA color to use for that particular data value.  The
  78. first number is for data value 0, the second for data value 1, etc.  This
  79. translation takes place on the fly, in the assembler code, so user programs
  80. can manipulate the translation table to stretch the capabilities of the EGA's
  81. 16 colors to display data which is 8 bits deep.  An example of one of these
  82. files is provided in the distribution.
  83.  
  84. Command Line Syntax
  85.  
  86. The grammar that I will use for describing the commands is quite simple.
  87. The command name will be the first word on the line.  This may be followed
  88. by nothing (no parameters), mandatory parameters or optional parameters.
  89. Optional parameters will be enclosed in square brackets ('[]'), and mandatory
  90. parameters will be enclosed in angle brackets ('<>').  If two items within
  91. square brackets are separated by a pipe (|),  you may select one of the two,
  92. but not both. <cr> indicates an end of line. 
  93.  
  94. Raster Image Display Routines
  95.  
  96. The basic command line for calling seq is:
  97.  
  98. seq <xdim ydim> [-c | -p xwhere ywhere][-m mapfile] <fileofnames><cr>
  99.  
  100. xdim and ydim are the xdimension and y dimension of the image file(s) which
  101. are to be displayed.  -c causes the image to be centered on the screen and
  102. -p allows the user to pick a particular location for the upper left corner
  103. of the image to be positioned.  -m will load a color map before
  104. displaying the picture (see below).  'fileofnames' is the name of a file which
  105. contains a list of file names which make up a sequence of image files to be
  106. displayed in movie fashion. The way to display only one file is to place the
  107. name of the image file into another textfile.  Optional parameters may be
  108. specified in any order, but must occur between the image dimensions and the
  109. 'fileofnames'.  All of the images in the sequence are interpreted as
  110. if they have the dimensions xdim,ydim.
  111.  
  112. The 'pflip' program can be valuable on the PGA, it enables a simple
  113. keystroke to flip back and forth between the text and graphic displays.
  114.  
  115. Palette Manipulation and Creation Routines.
  116.  
  117. Several routines are available for the use and modification of color palettes.
  118. You can change individual entries, load entire palettes from the color palette
  119. files, and build palette files from text files.  
  120.  
  121. The routine paload is available for the No. 9 card.  The syntax is:
  122.  
  123. paload <filename><cr>
  124.  
  125. This routine used the raw palette file, 'filename', to initialize the hardware
  126. color lookup table.
  127.  
  128. Palset, also available for the No. 9 card, can be a one line command or it can
  129. be used interactively.  The syntax for the one line command is as follows:
  130.  
  131. palset <entry_no> <red> <green> <blue><cr>
  132.  
  133. Entry_no is the register number of the entry that will be changed. Red, green
  134. and blue are the RGB components that will be used to initialize the entry.
  135. You can set more than one entry by using palset in interactive mode.  To do
  136. this, enter palset <cr> on the command line.  Palset will then accept lines
  137. of keyboard input of the form:
  138. <entry_no> <red> <green> <blue>
  139. where the meanings of the items are the same as above.  palset will continue to
  140. accept lines until it sees a period as the first element on the line.  For 
  141. example, this interaction:
  142.  
  143. palset <cr>
  144. 1 0 0 0
  145. 10 30 30 30
  146. 100 112 0 0 
  147. .
  148.  
  149. will set the second color palette entry to black(0 for red, 0 for blue and 0
  150. for green is black), the 10th entry to a shade of grey,  and the 100th entry
  151. to a shade of red. You can also redirect input from a text file of this form
  152. with the same result.  For example:
  153.  
  154. palset < <filename><cr>
  155.  
  156. can be used to set palette entrys according to the contents of the file,
  157. 'filename'.
  158.  
  159. Palbuild is a utility that you can use to create a raw palette file from 
  160. text of the same form used by palset.  The syntax is :
  161.  
  162. palbuild <newpalfile><cr>
  163.  
  164. or
  165.  
  166. palbuild <newpalfile> < <filename><cr>.
  167.  
  168. The first form of the command will wait for input from the keyboard terminated
  169. by a period just as palset does.  The last form gets its input from the text
  170. file 'filename', again just as palset.  This routine has no effect on the
  171. hardware color look-up table.  Instead, it converts the input to the raw palette
  172. file format that can be used by paload.
  173.  
  174. Miscellaneous Utilities
  175.  
  176. A routine called gclear is also provide.  This routine simply clears the 
  177. graphics buffer to all zeros.  The syntax is as follows:
  178.  
  179. gclear<cr>.
  180.  
  181. Another utility called init9 initializes the graphics hardware.  This routine
  182. is only necessary on the No. 9 card, and is supplied by Number Nine Corporation.
  183. The routine takes no parameters.
  184.  
  185. Questions and comments:
  186. Thomas Redman
  187. University of Illinois
  188. National Center for Supercomputing Applications
  189. 152 Computing Applications Building
  190. 605 E. Springfield Ave.
  191. Champaign, IL  61820
  192. (217)244-0072
  193.