Skip to content

Commit

Permalink
Renamed RePage to ResetPage.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Aug 11, 2024
1 parent ac0b36f commit 315db72
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 39 deletions.
28 changes: 14 additions & 14 deletions src/Magick.NET.Core/IMagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,17 +1186,17 @@ public partial interface IMagickImage : IDisposable
void CopyPixels(IMagickImage source, IMagickGeometry geometry, int x, int y, Channels channels);

/// <summary>
/// Crop image (subregion of original image). RePage should be called unless the Page information
/// is needed.
/// Crop image (subregion of original image). <see cref="ResetPage"/> should be called unless
/// the <see cref="Page"/> information is needed.
/// </summary>
/// <param name="width">The width of the subregion to crop.</param>
/// <param name="height">The height of the subregion to crop.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Crop(uint width, uint height);

/// <summary>
/// Crop image (subregion of original image). RePage should be called unless the Page information
/// is needed.
/// Crop image (subregion of original image). <see cref="ResetPage"/> should be called unless
/// the <see cref="Page"/> information is needed.
/// </summary>
/// <param name="width">The width of the subregion to crop.</param>
/// <param name="height">The height of the subregion to crop.</param>
Expand All @@ -1205,16 +1205,16 @@ public partial interface IMagickImage : IDisposable
void Crop(uint width, uint height, Gravity gravity);

/// <summary>
/// Crop image (subregion of original image). RePage should be called unless the Page information
/// is needed.
/// Crop image (subregion of original image). <see cref="ResetPage"/> should be called unless
/// the <see cref="Page"/> information is needed.
/// </summary>
/// <param name="geometry">The subregion to crop.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Crop(IMagickGeometry geometry);

/// <summary>
/// Crop image (subregion of original image). RePage should be called unless the Page information
/// is needed.
/// Crop image (subregion of original image). <see cref="ResetPage"/> should be called unless
/// the <see cref="Page"/> information is needed.
/// </summary>
/// <param name="geometry">The subregion to crop.</param>
/// <param name="gravity">The position where the cropping should start from.</param>
Expand Down Expand Up @@ -2607,12 +2607,6 @@ public partial interface IMagickImage : IDisposable
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void RemoveWriteMask();

/// <summary>
/// Resets the page property of this image.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void RePage();

/// <summary>
/// Resize image in terms of its pixel size.
/// </summary>
Expand All @@ -2628,6 +2622,12 @@ public partial interface IMagickImage : IDisposable
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Resample(PointD density);

/// <summary>
/// Resets the page property of this image.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void ResetPage();

/// <summary>
/// Resize image to specified size.
/// <para />
Expand Down
2 changes: 1 addition & 1 deletion src/Magick.NET.Core/IMagickImageCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public partial interface IMagickImageCollection : IDisposable
/// Resets the page property of every image in the collection.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void RePage();
void ResetPage();

/// <summary>
/// Reverses the order of the images in the collection.
Expand Down
30 changes: 15 additions & 15 deletions src/Magick.NET/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2280,8 +2280,8 @@ public void CopyPixels(IMagickImage source, IMagickGeometry geometry, int x, int
}

/// <summary>
/// Crop image (subregion of original image). RePage should be called unless the Page information
/// is needed.
/// Crop image (subregion of original image). <see cref="ResetPage"/> should be called unless
/// the <see cref="Page"/> information is needed.
/// </summary>
/// <param name="width">The width of the subregion to crop.</param>
/// <param name="height">The height of the subregion to crop.</param>
Expand All @@ -2290,8 +2290,8 @@ public void Crop(uint width, uint height)
=> Crop(width, height, Gravity.Undefined);

/// <summary>
/// Crop image (subregion of original image). RePage should be called unless the Page information
/// is needed.
/// Crop image (subregion of original image). <see cref="ResetPage"/> should be called unless
/// the <see cref="Page"/> information is needed.
/// </summary>
/// <param name="width">The width of the subregion to crop.</param>
/// <param name="height">The height of the subregion to crop.</param>
Expand All @@ -2301,17 +2301,17 @@ public void Crop(uint width, uint height, Gravity gravity)
=> Crop(new MagickGeometry(0, 0, width, height), gravity);

/// <summary>
/// Crop image (subregion of original image). RePage should be called unless the Page information
/// is needed.
/// Crop image (subregion of original image). <see cref="ResetPage"/> should be called unless
/// the <see cref="Page"/> information is needed.
/// </summary>
/// <param name="geometry">The subregion to crop.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void Crop(IMagickGeometry geometry)
=> Crop(geometry, Gravity.Undefined);

/// <summary>
/// Crop image (subregion of original image). RePage should be called unless the Page information
/// is needed.
/// Crop image (subregion of original image). <see cref="ResetPage"/> should be called unless
/// the <see cref="Page"/> information is needed.
/// </summary>
/// <param name="geometry">The subregion to crop.</param>
/// <param name="gravity">The position where the cropping should start from.</param>
Expand Down Expand Up @@ -5144,13 +5144,6 @@ public void RemoveReadMask()
public void RemoveWriteMask()
=> _nativeInstance.SetWriteMask(null);

/// <summary>
/// Resets the page property of this image.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void RePage()
=> Page = new MagickGeometry(0, 0, 0, 0);

/// <summary>
/// Resize image in terms of its pixel size.
/// </summary>
Expand All @@ -5168,6 +5161,13 @@ public void Resample(double resolutionX, double resolutionY)
public void Resample(PointD density)
=> Resample(density.X, density.Y);

/// <summary>
/// Resets the page property of this image.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void ResetPage()
=> Page = new MagickGeometry(0, 0, 0, 0);

/// <summary>
/// Resize image to specified size.
/// <para />
Expand Down
4 changes: 2 additions & 2 deletions src/Magick.NET/MagickImageCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,11 +1266,11 @@ public void RemoveAt(int index)
/// Resets the page property of every image in the collection.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void RePage()
public void ResetPage()
{
foreach (var image in _images)
{
image.RePage();
image.ResetPage();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Magick.NET.Tests;

public partial class MagickImageCollectionTests
{
public class TheRePageMethod
public class TheResetPageMethod
{
[Fact]
public void ShouldResetThePagePropertyOfAllTheImages()
Expand All @@ -25,7 +25,7 @@ public void ShouldResetThePagePropertyOfAllTheImages()
Assert.Equal(50, images[2].Page.X);
Assert.Equal(60, images[2].Page.Y);

images.RePage();
images.ResetPage();

Assert.Equal(0, images[0].Page.X);
Assert.Equal(0, images[0].Page.Y);
Expand All @@ -38,13 +38,15 @@ public void ShouldResetThePagePropertyOfAllTheImages()
[Fact]
public void ShouldNotChangeThePageSettings()
{
using var images = new MagickImageCollection();
images.Add(new MagickImage(MagickColors.Purple, 1, 1));
using var images = new MagickImageCollection
{
new MagickImage(MagickColors.Purple, 1, 1),
};

images[0].Page = new MagickGeometry("0x0+10+20");
images[0].Settings.Page = new MagickGeometry("0x0+10+20");

images.RePage();
images.ResetPage();

Assert.Equal(0, images[0].Page.X);
Assert.Equal(0, images[0].Page.Y);
Expand Down
4 changes: 2 additions & 2 deletions tests/Magick.NET.Tests/MagickImageTests/TheCloneMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void ShouldCloneUsingTheSpecifiedOffset()
using var icon = new MagickImage(Files.MagickNETIconPNG);
using var area = icon.Clone();
area.Crop(64, 64, Gravity.Southeast);
area.RePage();
area.ResetPage();
area.Crop(64, 32, Gravity.North);

using var part = icon.Clone(64, 64, 64, 32);
Expand All @@ -81,7 +81,7 @@ public void ShouldCloneTheSpecifiedGeometry()
using var icon = new MagickImage(Files.MagickNETIconPNG);
using var area = icon.Clone();
area.Crop(64, 64, Gravity.Southeast);
area.RePage();
area.ResetPage();
area.Crop(64, 32, Gravity.North);

using var part = icon.Clone(new MagickGeometry(64, 64, 64, 32));
Expand Down

0 comments on commit 315db72

Please sign in to comment.