Available in the LEADTOOLS Imaging toolkit. |
ContourFilter example for C++ 4.0 and later
ILEADRasterDlgKrn_U * m_pRasterKrnDlg;
m_pRasterKrnDlg = NULL;
CoCreateInstance(CLSID_LEADRasterDlgKrn_U,
NULL,
CLSCTX_ALL,
IID_ILEADRasterDlgKrn_U,
(void**)&m_pRasterKrnDlg);
m_pRasterKrnDlg->InitDlg(INIT_WITH_COLOR);
ILEADRasterDlgImgEfx_U* m_pRasterImgEfxDlg;
m_pRasterImgEfxDlg =NULL;
CoCreateInstance(CLSID_LEADRasterDlgImgEfx_U,
NULL,
CLSCTX_ALL,
IID_ILEADRasterDlgImgEfx_U,
(void**)&m_pRasterImgEfxDlg);
short nRet;
m_Lead1.Load("c:\\test.bmp",24,1,1);
m_pRasterImgEfxDlg->put_MaxError(5);
m_pRasterImgEfxDlg->put_DeltaDirection(5);
m_pRasterImgEfxDlg->put_Threshold(5);
m_pRasterImgEfxDlg->put_ContourOption(CONTOUR_LINK_COLOR);
m_pRasterImgEfxDlg->put_ContourOptionFlags(CONTOURFILTER_SHOW_OPTION_ALL);
m_pRasterImgEfxDlg->put_UIFlags(CONTOURFILTER_SHOW_PREVIEW + CONTOURFILTER_SHOW_DELTADIRECTION + CONTOURFILTER_SHOW_MAXIMUMERROR + CONTOURFILTER_SHOW_OPTION + CONTOURFILTER_SHOW_THRESHOLD + CONTOURFILTER_SHOW_TOOL_ZOOMLEVEL);
m_pRasterImgEfxDlg->put_Bitmap(m_Lead1.GetBitmap());
nRet = m_pRasterImgEfxDlg->ShowContourFilterDlg((long)this->m_hWnd);
nRet = m_Lead1.ContourFilter(m_pRasterImgEfxDlg->Threshold, m_pRasterImgEfxDlg->DeltaDirection, m_pRasterImgEfxDlg->MaxError, 2/*m_pRasterImgEfxDlg->get_ContourOption(0)*/);
m_pRasterImgEfxDlg->put_Bitmap(0);