www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/26/08:00:13

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE301330CC6@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Fading in/out with 16 bit colours
Date: Mon, 26 Apr 1999 09:30:21 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

Chris Mears writes:
> In mode 13h, with a 256 colour palette, you could fade the whole screen
> in and out simply by changing the values in the palette.  And it was
> fast.  Now, my question:  is there a fast and easy way to achieve the
> same effect with 16 bit colours?  Using djgpp and allegro, of course.

There is no such easy way. You have to manually modify every single
pixel on the screen to make them darker or lighter. The Allegro
translucency and lighting functions can do this (eg. draw translucent
black rectangles to darken the screen down), but it will be very
slow and probably not look too smooth.

Alternatively you could sacrifice a 128k lookup table, and use that
to store the color one level darker than each 16 bit pixel, then
just loop through the screen memory and replace each pixel with the
version from your table. Allegro won't do that for you, though, and
it still might be too slow, depending on video resolution and the
speed of your PC.

In truecolor modes, it is much more useful to swipe things on and off
from the side of the screen, rather than trying to fade them :-)


	Shawn Hargreaves.


- Raw text -


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