示例#1
0
        public static void Scale(this ITransformHolder self, double scale, double centerX, double centerY)
        {
            var d0 = self.TransformPoint(centerX, centerY);

            self.ScaleMatrix.ScaleX = scale;
            self.ScaleMatrix.ScaleY = scale;

            var d1 = self.TransformPoint(centerX, centerY);

            var diff = d1 - d0;

            self.TranslateMatrix.X += diff.X * scale;
            self.TranslateMatrix.Y += diff.Y * scale;
        }
示例#2
0
 public static Point GetTranslateToPosition(this ITransformHolder self)
 {
     return(new Point(self.TranslateMatrix.X, self.TranslateMatrix.Y));
 }
示例#3
0
 public static void TranslateY(this ITransformHolder self, double offsetY)
 {
     self.TranslateMatrix.Y += offsetY;
 }
示例#4
0
 public static void TranslateX(this ITransformHolder self, double offsetX)
 {
     self.TranslateMatrix.X += offsetX;
 }
示例#5
0
 public static void SetTranslate(this ITransformHolder self, double offsetX, double offsetY)
 {
     self.TranslateMatrix.X = offsetX;
     self.TranslateMatrix.Y = offsetY;
 }
示例#6
0
 public static Point TransformPoint(this ITransformHolder self, double x, double y)
 {
     return(new Point(
                (x - self.TranslateMatrix.X) / self.ScaleMatrix.ScaleX,
                (y - self.TranslateMatrix.Y) / self.ScaleMatrix.ScaleY));
 }