コード例 #1
0
        /// <summary>
        /// Get the transformations
        /// </summary>
        /// <param name="transformType">Type of transform type</param>
        /// <param name="parameters">The transform parameters</param>
        /// <returns>The transform</returns>
        private Transform GetUnderlyingTransform(TransformType transformType, params double[] parameters)
        {
            Transform transform = null;

            switch (transformType)
            {
            case TransformType.RenderTransform:
                break;

            case TransformType.RotateTransform:
                transform = new RotateTransform
                {
                    Angle   = parameters[0],
                    CenterX = parameters[1],
                    CenterY = parameters[2]
                };
                break;

            case TransformType.TranslateTransform:
                transform = new TranslateTransform {
                    X = parameters[0], Y = parameters[1]
                };
                break;

            case TransformType.MatrixTransform:
                transform = new MatrixTransform(parameters[0], parameters[1], parameters[2], parameters[3],
                                                parameters[4], parameters[5]);
                break;
            }

            return(transform?.Clone());
        }
コード例 #2
0
ファイル: FreezableActions.cs プロジェクト: dotnet/wpf-test
        public override void Perform()
        {
            MatrixTransform matrixTransform = (MatrixTransform)Border.RenderTransform;
            Matrix          matrix          = matrixTransform.Matrix;

            if (matrixTransform.CanFreeze)
            {
                matrixTransform.Freeze();
            }
            MatrixTransform matrixTransformClone = matrixTransform.Clone();

            matrix.Scale(10, 10);
            matrixTransformClone = new MatrixTransform(matrix);
            if (matrixTransformClone.CanFreeze)
            {
                matrixTransformClone.Freeze();
            }
        }