Browse Source

[SL.Core] add center property to rectangle

af/octree-no-pixelmap
Scott Williams 9 years ago
parent
commit
0d18481fb3
  1. 10
      src/SixLabors.Core/Primitives/Rectangle.cs
  2. 10
      src/SixLabors.Core/Primitives/RectangleF.cs

10
src/SixLabors.Core/Primitives/Rectangle.cs

@ -110,6 +110,16 @@ namespace SixLabors.Primitives
}
}
/// <summary>
/// Gets the coordinates of the center of the rectangular region represented by this <see cref="RectangleF"/>.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public Point Center
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => new Point(this.X + (this.Width / 2), this.Y + (this.Height / 2));
}
/// <summary>
/// Gets a value indicating whether this <see cref="Rectangle"/> is empty.
/// </summary>

10
src/SixLabors.Core/Primitives/RectangleF.cs

@ -110,6 +110,16 @@ namespace SixLabors.Primitives
}
}
/// <summary>
/// Gets the coordinates of the center of the rectangular region represented by this <see cref="RectangleF"/>.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public PointF Center
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => new PointF(this.X + (this.Width / 2), this.Y + (this.Height / 2));
}
/// <summary>
/// Gets a value indicating whether this <see cref="RectangleF"/> is empty.
/// </summary>

Loading…
Cancel
Save