From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Using Create_Color_Table in Allegro Date: Wed, 25 Jun 1997 19:27:36 +0100 Organization: None Distribution: world Message-ID: References: <01bc8171$a0174b60$b7a42499 AT syntaxlogic DOT earthlink DOT net> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 38 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Alex Kain writes: >How do I use the function to fade a colored pixel to its closest >grayscale color in a palette? a) There is no such function as 'Create_Color_Table'. b) If you are talking about create_color_table(), try something like; RGB myblender(PALLETE pal, int x, int y) { RGB c; int grayscale = ((int)pal[y].r + (int)pal[y].g + (int)pal[y].b) / 3; c.r = (greyscale * (255 - x) / 255) + ((int)pal[y].r * x / 255); c.g = (greyscale * (255 - x) / 255) + ((int)pal[y].g * x / 255); c.b = (greyscale * (255 - x) / 255) + ((int)pal[y].b * x / 255); return c; } color_map = malloc(sizeof(COLOR_MAP)); create_color_table(color_map, palette, myblender, NULL); Then you can use draw_lit_sprite(), draw_lit_rle_sprite(), and the lit texture mapping modes, and a light level of 0 will give you a grayscale (assuming there are suitable colors available in your palette, of course!) while light 255 will give you the original colors. This is untested, but it should work...) -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.