hDocCleanRgn example for C++ 4.0 and later
short nRet;
//HolePunch Remove
//This example updates a windows region with the 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 C
DLL 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 = m_LEAD1.HolePunchRemove(HOLEPUNCH_SINGLE_REGION | HOLEPUNCH_USE_DPI |
HOLEPUNCH_USE_COUNT | HOLEPUNCH_USE_LOCATION,
2, 4, 0, 0, 0, 0, HOLEPUNCH_LEFT);
if(nRet == 0)
{
m_LEAD1.FreeRgn();
m_LEAD1.SetRgnHandle(m_LEAD1.GethDocCleanRgn(), 0.0f, 0.0f, L_RGN_SET);
m_LEAD1.SethDocCleanRgn(0); //no longer need rgn
m_LEAD1.SetRgnFrameType(RGNFRAME_COLOR);
}
void CDoccleanDlg::OnHolePunchRemoveLeadctrl1(long hRgn, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight, long iHoleIndex, long iHoleTotalCount, long iWhiteCount, long iBlackCount)
{
CString csOut;
csOut.Format("HolePunch at %d,%d,%d,%d, Index=%d Count=%d WhiteCount=%d, BlackCount=%d\n",
(long)fBoundingRectLeft,
(long)fBoundingRectTop,
(long)fBoundingRectWidth,
(long)fBoundingRectHeight,
iHoleIndex,
iHoleTotalCount,
iWhiteCount,
iBlackCount);
OutputDebugString(csOut);
}