This metafile command draws a connected sequence of lines.
class MetaDrawSplines : public Meta { public: Rectangle Bounds; unsigned Count; Point Points[1]; Point& operator()(unsigned Index); };
Bounds | The bounding Rectangle (in device units) |
Count | The number of points defining the curve sequence. This should be one more than three times the number of curves in the sequence. Each curve requires two control points and an end point (that is, 3 points) with the first curve requiring a starting point as well. |
Points | An array of points defining the connected cubic curves to be drawn. |
A Bezier Spline is a cubic curve defined by control points.
The current position is neither used or updated.
Lines are drawn using the current pen.
The following diagram illustrates the specification of two smoothly joined cubic curves.
The array of points defining the illustrated cubic is specifed as:
// current position == starting position == assumed (0,0) Point points[] = { Point(0,150), // first control Point of first Curve Point(150,0), // Second control Point of first Curve Point(150,150), // end of first Curve and start of second Curve. Point(150,300), // first control Point of second Curve Point(0,150), // Second control Point of second Curve Point(0,300) }; // Ending Point of second Curve
A cubic is defined by specifying the starting and ending points and the gradient at these points. When defining multiple cubics, the points are in groups of three (except when explicity specifying the starting position of the first cubic; where, the first Point is the starting position of the curve sequence and the next three points form the first group). The starting Point of the second cubic is the ending point of the first cubic; and so the second group of three points are the two control points and ending point of the second cubic.
As can be seen in the above illustration, the dotted lines defined by the control points are tangential to the resulting cubic curves (red for the first cubic and green for the second cubic). Because the points (150,0), (150,150) and (150,300) are collinear, the two cubics connect smoothly (and if they were not collinear the connection would not be smooth (i.e. first derivative discontinuous at that point)).
See related C functions