hDocCleanRgn example for C++ Builder
void __fastcall TForm1::Button4Click(TObject *Sender)
{
int nRet;
// HolePunch Remove
// This example updates a windows region with all removed hole punches
// For the example, a windows region is updated and then converted to a LEAD region
// but in practice it would easier and faster to just update a LEAD region
// The HOLEPUNCH_USE_DPI flag instructs the API to determine the size of the hole punches
// based on the image DPI
// The image is modified
// The HolePunch Event is used to display information about each hole punch removed
nRet = LEADImage1->HolePunchRemove (HOLEPUNCH_SINGLE_REGION | HOLEPUNCH_USE_DPI | HOLEPUNCH_USE_COUNT | HOLEPUNCH_USE_LOCATION,
2, 4, 0, 0, 0, 0, HOLEPUNCH_LEFT);
if (nRet == SUCCESS)
{
LEADImage1->FreeRgn ();
LEADImage1->SetRgnHandle ((int)LEADImage1->hDocCleanRgn, 0, 0, L_RGN_SET);
LEADImage1-> hDocCleanRgn = 0 ;// no longer need rgn
LEADImage1->RgnFrameType = ftAnimated;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::LEADImage1HolePunchRemove(TObject *Sender,
L_HRGN hHoleRgn, int nBoundingRectLeft, int nBoundingRectTop,
int nBoundingRectWidth, int nBoundingRectHeight, int iHoleIndex,
int iHoleTotalCount, int iWhiteCount, int iBlackCount)
{
char szTemp[256];
wsprintf(szTemp,"HolePunch at %d,%d,%d,%d HoleIndex= %d TotalCount= %d WhiteCount= %d BlackCount= %d",
nBoundingRectLeft,
nBoundingRectTop,
nBoundingRectWidth,
nBoundingRectHeight,
iHoleIndex,
iHoleTotalCount,
iWhiteCount,
iBlackCount);
OutputDebugString(szTemp);
}