CURVE

typedef struct tagCurve
{
   L_UINT uStructSize; 
   L_INT32 nType;
   L_INT32 nPointCount;
   POINT *pPoints;
   L_UINT uFillMode;
   L_DOUBLE dTension;
   L_INT nClose;
   L_INT32 nReserved;
} CURVE, L_FAR * pCURVE;

The CURVE structure defines a curve for the L_SetBitmapRgnCurve function and the L_CurveToBezier function.

Member

Description

uStructSize

Size of this structure in bytes, for versioning. Use the sizeof() macro to calculate this value.

nType

Flag that indicates the type of curve defined. Possible values are:

 

Value

Meaning

 

CURVE_BEZIER

The points specified in the pPoints field define a Bezier curve.

 

CURVE_STANDARD

The points specified in the pPoints field define a standard curve.

nPointCount

Number of points in the pPoints array.

 

If nType is CURVE_BEZIER, nPointCount must be 3n + 1, where n >= 1. For example, nPointCount can be 4, 7, 10, 13, and so on.

 

If nType is CURVE_STANDARD, nPointCount must be greater than or equal to 3. For example, nPointCount can be 3, 4, 5, 6, and so on.

pPoints

Pointer to an array of POINT structures that contain the points that define the curve.

uFillMode

Flag that indicates how to handle complex crossing lines. The following are valid values, which are illustrated below:

 

Value

Meaning

 

L_POLY_WINDING

[0] All pixels that are inside the resulting exterior lines are in the region.

 

L_POLY_ALTERNATE

[1] The region includes the area between odd-numbered and even-numbered polygon sides on each scan line.

 

 

image\starcurve8.gif

dTension

Value that indicates the "straightness" of the curves that connect points. This value is used only when nType is CURVE_STANDARD. Valid values are between 0.0 and 1.0, where 0.0 indicates straight lines, and 1.0 indicates lines with the highest curvature. A typical value for dTension is 0.5.

 

image\Tension.gif

nClose

Value that indicates how the curve is closed. This value is used only when nType is CURVE_STANDARD. Possible values are:

 

Value

Meaning

 

CURVE_NO_CLOSE

[0x0] For n points, draw (n – 3) segments. For example, for points {P0, P1, P2, P3, P4}, draw segments P1P2 and P2P3.

 

CURVE_CLOSE

[0x1] For n points draw (n) segments. For example, for points {P0, P1, P2, P3, P4}, draw segments P0P1, P1P2, P2P3, P3P4, P4P0.

 

CURVE_PARTIAL_CLOSE

[0x2] For n points draw (n – 1) segments. For example, for points {P0, P1, P2, P3, P4}, draw segments P0P1, P1P2, P2P3, P3P4 (but not P4P0).

 

In the following diagram, the resulting region is shown in gray.

 

image\CurveClose.gif

nReserved

Reserved for future use.

Comments

The CURVE structure is used by the L_SetBitmapRgnCurve function to draw a curve using an array of POINT items. It is also used by the L_CurveToBezier function to convert a curve to a Bezier. The CURVE structure can define two types of curves:

image\sqrblit.gif nType is CURVE_STANDARD: A smooth curve that goes through all of the points. In this case, nPointCount must be at least three.

image\sqrblit.gif nType is CURVE_BEZIER: A series of Bezier curves that use the points as control points. In this case, nPointCount must be 3n + 1, where n >= 1. For example, nPointCount can be 4, 7, 10, 13, and so on. The first four points define the first Bezier curve, and each subsequent group of three points defines the next Bezier curve, using the last point of the previous Bezier curve as the starting point.

Some functions which take this structure as a parameter require that the structure be initialized prior to the function call. You must set the uStructSize member to the total size, in bytes, of the structure. Use the sizeof() macro to calculate this value. Functions that do not require the structure be initialized will take the total size of the structure, in bytes, as an additional function parameter.