示例#1
0
文件: Size.cs 项目: aliaspilote/TX52
 public static bool Equals(Size size1, Size size2)
 {
     if (size1.IsEmpty)
     {
         return size2.IsEmpty;
     }
     return (size1.Width.Equals(size2.Width) && size1.Height.Equals(size2.Height));
 }
示例#2
0
文件: Rect.cs 项目: aliaspilote/TX52
 public Rect(Point location, Size size)
 {
     if (size.IsEmpty)
     {
         _x = 0;
         _y = 0;
         _width = 0;
         _height = 0;
     }
     else
     {
         _x = location._x;
         _y = location._y;
         _width = size._width;
         _height = size._height;
     }
 }
示例#3
0
文件: Rect.cs 项目: aliaspilote/TX52
 public static Rect Inflate(Rect rect, Size size)
 {
     rect.Inflate(size._width, size._height);
     return rect;
 }
示例#4
0
文件: Rect.cs 项目: aliaspilote/TX52
 public void Inflate(Size size)
 {
     Inflate(size._width, size._height);
 }
示例#5
0
文件: Rect.cs 项目: aliaspilote/TX52
 public Rect(Size size)
 {
     if (size.IsEmpty)
     {
         _x = 0;
         _y = 0;
         _width = 0;
         _height = 0;
     }
     else
     {
         _x = _y = 0.0;
         _width = size.Width;
         _height = size.Height;
     }
 }
示例#6
0
文件: Size.cs 项目: aliaspilote/TX52
 public bool Equals(Size value)
 {
     return Equals(this, value);
 }
示例#7
0
文件: Size.cs 项目: aliaspilote/TX52
 static Size()
 {
     SEmpty = CreateEmptySize();
 }
示例#8
0
        public static Point GetClippingPoint(Size size, Point s, Point t)
        {
            double[] sides = new double[4];
            sides[0] = (s.X - size.Width / 2.0 - t.X) / (s.X - t.X);
            sides[1] = (s.Y - size.Height / 2.0 - t.Y) / (s.Y - t.Y);
            sides[2] = (s.X + size.Width / 2.0 - t.X) / (s.X - t.X);
            sides[3] = (s.Y + size.Height / 2.0 - t.Y) / (s.Y - t.Y);

            double fi = 0;
            for (int i = 0; i < 4; i++)
            {
                if (sides[i] <= 1)
                    fi = Math.Max(fi, sides[i]);
            }
            if (fi == 0)
            {
                fi = double.PositiveInfinity;
                for (int i = 0; i < 4; i++)
                    fi = Math.Min(fi, Math.Abs(sides[i]));
                fi *= -1;
            }

            return t + fi * (s - t);
        }