Minggu, 23 Mei 2010

The Vga Color Palette

The VGA color system is backwards compatible with the EGA and CGA adapters, and adds another level of configuration on top of that. CGA was able to display up to 16 colors, and EGA extended this by allowing each of the 16 colors to be chosen from a 64-color palette (these 64 colors are made up of two bits each for red, green and blue: two bits × three channels = six bits = 64 different values). VGA further extends this scheme by increasing the EGA palette from 64 entries to 256 entries. Two more blocks of 64 colors with progressively darker shades were added, along with 8 "blank" entries that were set to black.[12][dubious ]

in addition to the extended palette, each of the 256 entries could be assigned an arbitrary color value through the VGA DAC. The EGA BIOS only allowed 2 bits per channel to represent each entry, while VGA allowed 6 bits to represent the intensity of each of the three primaries (red, blue and green). This provided a total of 64 different intensity levels for red, green and blue, resulting in 262,144 possible colors, any 256 of which could be assigned to the palette (and in turn out of those 256, any 16 of them could be displayed in CGA video modes).

This method allowed new VGA colors to be used in EGA and CGA graphics modes, providing one remembered how the different palette systems are laid together. To set the text color to very dark red in text mode, for instance, it will need to be set to one of the CGA colors (for example, the default color, #7: light grey.) This color then maps to one in the EGA palette — in the case of CGA color 7, it maps to EGA palette entry 42. The VGA DAC must then be configured to change color 42 to dark red, and then immediately anything displayed on the screen in light-grey (CGA color 7) will become dark red. This feature was often used in 256-color VGA DOS games when they first loaded, by smoothly fading out the text screen to black. (The game Descent, from 1995, is an example.)

While CGA and EGA-compatible modes only allowed 16 colors to be displayed at any one time, other VGA modes, such as the widely used mode 13h, allowed all 256 palette entries to be displayed on the screen at the same time, and so in these modes any 256 colors could be shown out of the 262,144 colors available.

1 komentar:

  1. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!


    \Web Hosting Services

    BalasHapus