LBitmapRgn::CurveToBezier - Raster imaging C++ Class Library Help

LBitmapRgn::CurveToBezier

#include "ltwrappr.h"

virtual L_INT LBitmapRgn::CurveToBezier(pCurve, pOutPointCount, pOutPoint)

pCURVE pCurve;

pointer to a structure

L_INT * pOutPointCount;

pointer to a variable

POINT * pOutPoint;

pointer to an array of structures

Converts a curve (defined by an array of points that the curve passes through) to an array of Bezier points. The resulting array can be used to with the Windows GDI PolyBezier and PolyBezierTo.

Parameter

Description

pCurve

Pointer to a CURVE structure that defines a curve.

pOutPointCount

Pointer to a variable to be updated with the number of Bezier control points.

pOutPoint

Pointer to an array of POINT structures to be updated with the Bezier control points.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function is used to convert a standard curve to an array of Bezier control points. A LEAD standard curve (CURVE_STANDARD) is defined by the CURVE structure, and one of the fields is an array of POINT structures. The standard curve passes through all of the points in the array, and is continuous at each point. This function can be used to draw this curve by converting it to an array of Bezier points, and using the Windows GDI PolyBezier (or PolyBezierTo) to draw the equivalent Bezier.

To use this function, declare a variable of type CURVE, and fill in the appropriate fields. For this function, all fields of the CURVE structure are required EXCEPT uFillMode, which is ignored. For more information, refer to the CURVE structure.

The pOutPoint must point to an array of POINT structures that is large enough to hold the Bezier control points. At most, the resulting array must hold (3n + 1) entries, where n is the number of points in the CURVE_STANDARD curve. If this function is called with pOutPoint set to NULL, pOutPointCount will be updated with the required number of entries in the pOutPoint array.

Note: It is not necessary to have a bitmap associated with the class object to use the function.

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

Win32, x64.

See Also

Functions:

LBItmapRgn::SetRgnCurve, Class Members

Topics:

Raster Image Functions: Creating and Using a Region

 

Raster Image Functions: Region Processing

 

Converting Curves

Example

L_INT LBitmapRgn__CurveToBezierExample(HDC hDC, pCURVE pCurve) 
{ 
   L_INT nRet; 
   L_INT nBezierPointsCount; 
   POINT * pBezierPoints; 
   LBitmapRgn Region; 
   int nPrevROP2; 
 
   // Determine the required number of POINT structures 
   nRet =Region.CurveToBezier(pCurve, &nBezierPointsCount, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   pBezierPoints = new POINT[nBezierPointsCount]; 
   // Get the Bezier points 
   nRet =Region.CurveToBezier(pCurve, &nBezierPointsCount, pBezierPoints); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nPrevROP2 = SetROP2(hDC, R2_NOT); 
   // Draw the curve 
   nRet =PolyBezier(hDC, pBezierPoints, nBezierPointsCount); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =SetROP2(hDC, nPrevROP2); 
   if(nRet < SUCCESS) 
      return nRet; 
   delete [] pBezierPoints; 
 
   return SUCCESS; 
} 
Help Version 20.0.2018.6.22
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help