L_SetBitmapRgnCurve

#include "l_bitmap.h"

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

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

pRGNXFORM pXForm;

/* pointer to a coordinate-translation structure */

pCURVE pCurve;

/* pointer to a structure */

L_UINT uCombineMode;

/* action to take regarding the existing region */

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

Parameter

Description

pBitmap

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

pXForm

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

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.

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.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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

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.

Platforms

Windows 95 / 98 / Me, Windows 2000 / XP.

See Also

Functions:

L_SetBitmapRgnColor, L_SetBitmapRgnEllipse, L_SetBitmapRgnPolygon, L_SetBitmapRgnRect, L_SetBitmapRgnRoundRect, L_SetBitmapRgnColorHSVRange, L_SetBitmapRgnColorRGBRange

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

//This sample creates a smooth region that goes through five points, and inverts the region
L_INT SampleSetBitmapRgnCurve(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);
   
   //Do something with the region
   L_InvertBitmap(pBitmap);
   
   //When finished, free the region
   L_FreeBitmapRgn(pBitmap);
   
   return nRet;
}