InvertedText example for C++ Builder
void __fastcall TForm1::Button5Click(TObject *Sender)
{
int 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
LEADImage1->DocCleanSuccess = SUCCESS_REMOVE;
nRet = LEADImage1->InvertedText(INVERTEDTEXT_SINGLE_REGION|INVERTEDTEXT_LEAD_REGION|INVERTEDTEXT_USE_DPI, 5000, 500, 70, 95);
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::LEADImage1InvertedText (TObject *Sender,
L_HRGN hTextRgn, int nBoundingRectLeft, int nBoundingRectTop,
int nBoundingRectWidth, int nBoundingRectHeight, int nWhiteCount,
int nBlackCount)
{
AnsiString strTemp;
strTemp = "Inverted at " + IntToStr(nBoundingRectLeft) +","+
IntToStr(nBoundingRectTop) + "," + IntToStr(nBoundingRectWidth) +","+
IntToStr(nBoundingRectHeight) + " WhiteCount=" +
IntToStr(nWhiteCount) + " BlackCount= " +
IntToStr(nBlackCount);
OutputDebugString(strTemp.c_str());
}