delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/20/03:49:17

Message-ID: <380D499C.F017D7D8@snetch.cpg.com.au>
Date: Wed, 20 Oct 1999 14:48:28 +1000
From: Michael Abbott aka frEk <20014670 AT snetch DOT cpg DOT com DOT au>
Organization: Student of Computer Power Institute
X-Mailer: Mozilla 4.05 [en] (Win95; I)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: What is a good palette for 8-Bit Grafix?
References: <7uhdij$sfb$1 AT rohrpostix DOT uta4you DOT at>
Reply-To: djgpp AT delorie DOT com

Heya

What immediately comes to mind is using a palette sort of truecolor like... ie.
Instead of for example the hicolor 5-5-5 palette, within 8 bits you use a 3-3-2
palette which means 3 bits of red, 3 for green, 2 for blue...
Short program:

PALETTE result;

int main ()
{
  int r, g, b, index;

  index = 0;

  for (b = 0; b < 4; b ++)
    for (g = 0; g < 8; g ++)
      for (r = 0; r < 8; r ++)
      {
        result [index] .r = r * 8;
        result [index] .g = g * 8;
        result [index] .b = b * 16;
      }

  return 0;
}

I haven't tested this (just made it really really really quickly) so I can't
guarantee it's correct, but it seems to work fine in my mind... Of course, it
won't do anything but you should get the jist...

You could probably extend this to use HLS or CYM or whatever suits you at the
time... Converting your old graphics to this palette is another question... I'd
probably end up using PSP for that...

- frEk

> I want to create a game in Mode-X with Allegro, and now my problem is the
> following:
> Which Palette should I use? How can I make it, that every important color is
> in the palette, and that there are colors in the palette, which enable me to
> make smooth color-changes (for instance when I need the colors to draw a
> picture where a orange gradually turns to a grey or something...)? Can I
> download a good 8-Bit palette somewhere, or has anyone got any tips for how
> to make it?

- Raw text -


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