AdvancedLauncher.Tools.Extensions.PresentationSourceExtensions.GetVisualTransform C# (CSharp) Метод

GetVisualTransform() приватный статический Метод

Gets the matrix that will convert a point from "above" the coordinate space of a visual into the the coordinate space "below" the visual.
private static GetVisualTransform ( Visual v ) : System.Windows.Media.Matrix
v Visual
Результат System.Windows.Media.Matrix
        private static Matrix GetVisualTransform(Visual v)
        {
            Matrix m = Matrix.Identity;

            // A visual can currently have two properties that affect
            // its coordinate space:
            //    1) Transform - any matrix
            //    2) Offset - a simpification for just a 2D offset.
            Transform transform = VisualTreeHelper.GetTransform(v);
            if (transform != null) {
                Matrix cm = transform.Value;
                m = Matrix.Multiply(m, cm);
            }

            Vector offset = VisualTreeHelper.GetOffset(v);
            m.Translate(offset.X, offset.Y);

            return m;
        }