Derek,
Following is a function sent by Thadd�e Bechtold at Symbol.
But I am not sure if it helps your issue.

////////////////////////////////////////////////////////////////////////////
/
//
//       Function:     WriteOutBitmap()
//
//       Description:  This function writes out the bitmap into a BMP format
//
//       Parameters:   Pointer to the output file, pointer to the Palm OS
bitmap
//                                                        
//       Returns:      0 if successful        
//
////////////////////////////////////////////////////////////////////////////
/
void WriteOutBitmap( CStdioFile& theLocalFile, WORD* theBitmapPtr )
{
        BYTE                            theTempByte=0;
        WORD*                           theData = theBitmapPtr;
        WORD*                           theScanLine;
        LONG                            theWidth, theHeight, theRowBytes;
        LONG                            theBMPRowBytes;
        BITMAPFILEHEADER        theBitmapHeader;                // 14 bytes
        BITMAPINFOHEADER        theBitmapInfo;                  // 40 bytes
        RGBQUAD                         theBitmapColors[2];             // 8
bytes
        int                                     i, j;

        // First, grab the important information from the pointer to the
Palm OS
        // bitmap.
        theWidth = SyncHHToHostWord( *(theData++) );
        theHeight = SyncHHToHostWord( *(theData++) );
        theRowBytes = SyncHHToHostWord( *(theData++) );

        // Advance past the rest of the Palm OS bitmap header information so
that
        // our pointer is sitting at the actual bitmap data.
        theData+=5;

        // Each scan line must end on a four-byte boundary, so calculate
        // our BMP row bytes.
        theBMPRowBytes = ((theRowBytes + 3)/4) * 4;

        // First, fill in the file information structure
        // Since we are writing a version 3 BMP file, the file size is the
size of the file header 
        // plus the size of the bitmap header plus the size of the color
palette plus the size of 
        // the bitmap data
        theBitmapHeader.bfType          = 0x4D42;       // is always "BM";
        theBitmapHeader.bfSize          = sizeof( BITMAPFILEHEADER ) +
sizeof( BITMAPINFOHEADER ) + sizeof( theBitmapColors ) + (theHeight *
theBMPRowBytes);
        theBitmapHeader.bfReserved1     = 0;
        theBitmapHeader.bfReserved2     = 0;
        theBitmapHeader.bfOffBits       = sizeof( BITMAPFILEHEADER ) +
sizeof( BITMAPINFOHEADER ) + sizeof( theBitmapColors );

        // Write out the header information to the file
        theLocalFile.Write( &theBitmapHeader, sizeof(BITMAPFILEHEADER) );


        // Next fill in the bitmap information structure
        theBitmapInfo.biSize                    = sizeof( BITMAPINFOHEADER
);
        theBitmapInfo.biWidth                   = theWidth;
        theBitmapInfo.biHeight                  = theHeight;
        theBitmapInfo.biPlanes                  = 1;
        theBitmapInfo.biBitCount                = 1;
        theBitmapInfo.biCompression             = BI_RGB;
        theBitmapInfo.biSizeImage               = theHeight *
theBMPRowBytes;
        theBitmapInfo.biXPelsPerMeter   = 0x0B13;       // Default value
        theBitmapInfo.biYPelsPerMeter   = 0x0B13;       // Default value
        theBitmapInfo.biClrUsed                 = 2;
        theBitmapInfo.biClrImportant    = 2;

        // Write out the bitmap information to the file
        theLocalFile.Write( &theBitmapInfo, sizeof(BITMAPINFOHEADER) );


        theBitmapColors[0].rgbBlue              = 255;
        theBitmapColors[0].rgbRed               = 255;
        theBitmapColors[0].rgbGreen             = 255;
        theBitmapColors[1].rgbBlue              = 0;
        theBitmapColors[1].rgbRed               = 0;
        theBitmapColors[1].rgbGreen             = 0;

        // Write out the header information to the file
        theLocalFile.Write( &theBitmapColors, sizeof(theBitmapColors) );

        // Write out each scan line from the bottom up, adding
        // padding if necessary.
        theTempByte = 0;
        for (i=(theHeight-1); i>=0; i--)
        {
                // Grab a pointer to the scan line
                theScanLine = theData + (i*(theRowBytes/2));
                theLocalFile.Write( theScanLine, theRowBytes );

                // Finally, add padding if necessary so that the
                // bitmap is word aligned
                if (theRowBytes != theBMPRowBytes)
                {
                        for (j=theRowBytes; j<theBMPRowBytes; j++)
                                theLocalFile.Write( &theTempByte, 1 );
                }

        }
}
////////////////////////////////////////////////////////////////


-----Original Message-----
From: Derek Mc Connon [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 09, 2001 6:34 AM
To: Palm Developer Forum
Subject: Saving Bitmap


I have been able to get a bitmap drawn onto the sceen but i want to send
this as a bitmap to my pc.

I have a pointer to bitmap and it is getting my signature ok because when i
call the function:
    WinDrawBitmap (bmpP,10,10)
it prints my image to screen.  But i am having problems trying to save this
as a format/file i can send to my pc.

I checked the Beamer example but this beams the image to another device
using predefined system functions which i can't use.  Is there a predefined
system function for saving instead of beaming out there?

Any help would be greatly apreciated

Thanks
Derek


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

--
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