411 REFERENCE · Wikibooks
Programming for Palm OS/C/Off-screen windows
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Be sure to focus on your offscreen window after all the events have been delivered for the start-up of your application.
to create an offscreen window
(and to remember the original window that your application started with)
WinHandle offWin;
WinHandle sysWin;
Coord width = 160;
Coord height = 160;
WindowFormatType format = screenFormat;
UInt16 error;
offWin = WinCreateOffscreenWindow( width, height, format, &error);
sysWin = WinGetDrawWindow();
to release an offscreen window
Boolean eraseIt = false;
if ( offWin != NULL)
{
WinDeleteWindow( offWin, eraseIt);
}
to focus on an offscreen window
WinSetDrawWindow( offWin);
After this invocation, functions such as WinEraseRectangle, WinDrawLine and so on will draw to the offscreen window.
to blit your offscreen drawing to the original window
WinHandle srcWin;
WinHandle destWin;
RectangleType r;
Coord destX;
Coord destY;
WinDrawOperation mode;
srcWin = offWin;
destWin = sysWin;
r.topLeft.x = 0;
r.topLeft.y = 0;
r.extent.x = 160;
r.extent.y = 160;
destX = 0;
destY = 0;
mode = winPaint;
WinCopyRectangle( srcWin, destWin, &r, destX, destY, mode);