#include "ltsgm.h"
L_LTSGM_API L_INT L_MrcCreateNewSegment(hSegment, pBitmap, pSegment)
Manually adds a new segment and sets the segment information.
An existing segmentation handle. This handle is obtained by calling the L_MrcStartBitmapSegmentation function.
Pointer to the bitmap in which the segment will be created.
Pointer to the SEGMENTDATA structure that contains the segment information.
| Value | Meaning |
|---|---|
| >= 0 | Index of the newly added segment. The function was successful. |
| < 0 | An error occurred. Refer to Return Codes. |
Use this function to manually add a new segment using the coordinates and type specified in pSegment.
Call the L_MrcStartBitmapSegmentation function before using any of the segmentation functions. When the handle to the segmentation is no longer needed, free it by calling the L_MrcStopBitmapSegmentation function.
Required DLLs and Libraries
Manual segmentation example.
L_INT MrcCreateNewSegmentExample(pBITMAPHANDLE pBitmap){L_INT nRet;HSEGMENTATION hSegmentation;SEGMENTDATA Segment;/* start the segmentation process */nRet = L_MrcStartBitmapSegmentation (&hSegmentation, pBitmap, RGB(255, 255, 255), RGB(0, 0, 0));if (nRet != SUCCESS)return nRet;memset(&Segment, 0, sizeof(SEGMENTDATA));Segment.uStructSize = sizeof(SEGMENTDATA);SetRect(&Segment.rcBitmapSeg, 20, 20, 60, 60);Segment.uType = SEGTYPE_PICTURE;/* Create a new segment */nRet = L_MrcCreateNewSegment(hSegmentation, pBitmap, &Segment);if (nRet < 0)return nRet;/* End the segmentation process */nRet = L_MrcStopBitmapSegmentation (hSegmentation);if (nRet != SUCCESS)return nRet;return SUCCESS;}