I am using this piece of code to draw coloured text on screen. It works in
simulator, but not working in my LifeDrive Device
RectangleType rect = {{0, 32},{160, 12},};
IndexedColorType redIndex, blueIndex, blackIndex;
RGBColorType rgb;
Boolean inColor;
UInt32 depth;
UInt32 romVersion;
FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
if (romVersion >= sysVersion35)
WinPushDrawState();
// first, what color depth are we in?
if (romVersion < sysVersion30) {
depth = 1; // no system support for gray or colors.
inColor = 0;
}
else {
WinScreenMode(winScreenModeGet, 0, 0, &depth, 0);
inColor = (depth==8);
}
if (romVersion >= sysVersion35) {
// black's index changes for different depths (but is
always at the highest palette entry)
MemSet(&rgb, sizeof(rgb), 0);
blackIndex = WinRGBToIndex(&rgb);
// ditto for red.
MemSet(&rgb, sizeof(rgb), 0);
rgb.r=0xb0;
redIndex = WinRGBToIndex(&rgb);
// ditto for blue.
MemSet(&rgb, sizeof(rgb), 0);
rgb.b=0xb0;
blueIndex = WinRGBToIndex(&rgb);
}
if (inColor)
{
WinSetTextColor(blueIndex);
}
WinEraseRectangle(&rect,0);
WinDrawChars(message, strlen(message), 2, 32);
if (romVersion >= sysVersion35)
WinPopDrawState();
}
thanks in advance
-- cp
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/