Smooth example for C++ 5.0 and later
void CTutorDlg::OnButtonSmooth()
{
//This example smooths all nicks and bumps up to 2 pixels in length
//Long bumps/nicks are treated before short bumps/nicks
//A LEAD region is updated to show all the changes
//The Smooth Event is used to display information about bump or nick
//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);
//NOTE: This is not a complete example for handing events, some steps have been omitted.
//For a complete example of how to handle events, refer to the example
//Updating a Gauge and Detecting a User Interrupt.
int nRet;
m_LEADRasterView1.GetRaster().UnlockSupport(L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT);
m_pRasterProc->EnableMethodErrors = FALSE;
m_pRasterProc->EnableDocCleanEvents = TRUE;
m_pRasterProc->DocCleanSuccess = SUCCESS_REMOVE;
nRet = m_pRasterProc->Smooth(
m_LEADRasterView1.GetRaster(),
2,
(SmoothFlags)(SMOOTH_SINGLE_REGION | SMOOTH_LEAD_REGION | SMOOTH_FAVOR_LONG)
);
if (nRet == 0)
{
m_LEADRasterView1.SetRgnFrameType(RGNFRAME_COLOR);
}
void CRasterProcSink::OnSmooth(
long nBumpOrNick,
float fStartRow,
float fStartCol,
float fLength,
long uHorV
)
{
CString strMsg;
LPTSTR pszType = (nBumpOrNick == SMOOTH_BUMP) ? TEXT("Bump") : TEXT("Nick");
LPTSTR pszHorV = (uHorV = SMOOTH_HORIZONTAL_ELEMENT) ? TEXT("Horz") : TEXT("Vert");
strMsg.Format(TEXT("Found %s[%s] at [%0.0f,%0.0f]\tLength[%0.0f]\n"),
pszType,
pszHorV,
fStartRow,
fStartCol,
fLength);
OutputDebugString(strMsg);
}