DocCleanBitmap example for C++ Builder
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int nRet;
// Smooth
// 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
LEADImage1->DocCleanSuccess = SUCCESS_REMOVE;
nRet = LEADImage1->Smooth (2, SMOOTH_SINGLE_REGION |
SMOOTH_LEAD_REGION | SMOOTH_FAVOR_LONG);
if (nRet == SUCCESS)
{
LEADImage1->FreeRgn ();
LEADImage2->Bitmap = LEADImage1->DocCleanBitmap; //copy the result so we can get the rgn handle
LEADImage1->SetRgnHandle (LEADImage2->GetRgnHandle (), 0, 0, L_RGN_SET);
LEADImage2->Bitmap = 0; // no longer need copy
LEADImage1->DocCleanBitmap = 0; // no longer need rgn either
LEADImage1->RgnFrameType = ftAnimated;
}
}
void __fastcall TForm1::LEADImage1Smooth(TObject *Sender, int nBumpOrNick,
int nStartRow, int nStartCol, int nLength, int uHorV)
{
char * szType;
char * szHorV;
char szTemp[256];
if (nBumpOrNick == SMOOTH_BUMP)
szType = "Bump";
else
szType = "Nick";
if (uHorV == SMOOTH_HORIZONTAL_ELEMENT)
szHorV = "Horz.";
else
szHorV = "Vert.";
wsprintf(szTemp,"Fount %s at %d,%d Length %d - %s",
szType,nStartCol,nStartCol,nLength,szHorV);
OutputDebugString(szTemp);
}