delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/02/09:16:41

From: Charles Terry <cterry AT plinet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help: Flic Palette in Allegro
Date: Thu, 02 Apr 1998 06:26:37 -0800
Organization: All USENET -- http://www.Supernews.com
Lines: 52
Message-ID: <3523A01D.59EA@plinet.com>
References: <3 DOT 0 DOT 5 DOT 32 DOT 19980330175544 DOT 007e1320 AT pop DOT iquest DOT net>
<35203D66 DOT 991B872C AT sprynet DOT com> <3521161E DOT 3131 AT plinet DOT com>
<35217510 DOT B6BF3C54 AT sprynet DOT com> <352254A8 DOT 6F78 AT plinet DOT com>
<35228997 DOT 51780F5D AT sprynet DOT com> <3lSazEAi2oI1EwoZ AT talula DOT demon DOT co DOT uk> <3522D890 DOT FC18D5D2 AT sprynet DOT com>
NNTP-Posting-Host: 12147 AT 207 DOT 174 DOT 3 DOT 111
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ishpeck wrote:
> 
> Oh, alright... I give up... I'll do it
> the sensible way!  SHEESH!
> 
> :)

You cut too deep insinuating advocating sensibility.
The following code is guaranteed NOT to work- I
didn't have the allegro reference in front of me
when I wrote it, and I didn't even try to compile it.
But if I were trying to accomplish this conversion
its where I'd start.

Charles Terry

Char colortable[255]

pallete_convert(pal screenpal,pal flickpal)
{

RGB* SC[255];
RGB* PC[255];
int place,place2;
int bestvalue=0xffff;

setpallete(flickpal);
for (place=0;place<=255;place ++)getcolor(place,&PC[place]);	
setpallete(screenpal);
for (place=0;place<=255;place ++)getcolor(place,&SC[place]);
	// you probably would have to tweek the color value test below
for(place=0;place<=255;place++){
	for(place2=0;place2<=255;place2++){
		if( abs(SC.R-PC.R)+abs(SC.G-PC.G)+abs(SC.B-PC.B)<
		   bestvalue){
			bestvalue=place2;
			if (0==bestvalue)break;
		}}
	colortable[place]=bestvalue;
	bestvalue=0xffff;
}
}

color_flick(char* bmp,int size)
{
for(int place=0;place<size;place++)
{
	bmp[place]=colortable[bmp[place]];
}}

>

- Raw text -


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