Mail Archives: djgpp/1998/01/05/17:47:55
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 -