[comp.lang.pascal] WHERE IS BLACK COLOR?

zhou@brazil.psych.purdue.edu (Albert Zhou) (12/29/90)

Here is the problem with unit graph: After setting a background color, one
can not draw in black. You might think of using PutPixel(x, y, 0), but this
doesn't work either. Using GetPixel, I found the background color is 0. 
Where is black color?

By the way, the problem arises on VGA. However I doubt it is relevant.

tsmith@plains.NoDak.edu (Timothy Lyle Smith) (01/04/91)

In article <11636@j.cc.purdue.edu> zhou@brazil.psych.purdue.edu (Albert Zhou) writes:
>Here is the problem with unit graph: After setting a background color, one
>can not draw in black. You might think of using PutPixel(x, y, 0), but this
>doesn't work either. Using GetPixel, I found the background color is 0. 
>Where is black color?
>
>By the way, the problem arises on VGA. However I doubt it is relevant.

Your problem stems from pallete location 0 being defined as the background
color for VGA, and possibly other GAs.  By defining black to be at location
0 Borland can set the background at the same time.  In all fairness this may
have been safe before VGA so it would have worked well.  But now if you 
change the background color in VGA you will redefine what color "black" is and
will have no palette location that cooresponds to the real world color of 
black.  Your best way around this is to define one of the other palette 
locations to be black and change the constant for black to point to that
palette location.
-- 
Tim Smith  
Minard 300                      UUCP:        ...!uunet!plains!tsmith
North Dakota State University,  BITNET:      tsmith@plains.bitnet
Fargo, ND  58105                INTERNET:    tsmith@plains.NoDak.edu