Mail Archives: djgpp/1996/04/26/05:25:00
In article <4lmmgb$je3 AT frodo DOT smartlink DOT net>, nmarrone AT smartlink DOT net (Nicholas Marrone) writes:
> agserm AT netwizards DOT net (Ansel Sermersheim) wrote:
>
>>"Patrick L. Jenkins" <pjenki1 AT gl DOT umbc DOT edu> wrote:
>
>>>Anybody know how to fade the pallete (in Allegro or generically) 1 step
>>>at a time so that amazing wonderful stuff can be done?
>
>>>ex: an animation of some sort while fading to black...
>
>>Well I'd start like this.
>
>>mypal: array of 768 bytes
>
>>Read the pallette into mypal
>
> [Basic palette fading function deleted]
>
> That last way works well, but when you fade out the palette it looks
> grey and uneven. A better way to do it so that it fades evenly is to
> take a variable and start it at 63 (for a 256 color palette). Compare
> it to each R, B, & G value in each color, and if they are equal then
> decrement it by one. Once you have gone through everything once,
> decrement the variable and do it over again until the variable is
> zero. This causes the screen to fade out to black evenly.
>
> nicholas
>
>
Huh? From what this sounds like, wouldn't it look gray as well? (I haven't
tried it, but it sounds as if it won't preserve the colours correctly.)
Eg, if one palette entry is (r,g,b)=(32,48,63), the blue will be decremented to
48, then green & blue dec'd to 32 (now we have 50% gray), and then r,g,b dec'c
to 0 (50% gray to black). That doesn't sound too hot to me!
Adios
Mark Wodrich.
- Raw text -