public void DeviceToUser(ref double x, ref double y) { Cairo.Matrix inv = (Cairo.Matrix) this.transformMatrix.Clone(); Cairo.Status cs = inv.Invert(); if (cs == Cairo.Status.Success) { inv.TransformPoint(ref x, ref y); } else { throw new Exception("Unable to transform device coordinates to user coordinates because the matrix was uninvertible (" + cs.ToString() + ")."); } }
public static List<List<IntPoint>> Transform(List<List<IntPoint>> selection, Matrix transform) { List<List<IntPoint>> newPolygons = new List<List<IntPoint>> (); foreach (List<IntPoint> ipL in selection) { List<IntPoint> newPolygon = new List<IntPoint> (); foreach (IntPoint ip in ipL) { double x = ip.X; double y = ip.Y; transform.TransformPoint (ref x, ref y); newPolygon.Add (new IntPoint ((long)x, (long)y)); } newPolygons.Add (newPolygon); } return newPolygons; }