[gimp] libgimp: remove "select-transparent" parameters from the new selection API



commit bc5e0a79ab9ef0411a634cdc952d4edd16a6f252
Author: Michael Natterer <mitch gimp org>
Date:   Fri Feb 4 18:37:01 2011 +0100

    libgimp: remove "select-transparent" parameters from the new selection API
    
    and use the sample-transparent setting from GimpPDBContext instead.

 app/pdb/image-select-cmds.c       |   22 +++-------------------
 libgimp/gimpimageselect_pdb.c     |   13 ++++---------
 libgimp/gimpimageselect_pdb.h     |    6 ++----
 tools/pdbgen/pdb/image_select.pdb |   22 ++++++++--------------
 4 files changed, 17 insertions(+), 46 deletions(-)
---
diff --git a/app/pdb/image-select-cmds.c b/app/pdb/image-select-cmds.c
index 72706c6..362c8ab 100644
--- a/app/pdb/image-select-cmds.c
+++ b/app/pdb/image-select-cmds.c
@@ -54,13 +54,11 @@ image_select_color_invoker (GimpProcedure      *procedure,
   gint32 operation;
   GimpDrawable *drawable;
   GimpRGB color;
-  gboolean select_transparent;
 
   image = gimp_value_get_image (&args->values[0], gimp);
   operation = g_value_get_enum (&args->values[1]);
   drawable = gimp_value_get_drawable (&args->values[2], gimp);
   gimp_value_get_rgb (&args->values[3], &color);
-  select_transparent = g_value_get_boolean (&args->values[4]);
 
   if (success)
     {
@@ -73,7 +71,7 @@ image_select_color_invoker (GimpProcedure      *procedure,
                                         pdb_context->sample_merged,
                                         &color,
                                         (gint) (pdb_context->sample_threshold * 255.99),
-                                        select_transparent,
+                                        pdb_context->sample_transparent,
                                         pdb_context->sample_criterion,
                                         operation,
                                         pdb_context->antialias,
@@ -184,14 +182,12 @@ image_select_fuzzy_invoker (GimpProcedure      *procedure,
   GimpDrawable *drawable;
   gdouble x;
   gdouble y;
-  gboolean select_transparent;
 
   image = gimp_value_get_image (&args->values[0], gimp);
   operation = g_value_get_enum (&args->values[1]);
   drawable = gimp_value_get_drawable (&args->values[2], gimp);
   x = g_value_get_double (&args->values[3]);
   y = g_value_get_double (&args->values[4]);
-  select_transparent = g_value_get_boolean (&args->values[5]);
 
   if (success)
     {
@@ -206,7 +202,7 @@ image_select_fuzzy_invoker (GimpProcedure      *procedure,
                                      pdb_context->sample_merged,
                                      x, y,
                                      (gint) (pdb_context->sample_threshold * 255.99),
-                                     select_transparent,
+                                     pdb_context->sample_transparent,
                                      pdb_context->sample_criterion,
                                      operation,
                                      pdb_context->antialias,
@@ -362,7 +358,7 @@ register_image_select_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-select-color",
                                      "Create a selection by selecting all pixels (in the specified drawable) with the same (or similar) color to that specified.",
-                                     "This tool creates a selection over the specified image. A by-color selection is determined by the supplied color under the constraints of the current context settings. Essentially, all pixels (in the drawable) that have color sufficiently close to the specified color (as determined by the threshold and criterion context values) are included in the selection. To select transparent regions, the color specified must also have minimum alpha. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius', 'gimp-context-set-sample-merged', 'gimp-context-set-sample-criterion', 'gimp-context-set-sample-threshold'. In the case of a merged sampling, the supplied drawable is ignored.",
+                                     "This tool creates a selection over the specified image. A by-color selection is determined by the supplied color under the constraints of the current context settings. Essentially, all pixels (in the drawable) that have color sufficiently close to the specified color (as determined by the threshold and criterion context values) are included in the selection. To select transparent regions, the color specified must also have minimum alpha. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius', 'gimp-context-set-sample-merged', 'gimp-context-set-sample-criterion', 'gimp-context-set-sample-threshold', 'gimp-context-set-sample-transparent'. In the case of a merged sampling, the supplied drawable is ignored.",
                                      "David Gowers",
                                      "David Gowers",
                                      "2010",
@@ -393,12 +389,6 @@ register_image_select_procs (GimpPDB *pdb)
                                                     FALSE,
                                                     NULL,
                                                     GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               g_param_spec_boolean ("select-transparent",
-                                                     "select transparent",
-                                                     "Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.",
-                                                     FALSE,
-                                                     GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
@@ -543,12 +533,6 @@ register_image_select_procs (GimpPDB *pdb)
                                                     "y coordinate of initial seed fill point: (image coordinates)",
                                                     -G_MAXDOUBLE, G_MAXDOUBLE, 0,
                                                     GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               g_param_spec_boolean ("select-transparent",
-                                                     "select transparent",
-                                                     "Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.",
-                                                     FALSE,
-                                                     GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
diff --git a/libgimp/gimpimageselect_pdb.c b/libgimp/gimpimageselect_pdb.c
index 61e1648..f642c4b 100644
--- a/libgimp/gimpimageselect_pdb.c
+++ b/libgimp/gimpimageselect_pdb.c
@@ -40,7 +40,6 @@
  * @operation: The selection operation.
  * @drawable_ID: The affected drawable.
  * @color: The color to select.
- * @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
  *
  * Create a selection by selecting all pixels (in the specified
  * drawable) with the same (or similar) color to that specified.
@@ -56,7 +55,8 @@
  * gimp_context_set_feather(), gimp_context_set_feather_radius(),
  * gimp_context_set_sample_merged(),
  * gimp_context_set_sample_criterion(),
- * gimp_context_set_sample_threshold(). In the case of a merged
+ * gimp_context_set_sample_threshold(),
+ * gimp_context_set_sample_transparent(). In the case of a merged
  * sampling, the supplied drawable is ignored.
  *
  * Returns: TRUE on success.
@@ -67,8 +67,7 @@ gboolean
 gimp_image_select_color (gint32          image_ID,
                          GimpChannelOps  operation,
                          gint32          drawable_ID,
-                         const GimpRGB  *color,
-                         gboolean        select_transparent)
+                         const GimpRGB  *color)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
@@ -80,7 +79,6 @@ gimp_image_select_color (gint32          image_ID,
                                     GIMP_PDB_INT32, operation,
                                     GIMP_PDB_DRAWABLE, drawable_ID,
                                     GIMP_PDB_COLOR, color,
-                                    GIMP_PDB_INT32, select_transparent,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -198,7 +196,6 @@ gimp_image_select_polygon (gint32          image_ID,
  * @drawable_ID: The affected drawable.
  * @x: x coordinate of initial seed fill point: (image coordinates).
  * @y: y coordinate of initial seed fill point: (image coordinates).
- * @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
  *
  * Create a fuzzy selection starting at the specified coordinates on
  * the specified drawable.
@@ -231,8 +228,7 @@ gimp_image_select_fuzzy (gint32         image_ID,
                          GimpChannelOps operation,
                          gint32         drawable_ID,
                          gdouble        x,
-                         gdouble        y,
-                         gboolean       select_transparent)
+                         gdouble        y)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
@@ -245,7 +241,6 @@ gimp_image_select_fuzzy (gint32         image_ID,
                                     GIMP_PDB_DRAWABLE, drawable_ID,
                                     GIMP_PDB_FLOAT, x,
                                     GIMP_PDB_FLOAT, y,
-                                    GIMP_PDB_INT32, select_transparent,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
diff --git a/libgimp/gimpimageselect_pdb.h b/libgimp/gimpimageselect_pdb.h
index 6eb7e3f..2047ebb 100644
--- a/libgimp/gimpimageselect_pdb.h
+++ b/libgimp/gimpimageselect_pdb.h
@@ -31,8 +31,7 @@ G_BEGIN_DECLS
 gboolean gimp_image_select_color           (gint32          image_ID,
                                             GimpChannelOps  operation,
                                             gint32          drawable_ID,
-                                            const GimpRGB  *color,
-                                            gboolean        select_transparent);
+                                            const GimpRGB  *color);
 gboolean gimp_image_select_ellipse         (gint32          image_ID,
                                             GimpChannelOps  operation,
                                             gdouble         x,
@@ -47,8 +46,7 @@ gboolean gimp_image_select_fuzzy           (gint32          image_ID,
                                             GimpChannelOps  operation,
                                             gint32          drawable_ID,
                                             gdouble         x,
-                                            gdouble         y,
-                                            gboolean        select_transparent);
+                                            gdouble         y);
 gboolean gimp_image_select_rectangle       (gint32          image_ID,
                                             GimpChannelOps  operation,
                                             gdouble         x,
diff --git a/tools/pdbgen/pdb/image_select.pdb b/tools/pdbgen/pdb/image_select.pdb
index ac3a719..4a38a83 100644
--- a/tools/pdbgen/pdb/image_select.pdb
+++ b/tools/pdbgen/pdb/image_select.pdb
@@ -34,7 +34,8 @@ must also have minimum alpha.
 This prodecure is affected by the following context setters:
 gimp_context_set_antialias(), gimp_context_set_feather(),
 gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
-gimp_context_set_sample_criterion(), gimp_context_set_sample_threshold().
+gimp_context_set_sample_criterion(), gimp_context_set_sample_threshold(),
+gimp_context_set_sample_transparent().
 
 In the case of a merged sampling, the supplied drawable is ignored.
 HELP
@@ -49,11 +50,7 @@ HELP
 	{ name => 'drawable', type => 'drawable',
 	  desc => 'The affected drawable' },
 	{ name => 'color', type => 'color',
-	  desc => 'The color to select' },
-        { name => 'select_transparent', type => 'boolean',
-          desc => "Whether to consider transparent pixels for selection.
-                   If TRUE, transparency is considered as a unique selectable
-                   color." }
+	  desc => 'The color to select' }
     );
 
     %invoke = (
@@ -68,7 +65,7 @@ HELP
                                     pdb_context->sample_merged,
                                     &color,
                                     (gint) (pdb_context->sample_threshold * 255.99),
-                                    select_transparent,
+                                    pdb_context->sample_transparent,
                                     pdb_context->sample_criterion,
                                     operation,
                                     pdb_context->antialias,
@@ -209,7 +206,8 @@ at pixels along the seed fill boundary.
 This prodecure is affected by the following context setters:
 gimp_context_set_antialias(), gimp_context_set_feather(),
 gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
-gimp_context_set_sample_criterion(), gimp_context_set_sample_threshold().
+gimp_context_set_sample_criterion(), gimp_context_set_sample_threshold(),
+gimp_context_set_sample_transparent().
 
 In the case of a merged sampling, the supplied drawable is ignored.
 If the sample is merged, the specified coordinates are relative to the
@@ -230,11 +228,7 @@ HELP
 	  	   coordinates)' },
 	{ name => 'y', type => 'float',
 	  desc => 'y coordinate of initial seed fill point: (image
-	  	   coordinates)' },
-	{ name => 'select_transparent', type => 'boolean',
-          desc => "Whether to consider transparent pixels for selection.
-                   If TRUE, transparency is considered as a unique selectable
-                   color." }
+	  	   coordinates)' }
     );
 
     %invoke = (
@@ -251,7 +245,7 @@ HELP
                                  pdb_context->sample_merged,
                                  x, y,
                                  (gint) (pdb_context->sample_threshold * 255.99),
-                                 select_transparent,
+                                 pdb_context->sample_transparent,
                                  pdb_context->sample_criterion,
                                  operation,
                                  pdb_context->antialias,



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