]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 9 Dec 2010 14:27:51 +0000 (14:27 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 9 Dec 2010 14:27:51 +0000 (14:27 +0000)
magick/color.c

index 332bd84d9fe023b2cc8bcf418f3fed3b5341160b..18d33b3a384ba14dd765a3649dba18beebe4471b 100644 (file)
@@ -1577,7 +1577,7 @@ MagickExport MagickBooleanType IsColorSimilar(const Image *image,
         scale=(QuantumScale*GetAlphaPixelComponent(p));
       if (image->matte != MagickFalse)
         scale*=(QuantumScale*GetAlphaPixelComponent(q));
-      if (scale < MagickEpsilon)
+      if (scale <= MagickEpsilon)
         return(MagickTrue);
     }
 
@@ -1756,6 +1756,23 @@ MagickExport MagickBooleanType IsImageSimilar(const Image *image,
 %  This method is used by ColorFloodFill() and other algorithms which
 %  compare two colors.
 %
+%  This implements the equivelent of...
+%    fuzz < sqrt( color_distance^2 * u.a*v.a  + alpha_distance^2 )
+%
+%  Which produces a multi-dimentional cone for that colorspace along the
+%  transpaency vector
+%
+%  For example for an RGB
+%    color_distance^2  = ( (u.r-v.r)^2 + (u.g-v.g)^2 + (u.b-v.b)^2 ) / 3
+%
+%  See http://www.imagemagick.org/Usage/bugs/fuzz_distance/
+%
+%  Hue colorspace distances need more work.  Hue is not a distance, it is an
+%  angle!
+%
+%  A check that q is in the same color space as p should be made and the
+%  appropriate mapping made.  -- Anthony Thyssen  8 December 2010
+%
 %  The format of the IsMagickColorSimilar method is:
 %
 %      MagickBooleanType IsMagickColorSimilar(const MagickPixelPacket *p,
@@ -1768,26 +1785,6 @@ MagickExport MagickBooleanType IsImageSimilar(const Image *image,
 %    o q: Pixel q.
 %
 */
-/*
-   This implements the equivelent of...
-     fuzz < sqrt( color_distance^2 * u.a*v.a  + alpha_distance^2 )
-
-   Which produces a multi-dimentional cone for that colorspace
-   along the transpaency vector
-
-   For example for an RGB
-     color_distance^2  = ( (u.r-v.r)^2 + (u.g-v.g)^2 + (u.b-v.b)^2 ) / 3
-
-   See http://www.imagemagick.org/Usage/bugs/fuzz_distance/
-
-   Hue colorspace distances need more work.
-   Hue is not a distance, it is an angle!
-
-   A check that q is in the same color space as p should be made!
-   and the appropriate mapping made.
-
-   -- Anthony Thyssen  8 December 2010
-*/
 MagickExport MagickBooleanType IsMagickColorSimilar(const MagickPixelPacket *p,
   const MagickPixelPacket *q)
 {
@@ -1799,7 +1796,6 @@ MagickExport MagickBooleanType IsMagickColorSimilar(const MagickPixelPacket *p,
     scale,
     distance;
 
-
   if ((p->fuzz == 0.0) && (q->fuzz == 0.0))
     return(IsMagickColorEqual(p,q));
   if (p->fuzz == 0.0)
@@ -1827,7 +1823,7 @@ MagickExport MagickBooleanType IsMagickColorSimilar(const MagickPixelPacket *p,
         scale=(QuantumScale*GetAlphaPixelComponent(p));
       if (q->matte != MagickFalse)
         scale*=(QuantumScale*GetAlphaPixelComponent(q));
-      if ( scale < MagickEpsilon )
+      if ( scale <= MagickEpsilon )
         return(MagickTrue);
     }
 
@@ -1848,8 +1844,7 @@ MagickExport MagickBooleanType IsMagickColorSimilar(const MagickPixelPacket *p,
   fuzz*=3.0;
 
   pixel=p->red-q->red;
-  if ((p->colorspace == HSLColorspace) ||
-      (p->colorspace == HSBColorspace) ||
+  if ((p->colorspace == HSLColorspace) || (p->colorspace == HSBColorspace) ||
       (p->colorspace == HWBColorspace))
     {
       /* This calculates a arc distance for hue