Manually adds a new segment to a specific stripe and sets the segment information.
#include "ltwrappr.h"
L_INT LSegment::MrcCreateNewSegment(pBitmap, pSegment)
Pointer to an LBitmapBase object that references 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. |
< 1 | 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 LSegment::MrcStartBitmapSegmentation function before using any of the segmentation functions. When the LSegment class object is no longer needed, free it by calling the LSegment::MrcStopBitmapSegmentation function.
The following example illustrates the use of LSegment::MrcCreateNewSegment in performing manual segmentation.
L_INT LSegment__MrcCreateNewSegmentExample(LBitmapBase & Bitmap)
{
LSegment Segment;
SEGMENTDATA SegData;
L_INT nRet;
// Initialize the segmentation process
nRet = Segment.MrcStartBitmapSegmentation(&Bitmap,
RGB(255, 255, 255),
RGB(0, 0, 0));
if(nRet != SUCCESS)
return nRet;
SegData.uStructSize = sizeof(SEGMENTDATA);
SegData.rcBitmapSeg.left = 20;
SegData.rcBitmapSeg.top = 20;
SegData.rcBitmapSeg.right = 60;
SegData.rcBitmapSeg.bottom = 60;
SegData.uType = SEGTYPE_PICTURE;
// Add a segment to the stripe just set
nRet = Segment.MrcCreateNewSegment(&Bitmap, &SegData);
if(nRet < 1)
return nRet;
// Clean up
nRet = Segment.MrcStopBitmapSegmentation();
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}