DocCleanSuccess example for C++ 5.0 and later
void CTutorDlg::OnButtonDotremove()
{
//This example updates a region with all 1x1 to 3x3 specks that are solid black
//if a speck has any white pixels, it is NOT part of the updated region
//The call is configured to update a single LEAD region with all changes
//The image itself is unchanged
//The DotRemove Event is used to display information about each speck that is removed
//The following is declared and created in in the CTutorDlg class constructor
// ILEADRasterProcess *m_pRasterProc=NULL;
// hr = CoCreateInstance(
// CLSID_LEADRasterProcess,
// NULL,
// CLSCTX_ALL,
// IID_ILEADRasterProcess,
// (void**)&m_pRasterProc);
m_LEADRasterView1.GetRaster().UnlockSupport(L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT);
m_pRasterProc->EnableMethodErrors = FALSE;
m_pRasterProc->EnableDocCleanEvents = TRUE;
int nRet = m_pRasterProc->DotRemove(
m_LEADRasterView1.GetRaster(),
(DotRemoveFlags)(DOT_USE_SIZE | DOT_SINGLE_REGION | DOT_LEAD_REGION | DOT_IMAGE_UNCHANGED),
1,1,3,3);
if (nRet == 0)
{
m_LEADRasterView1.SetRgnFrameType(RGNFRAME_COLOR);
}
}
void CRasterProcSink::OnDotRemove(
long hRgn,
float fBoundingRectLeft,
float fBoundingRectTop,
float fBoundingRectWidth,
float fBoundingRectHeight,
long iWhiteCount,
long iBlackCount)
{
CString strMsg;
strMsg.Format(TEXT("Dot Found at [Left,Top,Width,Height] [%0.0f, %0.0f %0.0f, %0.0f] WhiteCount[%d] BlackCount[%d]\n"),
fBoundingRectLeft,
fBoundingRectTop,
fBoundingRectWidth,
fBoundingRectHeight,
iWhiteCount,
iBlackCount);
OutputDebugString(strMsg);
//Do not remove the speck if it contains any white pixels
m_pDlg->m_pRasterProc->DocCleanSuccess = (iWhiteCount > 0) ? SUCCESS_NOREMOVE : SUCCESS_REMOVE;
}