Normal quotes

This commit is contained in:
James Gregory 2013-12-30 18:34:31 +11:00
commit 18011c595a
352 changed files with 6040 additions and 6040 deletions

View file

@ -2,36 +2,36 @@
[Previous](55-01.html) [Table of Contents](index.html) [Next](55-03.html)
------------------------ --------------------------------- --------------------
So it’s perfectly reasonable to maintain 24 bits of color resolution,
So it's perfectly reasonable to maintain 24 bits of color resolution,
and X-Sharp represents colors internally as ideal, device-independent
24-bit RGB triplets. All shading calculations are performed on these
triplets, with 24-bit color precision. It’s only after the final 24-bit
RGB drawing color is calculated that the display adapter’s color
triplets, with 24-bit color precision. It's only after the final 24-bit
RGB drawing color is calculated that the display adapter's color
capabilities come into play, as the X-Sharp function
**ModelColorToColorIndex()** is called to map the desired RGB color to
the closest match the adapter is capable of displaying. Of course, that
mapping is adapter-dependent. On a 24-bpp device, it’s pretty obvious
mapping is adapter-dependent. On a 24-bpp device, it's pretty obvious
how the internal RGB color format maps to displayed pixel colors:
directly. On VGAs with 15-bpp Sierra Hicolor DACS, the mapping is
equally simple, with the five upper bits of each color component mapping
straight to display pixels. But how on earth do we map those
16,000,000-plus RGB colors into the 256-color space of a standard VGA?
This is the “color definition” problem I mentioned at the start of this
This is the "color definition" problem I mentioned at the start of this
chapter. The VGA palette is arbitrarily programmable to any set of 256
colors, with each color defined by six bits each of red, green, and blue
intensity. In X-Sharp, the function **InitializePalette()** can be
customized to set up the palette however we wish; this gives us nearly
complete flexibility in defining the working color set. Even with
infinite flexibility, however, 256 out of 16,000,000 or so possible
colors is a pretty puny selection. It’s easy to set up the palette to
colors is a pretty puny selection. It's easy to set up the palette to
give yourself a good selection of just blue intensities, or of just
greens; but for general color modeling there’s simply not enough palette
greens; but for general color modeling there's simply not enough palette
to go around.
One way to deal with the limited simultaneous color capabilities of the
VGA is to build an application that uses only a subset of RGB space,
then bias the VGA’s palette toward that subspace. This is the approach
then bias the VGA's palette toward that subspace. This is the approach
used in the DEMO1 sample program in X-Sharp; Listings 55.2 and 55.3 show
the versions of **InitializePalette()** and **ModelColorToColorIndex()**
that set up and perform the color mapping for DEMO1.