GraphicsPath::AddCurve(constPoint*,INT,REAL) method (gdipluspath.h)

The GraphicsPath::AddCurve method adds a cardinal spline to the current figure of this path.

Syntax

Status AddCurve(
  [in] const Point *points,
  [in] INT         count,
  [in] REAL        tension
);

Parameters

[in] points

Type: const Point*

Pointer to an array of points that define the cardinal spline. The cardinal spline is a curve that passes through each point in the array.

[in] count

Type: INT

Integer that specifies the number of elements in the points array.

[in] tension

Type: REAL

Nonnegative real number that controls the length of the curve and how the curve bends. A value of 0 specifies that the spline is a sequence of straight line segments. As the value increases, the curve becomes fuller.

Return value

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Remarks

You should keep a copy of the points array if those points will be needed later. The GraphicsPath object does not store the points passed to the AddClosedCurve method; instead, it converts the cardinal spline to a sequence of Bézier splines and stores the points that define those Bézier splines. You cannot retrieve the original array of points from the GraphicsPath object.

Examples

The following example creates a GraphicsPath object and calls the GraphicsPath::AddCurve method to add a cardinal spline to the path. The third argument passed to GraphicsPath::AddCurve specifies the tension for the cardinal spline.

VOID AddCurveExample(HDC hdc)
{
   Graphics graphics(hdc);
   Point pts[] = {Point(50, 50),
                  Point(60, 20),
                  Point(70, 100),
                  Point(80, 50)};
   GraphicsPath path;
   path.AddCurve(pts, 4);
   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);   
}
Color(255, 255, 0,  0)

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdipluspath.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

AddBezier Methods

AddBeziers Methods

AddClosedCurve Methods

AddCurve Methods

Cardinal Splines

Clipping with a Region

Constructing and Drawing Paths

Creating a Path Gradient

Drawing Cardinal Splines

GraphicsPath

Paths

Point