diff --git a/src/SixLabors.Core/Primitives/Point.cs b/src/SixLabors.Core/Primitives/Point.cs
index 6b9e129d8..77ebb62f6 100644
--- a/src/SixLabors.Core/Primitives/Point.cs
+++ b/src/SixLabors.Core/Primitives/Point.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
@@ -235,6 +235,17 @@ namespace SixLabors.Primitives
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Point Transform(Point point, Matrix3x2 matrix) => Round(Vector2.Transform(new Vector2(point.X, point.Y), matrix));
+ ///
+ /// Deconstructs this point into two integers
+ ///
+ /// The out value for X
+ /// The out value for Y
+ public void Deconstruct(out int x, out int y)
+ {
+ x = this.X;
+ y = this.Y;
+ }
+
///
/// Translates this by the specified amount.
///
diff --git a/src/SixLabors.Core/Primitives/PointF.cs b/src/SixLabors.Core/Primitives/PointF.cs
index a214b32e5..844a5f264 100644
--- a/src/SixLabors.Core/Primitives/PointF.cs
+++ b/src/SixLabors.Core/Primitives/PointF.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
@@ -247,6 +247,17 @@ namespace SixLabors.Primitives
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static PointF Transform(PointF point, Matrix3x2 matrix) => Vector2.Transform(point, matrix);
+ ///
+ /// Deconstructs this point into two floats
+ ///
+ /// The out value for X
+ /// The out value for Y
+ public void Deconstruct(out float x, out float y)
+ {
+ x = this.X;
+ y = this.Y;
+ }
+
///
/// Translates this by the specified amount.
///
diff --git a/src/SixLabors.Core/Primitives/Rectangle.cs b/src/SixLabors.Core/Primitives/Rectangle.cs
index 26694a028..239813ac7 100644
--- a/src/SixLabors.Core/Primitives/Rectangle.cs
+++ b/src/SixLabors.Core/Primitives/Rectangle.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
@@ -320,6 +320,21 @@ namespace SixLabors.Primitives
return new Rectangle(x1, y1, x2 - x1, y2 - y1);
}
+ ///
+ /// Deconstructs this rectangle into four integers
+ ///
+ /// The out value for X
+ /// The out value for Y
+ /// The out value for the width
+ /// The out value for the height
+ public void Deconstruct(out int x, out int y, out int width, out int height)
+ {
+ x = this.X;
+ y = this.Y;
+ width = this.Width;
+ height = this.Height;
+ }
+
///
/// Creates a Rectangle that represents the intersection between this Rectangle and the .
///
diff --git a/src/SixLabors.Core/Primitives/RectangleF.cs b/src/SixLabors.Core/Primitives/RectangleF.cs
index b5b96efc8..f212e5bcc 100644
--- a/src/SixLabors.Core/Primitives/RectangleF.cs
+++ b/src/SixLabors.Core/Primitives/RectangleF.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
@@ -259,6 +259,21 @@ namespace SixLabors.Primitives
return new RectangleF(x1, y1, x2 - x1, y2 - y1);
}
+ ///
+ /// Deconstructs this rectangle into four floats
+ ///
+ /// The out value for X
+ /// The out value for Y
+ /// The out value for the width
+ /// The out value for the height
+ public void Deconstruct(out float x, out float y, out float width, out float height)
+ {
+ x = this.X;
+ y = this.Y;
+ width = this.Width;
+ height = this.Height;
+ }
+
///
/// Creates a RectangleF that represents the intersection between this RectangleF and the .
///
diff --git a/src/SixLabors.Core/Primitives/Size.cs b/src/SixLabors.Core/Primitives/Size.cs
index 4c6c37979..0c468a80b 100644
--- a/src/SixLabors.Core/Primitives/Size.cs
+++ b/src/SixLabors.Core/Primitives/Size.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
@@ -251,6 +251,17 @@ namespace SixLabors.Primitives
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Size Truncate(SizeF size) => new Size(unchecked((int)size.Width), unchecked((int)size.Height));
+ ///
+ /// Deconstructs this size into two integers
+ ///
+ /// The out value for the width
+ /// The out value for the height
+ public void Deconstruct(out int width, out int height)
+ {
+ width = this.Width;
+ height = this.Height;
+ }
+
///
public override int GetHashCode() => HashCode.Combine(this.Width, this.Height);
diff --git a/src/SixLabors.Core/Primitives/SizeF.cs b/src/SixLabors.Core/Primitives/SizeF.cs
index a2bd687be..b7e15b5e3 100644
--- a/src/SixLabors.Core/Primitives/SizeF.cs
+++ b/src/SixLabors.Core/Primitives/SizeF.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
@@ -197,6 +197,17 @@ namespace SixLabors.Primitives
return new SizeF(v.X, v.Y);
}
+ ///
+ /// Deconstructs this size into two floats
+ ///
+ /// The out value for the width
+ /// The out value for the height
+ public void Deconstruct(out float width, out float height)
+ {
+ width = this.Width;
+ height = this.Height;
+ }
+
///
public override int GetHashCode() => HashCode.Combine(this.Width, this.Height);