/// <summary>Returns a third <see cref="T:System.Drawing.Rectangle" /> structure that represents the intersection of two other <see cref="T:System.Drawing.Rectangle" /> structures. If there is no intersection, an empty <see cref="T:System.Drawing.Rectangle" /> is returned.</summary> /// <param name="a">A rectangle to intersect. </param> /// <param name="b">A rectangle to intersect. </param> /// <returns>A <see cref="T:System.Drawing.Rectangle" /> that represents the intersection of <paramref name="a" /> and <paramref name="b" />.</returns> // Token: 0x06000725 RID: 1829 RVA: 0x00010838 File Offset: 0x0000EA38 public static Rectangle Intersect(Rectangle a, Rectangle b) { if (!a.IntersectsWithInclusive(b)) { return(Rectangle.Empty); } return(Rectangle.FromLTRB(Math.Max(a.Left, b.Left), Math.Max(a.Top, b.Top), Math.Min(a.Right, b.Right), Math.Min(a.Bottom, b.Bottom))); }
public static Rectangle Intersect(Rectangle r1, Rectangle r2) { // MS.NET returns a non-empty rectangle if the two rectangles // touch each other if (!r1.IntersectsWithInclusive(r2)) { return(Empty); } return(Rectangle.FromLTRB( Math.Max(r1.x, r2.x), Math.Max(r1.y, r2.y), Math.Min(r1.Right, r2.Right), Math.Min(r1.Bottom, r2.Bottom))); }
/// <summary> /// Intersect Shared Method /// </summary> /// /// <remarks> /// Produces a new Rectangle by intersecting 2 existing /// Rectangles. Returns null if there is no intersection. /// </remarks> public static Rectangle Intersect(Rectangle a, Rectangle b) { // MS.NET returns a non-empty rectangle if the two rectangles // touch each other if (!a.IntersectsWithInclusive(b)) { return(Empty); } return(Rectangle.FromLTRB( Math.Max(a.Left, b.Left), Math.Max(a.Top, b.Top), Math.Min(a.Right, b.Right), Math.Min(a.Bottom, b.Bottom))); }
/// <summary> /// Intersect Shared Method /// </summary> /// /// <remarks> /// Produces a new Rectangle by intersecting 2 existing /// Rectangles. Returns null if there is no intersection. /// </remarks> public static Rectangle Intersect(Rectangle a, Rectangle b) { // MS.NET returns a non-empty rectangle if the two rectangles // touch each other if (!a.IntersectsWithInclusive (b)) return Empty; return Rectangle.FromLTRB ( Math.Max (a.Left, b.Left), Math.Max (a.Top, b.Top), Math.Min (a.Right, b.Right), Math.Min (a.Bottom, b.Bottom)); }
public static Rectangle Intersect(Rectangle r1, Rectangle r2) { // MS.NET returns a non-empty rectangle if the two rectangles // touch each other if (!r1.IntersectsWithInclusive(r2)) { return Empty; } return Rectangle.FromLTRB( Math.Max(r1.x, r2.x), Math.Max(r1.y, r2.y), Math.Min(r1.Right, r2.Right), Math.Min(r1.Bottom, r2.Bottom)); }