gimp r27765 - in branches/gimp-2-6: . app/core



Author: neo
Date: Thu Dec  4 20:59:42 2008
New Revision: 27765
URL: http://svn.gnome.org/viewvc/gimp?rev=27765&view=rev

Log:
2008-12-04  Sven Neumann  <sven gimp org>

	Merged from trunk:

	Bug 563130 â Hue selection mode does not cross the 0-360 degrees 
line

	* app/core/gimpimage-contiguous-region.c (pixel_difference):
	applied patch from Daniel Hornung.



Modified:
   branches/gimp-2-6/ChangeLog
   branches/gimp-2-6/app/core/gimpimage-contiguous-region.c

Modified: branches/gimp-2-6/app/core/gimpimage-contiguous-region.c
==============================================================================
--- branches/gimp-2-6/app/core/gimpimage-contiguous-region.c	(original)
+++ branches/gimp-2-6/app/core/gimpimage-contiguous-region.c	Thu Dec  4 20:59:42 2008
@@ -379,36 +379,44 @@
           break;
 
         case GIMP_SELECT_CRITERION_H:
-          av0 = (gint)col1[0];
-          av1 = (gint)col1[1];
-          av2 = (gint)col1[2];
-          bv0 = (gint)col2[0];
-          bv1 = (gint)col2[1];
-          bv2 = (gint)col2[2];
+          av0 = (gint) col1[0];
+          av1 = (gint) col1[1];
+          av2 = (gint) col1[2];
+          bv0 = (gint) col2[0];
+          bv1 = (gint) col2[1];
+          bv2 = (gint) col2[2];
           gimp_rgb_to_hsv_int (&av0, &av1, &av2);
           gimp_rgb_to_hsv_int (&bv0, &bv1, &bv2);
-          max = abs (av0 - bv0);
+          /* wrap around candidates for the actual distance */
+          {
+            gint dist1 = abs (av0 - bv0);
+            gint dist2 = abs (av0 - 360 - bv0);
+            gint dist3 = abs (av0 - bv0 + 360);
+            max = MIN (dist1, dist2);
+            if (max > dist3)
+              max = dist3;
+          }
           break;
 
         case GIMP_SELECT_CRITERION_S:
-          av0 = (gint)col1[0];
-          av1 = (gint)col1[1];
-          av2 = (gint)col1[2];
-          bv0 = (gint)col2[0];
-          bv1 = (gint)col2[1];
-          bv2 = (gint)col2[2];
+          av0 = (gint) col1[0];
+          av1 = (gint) col1[1];
+          av2 = (gint) col1[2];
+          bv0 = (gint) col2[0];
+          bv1 = (gint) col2[1];
+          bv2 = (gint) col2[2];
           gimp_rgb_to_hsv_int (&av0, &av1, &av2);
           gimp_rgb_to_hsv_int (&bv0, &bv1, &bv2);
           max = abs (av1 - bv1);
           break;
 
         case GIMP_SELECT_CRITERION_V:
-          av0 = (gint)col1[0];
-          av1 = (gint)col1[1];
-          av2 = (gint)col1[2];
-          bv0 = (gint)col2[0];
-          bv1 = (gint)col2[1];
-          bv2 = (gint)col2[2];
+          av0 = (gint) col1[0];
+          av1 = (gint) col1[1];
+          av2 = (gint) col1[2];
+          bv0 = (gint) col2[0];
+          bv1 = (gint) col2[1];
+          bv2 = (gint) col2[2];
           gimp_rgb_to_hsv_int (&av0, &av1, &av2);
           gimp_rgb_to_hsv_int (&bv0, &bv1, &bv2);
           max = abs (av2 - bv2);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]