At 05:56 PM 9/24/2001 -0400, you wrote:
>Bill Kirby <[EMAIL PROTECTED]> wrote in message
>news:63237@palm-dev-forum...
> > 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).
>
>Thanks! I guess I misinterpreted the documentation: it kept mentioning
>"white pixel" and "black pixel" explicitly. It makes much more sense now
>that I see your explanation. I'd been wondering how the Palm OS did the
>masking efficiently with arbitrary pixel indexes. They don't. :)
>
>On the plus side, this means I'll be able to draw text of any color on a
>textured background as long as I put that color at either position 0 or 255
>in my palette. Hmmmm...

You can do that with any color at any index, it just takes 2 operations 
instead of one.  The code you originally quoted was mine, but you only 
listed the first part.  Here are both parts:

// first wipe all the pixels of the desired text to be zero (note, I didn't 
say what *color*, just zero),
// while leaving the background unchanged:

WinSetTextColor( (1<<depth)-1 );
WinSetBackColor( 0 );
WinSetDrawMode( winMask );
WinPaintChars( txt, len, x, y );

// now logical OR all the zero'd pixels with the index of the desired text 
color

WinSetTextColor( textColorIndex );
WinSetBackColor( 0 );
WinSetDrawMode( winOverlay );
WinPaintChars( txt, len, x, y );

Doing just the first step will create text in whatever color you have in 
your palette at index 0.






--
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/

Reply via email to