> >> Does anyone have a generic f() to check the palm for support
> >> and then set it the highest depth 1, 2, 4 or 8 bit?
> >> And, of course, would like to share it? :-)
>
> > hmm.. you need someone to write it for you? everything you
> > need is in the dcumentation - surely you can whip this code
> > up yourself.. it is not THAT hard :>
>
> Actually it IS that hard! The challenge is correctly supporting all OS versions
> - for < 3.0, WinScreenMode doesn't exist. For 3.1, it works, but does not allow
> 4-bit mode on the Palm V. etc. etc.
not too hard at all.. highest depth based on API is very simply.
---
static UInt32 depthsToTry[] = { 8, 4, 2, 1 };
static UInt32 romVersion;
static UInt32 oldDepthState;
void
DeviceInitialize()
{
// get the rom version for this device
FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
if (romVersion >= sysMakeROMVersion(3,0,0,sysROMStageRelease,0)) {
// save the current display state
WinScreenMode(winScreenModeGet,NULL,NULL,&oldDepthState,NULL);
// change into the "highest" possible mode (as we need)
{
UInt32 *depthPtr = &depthsToTry[0];
// loop until a valid mode is found (1bpp will ALWAYS work)
while (WinScreenMode(winScreenModeSet,NULL,NULL,depthPtr,NULL)) {
depthPtr++;
}
}
}
}
void
DeviceTerminate()
{
if (romVersion >= sysMakeROMVersion(3,0,0,sysROMStageRelease,0)) {
// restore the previous state
WinScreenMode(winScreenModeSet,NULL,NULL,&oldDepthPtr,NULL);
}
}
---
*sigh*.. of course, i have specified that the maximum i am interested
in is 8 bit display.. if a device comes out with 24 bit displays, and
i want to use it - i will probably release a new version, and hence i
would update the depthsToTry[] array.
cheers.
az.
--
Aaron Ardiri
Java Certified Programmer http://www.hig.se/~ardiri/
University-College i G�vle mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN
Tel: +46 26 64 87 38 Fax: +46 26 64 87 88
Mob: +46 70 656 1143 A/H: +46 8 668 78 72
if you enjoy it, then it aint work :) - rule #106 of life
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html