InfoHasAlpha example for C++ 5.0 and later
ILEADRasterIO *pRasterIO=NULL;
ILEADRasterProcess *pRasterProc = NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL,
IID_ILEADRasterIO, (void**)&pRasterIO);
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL,
IID_ILEADRasterProcess, (void**)&pRasterProc);
//load a 24-bit image
pRasterIO->Load(m_LEADRasterView1.GetRaster(),
"c:\\temp\\1.jpg", 24, 1, 1);
m_LEADRasterView2.GetRaster().SetBitmap(m_LEADRasterView1.GetRaster().GetBitmap());
//just make it 8-bit
pRasterProc->ColorRes(m_LEADRasterView1.GetRaster(), 8,
(ColorResPaletteConstants)0,
(ColorResDitherConstants)0, 0);
//now set an alpha channel
m_LEADRasterView1.GetRaster().SetBitmapAlpha(m_LEADRasterView2.GetRaster().GetBitmap());
//save and free
pRasterIO->Save(m_LEADRasterView1.GetRaster(),
"c:\\temp\\32.png", FILE_PNG, 32,
(QFactorConstants)0, 0);
m_LEADRasterView1.GetRaster().SetBitmap(0);
m_LEADRasterView2.GetRaster().SetBitmap(0);
AfxMessageBox(TEXT("Pause"));
//re-load
pRasterIO->GetFileInfo(m_LEADRasterView1.GetRaster(),
"c:\\temp\\32.png", 0, 0);
if(pRasterIO->GetInfoHasAlpha())
pRasterIO->Load(m_LEADRasterView1.GetRaster(),
"c:\\temp\\32.png", 0, 1, 1);
m_LEADRasterView2.GetRaster().SetBitmap(m_LEADRasterView1.GetRaster().GetBitmapAlpha());
pRasterIO->Release();
pRasterProc->Release();