www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/05/17:47:55

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Why does Allegro use bright pink for transparency?
Date: Mon, 5 Jan 1998 19:33:40 +0000
Organization: None
Distribution: world
Message-ID: <CG0jlSAUWTs0Ew5N@talula.demon.co.uk>
References: <34A32CDB DOT 767B AT nic DOT smsu DOT edu>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 21
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Tony O'Bryan writes:
>In 8-bit color modes, Allegro uses the customary color 0 for pixel
>transparency with sprites.  Why do the high-color and true-color modes
>use bright pink instead of black (0,0,0)?

If I used black, there would be no way to draw black pixels as part of a
masked image, which would be a major limitation! Of course the same
thing applies to pink, but it is a much less frequently used color :-)

Pink also has the advantage that it consists only of maximum and zero
color components, so there is no danger of rounding errors when
converting between different color depths, and that it is symmetrical
when you swap the red and blue components, so I can compare against
constant color values in the drawing code and the bit pattern will
remain the same in both RGB and BGR layouts (that isn't true for cyan,
which is another frequently used magic marker color).


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa

- Raw text -


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