Graphics::DrawClosedCurve(constPen*,constPointF*,INT,REAL) method (gdiplusgraphics.h)

The Graphics::DrawClosedCurve method draws a closed cardinal spline.

Syntax

Status DrawClosedCurve(
  [in] const Pen    *pen,
  [in] const PointF *points,
  [in] INT          count,
  [in] REAL         tension
);

Parameters

[in] pen

Type: const Pen*

Pointer to a pen that is used to draw the closed cardinal spline.

[in] points

Type: const PointF*

Pointer to an array of PointF objects that specify the coordinates of the closed cardinal spline. The array of PointF objects must contain a minimum of three elements.

[in] count

Type: INT

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

[in] tension

Type: REAL

Real number that specifies how tightly the curve bends through the coordinates of the closed cardinal spline.

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

Each ending point is the starting point for the next cardinal spline. In a closed cardinal spline, the curve continues through the last point in the points array and connects with the first point in the array.

Examples

The following example draws a closed cardinal spline.


VOID Example_DrawClosedCurve4(HDC hdc)
{
   Graphics graphics(hdc);

   // Define a Pen object and an array of PointF objects.
   Pen greenPen(Color(255, 0, 0, 255), 3);
   PointF point1(100.0f, 100.0f);
   PointF point2(200.0f, 50.0f);
   PointF point3(400.0f, 10.0f);
   PointF point4(500.0f, 100.0f);
   PointF point5(600.0f, 200.0f);
   PointF point6(700.0f, 400.0f);
   PointF point7(500.0f, 500.0f);

   PointF curvePoints[7] = {
      point1,
      point2,
      point3,
      point4,
      point5,
      point6,
      point7};

   // Draw the closed curve.
   graphics.DrawClosedCurve(&greenPen, curvePoints, 7, 1.0);

   // Draw the points in the curve.
   SolidBrush redBrush(Color(255, 255, 0, 0));
   graphics.FillEllipse(&redBrush, Rect(95, 95, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(495, 95, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(495, 495, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(195, 45, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(395, 5, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(595, 195, 10, 10));
   graphics.FillEllipse(&redBrush, Rect(695, 395, 10, 10));
}

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 gdiplusgraphics.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Cardinal Splines

DrawCurve Methods

Drawing Cardinal Splines

FillClosedCurve Methods

Graphics

Pen

PointF