Exemplo n.º 1
0
        public static RectangleI Inflate(RectangleI rect, int x, int y)
        {
            RectangleI rectangleI = rect;

            rectangleI.Inflate(x, y);
            return(rectangleI);
        }
Exemplo n.º 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));
        }
Exemplo n.º 3
0
        public void Intersect(RectangleI rect)
        {
            RectangleI RectangleI = Intersect(rect, this);

            x      = RectangleI.X;
            y      = RectangleI.Y;
            width  = RectangleI.Width;
            height = RectangleI.Height;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }