Creates or updates the bitmap region by adding a curved region.


#include "l_bitmap.h"

L_LTDIS_API L_INT L_SetBitmapRgnCurve(pBitmap, pXForm, pCurve, uCombineMode)



Pointer to the bitmap handle referencing the bitmap where the region is to be created or updated.


Pointer to an RGNXFORM structure that LEADTOOLS uses to translate between display coordinates and bitmap coordinates.

If you specify NULL in this parameter, the scalar fields default to 1, the offsets default to 0, and the view perspective defaults to the bitmap's view perspective.

pCURVE pCurve

Pointer to the CURVE structure that specifies the curve region. You specify the structure using device context coordinates, and LEADTOOLS translates the coordinates using the values specified in the pXForm parameter.

L_UINT uCombineMode

Flag that indicates the action to take regarding the existing bitmap region, if one is defined. For descriptions of the possible values, refer to Creating a Bitmap Region.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


Before calling this function, declare an RGNXFORM structure and set its values, which LEADTOOLS uses to translate between device context coordinates and bitmap coordinates. For details about how the structure works refer to the RGNXFORM structure description. For a description of common usage, refer to Translating Coordinates for a Bitmap Region.

To update an existing region, specify how the new region is to be combined with the existing one, in the uCombineMode parameter. For descriptions of the possibilities, refer to Creating a Bitmap Region.

Required DLLs and Libraries


Win32, x64.

See Also




This sample creates a smooth region that goes through five points, and inverts the region.

L_INT SetBitmapRgnCurveExample(pBITMAPHANDLE pBitmap) 
   L_INT nRet; 
   CURVE Curve; 
   POINT points[5]; 
   //Define the points of the curve 
   points[0].x = 30; 
   points[0].y = 30; 
   points[1].x = 30; 
   points[1].y = 200; 
   points[2].x = 130; 
   points[2].y = 130; 
   points[3].x = 75; 
   points[3].y = 75; 
   points[4].x = 130; 
   points[4].y = 30; 
   Curve.uStructSize = sizeof(CURVE); 
   Curve.nType = CURVE_STANDARD; 
   Curve.nPointCount = 5; 
   Curve.pPoints = points; 
   Curve.uFillMode = L_POLY_WINDING; 
   Curve.dTension = 0.5; 
   Curve.nClose = CURVE_CLOSE; 
   Curve.nReserved = 0; 
   nRet = L_SetBitmapRgnCurve(pBitmap, NULL, &Curve, L_RGN_SET); 
   if (nRet != SUCCESS) 
      return nRet; 
   //Do something with the region 
   nRet = L_InvertBitmap(pBitmap, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   //When finished, free the region 
   return L_FreeBitmapRgn(pBitmap); 

Help Version 22.0.2023.7.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.