/// <summary>Returns a <see cref="T:System.Drawing.RectangleF" /> structure that represents the intersection of two rectangles. If there is no intersection, and empty <see cref="T:System.Drawing.RectangleF" /> is returned.</summary> /// <param name="a">A rectangle to intersect. </param> /// <param name="b">A rectangle to intersect. </param> /// <returns>A third <see cref="T:System.Drawing.RectangleF" /> structure the size of which represents the overlapped area of the two specified rectangles.</returns> // Token: 0x0600074D RID: 1869 RVA: 0x00010DC4 File Offset: 0x0000EFC4 public static RectangleF Intersect(RectangleF a, RectangleF b) { if (!a.IntersectsWithInclusive(b)) { return(RectangleF.Empty); } return(RectangleF.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 RectangleF by intersecting 2 existing /// RectangleFs. Returns null if there is no intersection. /// </remarks> public static RectangleF Intersect(RectangleF a, RectangleF b) { // MS.NET returns a non-empty rectangle if the two rectangles // touch each other if (!a.IntersectsWithInclusive(b)) { return(Empty); } return(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 RectangleF by intersecting 2 existing /// RectangleFs. Returns null if there is no intersection. /// </remarks> public static RectangleF Intersect (RectangleF a, RectangleF b) { // MS.NET returns a non-empty rectangle if the two rectangles // touch each other if (!a.IntersectsWithInclusive (b)) return Empty; return 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)); }