delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/12/12:46:56

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro: Grayscale creation
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <ed9ohsc41b9t1g5frhv564qvlcd8l5bpov@4ax.com>
References: <391C097E DOT 74720B9C AT tiscalinet DOT it>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 31
X-Trace: /bdhN4N7JbF4CSTOI1KXCNeBOSlY5e0Aw7yRzv9Y13GLR1Sj/ljLAi36s8ppRBCbYtH1yXYPDVQh!aEIJ0SqggHeTrPRf1bB6aPJJ30jcNz3smWcvItoghLwVSVW6dbGlsWYd4IZ7yep26h1T1Bbs/msb!LBQExQ==
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Fri, 12 May 2000 15:58:31 GMT
Distribution: world
Date: Fri, 12 May 2000 15:58:31 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Fri, 12 May 2000 15:39:10 +0200, night DOT walker AT tiscalinet DOT it wrote:

>I want to set a 256-color grayscale on a 8bit screen, so i wrote:

[snip: gives four palettes of 64 grays each]

>How can I fix this? (i need more than 64 grays!)

The VGA specification only supports 64 levels of each component;
there is no standard extension to make cards support 256 levels.
Try this (untested) snippet, which adds a bit of color noise to
the grays to get them to look a little better:

int x;
PALETTE pal;

for(x = 0; x < 256; x++)
{
  pal[x].r = (x + rand() % 4) * 63 / 255;
  pal[x].g = (x + rand() % 4) * 63 / 255;
  pal[x].b = (x + rand() % 4) * 63 / 255;
}
set_palette(pal);

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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