From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro: Grayscale creation Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: References: <391C097E DOT 74720B9C AT tiscalinet DOT it> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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/