From: Tom St Denis Newsgroups: comp.os.msdos.djgpp Subject: Re: Loading multiple bitmaps in allegro? Date: Fri, 15 Dec 2000 01:29:10 GMT Organization: Deja.com Lines: 43 Message-ID: <91bs50$qt0$1@nnrp1.deja.com> References: <3a39477a DOT 22177941 AT news DOT virgin DOT net> <91brpk$qh2$1 AT nnrp1 DOT deja DOT com> NNTP-Posting-Host: 206.47.244.30 X-Article-Creation-Date: Fri Dec 15 01:29:10 2000 GMT X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt) X-Http-Proxy: HTTP/1.1 choco[0A000001] (Traffic-Server/3.5.7 [uScMs f p eN:t cCMi p s ]), 1.1 x51.deja.com:80 (Squid/1.1.22) for client 206.47.244.30 X-MyDeja-Info: XMYDJUIDtomstdenis To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <91brpk$qh2$1 AT nnrp1 DOT deja DOT com>, Tom St Denis wrote: > In article <3a39477a DOT 22177941 AT news DOT virgin DOT net>, > jamesb_420 AT hotmail DOT com (JB) wrote: > > I am trying to load multiple bitmaps using allegro, but i can't get > > them all to load in the correct color because the pallete is only set > > for one. > > What can i do? > > Turn your desk 90 degrees? > > Honestly just create a "total color usage" (i.e a 64x64x64 array of > longs) and select the 256 most used colors. Then dither your images > (i.e closest mean deviation for the RGB triplets) to fit the same pal. > > If you're smart in the future you would use the same palette :-) To clarify I meant do something like long col[64][64][64]; ... step through pixels ++col[pal[pixel[x]].r][pal[pixel[x].g][pal[pixel[x].b]]; Where pixel[x] is a 8-bit pixel value (addressed by x) and pal[] is your array struct pal { unsigned char r,g,b }; of palette values. The table would take about a MB of memory... not too much as long as you can free it up... Then you sort the table looking for the 256 highest values. Then you step through your bitmaps again and replace the color with one from your new palette that has the smallest mean deviation. Tom Sent via Deja.com http://www.deja.com/