|
Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_GetRgnPerimeterLength
#include "l_bitmap.h"
L_LTIMGEFX_API L_INT L_GetRgnPerimeterLength (pBitmap, pXForm, puLength, uFlags)
|
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
|
pRGNXFORM pXForm; |
/* pointer to a coordinate-translation structure */ |
|
L_SIZE_T *puLength; |
/* pointer to a variable to be updated */ |
|
L_UINT32 uFlags; |
/* flags*/ |
Computes the length of the perimeter of a region.
|
Parameter |
Description |
|
pBitmap |
Pointer to the bitmap handle. |
|
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. |
|
puLength |
Address of a variable to be updated with the perimeter length of the region. The length is expressed in pixels. |
|
uFlags |
Reserved for future use. Must be 0. |
Returns
|
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
|
LTIMGEFX For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 2000 / XP/Vista.
See Also
Example
#if defined (LEADTOOLS_V16_OR_LATER)
L_INT GetRgnPerimeterLengthExample(L_VOID)
{
L_INT nRet;
BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */
RECT rcRect;
L_SIZE_T uPerimeter;
/* Load a bitmap at its own bits per pixel */
nRet = L_LoadBitmap (TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\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_GetRgnPerimeterLength(&LeadBitmap, NULL, &uPerimeter, 0);
if(nRet !=SUCCESS)
return nRet;
//free bitmap
if(LeadBitmap.Flags.Allocated)
L_FreeBitmap(&LeadBitmap);
return SUCCESS;
}
#else
L_INT GetRgnPerimeterLengthExample(L_VOID)
{
L_INT nRet;
BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */
RECT rcRect;
L_SIZE_T uPerimeter;
/* Load a bitmap at its own bits per pixel */
nRet = L_LoadBitmap (TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\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_GetRgnPerimeterLength(&LeadBitmap, NULL, &uPerimeter);
if(nRet !=SUCCESS)
return nRet;
//free bitmap
if(LeadBitmap.Flags.Allocated)
L_FreeBitmap(&LeadBitmap);
return SUCCESS;
}
#endif // LEADTOOLS_V16_OR_LATER