At 02:32 AM 9/24/2001 -0400, you wrote:
>Hi,
>
> I found something unexpected while trying to draw white text on a
>textured background in 256 color mode with a custom palette. I was using the
>method mentioned in post 52788 of this newsgroup, which uses the following
>set of calls:
>
> WinSetTextColor(0);
> WinSetBackColor(255);
> WinSetDrawMode(winErase);
> WinPaintChars(txt, StrLen(txt), x, y);
>
>With a standard palette this works fine. But with a custom palette, I get
>weird results. What I first did was to use:
> WinSetTextColor(GetWhiteColorIndex());
> WinSetBackColor(GetBlackColorIndex());
Don't do that. Hardcode 0 and 255. Or to be more general, hardcode 0 and
(1<<bit_depth)-1.
It doesn't matter what the actual color of index 0 and 255 are. It's just
the *index* of the pixel that matters when doing masking
operations. Masking involves doing bitwise operations on the pixel index,
so you want each pixel to either be all 0's or all 1's. (0 and 255 in the
case of an 8-bit pixel).
--
Bill Kirby
Electron Hut
www.electronhut.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/