Skip to content

Commit 8c4cca7

Browse files
committed
Moved AffineTransform to IMagickImageCreateOperations.
1 parent 5740659 commit 8c4cca7

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

src/Magick.NET.Core/IMagickImage.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
253253
/// </summary>
254254
uint Width { get; }
255255

256-
/// <summary>
257-
/// Affine Transform image.
258-
/// </summary>
259-
/// <param name="affineMatrix">The affine matrix to use.</param>
260-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
261-
void AffineTransform(IDrawableAffine affineMatrix);
262-
263256
/// <summary>
264257
/// Applies the specified alpha option.
265258
/// </summary>

src/Magick.NET.Core/IMagickImageCreateOperations.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
22
// Licensed under the Apache License, Version 2.0.
33

4+
using ImageMagick.Drawing;
5+
46
namespace ImageMagick;
57

68
/// <summary>
@@ -177,6 +179,13 @@ public interface IMagickImageCreateOperations
177179
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
178180
void AddNoise(NoiseType noiseType, double attenuate, Channels channels);
179181

182+
/// <summary>
183+
/// Affine Transform image.
184+
/// </summary>
185+
/// <param name="affineMatrix">The affine matrix to use.</param>
186+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
187+
void AffineTransform(IDrawableAffine affineMatrix);
188+
180189
/// <summary>
181190
/// Resize image to specified size.
182191
/// <para />

src/Magick.NET/MagickImage.CloneMutator.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Apache License, Version 2.0.
33

44
using System;
5+
using ImageMagick.Drawing;
56

67
namespace ImageMagick;
78

@@ -91,6 +92,13 @@ public void AddNoise(NoiseType noiseType, double attenuate)
9192
public void AddNoise(NoiseType noiseType, double attenuate, Channels channels)
9293
=> SetResult(NativeMagickImage.AddNoise(noiseType, attenuate, channels));
9394

95+
public void AffineTransform(IDrawableAffine affineMatrix)
96+
{
97+
Throw.IfNull(nameof(affineMatrix), affineMatrix);
98+
99+
SetResult(NativeMagickImage.AffineTransform(affineMatrix.ScaleX, affineMatrix.ScaleY, affineMatrix.ShearX, affineMatrix.ShearY, affineMatrix.TranslateX, affineMatrix.TranslateY));
100+
}
101+
94102
public void Resize(uint width, uint height)
95103
=> Resize(new MagickGeometry(width, height));
96104

src/Magick.NET/MagickImage.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.IO;
1010
using System.Linq;
1111
using System.Threading;
12+
using System.Threading.Channels;
1213
using System.Threading.Tasks;
1314
using ImageMagick.Drawing;
1415

@@ -1151,9 +1152,8 @@ public void AddNoise(NoiseType noiseType, double attenuate, Channels channels)
11511152
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
11521153
public void AffineTransform(IDrawableAffine affineMatrix)
11531154
{
1154-
Throw.IfNull(nameof(affineMatrix), affineMatrix);
1155-
1156-
_nativeInstance.AffineTransform(affineMatrix.ScaleX, affineMatrix.ScaleY, affineMatrix.ShearX, affineMatrix.ShearY, affineMatrix.TranslateX, affineMatrix.TranslateY);
1155+
using var mutator = new Mutator(_nativeInstance);
1156+
mutator.AffineTransform(affineMatrix);
11571157
}
11581158

11591159
/// <summary>

src/Magick.NET/Native/MagickImage.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
242242
public partial IntPtr AddNoise(NoiseType noiseType, double attenuate, Channels channels);
243243

244244
[Throws]
245-
[SetInstance]
246-
public partial void AffineTransform(double scaleX, double scaleY, double shearX, double shearY, double translateX, double translateY);
245+
public partial IntPtr AffineTransform(double scaleX, double scaleY, double shearX, double shearY, double translateX, double translateY);
247246

248247
[Throws]
249248
public partial void Annotate(DrawingSettings settings, string text, string boundingArea, Gravity gravity, double degrees);

0 commit comments

Comments
 (0)