[gimp/soc-2009-siox-drb] 7.6 alter format



commit d7910ba49fa7637dcce3ab4f70e2d1034b9905de
Author: Jie Ding <jieding src gnome org>
Date:   Mon Jul 6 15:08:50 2009 +0800

    7.6 alter format

 app/base/siox.c                            |  156 ++++---------
 app/base/siox.h                            |    6 -
 app/core/gimpdrawable-foreground-extract.c |  149 ++++---------
 app/core/gimpdrawable-foreground-extract.h |   29 +--
 app/tools/gimpforegroundselecttool.c       |  351 ++++++++++++----------------
 5 files changed, 243 insertions(+), 448 deletions(-)
---
diff --git a/app/base/siox.c b/app/base/siox.c
index de111ae..543da16 100644
--- a/app/base/siox.c
+++ b/app/base/siox.c
@@ -828,20 +828,8 @@ siox_foreground_extract (SioxState          *state,
                          const gdouble       sensitivity[3],
                          gboolean            multiblob,
                          SioxProgressFunc    progress_callback,
-                         //gfloat              sioxdrbthreshold,//(new)
-                         //gboolean	     sioxdrboptions,//(new) 
-                         //gboolean            drbsignal,//(new)
-                         //gint                brush_radius,//(new)
-                         gpointer            progress_data)
+			 gpointer            progress_data)
 {
-//if(!drbsignal)
-  printf("siox_start====state->offset_x=%d,state->offset_y=%d,state->x = %d,state->y=%d,"
-	   "state->width=%d,state->height=%d,state->bgsiglen=%d,state->fgsiglen=%d\n",
-	   state->offset_x,state->offset_y,state->x,state->y,state->width,state->height,state->bgsiglen,state->fgsiglen);
-  printf("siox_mask_start====mask->ref_count=%d,mask->x=%d,mask->y=%d,mask->width=%d,mask->height=%d,mask->ntile_rows=%d"
-		 "mask->ntile_cols=%d,mask->cached_num=%d\n",
-		 mask->ref_count,mask->x,mask->y,mask->width,mask->height,mask->ntile_rows,mask->ntile_cols,mask->cached_num);	
-  printf("siox_foreground_extract \n");
   PixelRegion  srcPR;
   PixelRegion  mapPR;
   gpointer     pr;
@@ -884,34 +872,26 @@ siox_foreground_extract (SioxState          *state,
   total = width * height;
 
   if (refinement & SIOX_REFINEMENT_ADD_FOREGROUND)
-   { g_hash_table_foreach_remove (state->cache, siox_cache_remove_bg, NULL);
-    printf("siox_foreground_extract/refinement = SIOX_REFINEMENT_ADD_FOREGROUND \n");
-   }
+      g_hash_table_foreach_remove (state->cache, siox_cache_remove_bg, NULL);
+
   if (refinement & SIOX_REFINEMENT_ADD_BACKGROUND)
-    {g_hash_table_foreach_remove (state->cache, siox_cache_remove_fg, NULL);
-     printf("siox_foreground_extract/refinement = SIOX_REFINEMENT_ADD_BACKGROUND\n"); 
-     }
+      g_hash_table_foreach_remove (state->cache, siox_cache_remove_fg, NULL);
+    
   if (refinement & SIOX_REFINEMENT_CHANGE_SENSITIVITY)
-    {
       refinement = SIOX_REFINEMENT_RECALCULATE;
-      printf("siox_foreground_extract/refinement = SIOX_REFINEMENT_RECALCULATE \n");
-    }
   else
     {
       if (! state->bgsig)
-		{printf("siox_foreground_extract/!state->bgsig");
-			refinement |= SIOX_REFINEMENT_ADD_BACKGROUND;
-		}
+	refinement |= SIOX_REFINEMENT_ADD_BACKGROUND;
+		
       if (! state->fgsig)
-		{printf("siox_foreground_extract/!state->fgsig");
         refinement |= SIOX_REFINEMENT_ADD_FOREGROUND;
-		}
     }
 
 
   if (refinement & (SIOX_REFINEMENT_ADD_FOREGROUND |
                     SIOX_REFINEMENT_ADD_BACKGROUND))
-    {printf("siox_foreground_extract/count given foreground and background pixels \n");
+    {
       /* count given foreground and background pixels */
       pixel_region_init (&mapPR, mask, x, y, width, height, FALSE);
       total = width * height;
@@ -944,10 +924,9 @@ siox_foreground_extract (SioxState          *state,
             pixels += mapPR.w * mapPR.h;
             
             if (n % 16 == 0)
-              {siox_progress_update (progress_callback, progress_data,
+		siox_progress_update (progress_callback, progress_data,
                                     0.1 * ((gdouble) pixels / (gdouble) total));
-              printf("siox_foreground_extract/siox_progress_update 0.1\n");                      
-              }
+             
         }
 
 #ifdef SIOX_DEBUG
@@ -968,11 +947,11 @@ siox_foreground_extract (SioxState          *state,
                          width, height, FALSE);
       pixel_region_init (&mapPR, mask,
                          x, y, width, height, FALSE);
-printf("siox_foreground_extract/create inputs for color signatures \n");
+
       pr = pixel_regions_register (2, &srcPR, &mapPR);
 
       if (! (refinement & SIOX_REFINEMENT_ADD_FOREGROUND))
-        {printf("siox_foreground_extract/! (refinement & SIOX_REFINEMENT_ADD_FOREGROUND)\n");
+        {   
           gint i = 0;
 
           for (pixels = 0, n = 0;
@@ -1003,15 +982,14 @@ printf("siox_foreground_extract/create inputs for color signatures \n");
               pixels += mapPR.w * mapPR.h;
 
               if (n % 16 == 0)
-               { siox_progress_update (progress_callback, progress_data,
+		  siox_progress_update (progress_callback, progress_data,
                                       0.1 + 0.1 * ((gdouble) pixels /
                                                    (gdouble) total));
-               printf("siox_foreground_extract/siox_progress_update 0.1+0.1\n");   
-               }
+               
             }
         }
       else if (! (refinement & SIOX_REFINEMENT_ADD_BACKGROUND))
-        {printf("siox_foreground_extract/(refinement & SIOX_REFINEMENT_ADD_BACKGROUND) && (refinement & SIOX_REFINEMENT_ADD_FOREGROUND) \n");
+        {
           gint i = 0;
 
           for (pixels = 0, n = 0;
@@ -1042,15 +1020,13 @@ printf("siox_foreground_extract/create inputs for color signatures \n");
               pixels += mapPR.w * mapPR.h;
 
               if (n % 16 == 0)
-                {siox_progress_update (progress_callback, progress_data,
+		  siox_progress_update (progress_callback, progress_data,
                                       0.1 + 0.1 * ((gdouble) pixels /
                                                    (gdouble) total));
-                printf("siox_foreground_extract/siox_progress_update 0.1+0.1*\n");   
-                }  
-            }
+	    }
         }
       else   /* both changed */
-        {printf("siox_foreground_extract/! (refinement & SIOX_REFINEMENT_ADD_BACKGROUND)\n");
+        {
           gint i = 0;
           gint j = 0;
 
@@ -1087,16 +1063,14 @@ printf("siox_foreground_extract/create inputs for color signatures \n");
               pixels += mapPR.w * mapPR.h;
 
               if (n % 16 == 0)
-               { siox_progress_update (progress_callback, progress_data,
+                siox_progress_update (progress_callback, progress_data,
                                       0.1 + 0.1 * ((gdouble) pixels /
                                                    (gdouble) total));
-               printf("siox_foreground_extract/siox_progress_update 0.1+0.1**\n");   
-               }
-            }
+	    }
         }
 
       if (refinement & SIOX_REFINEMENT_ADD_BACKGROUND)
-        {printf("siox_foreground_extract/Create color signature for the background\n");
+        {
           /* Create color signature for the background */
           state->bgsig = create_signature (surebg, surebgcount,
                                            &state->bgsiglen, limits,
@@ -1131,8 +1105,7 @@ printf("siox_foreground_extract/create inputs for color signatures \n");
   }
   
   siox_progress_update (progress_callback, progress_data, 0.5);
-  printf("siox_foreground_extract/siox_progress_update 0.5\n");
-   printf("siox_foreground_extract/Reduce the working area to the region of interest\n");
+ 
   /* Reduce the working area to the region of interest */
   gimp_rectangle_intersect (x1, y1, x2 - x1, y2 - y1,
                             x, y, width, height,
@@ -1151,7 +1124,7 @@ printf("siox_foreground_extract/create inputs for color signatures \n");
   pixel_region_init (&mapPR, mask, x, y, width, height, TRUE);
 
   total = width * height;
- printf("siox_foreground_extract/ pixel_region_init _two\n");
+
   for (pr = pixel_regions_register (2, &srcPR, &mapPR), n = 0, pixels = 0;
        pr != NULL;
        pr = pixel_regions_process (pr), n++)
@@ -1246,10 +1219,9 @@ printf("siox_foreground_extract/create inputs for color signatures \n");
       pixels += mapPR.w * mapPR.h;
 
       if (n % 8 == 0)
-       { siox_progress_update (progress_callback, progress_data,
+	  siox_progress_update (progress_callback, progress_data,
                               0.5 + 0.3 * ((gdouble) pixels / (gdouble) total));
-       printf("siox_foreground_extract/ siox_progress_update 0.5+0.3\n");
-       }
+      
     }
 
 #ifdef SIOX_DEBUG
@@ -1263,19 +1235,19 @@ printf("siox_foreground_extract/create inputs for color signatures \n");
 
   /* smooth a bit for error killing */
   smooth_mask (mask, x, y, width, height);
-  printf("siox_foreground_extract/smooth a bit for error killing \n");
+
   /* erode, to make sure only "strongly connected components"
    * keep being connected
    */
   erode_mask (mask, x, y, width, height);
-printf("siox_foreground_extract/erode, to make sure only strongly connected components\n");
+
   /* search the biggest connected component */
   find_max_blob (mask, x, y, width, height,
                  multiblob ?
                  MULTIBLOB_DEFAULT_SIZEFACTOR : MULTIBLOB_ONE_BLOB_ONLY);
 
   siox_progress_update (progress_callback, progress_data, 0.9);
-printf("siox_foreground_extract/ siox_progress_update 0.9\n");
+
   /* smooth again - as user specified */
   for (n = 0; n < smoothness; n++)
     smooth_mask (mask, x, y, width, height);
@@ -1287,31 +1259,8 @@ printf("siox_foreground_extract/ siox_progress_update 0.9\n");
 
   /* dilate, to fill up boundary pixels killed by erode */
   dilate_mask (mask, x, y, width, height);
-printf("siox_foreground_extract/dilate, to fill up boundary pixels killed by erode\n");
+  
   siox_progress_update (progress_callback, progress_data, 1.0);
-  printf("siox_foreground_extract/ siox_progress_update 1.0\n");	 
-
-/*else
-{
-    gint	 brush_mode;
-    gfloat    threshold = sioxdrbthreshold;
-    gint         x, y;
-    x = drbstate->x;
-    y = drbstate->y;
-
-    brush_mode |= (sioxdrboptions ?
-                    SIOX_DRB_ADD   :
-                    SIOX_DRB_SUBTRACT);
-    drbstate = siox_drb (drbstate,drbmask,x,y,
-                        brush_radius,brush_mode,
-                        threshold);
-} */ 
-printf("siox_end====state->offset_x=%d,state->offset_y=%d,state->x = %d,state->y=%d,"
-	   "state->width=%d,state->height=%d,state->bgsiglen=%d,state->fgsiglen=%d",
-	   state->offset_x,state->offset_y,state->x,state->y,state->width,state->height,state->bgsiglen,state->fgsiglen);
-  printf("siox_mask_end====mask->ref_count=%d,mask->x=%d,mask->y=%d,mask->width=%d,mask->height=%d,mask->ntile_rows=%d"
-		 "mask->ntile_cols=%d,mask->cached_num=%d\n",mask->ref_count,mask->x,mask->y,mask->width,
-		 mask->height,mask->ntile_rows,mask->ntile_cols,mask->cached_num);	
 }
 
 
@@ -1342,40 +1291,25 @@ siox_drb (SioxState   *state,
           gint         y,
           gint         brush_radius,
           SioxDRBType  optionsrefinement,//
-		  //gint         brush_mode,
-          gfloat       threshold,
+	  gfloat       threshold,
           gpointer     progress_data)//
-{printf("siox_drb\n");
- printf("drb_start====state->offset_x=%d,state->offset_y=%d,state->x = %d,state->y=%d,"
-	   "state->width=%d,state->height=%d,state->bgsiglen=%d,state->fgsiglen=%d",
-	   state->offset_x,state->offset_y,state->x,state->y,state->width,state->height,state->bgsiglen,state->fgsiglen);	
+{
   PixelRegion  srcPR;
   PixelRegion  mapPR;
   gpointer     pr;
   gint         row, col;
   gint         brush_mode;//
-	//state = drbstate;//
-	//mask = drbmask;//
-	printf("brush_mode before");
-	brush_mode |= (optionsrefinement ?
-                    SIOX_DRB_ADD   :
-                    SIOX_DRB_SUBTRACT);	//
-     printf("brush_mode after");
+
   g_return_if_fail (state != NULL);
   g_return_if_fail (mask != NULL && tile_manager_bpp (mask) == 1);
 
-/*  if (drbrefinement & SIOX_DRB_ADD)
-	g_hash_table_foreach_remove(state->cache,siox_cache_remove_bg,NULL);
-  if (drbrefinement & SIOX_DRB_SUBTRACT)
-	g_hash_table_foreach_remove(state->cache,siox_cache_remove_fg,NULL);
-  if (drbrefinement & SIOX_DRB_CHANGE_THRESHOLD)	
-	{
-		drbrefinement = SIOX_DRB_RECALCULATE;
-	}
-  else 
-	{
-		
-	}*/
+  if (optionsrefinement & SIOX_DRB_ADD)
+    g_hash_table_foreach_remove(state->cache,siox_cache_remove_bg,NULL);
+  if (optionsrefinement & SIOX_DRB_SUBTRACT)
+    g_hash_table_foreach_remove(state->cache,siox_cache_remove_fg,NULL);
+  if (optionsrefinement & SIOX_DRB_CHANGE_THRESHOLD)
+    optionsrefinement = SIOX_DRB_RECALCULATE;
+   
   pixel_region_init (&srcPR, state->pixels,
                      x - brush_radius, y - brush_radius, brush_radius * 2,
                      brush_radius * 2, FALSE);
@@ -1412,7 +1346,7 @@ siox_drb (SioxState   *state,
               mindistbg = (gfloat) sqrt (cr->bgdist);
               mindistfg = (gfloat) sqrt (cr->fgdist);
 
-              if (brush_mode == SIOX_DRB_ADD)
+              if (optionsrefinement & SIOX_DRB_ADD)
                 {printf("siox_drb SIOX_DRB_ADD \n");
                   if (*m > SIOX_HIGH)
                     continue;
@@ -1428,8 +1362,8 @@ siox_drb (SioxState   *state,
                       alpha = MIN (d, 1.0);
                     }
                 }
-              else /*if (brush_mode == SIOX_DRB_SUBTRACT)*/
-                {printf("siox_drb SIOX_DRB_SUBSTRCT \n");
+              else if (optionsrefinement & SIOX_DRB_SUBTRACT) /*if (brush_mode == SIOX_DRB_SUBTRACT)*/
+                {
                   if (*m < SIOX_HIGH)
                     continue;
 
@@ -1462,12 +1396,6 @@ siox_drb (SioxState   *state,
           map += mapPR.rowstride;
         }
     }
-	 printf("drb_start====state->offset_x=%d,state->offset_y=%d,state->x = %d,state->y=%d,"
-	   "state->width=%d,state->height=%d,state->bgsiglen=%d,state->fgsiglen=%d",
-	   state->offset_x,state->offset_y,state->x,state->y,state->width,state->height,state->bgsiglen,state->fgsiglen);	
- printf("siox_drb_end====mask->ref_count=%d,mask->x=%d,mask->y=%d,mask->width=%d,mask->height=%d,mask->ntile_rows=%d"
-		 "mask->ntile_cols=%d,mask->cached_num=%d\n",mask->ref_count,mask->x,mask->y,mask->width,
-		 mask->height,mask->ntile_rows,mask->ntile_cols,mask->cached_num);	
 }
 
 /**
diff --git a/app/base/siox.h b/app/base/siox.h
index c207c64..e278c33 100644
--- a/app/base/siox.h
+++ b/app/base/siox.h
@@ -69,10 +69,6 @@ void        siox_foreground_extract (SioxState          *state,
                                      const gdouble       sensitivity[3],
                                      gboolean            multiblob,
                                      SioxProgressFunc    progress_callback,
-                                     //gfloat              sioxdrbthreshold,//(new)
-                                     //gboolean	 	 sioxdrboptions,//(new) 
-                                     //gboolean            drbsignal,//(new)
-                                     //gint                brush_radius,//(new)
                                      gpointer            progress_data);
 void        siox_done               (SioxState          *state);
 
@@ -84,9 +80,7 @@ void        siox_drb                (SioxState          *state,
                                      gint                y,
                                      gint                brush_radius,
                                      SioxDRBType         optionsrefinement,//
-                                     //gint                brush_mode,
                                      gfloat              threshold,
-                                    // SioxProgressFunc    progress_callback,//
                                      gpointer            progress_data);//(new)
 
 
diff --git a/app/core/gimpdrawable-foreground-extract.c b/app/core/gimpdrawable-foreground-extract.c
index f7495f8..614132e 100644
--- a/app/core/gimpdrawable-foreground-extract.c
+++ b/app/core/gimpdrawable-foreground-extract.c
@@ -46,7 +46,7 @@ gimp_drawable_foreground_extract (GimpDrawable              *drawable,
                                   GimpForegroundExtractMode  mode,
                                   GimpDrawable              *mask,
                                   GimpProgress              *progress)
-{printf("gimp_drawable_foreground_extract \n");
+{
   SioxState    *state;
   const gdouble sensitivity[3] = { SIOX_DEFAULT_SENSITIVITY_L,
                                    SIOX_DEFAULT_SENSITIVITY_A,
@@ -62,8 +62,8 @@ gimp_drawable_foreground_extract (GimpDrawable              *drawable,
                                                 gimp_item_get_height (GIMP_ITEM (mask)));
 
   if (state)
-    {     printf("gimp_drawable_foreground_extract/gimp_drawable_foreground_extract_siox  \n");
-          gimp_drawable_foreground_extract_siox (mask, state,
+    {
+      gimp_drawable_foreground_extract_siox (mask, state,
                                              SIOX_REFINEMENT_RECALCULATE,
 					     SIOX_DEFAULT_SMOOTHNESS,
 					     SIOX_DEFAULT_THRESHOLD  ,//
@@ -84,7 +84,7 @@ gimp_drawable_foreground_extract_siox_init (GimpDrawable *drawable,
                                             gint          y,
                                             gint          width,
                                             gint          height)
-{printf("gimp_drawable_foreground_extract_siox_init \n");
+{
   const guchar *colormap = NULL;
   gboolean      intersect;
   gint          offset_x;
@@ -103,7 +103,7 @@ gimp_drawable_foreground_extract_siox_init (GimpDrawable *drawable,
                                         gimp_item_get_height (GIMP_ITEM (drawable)),
                                         x, y, width, height,
                                         &x, &y, &width, &height);
-printf("gimp_drawable_foreground_extract_siox_init /gimp_rectangle_intersect\n");
+
 
   /* FIXME:
    * Clear the mask outside the rectangle that we are working on?
@@ -122,14 +122,14 @@ gimp_drawable_foreground_extract_siox (GimpDrawable       *mask,
                                        SioxState          *state,
                                        SioxRefinementType  refinement,
                                        gint                smoothness,
-                                       gfloat              sioxdrbthreshold,//(new)				
-                                       SioxDRBType	 	   sioxdrboption,//(new)   
+                                       gfloat              sioxdrbthreshold,
+                                       SioxDRBType         sioxdrboption,   
                                        const gdouble       sensitivity[3],
                                        gboolean            multiblob,
-                                       gboolean            drbsignal,//(new)
-                                       gint                brush_radius,//(new)
+                                       gboolean            drbsignal,
+                                       gint                brush_radius,
                                        GimpProgress       *progress)
-{printf("gimp_drawable_foreground_extract_siox\n");
+{
   gint x1, y1;
   gint x2, y2;
 
@@ -140,14 +140,12 @@ gimp_drawable_foreground_extract_siox (GimpDrawable       *mask,
 
   g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
 
-  if (progress)
+  if (progress && (!drbsignal))
     gimp_progress_start (progress, _("Foreground Extraction"), FALSE);
-  if (progress && (drbsignal))//(new)
+  if (progress && drbsignal)
     gimp_progress_start (progress, _("Detail Refinement Brush"), FALSE);
   if (GIMP_IS_CHANNEL (mask))
-    {
-      gimp_channel_bounds (GIMP_CHANNEL (mask), &x1, &y1, &x2, &y2);
-    }
+    gimp_channel_bounds (GIMP_CHANNEL (mask), &x1, &y1, &x2, &y2);
   else
     {
       x1 = 0;
@@ -155,24 +153,22 @@ gimp_drawable_foreground_extract_siox (GimpDrawable       *mask,
       x2 = gimp_item_get_width  (GIMP_ITEM (mask));
       y2 = gimp_item_get_height (GIMP_ITEM (mask));
     }
-  if(!drbsignal)
-	{ printf("gimp_drawable_foreground_extract_siox   !drbsignal\n");
-		siox_foreground_extract (state, refinement,
-                           gimp_drawable_get_tiles (mask), x1, y1, x2, y2,
-                           smoothness, sensitivity, multiblob,
-                           (SioxProgressFunc) gimp_progress_set_value,
-                           //sioxdrbthreshold,//(new)
-                           //sioxdrboption,//(new)  
-                           //drbsignal,//(new)
-                           //brush_radius,//(new)
-                           progress);
-	}
+  if (!drbsignal)
+    { 
+      siox_foreground_extract (state,
+                               refinement,
+                               gimp_drawable_get_tiles (mask),
+                               x1, y1, x2, y2,
+                               smoothness, sensitivity, multiblob,
+                               (SioxProgressFunc) gimp_progress_set_value,
+                               progress);
+    }
   else
-	{printf("gimp_drawable_foreground_extract_siox   else drbsignal\n");
-		gimp_drawable_foreground_extract_siox_drb(gimp_drawable_get_tiles (mask),
-					  state,sioxdrboption,sioxdrbthreshold,
-					  brush_radius,progress);
-	}
+    {
+      gimp_drawable_foreground_extract_siox_drb(gimp_drawable_get_tiles (mask),
+			        		state,sioxdrboption,sioxdrbthreshold,
+					        brush_radius,progress);
+    }
   if (progress)
     gimp_progress_end (progress);
 
@@ -181,95 +177,38 @@ gimp_drawable_foreground_extract_siox (GimpDrawable       *mask,
 
 void
 gimp_drawable_foreground_extract_siox_done (SioxState *state)
-{printf("gimp_drawable_foreground_extract/gimp_drawable_foreground_extract_siox_done \n");
+{
   g_return_if_fail (state != NULL);
 
   siox_done (state);
 }
 
 
-void                                   //(new)
-gimp_drawable_foreground_extract_siox_drb(GimpDrawable      *mask,
+void                                  
+gimp_drawable_foreground_extract_siox_drb(TileManager       *mask,
 					  SioxState         *state,
-			          SioxDRBType        optionsrefinement,
-					  gfloat	         optionsthreshold,//( should be float)
+					  SioxDRBType        optionsrefinement,
+					  gfloat             optionsthreshold,
 					  gint               radius,
 					  GimpProgress      *progress)
-{printf("gimp_drawable_foreground_extract_siox_drb\n");
-	/*gint brush_mode;
-	brush_mode |= (optionsrefinement ?
-                    SIOX_DRB_ADD   :
-                    SIOX_DRB_SUBTRACT);
-    */
-	 gint x = (state->x);
-         gint y = (state->y);
- 
-         siox_drb(state,//
-	      mask,//
-	      x,y,
-	      radius,
-		  optionsrefinement,//		  
-	      //brush_mode,  //
-	      optionsthreshold,
-	      progress);
+{
+  gint x = (state->x);
+  gint y = (state->y);
+  siox_drb(state,//
+           mask,//
+	   x,y,
+	   radius,
+	   optionsrefinement,//
+	   optionsthreshold,
+	   progress);
    
 }
 
 
 
-/*
-void                                                   //(new)
-gimp_drawable_foreground_extract_siox_drb(GimpDrawable      *mask,
-					  SioxState         *state,
-			        	  gboolean           optionsrefinement,
-					  gfloat	     optionsthreshold,//( should be float)
-					  gint               radius,
-					  GimpProgress      *progress)
-{
-    gint x = (state->x);
-    gint y = (state->y);
-    g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
-    if (progress)
-	gimp_progress_start (progress, _("Detail Refinement Brush"), FALSE);
-    siox_foreground_drb(state,gimp_drawable_get_tiles(mask),
-		       optionsrefinement,x,y,
-		       radius,optionsthreshold);
-    if (progress)
-    gimp_progress_end (progress);
 
-}
 
 
 
 
-void
-siox_foreground_drb (SioxState   *state,
-		    TileManager  *mask,
-		    gboolean      options,
-		    gint          x,
-		    gint	  y,
-		    gint          brushradius,
-		    gfloat        threshold)//
- {
-     SioxDRBType drbbrush_mode;//
-     gint sioxdrboptions = options;
-     TileManager *drbmask = mask;
-     SioxState  *drbstate = state;
-     gfloat drbthreshold = threshold;
-     gint  drbbrush_radius = brushradius;
-     gint drbx = x;
-     gint drby = y;
-
-     if(sioxdrboptions == 0)//
-	 drbbrush_mode = (1<<0);//
-     else if(sioxdrboptions == 1)//
-	 drbbrush_mode = (1<<1);//
-     siox_drb(drbstate,//
-	      drbmask,//
-	      drbx,drby,
-	      drbbrush_radius,
-	      drbbrush_mode,  //
-	      drbthreshold);
-	 
- }*/
- 
+
diff --git a/app/core/gimpdrawable-foreground-extract.h b/app/core/gimpdrawable-foreground-extract.h
index ecf629c..4c9fd4d 100644
--- a/app/core/gimpdrawable-foreground-extract.h
+++ b/app/core/gimpdrawable-foreground-extract.h
@@ -37,27 +37,20 @@ void        gimp_drawable_foreground_extract_siox  (GimpDrawable       *mask,
                                                     SioxState          *state,
                                                     SioxRefinementType  refinemane,
                                                     gint                smoothness,
-                                                    gfloat              sioxdrbthreshold,//(new)	
-                                                    SioxDRBType 	 	sioxdrboption,//(new)   
+                                                    gfloat              sioxdrbthreshold,	
+                                                    SioxDRBType         sioxdrboption,  
                                                     const gdouble       sensitivity[3],
                                                     gboolean            multiblob,
-                                                    gboolean            drbsignal,//
-                                                    gint                brush_radius,//(new)
+                                                    gboolean            drbsignal,
+                                                    gint                brush_radius,
                                                     GimpProgress       *progress);
 void        gimp_drawable_foreground_extract_siox_done (SioxState      *state);
 
-void gimp_drawable_foreground_extract_siox_drb(GimpDrawable      *mask,//(new)
-					       SioxState         *state,
-					       SioxDRBType        optionsrefinement,
-					       gfloat             optionsthreshold,//( should be float)
-					       gint               radius,
-					       GimpProgress      *progress);
-/*
-void siox_foreground_drb (SioxState    *state,//(new)
-			 TileManager  *mask,
-			 gboolean      options,
-			 gint          x,
-			 gint          y,
-			 gint          brushradius,
-			 gfloat        threshold);//(new)*/
+void        gimp_drawable_foreground_extract_siox_drb(TileManager       *mask,
+						      SioxState         *state,
+						      SioxDRBType        optionsrefinement,
+						      gfloat             optionsthreshold,
+						      gint               radius,
+						      GimpProgress      *progress);
+
 #endif  /*  __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__  */
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index 45083d5..237b53a 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -58,7 +58,6 @@ typedef struct
 {
   gint         width;
   gboolean     background;
- // gboolean     drbrefinement;	
   gint         num_points;
   GimpVector2 *points;
 } FgSelectStroke;
@@ -129,16 +128,9 @@ static void   gimp_foreground_select_options_notify (GimpForegroundSelectOptions
                                                      GParamSpec                  *pspec,
                                                      GimpForegroundSelectTool    *fg_select);
 
-/*----new 2009-6-28*/
-//static void   gimp_foreground_select_siox_drb(GimpTool         *tool,
-//                                             GimpDisplay      *display);
- 
-static gboolean gimp_forground_select_tool_drbsignal(gboolean drbsignal);
- 
+
 static gboolean mark_drb = FALSE;
-//static GimpFreeSelectTool *free_sel_drb; 
-//static GimpDisplay        *display_drb;
-/*----end*/
+
 
 G_DEFINE_TYPE (GimpForegroundSelectTool, gimp_foreground_select_tool,
                GIMP_TYPE_FREE_SELECT_TOOL)
@@ -149,7 +141,7 @@ G_DEFINE_TYPE (GimpForegroundSelectTool, gimp_foreground_select_tool,
 void
 gimp_foreground_select_tool_register (GimpToolRegisterCallback  callback,
                                       gpointer                  data)
-{printf("gimp_foreground_select_tool_register\n");
+{
   (* callback) (GIMP_TYPE_FOREGROUND_SELECT_TOOL,
                 GIMP_TYPE_FOREGROUND_SELECT_OPTIONS,
                 gimp_foreground_select_options_gui,
@@ -165,7 +157,7 @@ gimp_foreground_select_tool_register (GimpToolRegisterCallback  callback,
 
 static void
 gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass)
-{printf("gimp_foreground_select_tool_class_init \n");
+{
   GObjectClass            *object_class    = G_OBJECT_CLASS (klass);
   GimpToolClass           *tool_class      = GIMP_TOOL_CLASS (klass);
   GimpDrawToolClass       *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
@@ -193,7 +185,7 @@ gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass)
 
 static void
 gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
-{printf("gimp_foreground_select_tool_init  \n");
+{
   GimpTool *tool = GIMP_TOOL (fg_select);
 
   gimp_tool_control_set_scroll_lock (tool->control, FALSE);
@@ -211,8 +203,8 @@ gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
   fg_select->stroke  = NULL;
   fg_select->strokes = NULL;
   fg_select->mask    = NULL;
-  fg_select->drbsignal = NULL; //(new)  
-  fg_select->drbsignals = NULL;//(new)	
+  fg_select->drbsignal = NULL; 
+  fg_select->drbsignals = NULL;	
 }
 
 
@@ -237,7 +229,7 @@ gimp_foreground_select_tool_constructor (GType                  type,
 
 static void
 gimp_foreground_select_tool_finalize (GObject *object)
-{printf("gimp_foreground_select_tool_finalize\n");
+{
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (object);
 
   if (fg_select->stroke)
@@ -265,7 +257,7 @@ static void
 gimp_foreground_select_tool_control (GimpTool       *tool,
                                      GimpToolAction  action,
                                      GimpDisplay    *display)
-{ printf("gimp_foreground_select_tool_control \n");
+{ 
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
 
   switch (action)
@@ -287,13 +279,13 @@ gimp_foreground_select_tool_control (GimpTool       *tool,
             g_free (stroke->points);
             g_slice_free (FgSelectStroke, stroke);
           }
-		for (drblist = fg_select->drbsignals; drblist; drblist = drblist->next)//(new)
-		  {
-			 FgSelectStroke *drbsignal = drblist->data; 
+	for (drblist = fg_select->drbsignals; drblist; drblist = drblist->next)//(new)
+	  {
+	    FgSelectStroke *drbsignal = drblist->data; 
 			 
-			 g_free (drbsignal->points);
-			 g_slice_free (FgSelectStroke, drbsignal); 
-		  }
+	    g_free (drbsignal->points);
+	    g_slice_free (FgSelectStroke, drbsignal); 
+	  }
 
         g_list_free (fg_select->strokes);
         fg_select->strokes = NULL;
@@ -345,10 +337,10 @@ gimp_foreground_select_tool_oper_update (GimpTool         *tool,
         case SELECTION_ANCHOR:
           if (fg_select->strokes)
             {
-		   if(!fg_select->drbsignal)//(new)
-		status = _("Add more strokes or press Up to drb");
+		if(!fg_select->drbsignal)//(new)
+		  status = _("Add more strokes or press Up to drb");
 		else
-		status = _("Add more drb or press Enter to accept the selection");
+		  status = _("Add more drb or press Enter to accept the selection");
 	    }
           else
             status = _("Mark foreground by painting on the object to extract");
@@ -395,12 +387,6 @@ gimp_foreground_select_tool_modifier_key (GimpTool        *tool,
                     "background", ! options->background,
                     NULL);
     }
- /* if (key == GDK_SHIFT_MASK)
-	{
-	  mark_drb = TRUE;
-	   // gimp_foreground_select_tool_select (free_sel_drb, display_drb);//(alter)
-	  //gimp_foreground_select_tool_select (GIMP_FREE_SELECT_TOOL (tool), display);//(alter)  
-	}*/
 }
 
 static void
@@ -438,7 +424,7 @@ static gboolean
 gimp_foreground_select_tool_key_press (GimpTool    *tool,
                                        GdkEventKey *kevent,
                                        GimpDisplay *display)
-{printf("gimp_foreground_select_tool_key_press\n");
+{
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
 
   if (display != tool->display)
@@ -448,14 +434,12 @@ gimp_foreground_select_tool_key_press (GimpTool    *tool,
     {
       switch (kevent->keyval)
         {
-        case GDK_Up:	//(new)
-	  {mark_drb = TRUE;
-	  printf("click Up\n");	
-	 
-          G_CALLBACK (gimp_foreground_select_options_notify);////?(������)
-                          
+        case GDK_Up:	
+	  mark_drb = TRUE;
+	  printf("click Up\n");
+	  G_CALLBACK (gimp_foreground_select_options_notify);//?                
 	  return  TRUE;	
-	  }
+	  
         case GDK_Return:
         case GDK_KP_Enter:
         case GDK_ISO_Enter:
@@ -486,24 +470,22 @@ gimp_foreground_select_tool_button_press (GimpTool            *tool,
                                           GdkModifierType      state,
                                           GimpButtonPressType  press_type,
                                           GimpDisplay         *display)
-{printf("gimp_foreground_select_tool_button_press\n");
+{
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
   GimpDrawTool             *draw_tool = GIMP_DRAW_TOOL (tool);
 
   if (fg_select->mask &&(!mark_drb))//
-    {printf("button press/ fg_select->mask\n");
+    {
       GimpVector2 point = gimp_vector2_new (coords->x, coords->y);
 
       gimp_draw_tool_pause (draw_tool);
 
       if (gimp_draw_tool_is_active (draw_tool) && draw_tool->display != display)
-		{ printf("gimp_foreground_select_tool_button_press/gimp_draw_tool_is_active\n");
-			gimp_draw_tool_stop (draw_tool);
-		}
+	  gimp_draw_tool_stop (draw_tool);
+		
       if (! gimp_tool_control_is_active (tool->control))
-		{printf("gimp_foreground_select_tool_button_press/! gimp_tool_control_is_active \n");
-			gimp_tool_control_activate (tool->control);
-		}    
+	  gimp_tool_control_activate (tool->control);
+		    
       fg_select->last_coords = *coords;
 
       g_return_if_fail (fg_select->stroke == NULL);
@@ -512,15 +494,14 @@ gimp_foreground_select_tool_button_press (GimpTool            *tool,
       g_array_append_val (fg_select->stroke, point);
 
       if (! gimp_draw_tool_is_active (draw_tool))
-		{printf("gimp_foreground_select_tool_button_press/! gimp_tool_control_is_active /tool/start \n");
-			gimp_draw_tool_start (draw_tool, display);
-		}
+	  gimp_draw_tool_start (draw_tool, display);
+      
       gimp_draw_tool_resume (draw_tool);
     }
   else if (fg_select->mask && mark_drb)//
-	{
-		GimpVector2 point = gimp_vector2_new (coords->x, coords->y);
-		printf("----------------------drb brush\n");
+    {
+      GimpVector2 point = gimp_vector2_new (coords->x, coords->y);
+	
       gimp_draw_tool_pause (draw_tool);
 
       if (gimp_draw_tool_is_active (draw_tool) && draw_tool->display != display)//?
@@ -541,8 +522,7 @@ gimp_foreground_select_tool_button_press (GimpTool            *tool,
 		gimp_draw_tool_start (draw_tool, display);
 	
       gimp_draw_tool_resume (draw_tool);
-		
-	}
+    }
   else
     {
       GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
@@ -557,10 +537,10 @@ gimp_foreground_select_tool_button_release (GimpTool              *tool,
                                             GdkModifierType        state,
                                             GimpButtonReleaseType  release_type,
                                             GimpDisplay           *display)
-{printf("gimp_foreground_select_tool_button_release\n");
+{
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
 
-  if (fg_select->mask && (!mark_drb))
+  if (fg_select->mask)
     {
       GimpForegroundSelectOptions *options;
 
@@ -576,24 +556,8 @@ gimp_foreground_select_tool_button_release (GimpTool              *tool,
 
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
     }
-  else if (fg_select->mask && mark_drb)//
-	{
-	  GimpForegroundSelectOptions *options;
-
-      options = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (tool);
-
-      gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
-
-      gimp_tool_control_halt (tool->control);
-
-      gimp_foreground_select_tool_push_stroke (fg_select, display, options);//( alter )
-
-      gimp_free_select_tool_select (GIMP_FREE_SELECT_TOOL (tool), display);
-   
-      gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
-	}
   else
-    {printf("(parent_class)->button_release\n");
+    {
       GIMP_TOOL_CLASS (parent_class)->button_release (tool,
                                                       coords, time, state,
                                                       release_type,
@@ -607,7 +571,7 @@ gimp_foreground_select_tool_motion (GimpTool         *tool,
                                     guint32           time,
                                     GdkModifierType   state,
                                     GimpDisplay      *display)
-{printf("gimp_foreground_select_tool_motion \n");
+{
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
 
   if (fg_select->mask && (!mark_drb))
@@ -617,7 +581,7 @@ gimp_foreground_select_tool_motion (GimpTool         *tool,
                                           fg_select->stroke->len - 1);
        
       gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
-       printf("gimp_foreground_select_tool_motion/gimp_draw_tool_pause");
+       
       fg_select->last_coords = *coords;
 
       if (last->x != (gint) coords->x || last->y != (gint) coords->y)
@@ -630,7 +594,7 @@ gimp_foreground_select_tool_motion (GimpTool         *tool,
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
     }
   else if (fg_select->mask && mark_drb)	//(new)
-	{
+    {
       GimpVector2 *last = &g_array_index (fg_select->drbsignal,
                                           GimpVector2,
                                           fg_select->drbsignal->len - 1);
@@ -647,7 +611,7 @@ gimp_foreground_select_tool_motion (GimpTool         *tool,
         }
 
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));		
-	}
+    }
   else
     {
       GIMP_TOOL_CLASS (parent_class)->motion (tool,
@@ -661,7 +625,7 @@ gimp_foreground_select_tool_get_area (GimpChannel *mask,
                                       gint        *y1,
                                       gint        *x2,
                                       gint        *y2)
-{printf("gimp_foreground_select_tool_get_area\n");
+{
   gint width;
   gint height;
 
@@ -747,7 +711,7 @@ gimp_foreground_select_tool_draw (GimpDrawTool *draw_tool)
 static void
 gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
                                     GimpDisplay        *display)
-{printf("gimp_foreground_select_tool_select \n");
+{
   GimpForegroundSelectTool    *fg_select;
   GimpForegroundSelectOptions *options;
   GimpImage                   *image = display->image;
@@ -791,14 +755,9 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
                                   gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
                                   0, 0, 128);
   gimp_scan_convert_free (scan_convert);
-/*  if (fg_select->strokes)
-    {
-	  fg_select->drbsignal = mark_drb;
-	  printf("fg_select->drbsignal=%d\n",fg_select->drbsignal);
-    }
-*/	
+ 
   if (fg_select->strokes)
-    { printf("fg_select->strokes=%d\n",fg_select->strokes);
+    { 
       GList *list;
       GList *drblist;
       gimp_set_busy (image->gimp);
@@ -807,27 +766,25 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
         for (list = fg_select->strokes; list; list = list->next)
           gimp_foreground_select_tool_stroke (mask, list->data);
       else if (mark_drb)
-	    for (drblist = fg_select->drbsignals; drblist; drblist = drblist->next)
+	for (drblist = fg_select->drbsignals; drblist; drblist = drblist->next)
           gimp_foreground_select_tool_stroke (mask, drblist->data);//(alter)	
 			
       if (fg_select->state)
 	{ printf("fg_select->state\n");
 	  gimp_drawable_foreground_extract_siox (GIMP_DRAWABLE (mask),
-						  fg_select->state,
-						  fg_select->refinement,
-						  options->smoothness,
-				          options->threshold,//(new)
-						  //options->refinement,//			
-						  fg_select->drbrefinement,//				 
-						  options->sensitivity,
-						  ! options->contiguous,
-						  mark_drb,//
-						  options->stroke_width,//(new)	
-						  GIMP_PROGRESS (display));
+						 fg_select->state,
+						 fg_select->refinement,
+						 options->smoothness,
+						 options->threshold,//(new)
+						 fg_select->drbrefinement,//
+						 options->sensitivity,
+						 ! options->contiguous,
+						 mark_drb,//
+						 options->stroke_width,//(new)
+						 GIMP_PROGRESS (display));
 
       fg_select->refinement = SIOX_REFINEMENT_NO_CHANGE;
-      //options->refinement = SIOX_DRB_NO_CHANGE ;
-	  fg_select->drbrefinement = SIOX_DRB_NO_CHANGE ;	
+      fg_select->drbrefinement = SIOX_DRB_NO_CHANGE ;	
       gimp_unset_busy (image->gimp);
       }
     }
@@ -851,40 +808,37 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
     }
 
   gimp_foreground_select_tool_set_mask (fg_select, display, mask);
-printf("gimp_foreground_select_tool_set_mask     end\n");
+
   g_object_unref (mask);
-printf("gimp_foreground_select_tool_select    end\n");
 }
 
 static void
 gimp_foreground_select_tool_set_mask (GimpForegroundSelectTool *fg_select,
                                       GimpDisplay              *display,
                                       GimpChannel              *mask)
-{printf("gimp_foreground_select_tool_set_mask \n");
+{
   GimpTool                    *tool = GIMP_TOOL (fg_select);
   GimpForegroundSelectOptions *options;
 
   options = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (tool);
 
   if (fg_select->mask == mask)
-	{   printf("gimp_foreground_select_tool_set_mask  fg_fg_select->mask == mask\n"); 
-		return;
-	}
+      return;
+	
   if (fg_select->mask)
-    { printf("gimp_foreground_select_tool_set_mask if(fg_select->mask)\n"); 
+    {
       g_object_unref (fg_select->mask);
       fg_select->mask = NULL;
     }
 
   if (mask)
-	{printf("gimp_foreground_select_tool_set_mask if(mask)\n"); 
-		fg_select->mask = g_object_ref (mask);
-	}
+      fg_select->mask = g_object_ref (mask);
+	
   gimp_display_shell_set_mask (GIMP_DISPLAY_SHELL (display->shell),
                                GIMP_DRAWABLE (mask), options->mask_color);
 
   if (mask && (!mark_drb))
-    {printf("gimp_foreground_select_tool_set_mask if (mask && (!mark_drb))\n"); 
+    {
       gimp_tool_control_set_tool_cursor        (tool->control,
                                                 GIMP_TOOL_CURSOR_PAINTBRUSH);
       gimp_tool_control_set_toggle_tool_cursor (tool->control,
@@ -892,8 +846,8 @@ gimp_foreground_select_tool_set_mask (GimpForegroundSelectTool *fg_select,
 
       gimp_tool_control_set_toggled (tool->control, options->background);
     }
-  else if (mask && mark_drb)//(new)
-    {printf("gimp_foreground_select_tool_set_mask if (mask && mark_drb)\n"); 
+  else if (mask && mark_drb)
+    {
       gimp_tool_control_set_tool_cursor        (tool->control,
                                                 GIMP_TOOL_CURSOR_PAINTBRUSH);
       gimp_tool_control_set_toggle_tool_cursor (tool->control,
@@ -915,7 +869,7 @@ gimp_foreground_select_tool_set_mask (GimpForegroundSelectTool *fg_select,
 static void
 gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select,
                                    GimpDisplay              *display)
-{printf("gimp_foreground_select_tool_apply \n");
+{
   GimpTool             *tool    = GIMP_TOOL (fg_select);
   GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
 
@@ -937,10 +891,10 @@ gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select,
 static void
 gimp_foreground_select_tool_stroke (GimpChannel    *mask,
                                     FgSelectStroke *stroke)
-{printf("gimp_foreground_select_tool_stroke \n");
+{
   GimpScanConvert *scan_convert = gimp_scan_convert_new ();
 
-  if (stroke->num_points == 1)//(è¿?é??æ??ä¹?ç??解ï¼?)
+  if (stroke->num_points == 1)
     {
       GimpVector2 points[2];
 
@@ -972,50 +926,52 @@ static void
 gimp_foreground_select_tool_push_stroke (GimpForegroundSelectTool    *fg_select,
                                          GimpDisplay                 *display,
                                          GimpForegroundSelectOptions *options)
-{printf("gimp_foreground_select_tool_push_stroke\n");
+{
   GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
   FgSelectStroke   *stroke;
-if(!mark_drb)
- {g_return_if_fail (fg_select->stroke != NULL);
-
-  stroke = g_slice_new (FgSelectStroke);
-
-  stroke->background = options->background;
-  stroke->width      = ROUND ((gdouble) options->stroke_width / shell->scale_y);
-  stroke->num_points = fg_select->stroke->len;
-  stroke->points     = (GimpVector2 *) g_array_free (fg_select->stroke, FALSE);
-
-  fg_select->stroke = NULL;
-
-  fg_select->strokes = g_list_append (fg_select->strokes, stroke);
-
-  fg_select->refinement |= (stroke->background ?
-                            SIOX_REFINEMENT_ADD_BACKGROUND :
-                            SIOX_REFINEMENT_ADD_FOREGROUND);
- }
+if (!mark_drb)
+  {
+    g_return_if_fail (fg_select->stroke != NULL);
+    
+    stroke = g_slice_new (FgSelectStroke);
+    
+    stroke->background = options->background;
+    stroke->width      = ROUND ((gdouble) options->stroke_width / shell->scale_y);
+    stroke->num_points = fg_select->stroke->len;
+    stroke->points     = (GimpVector2 *) g_array_free (fg_select->stroke, FALSE);
+
+    fg_select->stroke = NULL;
+
+    fg_select->strokes = g_list_append (fg_select->strokes, stroke);
+
+    fg_select->refinement |= (stroke->background ?
+                              SIOX_REFINEMENT_ADD_BACKGROUND :
+                              SIOX_REFINEMENT_ADD_FOREGROUND);
+  }
 else
-  {g_return_if_fail (fg_select->drbsignal != NULL);
+  {
+    g_return_if_fail (fg_select->drbsignal != NULL);
 
-  stroke = g_slice_new (FgSelectStroke);
+    stroke = g_slice_new (FgSelectStroke);
 
-  stroke->background = options->refinement;//
-  stroke->width      = ROUND ((gdouble) options->stroke_width / shell->scale_y);
-  stroke->num_points = fg_select->drbsignal->len;
-  stroke->points     = (GimpVector2 *) g_array_free (fg_select->drbsignal, FALSE);
+    stroke->background = options->refinement;//
+    stroke->width      = ROUND ((gdouble) options->stroke_width / shell->scale_y);
+    stroke->num_points = fg_select->drbsignal->len;
+    stroke->points     = (GimpVector2 *) g_array_free (fg_select->drbsignal, FALSE);
 
-  fg_select->drbsignal = NULL;
+    fg_select->drbsignal = NULL;
 
-  fg_select->drbsignals = g_list_append (fg_select->drbsignals, stroke);
+    fg_select->drbsignals = g_list_append (fg_select->drbsignals, stroke);
 
-  fg_select->drbrefinement |= (stroke->background?
-                             SIOX_DRB_ADD :
-                             SIOX_DRB_SUBTRACT);
- }		
+    fg_select->drbrefinement |= (stroke->background?
+                               SIOX_DRB_ADD :
+                               SIOX_DRB_SUBTRACT);
+  }		
 }
 
 static gboolean
 gimp_foreground_select_tool_idle_select (GimpForegroundSelectTool *fg_select)
-{printf("gimp_foreground_select_tool_idle_select \n");
+{
   GimpTool *tool = GIMP_TOOL (fg_select);
 
   fg_select->idle_id = 0;
@@ -1030,59 +986,51 @@ static void
 gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
                                        GParamSpec                  *pspec,
                                        GimpForegroundSelectTool    *fg_select)
-{printf("gimp_foreground_select_options_notify \n");
+{
   SioxRefinementType refinement = 0;
   SioxDRBType        drbrefinement = 0; //
- if(!mark_drb)
-	{	if (! fg_select->mask)
-    return;
-
-  if (strcmp (pspec->name, "smoothness") == 0)
-    {printf("_notify   smoothness\n");
-      refinement = SIOX_REFINEMENT_CHANGE_SMOOTHNESS;
-    }
-  else if (strcmp (pspec->name, "contiguous") == 0)
-    {printf("_notify  contiguous\n");
-      refinement = SIOX_REFINEMENT_CHANGE_MULTIBLOB;
-    }
-  else if (g_str_has_prefix (pspec->name, "sensitivity"))
-    {printf("_notify   ssensitivity\n");
-      refinement = SIOX_REFINEMENT_CHANGE_SENSITIVITY;
-    }
-	}
- else//
-	{	
-		if (! fg_select->mask)
-          return;
-		if (strcmp (pspec->name, "threshold") == 0)//(new)
-         {
-			 printf("_notify   threshold\n");
-			 drbrefinement = SIOX_DRB_CHANGE_THRESHOLD;
-		 }
-		else if (strcmp (pspec->name, "smoothness") == 0)
-		{printf("_notify   smoothness\n");
-  			drbrefinement = SIOX_DRB_CHANGE_SMOOTHNESS;
-		}
-		else if (g_str_has_prefix (pspec->name, "sensitivity"))
-		{printf("_notify   ssensitivity\n");
- 			drbrefinement = SIOX_DRB_CHANGE_SENSITIVITY;
-		}	
-      
-	}
-  if (refinement)
-    {printf("_notify    if (refinement)\n");
-      fg_select->refinement |= refinement;
-
-      if (fg_select->idle_id)
+ if (!mark_drb)
+   {
+     if (!fg_select->mask)
+         return;
+
+     if (strcmp (pspec->name, "smoothness") == 0)
+	 refinement = SIOX_REFINEMENT_CHANGE_SMOOTHNESS;
+     
+     else if (strcmp (pspec->name, "contiguous") == 0)
+	 refinement = SIOX_REFINEMENT_CHANGE_MULTIBLOB;
+
+     else if (g_str_has_prefix (pspec->name, "sensitivity"))
+	 refinement = SIOX_REFINEMENT_CHANGE_SENSITIVITY;
+   }
+ else
+   {
+     if (! fg_select->mask)
+	 return;
+
+     if (strcmp (pspec->name, "threshold") == 0)//(new)
+	 drbrefinement = SIOX_DRB_CHANGE_THRESHOLD;
+
+     else if (strcmp (pspec->name, "smoothness") == 0)
+	 drbrefinement = SIOX_DRB_CHANGE_SMOOTHNESS;
+
+     else if (g_str_has_prefix (pspec->name, "sensitivity"))
+	 drbrefinement = SIOX_DRB_CHANGE_SENSITIVITY;
+   }
+ if (refinement)
+   {
+     fg_select->refinement |= refinement;
+
+     if (fg_select->idle_id)
         g_source_remove (fg_select->idle_id);
 
-      fg_select->idle_id =
+     fg_select->idle_id =
         g_idle_add_full (G_PRIORITY_LOW,
                          (GSourceFunc) gimp_foreground_select_tool_idle_select,
                          fg_select, NULL);
     }
-  if (drbrefinement)
-    {printf("_notify    if (refinement)\n");
+ if (drbrefinement)
+   {
       fg_select->drbrefinement |= drbrefinement;
 
       if (fg_select->idle_id)
@@ -1098,18 +1046,11 @@ gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
       GimpTool *tool = GIMP_TOOL (fg_select);
 
       if (tool->display)
-       { gimp_display_shell_set_mask (GIMP_DISPLAY_SHELL (tool->display->shell),
+        gimp_display_shell_set_mask (GIMP_DISPLAY_SHELL (tool->display->shell),
                                      GIMP_DRAWABLE (fg_select->mask),
                                      options->mask_color);
-       printf("gimp_foreground_select_options_notify /gimp_display_shell_set_mask \n");
-       } 
+       
     }
 }
 
-/*static void
-gimp_foreground_select_tool_push_drbsignal (GimpForegroundSelectTool    *fg_select,
-                                            GimpDisplay                 *display,
-                                            GimpForegroundSelectOptions *options)
-{
-	
-}*/
+



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