@@ -1729,64 +1729,57 @@ public double Compare(IMagickImage image, ErrorMetric metric, Channels channels)
17291729 /// Returns the distortion based on the specified metric.
17301730 /// </summary>
17311731 /// <param name="image">The other image to compare with this image.</param>
1732- /// <param name="settings ">The settings to use.</param>
1733- /// <param name="difference ">The image that will contain the difference .</param>
1734- /// <returns>The distortion based on the specified metric .</returns>
1732+ /// <param name="metric ">The metric to use.</param>
1733+ /// <param name="distortion ">The distortion based on the specified metric .</param>
1734+ /// <returns>The image that contains the difference .</returns>
17351735 /// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
1736- public double Compare ( IMagickImage image , ICompareSettings < QuantumType > settings , IMagickImage difference )
1737- => Compare ( image , settings , difference , ImageMagick . Channels . Undefined ) ;
1736+ public IMagickImage < QuantumType > Compare ( IMagickImage image , ErrorMetric metric , out double distortion )
1737+ => Compare ( image , metric , ImageMagick . Channels . Undefined , out distortion ) ;
17381738
17391739 /// <summary>
17401740 /// Returns the distortion based on the specified metric.
17411741 /// </summary>
17421742 /// <param name="image">The other image to compare with this image.</param>
17431743 /// <param name="metric">The metric to use.</param>
1744- /// <param name="difference">The image that will contain the difference.</param>
1745- /// <returns>The distortion based on the specified metric.</returns>
1744+ /// <param name="channels">The channel(s) to compare.</param>
1745+ /// <param name="distortion">The distortion based on the specified metric.</param>
1746+ /// <returns>The image that contains the difference.</returns>
17461747 /// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
1747- public double Compare ( IMagickImage image , ErrorMetric metric , IMagickImage difference )
1748- => Compare ( image , metric , difference , ImageMagick . Channels . Undefined ) ;
1748+ public IMagickImage < QuantumType > Compare ( IMagickImage image , ErrorMetric metric , Channels channels , out double distortion )
1749+ => Compare ( image , new CompareSettings { Metric = metric } , channels , out distortion ) ;
17491750
17501751 /// <summary>
17511752 /// Returns the distortion based on the specified metric.
17521753 /// </summary>
17531754 /// <param name="image">The other image to compare with this image.</param>
1754- /// <param name="metric">The metric to use.</param>
1755- /// <param name="difference">The image that will contain the difference.</param>
1756- /// <param name="channels">The channel(s) to compare.</param>
1757- /// <returns>The distortion based on the specified metric.</returns>
1755+ /// <param name="settings">The settings to use.</param>
1756+ /// <param name="distortion">The distortion based on the specified metric.</param>
1757+ /// <returns>The image that contains the difference.</returns>
17581758 /// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
1759- public double Compare ( IMagickImage image , ErrorMetric metric , IMagickImage difference , Channels channels )
1760- => Compare ( image , new CompareSettings { Metric = metric } , difference , channels ) ;
1759+ public IMagickImage < QuantumType > Compare ( IMagickImage image , ICompareSettings < QuantumType > settings , out double distortion )
1760+ => Compare ( image , settings , ImageMagick . Channels . Undefined , out distortion ) ;
17611761
17621762 /// <summary>
17631763 /// Returns the distortion based on the specified metric.
17641764 /// </summary>
17651765 /// <param name="image">The other image to compare with this image.</param>
17661766 /// <param name="settings">The settings to use.</param>
1767- /// <param name="difference">The image that will contain the difference.</param>
17681767 /// <param name="channels">The channel(s) to compare.</param>
1769- /// <returns>The distortion based on the specified metric.</returns>
1768+ /// <param name="distortion">The distortion based on the specified metric.</param>
1769+ /// <returns>The image that contains the difference.</returns>
17701770 /// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
1771- public double Compare ( IMagickImage image , ICompareSettings < QuantumType > settings , IMagickImage difference , Channels channels )
1771+ public IMagickImage < QuantumType > Compare ( IMagickImage image , ICompareSettings < QuantumType > settings , Channels channels , out double distortion )
17721772 {
17731773 Throw . IfNull ( nameof ( image ) , image ) ;
17741774 Throw . IfNull ( nameof ( settings ) , settings ) ;
1775- Throw . IfNull ( nameof ( difference ) , difference ) ;
1776-
1777- if ( difference is not MagickImage differenceImage )
1778- throw new NotSupportedException ( ) ;
17791775
17801776 using var temporaryDefines = new TemporaryDefines ( this ) ;
17811777 temporaryDefines . SetArtifact ( "compare:highlight-color" , settings . HighlightColor ) ;
17821778 temporaryDefines . SetArtifact ( "compare:lowlight-color" , settings . LowlightColor ) ;
17831779 temporaryDefines . SetArtifact ( "compare:masklight-color" , settings . MasklightColor ) ;
17841780
1785- var result = _nativeInstance . Compare ( image , settings . Metric , channels , out var distortion ) ;
1786- if ( result != IntPtr . Zero )
1787- differenceImage . _nativeInstance . Instance = result ;
1788-
1789- return distortion ;
1781+ var result = _nativeInstance . Compare ( image , settings . Metric , channels , out distortion ) ;
1782+ return Create ( result , _settings ) ;
17901783 }
17911784
17921785 /// <summary>
0 commit comments