Ok, I have a problem. I'm coding for a Palm OS 3.1 machine (IIIe). I'm
also coding for a IIIc, m100 and V, Vx, IIIx, and IIIxe. Anyway, this
problem is occurring only on those palms with an OS version below 3.3.
Here is how I set up the screen:
WinScreenMode(winScreenModeGetSupportedDepths, NULL, NULL,
&depth, NULL);
if (depth & (1 << 7))
bestDepth = 8;
else if (depth & (1 << 3))
bestDepth = 4;
else
bestDepth = 2;
WinScreenMode(winScreenModeSet, NULL, NULL, &bestDepth, NULL);
dm = DmOpenDatabaseByTypeCreator('STCW', 'DNFO',
dmModeReadOnly);
if (dm == NULL)
return false;
win = WinCreateOffscreenWindow(320, 120, screenFormat, &error);
if (!win) {
FrmCustomAlert(ErrorAlert, "Unable to allocate
windows!", " ", " ");
return false;
}
Here is how I draw to it:
handle = DmGetResource('Tbmp', 2001 + i);
if (handle == NULL) {
FrmCustomAlert(ErrorAlert, "Unable to get bitmap!", " ", "
");
return;
}
frame = (BitmapPtr) MemHandleLock(handle);
WinSetDrawWindow(win);
WinDrawBitmap(frame, 0, 0); // <--- Error occurs here!
WinSetDrawWindow(screen);
MemPtrUnlock(frame);
WinCopyRectangle(win, screen, c, x, y, winPaint);
On OS 3.3 and above, this works flawlessly. On 3.2 and below it dies
with an error 'ScrDriverNew.c Line: 500, Invalid Params' . What I'm
doing is creating an off secreen bitmap I can copy the multi-bit image
to so I can than use copy rectangle to crop out part of the image.
I can see three ways out of this problem:
1) Write my own version of WinDrawBitmap in assembler so that I no
longer have the problem. The routine should work with any depth (1, 2,
4, 8, and 16).
2) Dummy up a bitmap structure and make the frame bitmap resource look
like a window, so I can skip the WinDrawBitmap issue and just use
WInCopyRectangle. (btw, WinDrawBitmap works fine when going directly to
the screen, go figure...)
3) Figure out something else I'm not seeing ...
Problems I have with the above solutions: (TIME)
1) I'm not an assembly programmer and don't have a clue where to start.
2) I'm not sure this would work. I don't want to waste time if I don;t
have to. If anyone can tell me yea or nay here, I'd do it.
3) Well, I'm open to suggestions :-)
Thanx in Advance for any help...
Chris Olson
btw, I'll be at Palm Source this year, any attendies get to see what I'm
working on, and it's pretty cool !!!
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/