Despeckle example for C++ 5.0 and later

This example automatically removes specks from the bitmap and repaints the image. Use this on a 1-bit bitmap such as a scanned document.

 

//You must unlock support for this feature
//L_KEY_DOCUMENT represents the unlock support string
m_LEADRasterView1.GetRaster().UnlockSupport (L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT);

ILEADRasterProcess *pRasterProc=NULL;
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL,
                 IID_ILEADRasterProcess, (void**)&pRasterProc);
pRasterProc->Despeckle(m_LEADRasterView1.GetRaster());
m_LEADRasterView1.ForceRepaint();
pRasterProc->Release();