At 11:32 AM 8/1/2001 -0400, you wrote:
>Thanks for the reply.
>
>Tried it, just get the same black block I did with winErase mode. I had
>some marginal luck not using WinPaintChars but using
>WinEraseChars and WinInvertChars, but I wasn't able to set the text color
>and it didn't work on grayscale devices.
>
>Here's the failing code snippet:
>
> RGBColorType rgb;
> IndexedColorType idxColor;
> rgb.r = GetRValue( 0 );
> rgb.g = GetGValue( 0 );
> rgb.b = GetBValue( 0 );
> idxColor = WinRGBToIndex( &rgb );
> WinSetTextColor( idxColor );
> rgb.r = GetRValue( 255 );
> rgb.g = GetGValue( 255 );
> rgb.b = GetBValue( 255 );
> idxColor = WinRGBToIndex( &rgb );
> WinSetBackColor( idxColor );
> WinSetDrawMode( winMask ); //or winErase
> WinPaintChars("Whatever", 8, 0, 0 );
You shouldn't be using any of the RGB stuff. When masking, all that
matters is the pixel
index. You should use 0 and (1<<depth)-1, where depth is the current bit
depth. I think
part of your problem is that WinRGBToIndex() of RGB(0,0,0) might not be
returning 255.
When using the various blitter modes, you're just doing logical operations
on pixels.
So all that matters is the actual byte of data in screen memory, not the
color that value
represents.
> rgb.r = GetRValue( 0 );
> rgb.g = GetGValue( 0 );
> rgb.b = GetBValue( 255 );
> idxColor = WinRGBToIndex( &rgb );
> WinSetTextColor( idxColor );
> rgb.r = GetRValue( 0 );
> rgb.g = GetGValue( 0 );
> rgb.b = GetBValue( 0 );
> idxColor = WinRGBToIndex( &rgb );
> WinSetBackColor( idxColor );
> WinSetDrawMode( winOverlay );
> WinPaintChars("Whatever", 8, 0, 0 );
You should set the back color to index 0 (white, rgb(255,255,255)) when doing
overlay. Overlay is just a logical OR, so it's taking the pixels on the
screen, and
OR'ing them with the pixel in the text. You want the background of the
text you're
overlaying to be 0 (no bits on), so that the background of the screen is
not modified.
If you still have problems, try the code I posted. It works, really. :)
--
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/