From d4bb69649974bd83b411894ac900163e5e5c3ca0 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Fri, 22 Nov 2024 23:45:49 +0100 Subject: [PATCH] Moved HoughLine to IMagickImageCreateOperations. --- src/Magick.NET.Core/IMagickImage.cs | 15 --------------- .../IMagickImageCreateOperations.cs | 15 +++++++++++++++ src/Magick.NET/MagickImage.CloneMutator.cs | 6 ++++++ src/Magick.NET/MagickImage.cs | 10 ++++++++-- src/Magick.NET/Native/MagickImage.cs | 3 +-- 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/Magick.NET.Core/IMagickImage.cs b/src/Magick.NET.Core/IMagickImage.cs index 602b01021b..af3b0be6d6 100644 --- a/src/Magick.NET.Core/IMagickImage.cs +++ b/src/Magick.NET.Core/IMagickImage.cs @@ -1135,21 +1135,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl /// A value indicating whether a profile with the specified name already exists on the image. bool HasProfile(string name); - /// - /// Identifies lines in the image. - /// - /// Thrown when an error is raised by ImageMagick. - void HoughLine(); - - /// - /// Identifies lines in the image. - /// - /// The width of the neighborhood. - /// The height of the neighborhood. - /// The line count threshold. - /// Thrown when an error is raised by ImageMagick. - void HoughLine(uint width, uint height, uint threshold); - /// /// Implode image (special effect). /// diff --git a/src/Magick.NET.Core/IMagickImageCreateOperations.cs b/src/Magick.NET.Core/IMagickImageCreateOperations.cs index 81bc33e2e6..a3f071ce22 100644 --- a/src/Magick.NET.Core/IMagickImageCreateOperations.cs +++ b/src/Magick.NET.Core/IMagickImageCreateOperations.cs @@ -569,6 +569,21 @@ public interface IMagickImageCreateOperations /// Thrown when an error is raised by ImageMagick. void GaussianBlur(double radius, double sigma, Channels channels); + /// + /// Identifies lines in the image. + /// + /// Thrown when an error is raised by ImageMagick. + void HoughLine(); + + /// + /// Identifies lines in the image. + /// + /// The width of the neighborhood. + /// The height of the neighborhood. + /// The line count threshold. + /// Thrown when an error is raised by ImageMagick. + void HoughLine(uint width, uint height, uint threshold); + /// /// Resize image to specified size. /// diff --git a/src/Magick.NET/MagickImage.CloneMutator.cs b/src/Magick.NET/MagickImage.CloneMutator.cs index 9096fea437..b51f7ade0c 100644 --- a/src/Magick.NET/MagickImage.CloneMutator.cs +++ b/src/Magick.NET/MagickImage.CloneMutator.cs @@ -329,6 +329,12 @@ public void GaussianBlur(double radius, double sigma) public void GaussianBlur(double radius, double sigma, Channels channels) => SetResult(NativeMagickImage.GaussianBlur(radius, sigma, channels)); + public void HoughLine() + => HoughLine(0, 0, 40); + + public void HoughLine(uint width, uint height, uint threshold) + => SetResult(NativeMagickImage.HoughLine(width, height, threshold)); + public void Resize(uint width, uint height) => Resize(new MagickGeometry(width, height)); diff --git a/src/Magick.NET/MagickImage.cs b/src/Magick.NET/MagickImage.cs index 0546d91a85..d543f537c0 100644 --- a/src/Magick.NET/MagickImage.cs +++ b/src/Magick.NET/MagickImage.cs @@ -3387,7 +3387,10 @@ public IReadOnlyDictionary, uint> Histogram() /// /// Thrown when an error is raised by ImageMagick. public void HoughLine() - => HoughLine(0, 0, 40); + { + using var mutator = new Mutator(_nativeInstance); + mutator.HoughLine(); + } /// /// Identifies lines in the image. @@ -3397,7 +3400,10 @@ public void HoughLine() /// The line count threshold. /// Thrown when an error is raised by ImageMagick. public void HoughLine(uint width, uint height, uint threshold) - => _nativeInstance.HoughLine(width, height, threshold); + { + using var mutator = new Mutator(_nativeInstance); + mutator.HoughLine(width, height, threshold); + } /// /// Implode image (special effect). diff --git a/src/Magick.NET/Native/MagickImage.cs b/src/Magick.NET/Native/MagickImage.cs index 4c1f057e12..e4cc88ed48 100644 --- a/src/Magick.NET/Native/MagickImage.cs +++ b/src/Magick.NET/Native/MagickImage.cs @@ -475,8 +475,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM public partial IntPtr Histogram(out nuint length); [Throws] - [SetInstance] - public partial void HoughLine(nuint width, nuint height, nuint threshold); + public partial IntPtr HoughLine(nuint width, nuint height, nuint threshold); [Throws] [SetInstance]