void MakeCurve(PointF [] points, PointF [] tangents, int offset, int length, CurveType type)
{
MoveTo (points [offset].X, points [offset].Y);
int i = offset;
for (; 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;
context.AddCurveToPoint (x1, y1, x2, y2, x3, y3);
}
if (type == CurveType.Close) {
/* complete (close) the curve using the first point */
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;
context.AddCurveToPoint (x1, y1, x2, y2, x3, y3);
context.ClosePath ();
}
}