CURVE
typedef struct tagCurve
{
L_UINT uStructSize;
L_INT nType;
L_INT nPointCount;
L_POINT *pPoints;
L_UINT uFillMode;
L_DOUBLE dTension;
L_INT nClose;
L_INT nReserved;
} CURVE, * pCURVE;
The CURVE structure defines a curve for the LBitmapRgn::SetRgnCurve function and the LBitmapRgn::CurveToBezier function.
Member |
Description |
|
uStructSize |
Size of the structure. This must be set before passing this structure to the LEAD functions. |
|
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. (Catmull-Rom) |
|
CURVE_NATURAL_CUBIC_SPLINE |
The points specified in the pPoints field define a standard curve (Natural Cubic Spline) |
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 or CURVE_NATURAL_CUBIC_SPLINE, 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 L_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. |
|
||
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. |
|
|
||
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. |
|
|
||
nReserved |
Reserved for future use. |
Comments
The CURVE structure is used by the LBitmapRgn::SetRgnCurve function to draw a curve using an array of POINT items. It is also used by the LBitmapRgn::CurveToBezier function to convert a curve to a Bezier. The CURVE structure can define three types of curves:
nType is CURVE_STANDARD: A smooth curve that goes through all of the points. In this case, nPointCount must be at least three.
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.
nType is CURVE_NATURAL_CUBIC_SPLINE: A smooth curve that passes through all of the points. The field nPointCount must be at least three. This differs from CURVE_STANDARD (Catmull-Rom) in that moving one point causes all curve segments to change. For the CURVE_STANDARD, moving one point affects only the adjacent curve segments.