private bool ReadCanonicalForm(Transform transform, bool useIfChangeable) { bool flag = false; if (CanonicalTransform.IsCanonical(transform)) { TransformGroup transformGroup = (TransformGroup)transform; ScaleTransform scaleTransform = transformGroup.Children[CanonicalTransformOrder.ScaleIndex] as ScaleTransform; SkewTransform skewTransform = transformGroup.Children[CanonicalTransformOrder.SkewIndex] as SkewTransform; RotateTransform rotateTransform = transformGroup.Children[CanonicalTransformOrder.RotateIndex] as RotateTransform; TranslateTransform translateTransform = transformGroup.Children[CanonicalTransformOrder.TranslateIndex] as TranslateTransform; this.decomposition.Center = new Point(scaleTransform.CenterX, scaleTransform.CenterY); this.decomposition.Scale = new Vector(scaleTransform.ScaleX, scaleTransform.ScaleY); this.decomposition.Skew = new Vector(skewTransform.AngleX, skewTransform.AngleY); this.decomposition.RotationAngle = rotateTransform.Angle; this.decomposition.Translation = new Vector(translateTransform.X, translateTransform.Y); if (useIfChangeable && !transformGroup.IsFrozen) { this.transformGroup = transformGroup; } else { this.InitializeTransformGroup(); } flag = true; } return(flag); }
public static bool IsCanonical(Transform transform) { return(CanonicalTransform.IsCanonical(transform, false)); }