L_Doc2GetZoneNodes

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2GetZoneNodes(hDoc, nPageIndex, nZoneIndex, ppPoints, pnNodesCount)

Gets the polygon of the user zone.

Parameters

L_HDOC2 hDoc

Handle to the OCR document. This handle is obtained by calling the L_Doc2StartUp function.

L_INT nPageIndex

Index of the page. This is a zero-based index.

L_INT nZoneIndex

Index of the zone. This is a zero-based index.

PPOINT * ppPoints

Address of an array of POINT structures to be updated with polygon points

L_INT * pnNodesCount

Address of a variable to be updated with the number of polygon points.

Returns

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

Comments

This function retrieves a polygon, which consists of the vertices of a user zone. This can be useful for an application with a GUI when drawing irregular zones.

✎ NOTE

This function will not work for OMR zones, because OMR zones should have a regular shape.

To use the function properly:

  1. Call it with passing NULL to ppPoints to get the number of polygon points.
  2. Allocate an array of POINT structures using the obtained number.
  3. Call it a second time with passing the address of the allocated array to the ppPoints parameter to obtain the polygon points.

To add a user zone, call the L_Doc2AddZone / L_Doc2AddZoneExt function. To add rectangle(s) to a user zone to make its shape irregular, call the L_Doc2AddZoneRect / L_Doc2AddZoneRectExt function.

To get zone rectangles, call the L_Doc2GetZoneLayout / L_Doc2GetZoneLayoutExt function. To set zone rectangles call the L_Doc2SetZoneLayout / L_Doc2SetZoneLayoutExt function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT Doc2ZoneNodesExample(L_HDOC2 hDoc, L_INT nPageIndex, L_INT nZoneIndex) 
{ 
   L_INT nRet; 
 
   L_INT nNodesCount; 
   POINT * pNodes = NULL; 
   nRet = L_Doc2GetZoneNodes(hDoc, nPageIndex, nZoneIndex, NULL, &nNodesCount); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   pNodes = (POINT *)GlobalAllocPtr(GHND, sizeof(POINT) * nNodesCount); 
   nRet = L_Doc2GetZoneNodes(hDoc, nPageIndex, nZoneIndex, &pNodes, &nNodesCount); 
   if (nRet != SUCCESS) 
   { 
      GlobalFreePtr(pNodes); 
      return nRet; 
   } 
 
   L_TCHAR szBuffer[100]; 
 
   for(int i=0; i<nNodesCount; i++) 
   { 
      memset(szBuffer, 0, sizeof(szBuffer)); 
      wsprintf(szBuffer, TEXT("Zone Nodes # %d\nx = %d\ny = %d\n"), 
         i, 
         pNodes[i].x, 
         pNodes[i].y); 
 
      MessageBox(NULL, szBuffer, TEXT("Notice"), MB_OK); 
   } 
 
   GlobalFreePtr(pNodes); 
   return SUCCESS; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help