Graphics::DrawCurve(constPen*,constPoint*,INT,INT,INT,REAL) method (gdiplusgraphics.h)
The Graphics::DrawCurve method draws a cardinal spline.
Syntax
Status DrawCurve(
[in] const Pen *pen,
[in] const Point *points,
[in] INT count,
[in] INT offset,
[in] INT numberOfSegments,
[in] REAL tension
);
Parameters
[in] pen
Type: const Pen*
Pointer to a pen that is used to draw the cardinal spline.
[in] points
Type: const Point*
Pointer to an array of Point objects that specify the coordinates that the cardinal spline passes through.
[in] count
Type: INT
Integer that specifies the number of elements in the points array.
[in] offset
Type: INT
Integer that specifies the element in the points array that specifies the point at which the cardinal spline begins.
[in] numberOfSegments
Type: INT
Integer that specifies the number of segments in the cardinal spline.
[in] tension
Type: REAL
Real number that specifies how tightly the curve bends through the coordinates of the 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
A segment is defined as a curve that connects two consecutive points in the cardinal spline. The ending point of each segment is the starting point for the next. The numberOfSegments parameter must not be greater than the count parameter minus the offset parameter plus one.
Examples
The following example draws a cardinal spline.
VOID Example_DrawCurve2(HDC hdc)
{
Graphics graphics(hdc);
// Define a Pen object and an array of Point objects.
Pen greenPen(Color::Green, 3);
Point point1(100, 100);
Point point2(200, 50);
Point point3(400, 10);
Point point4(500, 100);
Point curvePoints[4] = {
point1,
point2,
point3,
point4};
Point* pcurvePoints = curvePoints;
// Specify offset, number of segments to draw, and tension.
int offset = 1;
int segments = 2;
REAL tension = 1.0;
// Draw the curve.
graphics.DrawCurve(&greenPen, curvePoints, 4, offset, segments, tension);
//Draw the points in the curve.
SolidBrush redBrush(Color::Red);
graphics.FillEllipse(&redBrush, Rect(95, 95, 10, 10));
graphics.FillEllipse(&redBrush, Rect(195, 45, 10, 10));
graphics.FillEllipse(&redBrush, Rect(395, 5, 10, 10));
graphics.FillEllipse(&redBrush, Rect(495, 95, 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 |