home *** CD-ROM | disk | FTP | other *** search
- RASTER GRAHPICS ON IBM PCS
-
- Introduction
-
- The IBM PC raster graphics package consists of separate programs for
- three different PC display adapters. The Revolution 512x8 board from
- Number Nine Computer Corp. offers the best aspect ratio and 256 colors
- out of a full palette of 24 bits (16.7 million colors) on a roughly
- 512x480 screen. IBM's Professional Graphics Adapter has the best
- resolution of 640x480 and can display 256 colors from a palette of 12
- bits (4096 colors). The IBM Enhanced Graphics Adapter is a much better
- choice for software compatibility, cost, and text mode work, but only
- 16 colors out of a palette of 6 bits (64 colors).
-
- Source Code Files
-
- Programs are available to display raster images, clear the graphics
- screen, set individual palette entries, and load the entire palette from a
- file. Different source code is available for the different display adapters
- that we support. The source code's base file name (not the extension) is
- suffixed by a character indicating the display adapter that it uses. For
- example, seqe.c is the image display routine for the EGA and seq9.c is the
- display routine for the No. 9 card. Each display adapter also has an assembly
- language driver routine. These are called no9.asm, pga.asm and ega.asm for
- the No. 9 card, the PGA and the EGA respectively.
-
- Raw Image File Format
-
- Image files are raw binary files, one byte per pixel indicating a color value
- from 0-255. They are interpreted as a continuous stream of bytes, i.e. the
- second line immediately follows the first line with no end of line or end of
- record marker. Note that this matches the "de facto" standard used on the
- Sun systems.
-
- Color map files
-
- Raw palette files that we use consists of 256 bytes of the red entries
- followed by 256 bytes of the green entries and then 256 bytes of the blue
- entries. Each entry in the color lookup table is composed of one byte from
- each of the three component areas. To get the Nth entry, the Nth
- element(red), the (N+256)th element and the (N+512)th element are
- combined to get the desired RGB value for the Nth color register.
-
- Each display adapter handles color differently. The [-m mapfile] parameter
- causes seq to load the set of palette registers before displaying the image,
- but color map files are interpreted differently for each display.
-
- The No. 9 board uses a separate monitor, so the palette registers only
- change when they are explicitly set. Therefore, a program called 'paload'
- is available, independent of seq9, to load palette files. Paload uses the
- raw palette file format. It takes one parameter, the name of the palette
- file, and loads that data into the board's registers. Color map loading can
- take place before or after an image is displayed, allowing the user to change
- color maps without re-displaying the image.
-
- The PGA palette registers can only take entries from 0-15 for each of the
- RGB components rather that the 0-255 range provide by the raw palette file
- format. For compatibility with the higher-end systems and the No. 9, the
- color map files are identical to the ones used on the No. 9. To handle the
- lesser color capability of the PGA, each table entry is divided by 16 (retain
- high order 4 bits) before being used. There is no independent 'paload'
- program for the PGA because the screen is continually getting reset to be used
- as a console. Instead, the color map can only be loaded by specifying a file
- name on the command line of seqp with the [-m mapfile] parameter.
-
- The EGA requires a very special color map file. Our goal is to have all
- the display programs use data which is one byte per pixel (0-255), but the
- EGA can only display 16 colors. To accomplish this, both a palette and
- a special translation table is used. On the command line, specification
- of the palette file is the same as the others: [-m egamapfile].
-
- The EGA palette file is an ASCII card image file containing a list of
- 272 numbers, one per line. The first 16 numbers are the color map settings
- as per IBM specifications. Each number represents a palette register byte
- meaning: xxRGBrgb to the EGA palette of 64 colors. The next 256 numbers
- make up the translation table. Each number is in the range 0-15 and
- corresponds to the EGA color to use for that particular data value. The
- first number is for data value 0, the second for data value 1, etc. This
- translation takes place on the fly, in the assembler code, so user programs
- can manipulate the translation table to stretch the capabilities of the EGA's
- 16 colors to display data which is 8 bits deep. An example of one of these
- files is provided in the distribution.
-
- Command Line Syntax
-
- The grammar that I will use for describing the commands is quite simple.
- The command name will be the first word on the line. This may be followed
- by nothing (no parameters), mandatory parameters or optional parameters.
- Optional parameters will be enclosed in square brackets ('[]'), and mandatory
- parameters will be enclosed in angle brackets ('<>'). If two items within
- square brackets are separated by a pipe (|), you may select one of the two,
- but not both. <cr> indicates an end of line.
-
- Raster Image Display Routines
-
- The basic command line for calling seq is:
-
- seq <xdim ydim> [-c | -p xwhere ywhere][-m mapfile] <fileofnames><cr>
-
- xdim and ydim are the xdimension and y dimension of the image file(s) which
- are to be displayed. -c causes the image to be centered on the screen and
- -p allows the user to pick a particular location for the upper left corner
- of the image to be positioned. -m will load a color map before
- displaying the picture (see below). 'fileofnames' is the name of a file which
- contains a list of file names which make up a sequence of image files to be
- displayed in movie fashion. The way to display only one file is to place the
- name of the image file into another textfile. Optional parameters may be
- specified in any order, but must occur between the image dimensions and the
- 'fileofnames'. All of the images in the sequence are interpreted as
- if they have the dimensions xdim,ydim.
-
- The 'pflip' program can be valuable on the PGA, it enables a simple
- keystroke to flip back and forth between the text and graphic displays.
-
- Palette Manipulation and Creation Routines.
-
- Several routines are available for the use and modification of color palettes.
- You can change individual entries, load entire palettes from the color palette
- files, and build palette files from text files.
-
- The routine paload is available for the No. 9 card. The syntax is:
-
- paload <filename><cr>
-
- This routine used the raw palette file, 'filename', to initialize the hardware
- color lookup table.
-
- Palset, also available for the No. 9 card, can be a one line command or it can
- be used interactively. The syntax for the one line command is as follows:
-
- palset <entry_no> <red> <green> <blue><cr>
-
- Entry_no is the register number of the entry that will be changed. Red, green
- and blue are the RGB components that will be used to initialize the entry.
- You can set more than one entry by using palset in interactive mode. To do
- this, enter palset <cr> on the command line. Palset will then accept lines
- of keyboard input of the form:
- <entry_no> <red> <green> <blue>
- where the meanings of the items are the same as above. palset will continue to
- accept lines until it sees a period as the first element on the line. For
- example, this interaction:
-
- palset <cr>
- 1 0 0 0
- 10 30 30 30
- 100 112 0 0
- .
-
- will set the second color palette entry to black(0 for red, 0 for blue and 0
- for green is black), the 10th entry to a shade of grey, and the 100th entry
- to a shade of red. You can also redirect input from a text file of this form
- with the same result. For example:
-
- palset < <filename><cr>
-
- can be used to set palette entrys according to the contents of the file,
- 'filename'.
-
- Palbuild is a utility that you can use to create a raw palette file from
- text of the same form used by palset. The syntax is :
-
- palbuild <newpalfile><cr>
-
- or
-
- palbuild <newpalfile> < <filename><cr>.
-
- The first form of the command will wait for input from the keyboard terminated
- by a period just as palset does. The last form gets its input from the text
- file 'filename', again just as palset. This routine has no effect on the
- hardware color look-up table. Instead, it converts the input to the raw palette
- file format that can be used by paload.
-
- Miscellaneous Utilities
-
- A routine called gclear is also provide. This routine simply clears the
- graphics buffer to all zeros. The syntax is as follows:
-
- gclear<cr>.
-
- Another utility called init9 initializes the graphics hardware. This routine
- is only necessary on the No. 9 card, and is supplied by Number Nine Corporation.
- The routine takes no parameters.
-
- Questions and comments:
- Thomas Redman
- University of Illinois
- National Center for Supercomputing Applications
- 152 Computing Applications Building
- 605 E. Springfield Ave.
- Champaign, IL 61820
- (217)244-0072
-