]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 22 Oct 2009 23:59:52 +0000 (23:59 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 22 Oct 2009 23:59:52 +0000 (23:59 +0000)
ChangeLog
magick/gem.c

index ca5dd14add4236eb4c7183e388a3213fe24ff770..dab7b058746cb16518b45c990389014a89b14c25 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
 2009-10-18  6.5.7-1 Cristy  <quetzlzacatenango@image...>
   * Alpha blending is not required for ScaleImage().
   * Guassian noise operator is not longer discontinuous.
+  * Correct hue computation for the HSB colorspace.
 
 2009-10-14  6.5.7-0 Pino Toscano  <pino@kde...>
   * ImageMagick fails to build in GNU/HURD due to absence of PATH_MAX.
index f0cd3467e062a2ed219880a05d7cbc5b85024bad..747ba0762137896d5251d8f4537c695fb8b7f523 100644 (file)
@@ -372,16 +372,20 @@ MagickExport void ConvertRGBToHSB(const Quantum red,const Quantum green,
   *brightness=(double) (QuantumScale*max);
   if (delta == 0.0)
     return;
-  if ((MagickRealType) red == max)
-    *hue=(double) ((green-(MagickRealType) blue)/delta);
+  if (red == max)
+    *hue=((((max-blue)/6.0)+(delta/2.0))-(((max-green)/6.0)+(delta/2.0)))/delta;
   else
-    if ((MagickRealType) green == max)
-      *hue=(double) (2.0+(blue-(MagickRealType) red)/delta);
+    if (green == max)
+      *hue=(1.0/3.0)+((((max-red)/6.0)+(delta/2.0))-(((max-blue)/6.0)+
+        (delta/2.0)))/delta;
     else
-      *hue=(double) (4.0+(red-(MagickRealType) green)/delta);
-  *hue/=6.0;
+      if (blue == max)
+        *hue=(2.0/3.0)+((((max-green)/6.0)+(delta/2.0))-(((max-red)/6.0)+
+          (delta/2.0)))/delta;
   if (*hue < 0.0)
     *hue+=1.0;
+  if (*hue > 1.0)
+    *hue-=1.0;
 }
 \f
 /*