From 315db72ded2be5ac4160891e6b6b31edbe61e88c Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sun, 11 Aug 2024 15:46:52 +0200 Subject: [PATCH] Renamed RePage to ResetPage. --- src/Magick.NET.Core/IMagickImage.cs | 28 ++++++++--------- src/Magick.NET.Core/IMagickImageCollection.cs | 2 +- src/Magick.NET/MagickImage.cs | 30 +++++++++---------- src/Magick.NET/MagickImageCollection.cs | 4 +-- ...eRePageMethod.cs => TheResetPageMethod.cs} | 12 ++++---- .../MagickImageTests/TheCloneMethod.cs | 4 +-- 6 files changed, 41 insertions(+), 39 deletions(-) rename tests/Magick.NET.Tests/MagickImageCollectionTests/{TheRePageMethod.cs => TheResetPageMethod.cs} (86%) diff --git a/src/Magick.NET.Core/IMagickImage.cs b/src/Magick.NET.Core/IMagickImage.cs index 7d29c48a7b..bfb1fc497b 100644 --- a/src/Magick.NET.Core/IMagickImage.cs +++ b/src/Magick.NET.Core/IMagickImage.cs @@ -1186,8 +1186,8 @@ public partial interface IMagickImage : IDisposable void CopyPixels(IMagickImage source, IMagickGeometry geometry, int x, int y, Channels channels); /// - /// Crop image (subregion of original image). RePage should be called unless the Page information - /// is needed. + /// Crop image (subregion of original image). should be called unless + /// the information is needed. /// /// The width of the subregion to crop. /// The height of the subregion to crop. @@ -1195,8 +1195,8 @@ public partial interface IMagickImage : IDisposable void Crop(uint width, uint height); /// - /// Crop image (subregion of original image). RePage should be called unless the Page information - /// is needed. + /// Crop image (subregion of original image). should be called unless + /// the information is needed. /// /// The width of the subregion to crop. /// The height of the subregion to crop. @@ -1205,16 +1205,16 @@ public partial interface IMagickImage : IDisposable void Crop(uint width, uint height, Gravity gravity); /// - /// Crop image (subregion of original image). RePage should be called unless the Page information - /// is needed. + /// Crop image (subregion of original image). should be called unless + /// the information is needed. /// /// The subregion to crop. /// Thrown when an error is raised by ImageMagick. void Crop(IMagickGeometry geometry); /// - /// Crop image (subregion of original image). RePage should be called unless the Page information - /// is needed. + /// Crop image (subregion of original image). should be called unless + /// the information is needed. /// /// The subregion to crop. /// The position where the cropping should start from. @@ -2607,12 +2607,6 @@ public partial interface IMagickImage : IDisposable /// Thrown when an error is raised by ImageMagick. void RemoveWriteMask(); - /// - /// Resets the page property of this image. - /// - /// Thrown when an error is raised by ImageMagick. - void RePage(); - /// /// Resize image in terms of its pixel size. /// @@ -2628,6 +2622,12 @@ public partial interface IMagickImage : IDisposable /// Thrown when an error is raised by ImageMagick. void Resample(PointD density); + /// + /// Resets the page property of this image. + /// + /// Thrown when an error is raised by ImageMagick. + void ResetPage(); + /// /// Resize image to specified size. /// diff --git a/src/Magick.NET.Core/IMagickImageCollection.cs b/src/Magick.NET.Core/IMagickImageCollection.cs index f26d7f0f82..606ddb6b59 100644 --- a/src/Magick.NET.Core/IMagickImageCollection.cs +++ b/src/Magick.NET.Core/IMagickImageCollection.cs @@ -362,7 +362,7 @@ public partial interface IMagickImageCollection : IDisposable /// Resets the page property of every image in the collection. /// /// Thrown when an error is raised by ImageMagick. - void RePage(); + void ResetPage(); /// /// Reverses the order of the images in the collection. diff --git a/src/Magick.NET/MagickImage.cs b/src/Magick.NET/MagickImage.cs index 178daedd3b..842b7e215a 100644 --- a/src/Magick.NET/MagickImage.cs +++ b/src/Magick.NET/MagickImage.cs @@ -2280,8 +2280,8 @@ public void CopyPixels(IMagickImage source, IMagickGeometry geometry, int x, int } /// - /// Crop image (subregion of original image). RePage should be called unless the Page information - /// is needed. + /// Crop image (subregion of original image). should be called unless + /// the information is needed. /// /// The width of the subregion to crop. /// The height of the subregion to crop. @@ -2290,8 +2290,8 @@ public void Crop(uint width, uint height) => Crop(width, height, Gravity.Undefined); /// - /// Crop image (subregion of original image). RePage should be called unless the Page information - /// is needed. + /// Crop image (subregion of original image). should be called unless + /// the information is needed. /// /// The width of the subregion to crop. /// The height of the subregion to crop. @@ -2301,8 +2301,8 @@ public void Crop(uint width, uint height, Gravity gravity) => Crop(new MagickGeometry(0, 0, width, height), gravity); /// - /// Crop image (subregion of original image). RePage should be called unless the Page information - /// is needed. + /// Crop image (subregion of original image). should be called unless + /// the information is needed. /// /// The subregion to crop. /// Thrown when an error is raised by ImageMagick. @@ -2310,8 +2310,8 @@ public void Crop(IMagickGeometry geometry) => Crop(geometry, Gravity.Undefined); /// - /// Crop image (subregion of original image). RePage should be called unless the Page information - /// is needed. + /// Crop image (subregion of original image). should be called unless + /// the information is needed. /// /// The subregion to crop. /// The position where the cropping should start from. @@ -5144,13 +5144,6 @@ public void RemoveReadMask() public void RemoveWriteMask() => _nativeInstance.SetWriteMask(null); - /// - /// Resets the page property of this image. - /// - /// Thrown when an error is raised by ImageMagick. - public void RePage() - => Page = new MagickGeometry(0, 0, 0, 0); - /// /// Resize image in terms of its pixel size. /// @@ -5168,6 +5161,13 @@ public void Resample(double resolutionX, double resolutionY) public void Resample(PointD density) => Resample(density.X, density.Y); + /// + /// Resets the page property of this image. + /// + /// Thrown when an error is raised by ImageMagick. + public void ResetPage() + => Page = new MagickGeometry(0, 0, 0, 0); + /// /// Resize image to specified size. /// diff --git a/src/Magick.NET/MagickImageCollection.cs b/src/Magick.NET/MagickImageCollection.cs index f892ad928d..a4e2492278 100644 --- a/src/Magick.NET/MagickImageCollection.cs +++ b/src/Magick.NET/MagickImageCollection.cs @@ -1266,11 +1266,11 @@ public void RemoveAt(int index) /// Resets the page property of every image in the collection. /// /// Thrown when an error is raised by ImageMagick. - public void RePage() + public void ResetPage() { foreach (var image in _images) { - image.RePage(); + image.ResetPage(); } } diff --git a/tests/Magick.NET.Tests/MagickImageCollectionTests/TheRePageMethod.cs b/tests/Magick.NET.Tests/MagickImageCollectionTests/TheResetPageMethod.cs similarity index 86% rename from tests/Magick.NET.Tests/MagickImageCollectionTests/TheRePageMethod.cs rename to tests/Magick.NET.Tests/MagickImageCollectionTests/TheResetPageMethod.cs index 9c8f306af3..974a8944ac 100644 --- a/tests/Magick.NET.Tests/MagickImageCollectionTests/TheRePageMethod.cs +++ b/tests/Magick.NET.Tests/MagickImageCollectionTests/TheResetPageMethod.cs @@ -8,7 +8,7 @@ namespace Magick.NET.Tests; public partial class MagickImageCollectionTests { - public class TheRePageMethod + public class TheResetPageMethod { [Fact] public void ShouldResetThePagePropertyOfAllTheImages() @@ -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); @@ -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); diff --git a/tests/Magick.NET.Tests/MagickImageTests/TheCloneMethod.cs b/tests/Magick.NET.Tests/MagickImageTests/TheCloneMethod.cs index 6fa95b7728..fcd575b765 100644 --- a/tests/Magick.NET.Tests/MagickImageTests/TheCloneMethod.cs +++ b/tests/Magick.NET.Tests/MagickImageTests/TheCloneMethod.cs @@ -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); @@ -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));