Available in the LEADTOOLS Imaging toolkit. |
InvertedText example for C++ 4.0 and later
short nRet;
//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
m_LEAD1.SetDocCleanSuccess(SUCCESS_REMOVE);
nRet = m_LEAD1.InvertedText(INVERTEDTEXT_SINGLE_REGION | INVERTEDTEXT_LEAD_REGION | INVERTEDTEXT_USE_DPI, 5000, 500, 70, 95);
if(nRet == 0)
{
m_LEAD1.FreeRgn();
m_LEAD2.SetBitmap(m_LEAD1.GetDocCleanBitmap()); //copy the result so we can get the rgn handle
m_LEAD1.SetRgnHandle(m_LEAD2.GetRgnHandle(), 0.0f, 0.0f, L_RGN_SET);
m_LEAD2.SetBitmap(0); //no longer need copy
m_LEAD1.SetDocCleanBitmap(0); //no longer need rgn either
m_LEAD1.SetRgnFrameType(RGNFRAME_COLOR);
}
void CDoccleanDlg::OnInvertedTextLeadctrl1(long hRgn, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight, long iWhiteCount, long iBlackCount)
{
CString csOut;
csOut.Format("Inverted at %d, %d, %d, %d, WhiteCount=%d BlackCount=%d\n",
(long)fBoundingRectLeft,
(long)fBoundingRectTop,
(long)fBoundingRectWidth,
(long)fBoundingRectHeight,
iWhiteCount,
iBlackCount);
OutputDebugString(csOut);
}