forlang.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Graphics Mode Colors
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     In VGA, MCGA, or EGA graphics mode, a color is specified by an
     INTEGER*4 value. The default colors for indexes 0 - 15 in color
     text modes and in 16-color graphics modes have symbolic constants
     defined for them in FGRAPH.FD. These colors are as follows:
 
     Index     Constant
 
     0         $BLACK
     1         $BLUE
     2         $GREEN
     3         $CYAN
     4         $RED
     5         $MAGENTA
     6         $BROWN
     7         $WHITE
     8         $GRAY
     9         $LIGHTBLUE
     10        $LIGHTGREEN
     11        $LIGHTCYAN
     12        $LIGHTRED
     13        $LIGHTMAGENTA
     14        $YELLOW
     15        $BRIGHTWHITE
 
     In the value specification of a color, the lower three bytes
     represent the three component colors: red, green, and blue.
 
     The VGA and MCGA support 262,144 colors (256K), and the byte
     representing each of the component colors must be in the range
     0-31. In other words, the lower-order six bits of each byte specify
     the component's intensity and the high-order two bits should be
     zero. The fourth (high-order) byte in the long value is unused and
     should be set to 0. The diagram below shows the ordering of bytes
     within the long value:
 
          blue byte     green byte     red byte
          00BBBBBB      00GGGGGG       00RRRRRR
          high ────────────────────── low order
 
     The EGA supports only 64 different colors. Color values for EGA are
     specified in exactly the same way as for the VGA. However, the four
     low-order bits of each byte are simply ignored.
 
     If a VGA or MCGA adapter is connected to an analog monochrome
     monitor, the color value is transformed into its gray-scale
     equivalent, based on the weighted sum of its red, green, and blue
     components (30% red + 50% green + 11% blue). The original red,
     green, and blue values are lost.
                                    -♦-