L_GetRgnContourPoints

#include "l_bitmap.h"

L_LTIMGEFX_API L_INT L_GetRgnContourPoints (pBitmap, pXForm, ppPoints, puSize, uFlags)

Returns the contour coordinates of a region.

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle.

pRGNXFORM pXForm

Pointer to an RGNXFORM structure that LEADTOOLS uses to translate between display coordinates and bitmap coordinates.

If you specify NULL in this parameter, the scalar fields default to 1, the offsets default to 0, and the view perspective defaults to the bitmap's view perspective.

POINT **ppPoints

Pointer to a pointer to be updated with an array that contains the coordinate points of the contour for the specified region. A memory buffer for this array is allocated by the function. When the array is no longer needed, the user should free it by calling the GlobalFreePtr macro.

L_UINT *puSize

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

L_UINT uFlags

Flag that indicates the required contour points. Possible values are:

Value Meaning
RGNCONTOUR_ALL [0x0000] Gets all region contour points ignoring their order.
RGNCONTOUR_OUTSIDE [0x0001] Gets the outside region contour points only in an ordered way that allows you to reconstruct the outside region shape from these points.

Returns

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

Comments

This function works only on bitmaps having a region. If a bitmap does not have a region the function returns the error: Not Initialized.

To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available in the Document and Medical Imaging toolkits.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT GetRgnContourPointsExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle for the image */ 
   RECT rcRect;  
   POINT        * pPoints;  
   L_UINT uSize;  
   /* Load a bitmap at its own bits per pixel */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);  
   if(nRet !=SUCCESS) 
      return nRet; 
   rcRect.top = LeadBitmap.Height/3;  
   rcRect.bottom = LeadBitmap.Height*2/3;  
   rcRect.left = LeadBitmap.Width/3;  
   rcRect.right = LeadBitmap.Width*2/3;  
   nRet = L_SetBitmapRgnEllipse (&LeadBitmap, NULL, &rcRect, L_RGN_SET);  
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet = L_GetRgnContourPoints (&LeadBitmap, NULL, &pPoints, &uSize, RGNCONTOUR_ALL); 
   if(nRet !=SUCCESS) 
      return nRet; 
    
   //free bitmap  
   if(LeadBitmap.Flags.Allocated)   
      L_FreeBitmap(&LeadBitmap);   
   return SUCCESS; 
} 
Help Version 20.0.2019.9.22
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help