Esempio n. 1
0
 public static Rect InflateNew(Rect rect, double width, double height)
 {
     var r = new Rect(rect._x, rect._y, rect._width, rect._height);
     r.Inflate(width, height);
     return r;
 }
Esempio n. 2
0
 public static Rect Inflate(Rect rect, double width, double height)
 {
     rect.Inflate(width, height);
     return rect;
 }
Esempio n. 3
0
 static Rect()
 {
     SEmpty = CreateEmptyRect();
 }
Esempio n. 4
0
 public static Rect Inflate(Rect rect, Size size)
 {
     rect.Inflate(size._width, size._height);
     return rect;
 }
Esempio n. 5
0
 public static Rect Union(Rect rect, Point point)
 {
     rect.Union(new Rect(point, point));
     return rect;
 }
Esempio n. 6
0
 public bool Contains(Rect rect)
 {
     if (IsEmpty || rect.IsEmpty)
     {
         return false;
     }
     return ((((_x <= rect._x) && (_y <= rect._y)) && ((_x + _width) >= (rect._x + rect._width))) && ((_y + _height) >= (rect._y + rect._height)));
 }
Esempio n. 7
0
 public void Union(Rect rect)
 {
     if (IsEmpty)
     {
         _x = 0;
         _y = 0;
         _width = 0;
         _height = 0;
     }
     else if (!rect.IsEmpty)
     {
         double num2 = Math.Min(Left, rect.Left);
         double num = Math.Min(Top, rect.Top);
         if ((rect.Width == double.PositiveInfinity) || (Width == double.PositiveInfinity))
         {
             _width = double.PositiveInfinity;
         }
         else
         {
             double num4 = Math.Max(Right, rect.Right);
             _width = Math.Max(num4 - num2, 0.0);
         }
         if ((rect.Height == double.PositiveInfinity) || (Height == double.PositiveInfinity))
         {
             _height = double.PositiveInfinity;
         }
         else
         {
             double num3 = Math.Max(Bottom, rect.Bottom);
             _height = Math.Max(num3 - num, 0.0);
         }
         _x = num2;
         _y = num;
     }
 }
Esempio n. 8
0
 public static Rect Union(Rect rect1, Rect rect2)
 {
     rect1.Union(rect2);
     return rect1;
 }
Esempio n. 9
0
 public void Intersect(Rect rect)
 {
     if (!IntersectsWith(rect))
     {
         _x = 0;
         _y = 0;
         _width = 0;
         _height = 0;
     }
     else
     {
         var num2 = Math.Max(Left, rect.Left);
         var num = Math.Max(Top, rect.Top);
         _width = Math.Max(Math.Min(Right, rect.Right) - num2, 0.0);
         _height = Math.Max(Math.Min(Bottom, rect.Bottom) - num, 0.0);
         _x = num2;
         _y = num;
     }
 }
Esempio n. 10
0
 public static Rect Intersect(Rect rect1, Rect rect2)
 {
     rect1.Intersect(rect2);
     return rect1;
 }
Esempio n. 11
0
 public bool IntersectsWith(Rect rect)
 {
     if (IsEmpty || rect.IsEmpty)
     {
         return false;
     }
     return ((((rect.Left <= Right) && (rect.Right >= Left)) && (rect.Top <= Bottom)) && (rect.Bottom >= Top));
 }
Esempio n. 12
0
 public static Rect Offset(Rect rect, double offsetX, double offsetY)
 {
     rect.Offset(offsetX, offsetY);
     return rect;
 }
Esempio n. 13
0
 public static Rect Offset(Rect rect, Vector offsetVector)
 {
     rect.Offset(offsetVector.X, offsetVector.Y);
     return rect;
 }
Esempio n. 14
0
 public bool Equals(Rect value)
 {
     return Equals(this, value);
 }
Esempio n. 15
0
 public static bool Equals(Rect rect1, Rect rect2)
 {
     if (rect1.IsEmpty)
     {
         return rect2.IsEmpty;
     }
     return (((rect1.X.Equals(rect2.X) && rect1.Y.Equals(rect2.Y)) && rect1.Width.Equals(rect2.Width)) && rect1.Height.Equals(rect2.Height));
 }