L_OcrPage_HitTestZone

Summary

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

Syntax

#include "ltocr.h"

L_LTOCR_API L_INT EXT_FUNCTION L_OcrPage_HitTestZone(page, point, zoneIndex)

Parameters

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.

Returns

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

Comments

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

See Also

Functions

Topics

Example

// 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 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - LEAD Engine C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.