CreateMaskFromRgn example for C++ 5.0 and later
int nRet;
ILEADRasterIO *pRasterIO = NULL;
CoCreateInstance(
CLSID_LEADRasterIO,
NULL,
CLSCTX_ALL,
IID_ILEADRasterIO,
(void**)&pRasterIO
);
/* This example loads an image, sets a color region using black,
and then creates a 1-bit mask image from that bitmap. */
nRet = pRasterIO->Load(m_LEADRasterView1.GetRaster (), "C:\\PARROTS.JPG", 0, 0, 1);
if (nRet == 0)
{
m_LEADRasterView1.GetRaster ().SetRgnColor(RGB(0, 0, 0), L_RGN_SET);
nRet = m_LEADRasterView1.GetRaster().CreateMaskFromRgn();
if (nRet == 0)
m_LEADRasterView2.GetRaster().SetBitmap (m_LEADRasterView1.GetRaster().GetMaskBitmap());
}
pRasterIO->Release();