[comp.os.msdos.programmer] How to mix colors in Turbo C ???

jita@eecs.cs.pdx.edu (Hengky Jita) (04/30/91)

I am trying to use the Turbo C's setcolor function to mix 
colors so that I can have colors such as, yellow, a darker 
yellow, a much more darker yellow, or the darkest yellow color.
My question is, how can I get a darker or a brighter color?
I don't think "setcolor(YELLOW|BLACK);" would give me the
darker color of yellow.
Is there a way to do it besides using the setcolor function
call?
Any inputs will be greatly appreciated.

---------

					Hengky Jita - Computer Science                                                  Portland State Univ
INTERNET: jita@cs.pdx.edu		(503) 725-7240	
USMAIL	: 1705 SW 11 TH AVE # 510 ,  PORTLAND, OR, 97201
======================================================================

jdb@reef.cis.ufl.edu (Brian K. W. Hook) (05/01/91)

I don't think mixing colors is going to be as easy as using setcolor().
Setcolor takes an enumed integer from 0-15, I believe (may be different for
the 256color BGI).  If you look in <graphics.h> you will see that the color
values are in fact enumerated.  Thus, ORing them won't work.

If you are in a 16 color mode with an EGA/VGA board, you would have to
probably remap your pallete using remappallete() or setpalette(), can't
remember which is the correct name.  This reduces the amount of available
colors though (since if you have 8 shades of grey, you can still only have
8 more other colors).  This is how EA gets that lifelike King Tut picture
using an EGA.  They remap the colors to pretty much all shades of
yellow/gold.

If you don't want to reduce the amount of colors available, you must resort
to dithering.  The crude method would be to use setlinestyle() and
setfillmask().  But if you would like to be sophisticated about it, try
getting a good book on graphics that covers dithering.

If you are using 256 color VGA, you probably have the 256 color BGI, and
then you are set.  I have never used this BGI, so I can't say much about
it.

Brian