void AppendCurve(PointF [] points, PointF [] tangents, int offset, int length, CurveType type)
{
PathPointType ptype = ((type == CurveType.Close) || (points.Length == 0)) ? PathPointType.Start : PathPointType.Line;
int i;
AppendPoint (points [offset], ptype, true);
for (i = offset; i < offset + length; i++) {
int j = i + 1;
float x1 = points [i].X + tangents [i].X;
float y1 = points [i].Y + tangents [i].Y;
float x2 = points [j].X - tangents [j].X;
float y2 = points [j].Y - tangents [j].Y;
float x3 = points [j].X;
float y3 = points [j].Y;
AppendBezier (x1, y1, x2, y2, x3, y3);
}
/* complete (close) the curve using the first point */
if (type == CurveType.Close) {
float x1 = points [i].X + tangents [i].X;
float y1 = points [i].Y + tangents [i].Y;
float x2 = points [0].X - tangents [0].X;
float y2 = points [0].Y - tangents [0].Y;
float x3 = points [0].X;
float y3 = points [0].Y;
AppendBezier (x1, y1, x2, y2, x3, y3);
CloseFigure ();
}
}