MetaDrawSplinesTo


This metafile command draws a connected sequence of bezier curves.

class MetaDrawSplinesTo : 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 three times the number of curves in the sequence. Each curve requires two control points and an end point (that is, 3 points). The first curve begins at the current position in the device context.
Points An array of points defining the connected cubic curves to be drawn.

Notes

A Bezier spline is a cubic curve defined by control points.

The current position is updated to be at the end of the last curve.

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:

Point points[] = { Point(0,0),      // Starting Point of first Curve
                   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