InvertedText example for Delphi
procedure TForm1.Button5Click(Sender: TObject);
var
nRet : Integer;
begin
{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 Or INVERTEDTEXT_LEAD_REGION Or INVERTEDTEXT_USE_DPI, 5000, 500, 70, 95);
If (nRet = SUCCESS) Then
begin
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;
End;
end;
procedure TForm1.LEADImage1InvertedText (Sender: TObject; hTextRgn: L_HRGN;
nBoundingRectLeft, nBoundingRectTop, nBoundingRectWidth,
nBoundingRectHeight, nWhiteCount, nBlackCount: Integer);
begin
OutputDebugString(pChar('Inverted at ' + IntToStr(nBoundingRectLeft) +','+
IntToStr(nBoundingRectTop) + ',' + IntToStr(nBoundingRectWidth) +','+
IntToStr(nBoundingRectHeight) +' WhiteCount=' +
IntToStr(nWhiteCount) + ' BlackCount= ' +
IntToStr(nBlackCount)));
end;