[comp.os.msdos.programmer] TC2.0 VGA Color tables

goldstein@arecibo.aero.org (Fogbound Child) (12/07/90)

Hi.
Are there any Turbo-C v2.0 Color Table Wizards out there?

I've been trying to hack some VGA color-table manipulations, and have met up 
with some problems. The following description is mainly empirical, since 
the manual is not very precise (nor descriptive) on these counts.

It seems that TC allows you a palette which contains 16 entries, each of 
which points to a different color. So far so good.

Now, these colors that are pointed to are RGB representations off in memory 
somewhere. Evidently, the first 64 of these may be modified using the

setrgbpalette(int color_num, int red, int green, int blue)

command. If color_num > 63, it doesn't seem to effect the color in question. 
So this much is relatively straightforward, and even semi-documented. The 
documentation claims in one manual that the setrgbpalette() command works 
only for 8514 graphics, and in another place that it would work under the 
EGAVGA driver.
I've successfully modified colors, and even written a simple mouse-based 
program that allows me to change each red, green, or blue value and see the 
resulting color.

Questions...
I haven't been able to find a way to obtain what RGB value exists for a 
color in the table. The getpalette() command will return _which_ colors are 
pointed to, but not the RGB data from those colors themselves. I have also 
been unable to find where in memory these RGB combinations are being stored.

I'd really like to find a way to set up colors and then, say, restore the 
defaults without doing a closegraph() and initgraph().

Anyone have any advice for me? Is my understanding of the color table stuff 
incorrect?

Thanks muchly!
___Samuel___
_________I_claim_and_accept_sole_responsibility_for_the_above._SjG.____________
<goldstein@aerospace.aero.org  | "If it is possible to blame the Creator,
<goldstein@arecibo.aero.org>   | then I think he really creates life too  
 ...Really don't mind if you   | much at random, and destroys it too much
       sit this one out...     | at random." -- Lu Xun