diff --git a/src/SixLabors.Core/Primitives/Rectangle.cs b/src/SixLabors.Core/Primitives/Rectangle.cs index 735920f0a..e7fa21867 100644 --- a/src/SixLabors.Core/Primitives/Rectangle.cs +++ b/src/SixLabors.Core/Primitives/Rectangle.cs @@ -110,6 +110,16 @@ namespace SixLabors.Primitives } } + /// + /// Gets the coordinates of the center of the rectangular region represented by this . + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Point Center + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => new Point(this.X + (this.Width / 2), this.Y + (this.Height / 2)); + } + /// /// Gets a value indicating whether this is empty. /// diff --git a/src/SixLabors.Core/Primitives/RectangleF.cs b/src/SixLabors.Core/Primitives/RectangleF.cs index 36578a455..f914091b3 100644 --- a/src/SixLabors.Core/Primitives/RectangleF.cs +++ b/src/SixLabors.Core/Primitives/RectangleF.cs @@ -110,6 +110,16 @@ namespace SixLabors.Primitives } } + /// + /// Gets the coordinates of the center of the rectangular region represented by this . + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public PointF Center + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => new PointF(this.X + (this.Width / 2), this.Y + (this.Height / 2)); + } + /// /// Gets a value indicating whether this is empty. ///