Beispiel #1
0
        public static RectangleI Inflate(RectangleI rect, int x, int y)
        {
            RectangleI rectangleI = rect;

            rectangleI.Inflate(x, y);
            return(rectangleI);
        }
Beispiel #2
0
        public static RectangleI Union(RectangleI a, RectangleI b)
        {
            int x    = Math.Min(a.X, b.X);
            int num1 = Math.Max(a.X + a.Width, b.X + b.Width);
            int y    = Math.Min(a.Y, b.Y);
            int num2 = Math.Max(a.Y + a.Height, b.Y + b.Height);

            return(new RectangleI(x, y, num1 - x, num2 - y));
        }
Beispiel #3
0
        public void Intersect(RectangleI rect)
        {
            RectangleI RectangleI = Intersect(rect, this);

            x      = RectangleI.X;
            y      = RectangleI.Y;
            width  = RectangleI.Width;
            height = RectangleI.Height;
        }
Beispiel #4
0
        public static RectangleI Intersect(RectangleI a, RectangleI b)
        {
            int x    = Math.Max(a.X, b.X);
            int num1 = Math.Min(a.X + a.Width, b.X + b.Width);
            int y    = Math.Max(a.Y, b.Y);
            int num2 = Math.Min(a.Y + a.Height, b.Y + b.Height);

            return(num1 >= x && num2 >= y ?
                   new RectangleI(x, y, num1 - x, num2 - y) :
                   Empty);
        }
Beispiel #5
0
        public override bool Equals(object obj)
        {
            if (!(obj is RectangleI))
            {
                return(false);
            }

            RectangleI rectangleI = (RectangleI)obj;

            return(rectangleI.X == x && rectangleI.Y == y && rectangleI.Width == width && rectangleI.Height == height);
        }
Beispiel #6
0
 public bool IntersectsWith(RectangleI rect)
 {
     return(rect.X < x + width && x < rect.X + rect.Width && rect.Y < y + height && y < rect.Y + rect.Height);
 }
Beispiel #7
0
 public bool Contains(RectangleI rect)
 {
     return(x <= rect.X && rect.X + rect.Width <= X + Width && Y <= rect.Y && rect.Y + rect.Height <= Y + Height);
 }