Skip to content

Commit ac0b36f

Browse files
committed
Renamed Map to Remap.
1 parent b52a4fd commit ac0b36f

File tree

8 files changed

+158
-154
lines changed

8 files changed

+158
-154
lines changed

src/Magick.NET.Core/IMagickImage.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,23 +1995,6 @@ public partial interface IMagickImage : IDisposable
19951995
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
19961996
void Magnify();
19971997

1998-
/// <summary>
1999-
/// Remap image colors with closest color from reference image.
2000-
/// </summary>
2001-
/// <param name="image">The image to use.</param>
2002-
/// <returns>The error informaton.</returns>
2003-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
2004-
IMagickErrorInfo Map(IMagickImage image);
2005-
2006-
/// <summary>
2007-
/// Remap image colors with closest color from reference image.
2008-
/// </summary>
2009-
/// <param name="image">The image to use.</param>
2010-
/// <param name="settings">Quantize settings.</param>
2011-
/// <returns>The error informaton.</returns>
2012-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
2013-
IMagickErrorInfo Map(IMagickImage image, IQuantizeSettings settings);
2014-
20151998
/// <summary>
20161999
/// Delineate arbitrarily shaped clusters in the image.
20172000
/// </summary>
@@ -2566,6 +2549,23 @@ public partial interface IMagickImage : IDisposable
25662549
/// <param name="region">The mask region.</param>
25672550
void RegionMask(IMagickGeometry region);
25682551

2552+
/// <summary>
2553+
/// Remap image colors with closest color from reference image.
2554+
/// </summary>
2555+
/// <param name="image">The image to use.</param>
2556+
/// <returns>The error informaton.</returns>
2557+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
2558+
IMagickErrorInfo Remap(IMagickImage image);
2559+
2560+
/// <summary>
2561+
/// Remap image colors with closest color from reference image.
2562+
/// </summary>
2563+
/// <param name="image">The image to use.</param>
2564+
/// <param name="settings">Quantize settings.</param>
2565+
/// <returns>The error informaton.</returns>
2566+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
2567+
IMagickErrorInfo Remap(IMagickImage image, IQuantizeSettings settings);
2568+
25692569
/// <summary>
25702570
/// Removes the artifact with the specified name.
25712571
/// </summary>

src/Magick.NET.Core/IMagickImageCollection.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,21 @@ public partial interface IMagickImageCollection : IDisposable
343343
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
344344
Task ReadAsync(string fileName, MagickFormat format, CancellationToken cancellationToken);
345345

346+
/// <summary>
347+
/// Remap image colors with closest color from reference image.
348+
/// </summary>
349+
/// <param name="image">The image to use.</param>
350+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
351+
void Remap(IMagickImage image);
352+
353+
/// <summary>
354+
/// Remap image colors with closest color from reference image.
355+
/// </summary>
356+
/// <param name="image">The image to use.</param>
357+
/// <param name="settings">Quantize settings.</param>
358+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
359+
void Remap(IMagickImage image, IQuantizeSettings settings);
360+
346361
/// <summary>
347362
/// Resets the page property of every image in the collection.
348363
/// </summary>

src/Magick.NET.Core/IMagickImageCollection{TQuantumType}.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,6 @@ public partial interface IMagickImageCollection<TQuantumType> : IMagickImageColl
129129
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
130130
IMagickImage<TQuantumType> Fx(string expression, Channels channels);
131131

132-
/// <summary>
133-
/// Remap image colors with closest color from reference image.
134-
/// </summary>
135-
/// <param name="image">The image to use.</param>
136-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
137-
void Map(IMagickImage<TQuantumType> image);
138-
139-
/// <summary>
140-
/// Remap image colors with closest color from reference image.
141-
/// </summary>
142-
/// <param name="image">The image to use.</param>
143-
/// <param name="settings">Quantize settings.</param>
144-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
145-
void Map(IMagickImage<TQuantumType> image, IQuantizeSettings settings);
146-
147132
/// <summary>
148133
/// Merge all layers onto a canvas just large enough to hold all the actual images. The virtual
149134
/// canvas of the first image is preserved but otherwise ignored.

src/Magick.NET.Core/IMagickImage{TQuantumType}.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -542,23 +542,6 @@ public partial interface IMagickImage<TQuantumType> : IMagickImage, IComparable<
542542
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
543543
void LevelColors(IMagickColor<TQuantumType> blackColor, IMagickColor<TQuantumType> whiteColor, Channels channels);
544544

545-
/// <summary>
546-
/// Remap image colors with closest color from the specified colors.
547-
/// </summary>
548-
/// <param name="colors">The colors to use.</param>
549-
/// <returns>The error informaton.</returns>
550-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
551-
IMagickErrorInfo Map(IEnumerable<IMagickColor<TQuantumType>> colors);
552-
553-
/// <summary>
554-
/// Remap image colors with closest color from the specified colors.
555-
/// </summary>
556-
/// <param name="colors">The colors to use.</param>
557-
/// <param name="settings">Quantize settings.</param>
558-
/// <returns>The error informaton.</returns>
559-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
560-
IMagickErrorInfo Map(IEnumerable<IMagickColor<TQuantumType>> colors, IQuantizeSettings settings);
561-
562545
/// <summary>
563546
/// Changes any pixel that matches target with the color defined by fill.
564547
/// </summary>
@@ -609,6 +592,23 @@ public partial interface IMagickImage<TQuantumType> : IMagickImage, IComparable<
609592
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
610593
void Ping(string fileName, IMagickReadSettings<TQuantumType>? readSettings);
611594

595+
/// <summary>
596+
/// Remap image colors with closest color from the specified colors.
597+
/// </summary>
598+
/// <param name="colors">The colors to use.</param>
599+
/// <returns>The error informaton.</returns>
600+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
601+
IMagickErrorInfo Remap(IEnumerable<IMagickColor<TQuantumType>> colors);
602+
603+
/// <summary>
604+
/// Remap image colors with closest color from the specified colors.
605+
/// </summary>
606+
/// <param name="colors">The colors to use.</param>
607+
/// <param name="settings">Quantize settings.</param>
608+
/// <returns>The error informaton.</returns>
609+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
610+
IMagickErrorInfo Remap(IEnumerable<IMagickColor<TQuantumType>> colors, IQuantizeSettings settings);
611+
612612
/// <summary>
613613
/// Changes the value of individual pixels based on the intensity of each pixel compared to a
614614
/// random threshold. The result is a low-contrast, two color image.

src/Magick.NET/MagickImage.cs

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3824,69 +3824,6 @@ public void Lower(uint size)
38243824
public void Magnify()
38253825
=> _nativeInstance.Magnify();
38263826

3827-
/// <summary>
3828-
/// Remap image colors with closest color from the specified colors.
3829-
/// </summary>
3830-
/// <param name="colors">The colors to use.</param>
3831-
/// <returns>The error informaton.</returns>
3832-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
3833-
public IMagickErrorInfo Map(IEnumerable<IMagickColor<QuantumType>> colors)
3834-
{
3835-
Throw.IfNull(nameof(colors), colors);
3836-
3837-
return Map(colors, new QuantizeSettings());
3838-
}
3839-
3840-
/// <summary>
3841-
/// Remap image colors with closest color from the specified colors.
3842-
/// </summary>
3843-
/// <param name="colors">The colors to use.</param>
3844-
/// <param name="settings">Quantize settings.</param>
3845-
/// <returns>The error informaton.</returns>
3846-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
3847-
public IMagickErrorInfo Map(IEnumerable<IMagickColor<QuantumType>> colors, IQuantizeSettings settings)
3848-
{
3849-
Throw.IfNull(nameof(colors), colors);
3850-
3851-
var colorList = new List<IMagickColor<QuantumType>>(colors);
3852-
if (colorList.Count == 0)
3853-
throw new ArgumentException("Value cannot be empty.", nameof(colors));
3854-
3855-
using var images = new MagickImageCollection();
3856-
foreach (var color in colorList)
3857-
images.Add(new MagickImage(color, 1, 1));
3858-
3859-
using var image = images.AppendHorizontally();
3860-
return Map(image, settings);
3861-
}
3862-
3863-
/// <summary>
3864-
/// Remap image colors with closest color from reference image.
3865-
/// </summary>
3866-
/// <param name="image">The image to use.</param>
3867-
/// <returns>The error informaton.</returns>
3868-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
3869-
public IMagickErrorInfo Map(IMagickImage image)
3870-
=> Map(image, new QuantizeSettings());
3871-
3872-
/// <summary>
3873-
/// Remap image colors with closest color from reference image.
3874-
/// </summary>
3875-
/// <param name="image">The image to use.</param>
3876-
/// <param name="settings">Quantize settings.</param>
3877-
/// <returns>The error informaton.</returns>
3878-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
3879-
public IMagickErrorInfo Map(IMagickImage image, IQuantizeSettings settings)
3880-
{
3881-
Throw.IfNull(nameof(image), image);
3882-
Throw.IfNull(nameof(settings), settings);
3883-
3884-
if (_nativeInstance.Map(image, settings))
3885-
return new MagickErrorInfo();
3886-
3887-
return CreateErrorInfo(this);
3888-
}
3889-
38903827
/// <summary>
38913828
/// Delineate arbitrarily shaped clusters in the image.
38923829
/// </summary>
@@ -5088,6 +5025,69 @@ public void ReduceNoise(uint order)
50885025
public void RegionMask(IMagickGeometry geometry)
50895026
=> _nativeInstance.RegionMask(MagickRectangle.FromGeometry(geometry, this));
50905027

5028+
/// <summary>
5029+
/// Remap image colors with closest color from the specified colors.
5030+
/// </summary>
5031+
/// <param name="colors">The colors to use.</param>
5032+
/// <returns>The error informaton.</returns>
5033+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
5034+
public IMagickErrorInfo Remap(IEnumerable<IMagickColor<QuantumType>> colors)
5035+
{
5036+
Throw.IfNull(nameof(colors), colors);
5037+
5038+
return Remap(colors, new QuantizeSettings());
5039+
}
5040+
5041+
/// <summary>
5042+
/// Remap image colors with closest color from the specified colors.
5043+
/// </summary>
5044+
/// <param name="colors">The colors to use.</param>
5045+
/// <param name="settings">Quantize settings.</param>
5046+
/// <returns>The error informaton.</returns>
5047+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
5048+
public IMagickErrorInfo Remap(IEnumerable<IMagickColor<QuantumType>> colors, IQuantizeSettings settings)
5049+
{
5050+
Throw.IfNull(nameof(colors), colors);
5051+
5052+
var colorList = new List<IMagickColor<QuantumType>>(colors);
5053+
if (colorList.Count == 0)
5054+
throw new ArgumentException("Value cannot be empty.", nameof(colors));
5055+
5056+
using var images = new MagickImageCollection();
5057+
foreach (var color in colorList)
5058+
images.Add(new MagickImage(color, 1, 1));
5059+
5060+
using var image = images.AppendHorizontally();
5061+
return Remap(image, settings);
5062+
}
5063+
5064+
/// <summary>
5065+
/// Remap image colors with closest color from reference image.
5066+
/// </summary>
5067+
/// <param name="image">The image to use.</param>
5068+
/// <returns>The error informaton.</returns>
5069+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
5070+
public IMagickErrorInfo Remap(IMagickImage image)
5071+
=> Remap(image, new QuantizeSettings());
5072+
5073+
/// <summary>
5074+
/// Remap image colors with closest color from reference image.
5075+
/// </summary>
5076+
/// <param name="image">The image to use.</param>
5077+
/// <param name="settings">Quantize settings.</param>
5078+
/// <returns>The error informaton.</returns>
5079+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
5080+
public IMagickErrorInfo Remap(IMagickImage image, IQuantizeSettings settings)
5081+
{
5082+
Throw.IfNull(nameof(image), image);
5083+
Throw.IfNull(nameof(settings), settings);
5084+
5085+
if (_nativeInstance.Map(image, settings))
5086+
return new MagickErrorInfo();
5087+
5088+
return CreateErrorInfo(this);
5089+
}
5090+
50915091
/// <summary>
50925092
/// Removes the artifact with the specified name.
50935093
/// </summary>

src/Magick.NET/MagickImageCollection.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -610,29 +610,6 @@ public void Insert(int index, IMagickImage<QuantumType> item)
610610
public void Insert(int index, string fileName)
611611
=> _images.Insert(index, new MagickImage(fileName));
612612

613-
/// <summary>
614-
/// Remap image colors with closest color from reference image.
615-
/// </summary>
616-
/// <param name="image">The image to use.</param>
617-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
618-
public void Map(IMagickImage<QuantumType> image)
619-
=> Map(image, new QuantizeSettings());
620-
621-
/// <summary>
622-
/// Remap image colors with closest color from reference image.
623-
/// </summary>
624-
/// <param name="image">The image to use.</param>
625-
/// <param name="settings">Quantize settings.</param>
626-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
627-
public void Map(IMagickImage<QuantumType> image, IQuantizeSettings settings)
628-
{
629-
Throw.IfNull(nameof(image), image);
630-
Throw.IfNull(nameof(settings), settings);
631-
632-
using var imageAttacher = new TemporaryImageAttacher(_images);
633-
_nativeInstance.Map(_images[0], settings, image);
634-
}
635-
636613
/// <summary>
637614
/// Merge all layers onto a canvas just large enough to hold all the actual images. The virtual
638615
/// canvas of the first image is preserved but otherwise ignored.
@@ -860,6 +837,29 @@ public IMagickImage<QuantumType> Polynomial(double[] terms)
860837
return MagickImage.Create(image, GetSettings());
861838
}
862839

840+
/// <summary>
841+
/// Remap image colors with closest color from reference image.
842+
/// </summary>
843+
/// <param name="image">The image to use.</param>
844+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
845+
public void Remap(IMagickImage image)
846+
=> Remap(image, new QuantizeSettings());
847+
848+
/// <summary>
849+
/// Remap image colors with closest color from reference image.
850+
/// </summary>
851+
/// <param name="image">The image to use.</param>
852+
/// <param name="settings">Quantize settings.</param>
853+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
854+
public void Remap(IMagickImage image, IQuantizeSettings settings)
855+
{
856+
Throw.IfNull(nameof(image), image);
857+
Throw.IfNull(nameof(settings), settings);
858+
859+
using var imageAttacher = new TemporaryImageAttacher(_images);
860+
_nativeInstance.Map(_images[0], settings, image);
861+
}
862+
863863
/// <summary>
864864
/// Quantize images (reduce number of colors).
865865
/// </summary>

0 commit comments

Comments
 (0)