LBitmapRgn::SetRgnCurve

#include "ltwrappr.h"

virtual L_INT LBitmapRgn::SetRgnCurve(pCurve)

pCURVE pCurve;

/* pointer to a structure */

Creates or updates the region of the class object's associated bitmap by adding a curved region.

Parameter

Description

pCurve

Pointer to the CURVE structure that specifies the curve region. The structure is specified using device context coordinates, and LEADTOOLS translates the coordinates using the values specified in the LBitmapRgn::SetRgnXForm parameter.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To update an existing region, use the LBitmapRgn::SetRgnCombineMode function to specify how the new region is to be combined with the existing one. For descriptions of the possibilities, refer to Creating a Bitmap Region.

Required DLLs and Libraries

LTDIS

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:

LBitmapRgn::CurveToBezier, LBitmapRgn::SetRgnColorHSVRange, LBitmapRgn::SetRgnColorRGBRange, Class Members

Topics:

Raster Image Functions: Creating and Using a Region

 

Raster Image Functions: Region Processing

 

Creating a Bitmap Region

 

Working with the Existing Bitmap Region

 

Saving a Region

Example

L_INT LBitmapRgn__SetRgnCurveExample(LBitmap & Bitmap)
{
   L_INT nRet;
   CURVE curve;
   POINT pt[5];
   L_INT nWidth = Bitmap.GetWidth();
   L_INT nHeight = Bitmap.GetHeight();
   LBitmapRgn Region;
   pt[0].x = nWidth / 4;
   pt[0].y = nHeight / 4;
   pt[1].x = nWidth / 4;
   pt[1].y = 3 * nHeight / 4;
   pt[2].x = 3 * nWidth / 4;
   pt[2].y = 3 * nHeight / 4;
   pt[3].x = nWidth / 2;
   pt[3].y = nHeight / 2;
   pt[4].x = 3 * nWidth / 4;
   pt[4].y = nHeight / 4;
   curve.uStructSize=sizeof(CURVE);
   curve.nType = CURVE_STANDARD;
   curve.nPointCount = sizeof(pt) / sizeof(pt[0]);
   curve.pPoints = pt;
   curve.uFillMode = L_POLY_WINDING;
   curve.dTension = 0.5;
   curve.nClose = CURVE_CLOSE;
   curve.nReserved = 0;
   Region.SetBitmap(&Bitmap);
   nRet =Region.SetRgnCurve(&curve);
   if(nRet !=SUCCESS)
      return nRet;
   nRet =Bitmap.Invert();
   if(nRet !=SUCCESS)
      return nRet;
   nRet =Region.Free();
   if(nRet !=SUCCESS)
      return nRet;
   return SUCCESS;
}