public static D3Matrix FroMatrix(System.Windows.Media.Matrix matrix) { var result = new D3Matrix() { M11 = matrix.M11, M12 = matrix.M12, M13 = 0, M21 = matrix.M21, M22 = matrix.M22, M23 = 0, M31 = matrix.OffsetX, M32 = matrix.OffsetY, M33 = 1 }; return(result); }
public MatixTransformViewModel() { AddCommand = new DelegateCommand(AddD3Matrix); RemoveCommand = new DelegateCommand <D3Matrix>(RemoveD3Matrix); ApplyCommand = new DelegateCommand(ApplyD3Matrixs); CurrentRectangle = new Rectangle() { Width = 100, Height = 100, Stroke = Brushes.Coral }; D3Matrixs = new ObservableCollection <D3Matrix>(); D3Matrixs.Add(D3Matrix.FroMatrix(System.Windows.Media.Matrix.Identity)); D3Matrixs.Add(D3Matrix.FroMatrix(System.Windows.Media.Matrix.Identity)); Shapes = new ObservableCollection <Shape>(); Shapes.Add(CurrentRectangle); }
private void AddD3Matrix() { D3Matrixs.Add(D3Matrix.FroMatrix(System.Windows.Media.Matrix.Identity)); }
private void RemoveD3Matrix(D3Matrix obj) { D3Matrixs.Remove(obj); }