www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/17/14:05:06

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Can I use 256 grayscale colors?
Date: 13 Jun 1997 19:31:20 GMT
Organization: Oxford University, England
Lines: 23
Message-ID: <5ns768$mvk@news.ox.ac.uk>
References: <5npo2o$k8v$1 AT jaist-news DOT jaist DOT ac DOT jp>
NNTP-Posting-Host: sable.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019