InvertedText example for C++ 5.0 and later
void CTutorDlg::OnInvertedtext()
{
//InvertedText
//This example finds all inverted text regions greater than 5 inches in width and 1/2 inch in height
//and inverts the text so that it appears normal
//The InvertedText Event is used to display additional information about the inverted text regions
//A LEAD region is updated to show all of the changes
//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);
int nRet;
m_LEADRasterView1.GetRaster().UnlockSupport(L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT);
m_pRasterProc->EnableMethodErrors = FALSE;
//Enable the doc clean event
m_pRasterProc->EnableDocCleanEvents = TRUE;
nRet = m_pRasterProc->InvertedText (
m_LEADRasterView1.GetRaster(),
(InvertedTextFlags)(INVERTEDTEXT_SINGLE_REGION | INVERTEDTEXT_LEAD_REGION | INVERTEDTEXT_USE_DPI),
5000,
500,
70,
95);
if (nRet == 0)
{
m_LEADRasterView1.SetRgnFrameType(RGNFRAME_COLOR);
}
}
void CRasterProcSink::OnInvertedText(
long hRgn,
float fBoundingRectLeft,
float fBoundingRectTop,
float fBoundingRectWidth,
float fBoundingRectHeight,
long iWhiteCount,
long iBlackCount)
{
CString strMsg;
strMsg.Format(TEXT("Inverted at [Left,Top,Width,Height][%0.0f,%0.0f,%0.0f,%0.0f] WhiteCount[%d] BlackCount[%d]\n"),
fBoundingRectLeft,
fBoundingRectTop,
fBoundingRectWidth,
fBoundingRectHeight,
iWhiteCount,
iBlackCount);
OutputDebugString(strMsg);
}