static public void TransformPoints(PointF[] points, PointF origin, bool diagonal, bool horizontal, bool vertical)
{
Matrix translate = new Matrix();
Matrix rotate = new Matrix();
// Put the points into origin/local space
translate.Translate(-origin.X, -origin.Y);
translate.TransformPoints(points);
// Apply the flips/rotations (order matters)
if (horizontal)
{
Matrix h = new Matrix(-1, 0, 0, 1, 0, 0);
rotate.Multiply(h);
}
if (vertical)
{
Matrix v = new Matrix(1, 0, 0, -1, 0, 0);
rotate.Multiply(v);
}
if (diagonal)
{
Matrix d = new Matrix(0, 1, 1, 0, 0, 0);
rotate.Multiply(d);
}
// Apply the combined flip/rotate transformation
rotate.TransformPoints(points);
// Put points back into world space
translate.Invert();
translate.TransformPoints(points);
}