UInt8 GetGrayedImage()
{
        UInt16 i;

        for(i=0; i<(previewWidth*previewHeight); i++)
        {
                Red = bmpData[i] >> 11;
                Green = (bmpData[i] & (0x07e0))>>5;
                Blue = bmpData[i] & (0x001f);

                Avg = (Red+Green+Blue)/3;
                ..............
        }
}

The problem is "UInt16 i". Change this to a UInt32. By using a 16-bit offset, you can't reach the end of your 640x480 bitmap, which is at almost 614K (much larger than 64K) at 16-bits color depth.




-- Ben Combee, senior DTS engineer, PalmSource, Inc.
   Read "Combee on Palm OS" at http://palmos.combee.net/



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

Reply via email to