RawSave Example for C++ 5.0 and later
//This example saves a LEAD bitmap as RAW data starting at offset uOffset
//The data is padded so that each line of bytes is evenly divides 4
//The bits in each byte are reversed before saving
//The Bits per pixel of the raw data is the same as the bits per pixel LEAD1
//If LEAD1 is a palettized image, the palette is not saved--only the raw data
void CRawDlg::RawSave(TCHAR * pszFileName, unsigned long uOffset)
{
int nRet;
TCHAR szMsg[200];
ILEADRasterIO *pRasterIO=NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);
if (pRasterIO != NULL)
{
pRasterIO->SaveLSB = TRUE;
pRasterIO->SavePad4 = TRUE;
nRet = pRasterIO->SaveOffset (m_RasterView.GetRaster(), pszFileName, uOffset, (RasterFileConstants)FILE_RAW, 0, (QFactorConstants)0, 0);
if (nRet == 0)
wsprintf(szMsg, TEXT("SUCCESS file save: %s Size[%d]"), pszFileName, pRasterIO->GetFileSizeWritten());
else
wsprintf(szMsg, TEXT("FAILED file save: %s"), pszFileName);
AfxMessageBox(szMsg);
pRasterIO->Release();
}
}