L_MrcCreateNewSegment

#include "ltsgm.h"

L_LTSGM_API L_INT L_MrcCreateNewSegment(hSegment, pBitmap, pSegment)

HSEGMENTATION hSegment;

/* segmentation handle */

pBITMAPHANDLE pBitmap;

/* pointer to a bitmap handle */

pSEGMENTDATA pSegment;

/* pointer to a structure */

Manually adds a new segment and sets the segment information.

Parameter

Description

hSegment

An existing segmentation handle. This handle is obtained by calling the L_MrcStartBitmapSegmentation function.

pBitmap

Pointer to 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. The function was successful.

< 0

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

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

Functions:

L_MrcStartBitmapSegmentation, L_MrcStopBitmapSegmentation, L_MrcEnumSegments, L_MrcSaveSegmentation, L_MrcLoadSegmentation, L_MrcCopySegmentationHandle, L_MrcSegmentBitmap

Topics:

Manual Segmentation

 

MRC Bitmap Functions: Manual Segmentation

Example

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