InfoHasAlpha example for C++ Builder
LEADRasterIO* pRasterIO= NULL;
LEADRasterProcess* pRasterProc= NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);
pRasterIO->Load (LEADRasterView1->Raster, AnsiToOLESTR("v:\\images\\1.jpg"), 24, 1, 1); //load a 24-bit image
LEADRasterView2->Raster->Bitmap = LEADRasterView1->Raster->Bitmap;
pRasterProc->ColorRes (LEADRasterView1->Raster,
8,
(ColorResPaletteConstants)0,
(ColorResDitherConstants)0,
0); //just make it 8-bit
//now set an alpha channel
LEADRasterView1->Raster->BitmapAlpha = LEADRasterView2->Raster->Bitmap;
//save and free
pRasterIO->Save (LEADRasterView1->Raster, AnsiToOLESTR("c:\\temp\\32.png"), FILE_PNG, 32, (QFactorConstants)0, 0);
LEADRasterView1->Raster->Bitmap = 0;
LEADRasterView2->Raster->Bitmap = 0;
ShowMessage("Pause");
//re-load
pRasterIO->GetFileInfo (LEADRasterView1->Raster, AnsiToOLESTR("c:\\temp\\32.png"), 0, 0);
if (pRasterIO->InfoHasAlpha)
pRasterIO->Load (LEADRasterView1->Raster, AnsiToOLESTR("c:\\temp\\32.png"), 0, 1, 1);
LEADRasterView2->Raster->Bitmap = LEADRasterView1->Raster->BitmapAlpha;
pRasterProc-> Release( );
pRasterIO-> Release( );