I want to animate transitions between screens of my Palm App, and have already 
implemented a few simple "push" transitions using WinCopyRectangle. Next I'm 
looking to support zoom in/out (like maximization/minimization) transitions, 
but I've found that WinGetPixelRGB and WinSetPixelRGB are too slow (it takes 
several seconds to redraw the screen), so I'm looking to use a lower-level API. 
I'm perfectly happy to directly diddle the graphics buffers (probably with 
double-buffering), but haven't found a way to do that yet. The code I have so 
far looks like:

--------

        UInt16 prevCS;
        Int16 width, height;
        
        UInt16 *pDst, *dest, *pSrc, *src;
        
        UInt32 row, col;
        
        UInt32 newDepth = 16;
        
        UInt16 err;
        
        
        // set display to 16-bit
        WinScreenMode(winScreenModeSet, NULL, NULL, &newDepth, NULL);
        
        
        // get width and height
        prevCS = WinSetCoordinateSystem(kCoordinatesStandard);
        WinGetDisplayExtent(&width, &height);
        WinSetCoordinateSystem(prevCS);



        BitmapType* pDstBmp = BmpCreate(outputSize.m_x, outputSize.m_y, 
newDepth, NULL, &err);
        pDst = (UInt16*)BmpGetBits(pDstBmp);
        dest = pDst;
        
        
        BitmapType* pSrcBmp = WinGetBitmap(source->getWinHandle());
        pSrc = (UInt16*)BmpGetBits(pSrcBmp);
        src = pSrc;
        
        float xScale = (float)width  / (float)outputSize.m_x;
        float yScale = (float)height / (float)outputSize.m_y;
        
        UInt32 sRowOffset, dRowOffset;
        
        for (row=0; row<outputSize.m_y; row++) {
        
                sRowOffset = (int)(row * yScale * width);
                dRowOffset = (int)(row * outputSize.m_x);
        
                for (col=0; col<outputSize.m_x; col++) {
                        
                        // dumb pixel sampling
                        pDst[dRowOffset + col] = pSrc[sRowOffset + (int)(col * 
xScale)];
                        
                }
        }
        

---------

However, the sampling from the 'source' window's Bitmap memory isn't working. 
Each access is returning the same color, resulting in a solid color block from 
the sampling. It's not even the same color as the background of the form I'm 
sampling from (when the bitmap is drawn to the screen using WinDrawBitmap). Any 
suggestions as to what I'm doing wrong, or does anyone know of a low-level 
screen access library that's fast that I could use in place of trying to write 
my own code?

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

Reply via email to