My application has a function that creates an offscreen window, draws a
bitmap, and then copies a rect from that window to the active window.

it works fine on all ROM's, except for the IIIc. I do not have an actuall
IIIc to try it out with.


the error I get is "just read directly from low memory"

and when I hit the debug button, it jumps to the WinDeleteWindow call.


any ideas why this would happen only on the IIIc? something to do with
the screen having more bits?


void DrawBitmap(UInt16 bitmapID, Int16 x, Int16 y)
{
        VoidHand        bitmapH =       DmGetResource(bitmapRsc, bitmapID);
        WinHandle       window1;                                //offscreen windowarea
        WinHandle       window2 =       WinGetActiveWindow();   //display window       
 
        UInt16          error =         0;
        RectangleType   rect;
        

        //create offscreen window 
        window1 = WinCreateOffscreenWindow(320,372, genericFormat,&error); 
        

        //set current draw window to new offscreen window
        WinSetActiveWindow (window1);
        WinSetDrawWindow (window1);
        
         
        //draw bitmap onto new offscreen window
        if(bitmapH) {
        
                BitmapType      *bitmap;
                
                //lock the bitmap handle to retrieve the pointer
                bitmap = (BitmapPtr)MemHandleLock(bitmapH);

                //release bitmap resource
                DmReleaseResource(bitmapH);
                
                WinDrawBitmap(bitmap, 0, 0);
        }

        
        //src rect
        rect.topLeft.x = x;
        rect.topLeft.y = y;
        rect.extent.x = 158;
        rect.extent.y = 125;

        WinCopyRectangle(window1, window2, &rect, 1, 16, winPaint);
        
        
        WinSetActiveWindow (window2);
        WinSetDrawWindow (window2);
        
        //free up window from memory
        WinDeleteWindow(window1,true);
        
}


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to