Skip to content

Commit

Permalink
Moved Flip and Flop to IMagickImageCreateOperations.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Nov 21, 2024
1 parent 30fb91f commit e9f136c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
12 changes: 0 additions & 12 deletions src/Magick.NET.Core/IMagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -972,18 +972,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Evaluate(Channels channels, IMagickGeometry geometry, EvaluateOperator evaluateOperator, Percentage percentage);

/// <summary>
/// Flip image (reflect each scanline in the vertical direction).
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Flip();

/// <summary>
/// Flop image (reflect each scanline in the horizontal direction).
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Flop();

/// <summary>
/// Obtain font metrics for text string given current font, pointsize, and density settings.
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions src/Magick.NET.Core/IMagickImageCreateOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,18 @@ public interface IMagickImageCreateOperations
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Extent(IMagickGeometry geometry, Gravity gravity);

/// <summary>
/// Flip image (reflect each scanline in the vertical direction).
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Flip();

/// <summary>
/// Flop image (reflect each scanline in the horizontal direction).
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Flop();

/// <summary>
/// Resize image to specified size.
/// <para />
Expand Down
6 changes: 6 additions & 0 deletions src/Magick.NET/MagickImage.CloneMutator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ public void Extent(IMagickGeometry geometry, Gravity gravity, IMagickColor<Quant
Extent(geometry, gravity);
}

public void Flip()
=> SetResult(NativeMagickImage.Flip());

public void Flop()
=> SetResult(NativeMagickImage.Flop());

public void Resize(uint width, uint height)
=> Resize(new MagickGeometry(width, height));

Expand Down
10 changes: 8 additions & 2 deletions src/Magick.NET/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2887,7 +2887,10 @@ public void Extent(IMagickGeometry geometry, Gravity gravity, IMagickColor<Quant
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void Flip()
=> _nativeInstance.Flip();
{
using var mutator = new Mutator(_nativeInstance);
mutator.Flip();
}

/// <summary>
/// Floodfill pixels matching color (within fuzz factor) of target pixel(x,y) with replacement
Expand Down Expand Up @@ -2951,7 +2954,10 @@ public void FloodFill(IMagickImage<QuantumType> image, int x, int y, IMagickColo
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void Flop()
=> _nativeInstance.Flop();
{
using var mutator = new Mutator(_nativeInstance);
mutator.Flop();
}

/// <summary>
/// Obtain font metrics for text string given current font, pointsize, and density settings.
Expand Down
6 changes: 2 additions & 4 deletions src/Magick.NET/Native/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,13 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
public partial IntPtr Extent(string geometry, Gravity gravity);

[Throws]
[SetInstance]
public partial void Flip();
public partial IntPtr Flip();

[Throws]
public partial void FloodFill(DrawingSettings settings, nint x, nint y, IMagickColor<QuantumType>? target, bool invert);

[Throws]
[SetInstance]
public partial void Flop();
public partial IntPtr Flop();

[Throws]
[Cleanup(Name = "TypeMetric.Dispose")]
Expand Down

0 comments on commit e9f136c

Please sign in to comment.