#include "ltocr.h"

L_LTOCR_API L_INT EXT_FUNCTION L_OcrPage_HitTestZone(page, point, zoneIndex)

L_OcrPage page; handle to the OCR page
L_POINT point; the test point
L_INT* zoneIndex; address of an L_INT variable to be updated with the zone index at the specified point

Gets the zero-based index of the zone under a certain point.

Parameter Description
page Handle to the OCR page.
point The test point
zoneIndex Address of an L_INT variable to be updated with the zone index at the specified point.


SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


Gets the zero-based index of the zone under a certain point. If no zone is under the test point, 'zoneIndex' parameter will have he value -1.

You can use this method to check whether a zone (either added manually or automatically) is under a given test point. For example, if you have a bitmap in your viewer you had the page zones drawn over the bitmap as rectangles and you wish to allow the user to click with the mouse on the viewer to select and de-select drawn zones, you can use L_OcrPage_HitTestZone.

Required DLLs and Libraries

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: L_OcrPage_Destroy, L_OcrPage_FromBitmap, L_OcrPage_GetBitmap, L_OcrPage_SetBitmap, L_OcrPage_GetOverlayBitmap, L_OcrPage_SetOverlayBitmap, L_OcrPage_SetBitmapChangedCallback, L_OcrPage_IsInverted, L_OcrPage_GetRotateAngle, L_OcrPage_GetDeskewAngle, L_OcrPage_AutoPreprocess, L_OcrPage_AutoZone, L_OcrPage_GetZoneCount, L_OcrPage_InsertZone, L_OcrPage_AddZone, L_OcrPage_IndexOfZone, L_OcrPage_GetZoneAt, L_OcrPage_SetZoneAt, L_OcrPage_RemoveZone, L_OcrPage_RemoveZoneAt, L_OcrPage_ClearZones, L_OcrPage_GetZoneCells, L_OcrPage_SetZoneCells, L_OcrPage_IsRecognized, L_OcrPage_Recognize, L_OcrPage_Unrecognize, L_OcrPage_GetRecognizeStatistics, L_OcrPage_GetRecognizedCharacters, L_OcrPage_SetRecognizedCharacters, L_OcrPage_FreePageCharacters, L_OcrPage_GetZoneWords, L_OcrPage_FreeWords, L_OcrPage_GetText, L_OcrPage_ExtractZoneMICRData, L_OcrPage_DetectLanguages, L_OcrPage_LoadZonesFile, L_OcrPage_SaveZonesFile, L_OcrPage_SaveXml, L_OcrPage_GetAutoPreprocessValues
Topics: Programming with LEADTOOLS OCR Module - LEAD Engine
Starting and Shutting Down the OCR Engine
Recognizing OCR Pages
Working With OCR Pages


// This example assumes you already have a page created and you have WM_LBUTTONDOWN or WM_LBUTTONUP messages taken care of  
// so you can send the test point you wish to check again page zones and then the example will delete the zone under that point. 
L_INT L_OcrPage_HitTestZoneExample(L_OcrPage ocrPage, L_POINT point) 
   L_INT zoneIndex = -1; 
   L_INT retCode = L_OcrPage_HitTestZone(ocrPage, point, &zoneIndex); 
   if(retCode != SUCCESS) 
      return FAILURE; 
   if(zoneIndex >= 0) 
      // we were able to successfully find the zone that includes the user passed point, so delete it. 
      retCode = L_OcrPage_RemoveZoneAt(ocrPage, zoneIndex); 
      if(retCode != SUCCESS) 
         return FAILURE; 
   return SUCCESS; 
Help Version 20.0.2019.3.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.