Mail Archives: djgpp/1997/06/17/14:05:06
SUGANUMA yoshinori (suganuma AT jaist DOT ac DOT jp) wrote:
: Hello.
: I would like to use 256 grayscale colors with djgpp.
: Is it possible? and are there any libraries to do so?
The VGA hardware only uses 64 distinct colour strengths for red, green and
blue, so you can only achieve 64 grey levels. If this really bothers you,
you can use slightly off-grey colours in addition, something like this (in
Allegro code, which you're using anyway):
for (c=0;c<253;c++) {
palette[c].r=palette[c].g=palette[c].b=c/4;
palette[c].r+=c&1;
palette[c].g+=(c&2)>>1;
}
This will give 252 shades of almost-grey. For dark colours the hue will be
more off-grey than for light colours, but it may not be too noticeable.
--
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford
- Raw text -