delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/12/09:15:40

From: night DOT walker AT tiscalinet DOT it
Message-ID: <391C097E.74720B9C@tiscalinet.it>
Date: Fri, 12 May 2000 15:39:10 +0200
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en,pdf
MIME-Version: 1.0
To: DJ Delorie <djgpp AT delorie DOT com>
Subject: Allegro: Grayscale creation
Reply-To: djgpp AT delorie DOT com

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

int x;
for(x = 0; x<256; x++)
    _current_pallete.r = _current_pallete.g = _current_pallete.b = x;
set_palette(_current_pallete);

Yes, it is a weird write directly in _current_pallete, but i'm quite
lazy...

However it works, with just a problem: i don't get a 256-color
grayscale, i get 4 equal 64-color grayscales!
I figured it out with:

int x;
for(x = 0; x<256; x++) putpixel(screen, x+20, 20, x);

That draws 4 scales, 64 pixel each.
How can I fix this? (i need more than 64 grays!)

Thanx, Night Walker


- Raw text -


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