LSegment::MrcCreateNewSegment

#include "ltwrappr.h"

L_INT LSegment::MrcCreateNewSegment(pBitmap, pSegment)

LBitmapBase * pBitmap;

/* pointer to an LBitmapBase object */

pSEGMENTDATA pSegment;

/* segment information */

Manually adds a new segment to a specific stripe and sets the segment information.

Parameter

Description

pBitmap

Pointer to an LBitmapBase object that references the bitmap in which the segment will be created.

pSegment

Pointer to the SEGMENTDATA structure that contains the segment information.

Returns

>= 0

Index of the newly added segment.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

Required DLLs and Libraries

LTSGM

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Elements:

LSegment::MrcStartBitmapSegmentation, LSegment::MrcStopBitmapSegmentation, LSegment::MrcEnumSegments, LSegment::MrcSaveSegmentation, LSegment::MrcLoadSegmentation, LSegment::MrcCopySegmentationHandle, LSegment::MrcSegmentBitmap, LSegment::MrcSetSegmentData, LSegment::MrcDeleteSegment, Class Members

Topics:

General Segmentation

 

Manual Segmentation

Example

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;
}