[gimp] pdb: add "sample-criterion" as property to the PDB context



commit 1205a6aedd83cea8ccb43007dd2354eeaf5eae65
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jan 27 20:01:28 2011 +0100

    pdb: add "sample-criterion" as property to the PDB context
    
    See commit below

 app/pdb/context-cmds.c            |   93 +++++++++++++++++++++++++++++++++++++
 app/pdb/gimppdbcontext.c          |   15 ++++++
 app/pdb/gimppdbcontext.h          |    1 +
 app/pdb/image-select-cmds.c       |   28 ++---------
 app/pdb/internal-procs.c          |    2 +-
 libgimp/gimp.def                  |    4 ++
 libgimp/gimpcontext_pdb.c         |   66 ++++++++++++++++++++++++++
 libgimp/gimpcontext_pdb.h         |    2 +
 libgimp/gimpimageselect_pdb.c     |   46 ++++++++----------
 libgimp/gimpimageselect_pdb.h     |   82 ++++++++++++++++-----------------
 tools/pdbgen/pdb/context.pdb      |   56 ++++++++++++++++++++++
 tools/pdbgen/pdb/image_select.pdb |   22 +++------
 12 files changed, 312 insertions(+), 105 deletions(-)
---
diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c
index 2e7e71e..110db77 100644
--- a/app/pdb/context-cmds.c
+++ b/app/pdb/context-cmds.c
@@ -815,6 +815,51 @@ context_set_sample_merged_invoker (GimpProcedure      *procedure,
 }
 
 static GValueArray *
+context_get_sample_criterion_invoker (GimpProcedure      *procedure,
+                                      Gimp               *gimp,
+                                      GimpContext        *context,
+                                      GimpProgress       *progress,
+                                      const GValueArray  *args,
+                                      GError            **error)
+{
+  GValueArray *return_vals;
+  gint32 sample_criterion = 0;
+
+  g_object_get (context,
+                "sample-criterion", &sample_criterion,
+                NULL);
+
+  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+  g_value_set_enum (&return_vals->values[1], sample_criterion);
+
+  return return_vals;
+}
+
+static GValueArray *
+context_set_sample_criterion_invoker (GimpProcedure      *procedure,
+                                      Gimp               *gimp,
+                                      GimpContext        *context,
+                                      GimpProgress       *progress,
+                                      const GValueArray  *args,
+                                      GError            **error)
+{
+  gboolean success = TRUE;
+  gint32 sample_criterion;
+
+  sample_criterion = g_value_get_enum (&args->values[0]);
+
+  if (success)
+    {
+      g_object_set (context,
+                    "sample-criterion", sample_criterion,
+                    NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
 context_get_interpolation_invoker (GimpProcedure      *procedure,
                                    Gimp               *gimp,
                                    GimpContext        *context,
@@ -1770,6 +1815,54 @@ register_context_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-context-get-sample-criterion
+   */
+  procedure = gimp_procedure_new (context_get_sample_criterion_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-sample-criterion");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-sample-criterion",
+                                     "Get the sample criterion setting.",
+                                     "This procedure returns the sample criterion setting.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2011",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_enum ("sample-criterion",
+                                                      "sample criterion",
+                                                      "The sample criterion setting",
+                                                      GIMP_TYPE_SELECT_CRITERION,
+                                                      GIMP_SELECT_CRITERION_COMPOSITE,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-sample-criterion
+   */
+  procedure = gimp_procedure_new (context_set_sample_criterion_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-sample-criterion");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-set-sample-criterion",
+                                     "Set the sample merged setting.",
+                                     "This procedure modifies the sample criterion setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls how color similarity is determined. SELECT_CRITERION_COMPOSITE is the default value. This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-fuzzy'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2011",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("sample-criterion",
+                                                  "sample criterion",
+                                                  "The sample criterion setting",
+                                                  GIMP_TYPE_SELECT_CRITERION,
+                                                  GIMP_SELECT_CRITERION_COMPOSITE,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-context-get-interpolation
    */
   procedure = gimp_procedure_new (context_get_interpolation_invoker);
diff --git a/app/pdb/gimppdbcontext.c b/app/pdb/gimppdbcontext.c
index b6cc39d..49eaa38 100644
--- a/app/pdb/gimppdbcontext.c
+++ b/app/pdb/gimppdbcontext.c
@@ -42,6 +42,7 @@ enum
   PROP_FEATHER_RADIUS_X,
   PROP_FEATHER_RADIUS_Y,
   PROP_SAMPLE_MERGED,
+  PROP_SAMPLE_CRITERION,
   PROP_INTERPOLATION,
   PROP_TRANSFORM_DIRECTION,
   PROP_TRANSFORM_RESIZE,
@@ -100,6 +101,12 @@ gimp_pdb_context_class_init (GimpPDBContextClass *klass)
                                     FALSE,
                                     GIMP_PARAM_STATIC_STRINGS);
 
+  GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_SAMPLE_CRITERION,
+                                 "sample-crterion", NULL,
+                                 GIMP_TYPE_SELECT_CRITERION,
+                                 GIMP_SELECT_CRITERION_COMPOSITE,
+                                 GIMP_PARAM_STATIC_STRINGS);
+
   GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_INTERPOLATION,
                                  "interpolation", NULL,
                                  GIMP_TYPE_INTERPOLATION_TYPE,
@@ -179,6 +186,10 @@ gimp_pdb_context_set_property (GObject      *object,
       options->sample_merged = g_value_get_boolean (value);
       break;
 
+    case PROP_SAMPLE_CRITERION:
+      options->sample_criterion = g_value_get_enum (value);
+      break;
+
     case PROP_INTERPOLATION:
       options->interpolation = g_value_get_enum (value);
       break;
@@ -231,6 +242,10 @@ gimp_pdb_context_get_property (GObject    *object,
       g_value_set_boolean (value, options->sample_merged);
       break;
 
+    case PROP_SAMPLE_CRITERION:
+      g_value_set_enum (value, options->sample_criterion);
+      break;
+
     case PROP_INTERPOLATION:
       g_value_set_enum (value, options->interpolation);
       break;
diff --git a/app/pdb/gimppdbcontext.h b/app/pdb/gimppdbcontext.h
index c75c2ff..1f93b5d 100644
--- a/app/pdb/gimppdbcontext.h
+++ b/app/pdb/gimppdbcontext.h
@@ -44,6 +44,7 @@ struct _GimpPDBContext
   gdouble                 feather_radius_x;
   gdouble                 feather_radius_y;
   gboolean                sample_merged;
+  GimpSelectCriterion     sample_criterion;
 
   GimpInterpolationType   interpolation;
   GimpTransformDirection  transform_direction;
diff --git a/app/pdb/image-select-cmds.c b/app/pdb/image-select-cmds.c
index b45429d..1297ed6 100644
--- a/app/pdb/image-select-cmds.c
+++ b/app/pdb/image-select-cmds.c
@@ -56,7 +56,6 @@ image_select_color_invoker (GimpProcedure      *procedure,
   GimpRGB color;
   gint32 threshold;
   gboolean select_transparent;
-  gint32 select_criterion;
 
   image = gimp_value_get_image (&args->values[0], gimp);
   operation = g_value_get_enum (&args->values[1]);
@@ -64,7 +63,6 @@ image_select_color_invoker (GimpProcedure      *procedure,
   gimp_value_get_rgb (&args->values[3], &color);
   threshold = g_value_get_int (&args->values[4]);
   select_transparent = g_value_get_boolean (&args->values[5]);
-  select_criterion = g_value_get_enum (&args->values[6]);
 
   if (success)
     {
@@ -78,7 +76,7 @@ image_select_color_invoker (GimpProcedure      *procedure,
                                         &color,
                                         threshold,
                                         select_transparent,
-                                        select_criterion,
+                                        pdb_context->sample_criterion,
                                         operation,
                                         pdb_context->antialias,
                                         pdb_context->feather,
@@ -190,7 +188,6 @@ image_select_fuzzy_invoker (GimpProcedure      *procedure,
   gdouble y;
   gint32 threshold;
   gboolean select_transparent;
-  gint32 select_criterion;
 
   image = gimp_value_get_image (&args->values[0], gimp);
   operation = g_value_get_enum (&args->values[1]);
@@ -199,7 +196,6 @@ image_select_fuzzy_invoker (GimpProcedure      *procedure,
   y = g_value_get_double (&args->values[4]);
   threshold = g_value_get_int (&args->values[5]);
   select_transparent = g_value_get_boolean (&args->values[6]);
-  select_criterion = g_value_get_enum (&args->values[7]);
 
   if (success)
     {
@@ -215,7 +211,7 @@ image_select_fuzzy_invoker (GimpProcedure      *procedure,
                                      x, y,
                                      threshold,
                                      select_transparent,
-                                     select_criterion,
+                                     pdb_context->sample_criterion,
                                      operation,
                                      pdb_context->antialias,
                                      pdb_context->feather,
@@ -370,7 +366,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 specified threshold. Essentially, all pixels (in the drawable) that have color sufficiently close to the specified color (as determined by the threshold value) 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'. 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 specified threshold. Essentially, all pixels (in the drawable) that have color sufficiently close to the specified color (as determined by the threshold value) 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'. In the case of a merged sampling, the supplied drawable is ignored.",
                                      "David Gowers",
                                      "David Gowers",
                                      "2010",
@@ -413,13 +409,6 @@ register_image_select_procs (GimpPDB *pdb)
                                                      "Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.",
                                                      FALSE,
                                                      GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               g_param_spec_enum ("select-criterion",
-                                                  "select criterion",
-                                                  "The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.",
-                                                  GIMP_TYPE_SELECT_CRITERION,
-                                                  GIMP_SELECT_CRITERION_COMPOSITE,
-                                                  GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
@@ -527,8 +516,8 @@ register_image_select_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-select-fuzzy",
                                      "Create a fuzzy selection starting at the specified coordinates on the specified drawable.",
-                                     "This tool creates a fuzzy selection over the specified image. A fuzzy selection is determined by a seed fill under the constraints of the specified threshold. Essentially, the color at the specified coordinates (in the drawable) is measured and the selection expands outwards from that point to any adjacent pixels which are not significantly different (as determined by the threshold value). This process continues until no more expansion is possible. If antialiasing is turned on, the final selection mask will contain intermediate values based on close misses to the threshold bar 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'. In the case of a merged sampling, the supplied drawable is ignored. If the sample is merged, the specified coordinates are relative to the 
 image origin; otherwise, they are relative to"
-  "the drawable's origin.",
+                                     "This tool creates a fuzzy selection over the specified image. A fuzzy selection is determined by a seed fill under the constraints of the specified threshold. Essentially, the color at the specified coordinates (in the drawable) is measured and the selection expands outwards from that point to any adjacent pixels which are not significantly different (as determined by the threshold value). This process continues until no more expansion is possible. If antialiasing is turned on, the final selection mask will contain intermediate values based on close misses to the threshold bar 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'. In the case of a merged sampling, the supplied drawable is ignored. If the sample is merged, the speci
 fied coordinates are relative to the image"
+  "origin; otherwise, they are relative to the drawable's origin.",
                                      "David Gowers",
                                      "David Gowers",
                                      "2010",
@@ -576,13 +565,6 @@ register_image_select_procs (GimpPDB *pdb)
                                                      "Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.",
                                                      FALSE,
                                                      GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               g_param_spec_enum ("select-criterion",
-                                                  "select criterion",
-                                                  "The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.",
-                                                  GIMP_TYPE_SELECT_CRITERION,
-                                                  GIMP_SELECT_CRITERION_COMPOSITE,
-                                                  GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 466694e..a84e502 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 642 procedures registered total */
+/* 644 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 805bcba..d3c1890 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -82,6 +82,8 @@ EXPORTS
 	gimp_context_get_paint_mode
 	gimp_context_get_palette
 	gimp_context_get_pattern
+	gimp_context_get_sample_criterion
+	gimp_context_get_sample_merged
 	gimp_context_get_transform_direction
 	gimp_context_get_transform_recursion
 	gimp_context_get_transform_resize
@@ -103,6 +105,8 @@ EXPORTS
 	gimp_context_set_paint_mode
 	gimp_context_set_palette
 	gimp_context_set_pattern
+	gimp_context_set_sample_criterion
+	gimp_context_set_sample_merged
 	gimp_context_set_transform_direction
 	gimp_context_set_transform_recursion
 	gimp_context_set_transform_resize
diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c
index 78ff5fb..002a75b 100644
--- a/libgimp/gimpcontext_pdb.c
+++ b/libgimp/gimpcontext_pdb.c
@@ -1144,6 +1144,72 @@ gimp_context_set_sample_merged (gboolean sample_merged)
 }
 
 /**
+ * gimp_context_get_sample_criterion:
+ *
+ * Get the sample criterion setting.
+ *
+ * This procedure returns the sample criterion setting.
+ *
+ * Returns: The sample criterion setting.
+ *
+ * Since: GIMP 2.8
+ **/
+GimpSelectCriterion
+gimp_context_get_sample_criterion (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  GimpSelectCriterion sample_criterion = 0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-sample-criterion",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    sample_criterion = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return sample_criterion;
+}
+
+/**
+ * gimp_context_set_sample_criterion:
+ * @sample_criterion: The sample criterion setting.
+ *
+ * Set the sample merged setting.
+ *
+ * This procedure modifies the sample criterion setting. If an
+ * operation depends on the colors of the pixels present in a drawable,
+ * like when doing a seed fill, this setting controls how color
+ * similarity is determined. SELECT_CRITERION_COMPOSITE is the default
+ * value. This setting affects the following procedures:
+ * gimp_image_select_color(), gimp_image_select_fuzzy().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.8
+ **/
+gboolean
+gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-sample-criterion",
+                                    &nreturn_vals,
+                                    GIMP_PDB_INT32, sample_criterion,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
  * gimp_context_get_interpolation:
  *
  * Get the interpolation type.
diff --git a/libgimp/gimpcontext_pdb.h b/libgimp/gimpcontext_pdb.h
index 73b79d9..73ac2d5 100644
--- a/libgimp/gimpcontext_pdb.h
+++ b/libgimp/gimpcontext_pdb.h
@@ -64,6 +64,8 @@ gboolean               gimp_context_set_feather_radius      (gdouble
                                                              gdouble                   feather_radius_y);
 gboolean               gimp_context_get_sample_merged       (void);
 gboolean               gimp_context_set_sample_merged       (gboolean                  sample_merged);
+GimpSelectCriterion    gimp_context_get_sample_criterion    (void);
+gboolean               gimp_context_set_sample_criterion    (GimpSelectCriterion       sample_criterion);
 GimpInterpolationType  gimp_context_get_interpolation       (void);
 gboolean               gimp_context_set_interpolation       (GimpInterpolationType     interpolation);
 GimpTransformDirection gimp_context_get_transform_direction (void);
diff --git a/libgimp/gimpimageselect_pdb.c b/libgimp/gimpimageselect_pdb.c
index e2e36a0..6758d34 100644
--- a/libgimp/gimpimageselect_pdb.c
+++ b/libgimp/gimpimageselect_pdb.c
@@ -42,7 +42,6 @@
  * @color: The color to select.
  * @threshold: Threshold in intensity levels.
  * @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
- * @select_criterion: The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.
  *
  * Create a selection by selecting all pixels (in the specified
  * drawable) with the same (or similar) color to that specified.
@@ -56,21 +55,21 @@
  * 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(). In the case of a merged sampling,
- * the supplied drawable is ignored.
+ * gimp_context_set_sample_merged(),
+ * gimp_context_set_sample_criterion(). In the case of a merged
+ * sampling, the supplied drawable is ignored.
  *
  * Returns: TRUE on success.
  *
  * Since: GIMP 2.8
  **/
 gboolean
-gimp_image_select_color (gint32               image_ID,
-                         GimpChannelOps       operation,
-                         gint32               drawable_ID,
-                         const GimpRGB       *color,
-                         gint                 threshold,
-                         gboolean             select_transparent,
-                         GimpSelectCriterion  select_criterion)
+gimp_image_select_color (gint32          image_ID,
+                         GimpChannelOps  operation,
+                         gint32          drawable_ID,
+                         const GimpRGB  *color,
+                         gint            threshold,
+                         gboolean        select_transparent)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
@@ -84,7 +83,6 @@ gimp_image_select_color (gint32               image_ID,
                                     GIMP_PDB_COLOR, color,
                                     GIMP_PDB_INT32, threshold,
                                     GIMP_PDB_INT32, select_transparent,
-                                    GIMP_PDB_INT32, select_criterion,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -204,7 +202,6 @@ gimp_image_select_polygon (gint32          image_ID,
  * @y: y coordinate of initial seed fill point: (image coordinates).
  * @threshold: Threshold in intensity levels.
  * @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
- * @select_criterion: The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.
  *
  * Create a fuzzy selection starting at the specified coordinates on
  * the specified drawable.
@@ -221,24 +218,24 @@ gimp_image_select_polygon (gint32          image_ID,
  * 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(). In the case of a merged sampling,
- * the supplied drawable is ignored. If the sample is merged, the
- * specified coordinates are relative to the image origin; otherwise,
- * they are relative to the drawable's origin.
+ * gimp_context_set_sample_merged(),
+ * gimp_context_set_sample_criterion(). In the case of a merged
+ * sampling, the supplied drawable is ignored. If the sample is merged,
+ * the specified coordinates are relative to the image origin;
+ * otherwise, they are relative to the drawable's origin.
  *
  * Returns: TRUE on success.
  *
  * Since: GIMP 2.8
  **/
 gboolean
-gimp_image_select_fuzzy (gint32              image_ID,
-                         GimpChannelOps      operation,
-                         gint32              drawable_ID,
-                         gdouble             x,
-                         gdouble             y,
-                         gint                threshold,
-                         gboolean            select_transparent,
-                         GimpSelectCriterion select_criterion)
+gimp_image_select_fuzzy (gint32         image_ID,
+                         GimpChannelOps operation,
+                         gint32         drawable_ID,
+                         gdouble        x,
+                         gdouble        y,
+                         gint           threshold,
+                         gboolean       select_transparent)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
@@ -253,7 +250,6 @@ gimp_image_select_fuzzy (gint32              image_ID,
                                     GIMP_PDB_FLOAT, y,
                                     GIMP_PDB_INT32, threshold,
                                     GIMP_PDB_INT32, select_transparent,
-                                    GIMP_PDB_INT32, select_criterion,
                                     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 27ecc9b..9b0a780 100644
--- a/libgimp/gimpimageselect_pdb.h
+++ b/libgimp/gimpimageselect_pdb.h
@@ -28,48 +28,46 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
-gboolean gimp_image_select_color           (gint32               image_ID,
-                                            GimpChannelOps       operation,
-                                            gint32               drawable_ID,
-                                            const GimpRGB       *color,
-                                            gint                 threshold,
-                                            gboolean             select_transparent,
-                                            GimpSelectCriterion  select_criterion);
-gboolean gimp_image_select_ellipse         (gint32               image_ID,
-                                            GimpChannelOps       operation,
-                                            gdouble              x,
-                                            gdouble              y,
-                                            gdouble              width,
-                                            gdouble              height);
-gboolean gimp_image_select_polygon         (gint32               image_ID,
-                                            GimpChannelOps       operation,
-                                            gint                 num_segs,
-                                            const gdouble       *segs);
-gboolean gimp_image_select_fuzzy           (gint32               image_ID,
-                                            GimpChannelOps       operation,
-                                            gint32               drawable_ID,
-                                            gdouble              x,
-                                            gdouble              y,
-                                            gint                 threshold,
-                                            gboolean             select_transparent,
-                                            GimpSelectCriterion  select_criterion);
-gboolean gimp_image_select_rectangle       (gint32               image_ID,
-                                            GimpChannelOps       operation,
-                                            gdouble              x,
-                                            gdouble              y,
-                                            gdouble              width,
-                                            gdouble              height);
-gboolean gimp_image_select_round_rectangle (gint32               image_ID,
-                                            GimpChannelOps       operation,
-                                            gdouble              x,
-                                            gdouble              y,
-                                            gdouble              width,
-                                            gdouble              height,
-                                            gdouble              corner_radius_x,
-                                            gdouble              corner_radius_y);
-gboolean gimp_image_select_item            (gint32               image_ID,
-                                            GimpChannelOps       operation,
-                                            gint32               item_ID);
+gboolean gimp_image_select_color           (gint32          image_ID,
+                                            GimpChannelOps  operation,
+                                            gint32          drawable_ID,
+                                            const GimpRGB  *color,
+                                            gint            threshold,
+                                            gboolean        select_transparent);
+gboolean gimp_image_select_ellipse         (gint32          image_ID,
+                                            GimpChannelOps  operation,
+                                            gdouble         x,
+                                            gdouble         y,
+                                            gdouble         width,
+                                            gdouble         height);
+gboolean gimp_image_select_polygon         (gint32          image_ID,
+                                            GimpChannelOps  operation,
+                                            gint            num_segs,
+                                            const gdouble  *segs);
+gboolean gimp_image_select_fuzzy           (gint32          image_ID,
+                                            GimpChannelOps  operation,
+                                            gint32          drawable_ID,
+                                            gdouble         x,
+                                            gdouble         y,
+                                            gint            threshold,
+                                            gboolean        select_transparent);
+gboolean gimp_image_select_rectangle       (gint32          image_ID,
+                                            GimpChannelOps  operation,
+                                            gdouble         x,
+                                            gdouble         y,
+                                            gdouble         width,
+                                            gdouble         height);
+gboolean gimp_image_select_round_rectangle (gint32          image_ID,
+                                            GimpChannelOps  operation,
+                                            gdouble         x,
+                                            gdouble         y,
+                                            gdouble         width,
+                                            gdouble         height,
+                                            gdouble         corner_radius_x,
+                                            gdouble         corner_radius_y);
+gboolean gimp_image_select_item            (gint32          image_ID,
+                                            GimpChannelOps  operation,
+                                            gint32          item_ID);
 
 
 G_END_DECLS
diff --git a/tools/pdbgen/pdb/context.pdb b/tools/pdbgen/pdb/context.pdb
index 2bc00d9..a1a9f08 100644
--- a/tools/pdbgen/pdb/context.pdb
+++ b/tools/pdbgen/pdb/context.pdb
@@ -929,6 +929,61 @@ CODE
     );
 }
 
+sub context_get_sample_criterion {
+    $blurb = 'Get the sample criterion setting.';
+
+    $help = <<'HELP';
+This procedure returns the sample criterion setting.
+HELP
+
+    &mitch_pdb_misc('2011', '2.8');
+
+    @outargs = (
+        { name => 'sample_criterion', type => 'enum GimpSelectCriterion',
+          desc => 'The sample criterion setting' }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  g_object_get (context,
+                "sample-criterion", &sample_criterion,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_set_sample_criterion {
+    $blurb = 'Set the sample merged setting.';
+
+    $help = <<'HELP';
+This procedure modifies the sample criterion setting. If an operation
+depends on the colors of the pixels present in a drawable, like when
+doing a seed fill, this setting controls how color similarity is
+determined. SELECT_CRITERION_COMPOSITE is the default value. This
+setting affects the following procedures: gimp_image_select_color(),
+gimp_image_select_fuzzy().
+HELP
+
+    &mitch_pdb_misc('2011', '2.8');
+
+    @inargs = (
+        { name => 'sample_criterion', type => 'enum GimpSelectCriterion',
+          desc => 'The sample criterion setting' }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  g_object_set (context,
+                "sample-criterion", sample_criterion,
+                NULL);
+}
+CODE
+    );
+}
+
 sub context_get_interpolation {
     $blurb = 'Get the interpolation type.';
 
@@ -1172,6 +1227,7 @@ CODE
             context_get_feather context_set_feather
             context_get_feather_radius context_set_feather_radius
             context_get_sample_merged context_set_sample_merged
+            context_get_sample_criterion context_set_sample_criterion
             context_get_interpolation context_set_interpolation
             context_get_transform_direction context_set_transform_direction
             context_get_transform_resize context_set_transform_resize
diff --git a/tools/pdbgen/pdb/image_select.pdb b/tools/pdbgen/pdb/image_select.pdb
index 242c5a5..8d336ad 100644
--- a/tools/pdbgen/pdb/image_select.pdb
+++ b/tools/pdbgen/pdb/image_select.pdb
@@ -33,7 +33,8 @@ 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_feather_radius(), gimp_context_set_sample_merged(),
+gimp_context_set_sample_criterion().
 
 In the case of a merged sampling, the supplied drawable is ignored.
 HELP
@@ -54,11 +55,7 @@ HELP
         { name => 'select_transparent', type => 'boolean',
           desc => "Whether to consider transparent pixels for selection.
                    If TRUE, transparency is considered as a unique selectable
-                   color." },
-        { name => 'select_criterion', type => 'enum GimpSelectCriterion',
-          desc => "The criterion used to determine color similarity.
-                   SELECT_CRITERION_COMPOSITE is the standard choice.
-		   " },
+                   color." }
     );
 
     %invoke = (
@@ -74,7 +71,7 @@ HELP
                                     &color,
                                     threshold,
                                     select_transparent,
-                                    select_criterion,
+                                    pdb_context->sample_criterion,
                                     operation,
                                     pdb_context->antialias,
                                     pdb_context->feather,
@@ -213,7 +210,8 @@ 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_feather_radius(), gimp_context_set_sample_merged(),
+gimp_context_set_sample_criterion().
 
 In the case of a merged sampling, the supplied drawable is ignored.
 If the sample is merged, the specified coordinates are relative to the
@@ -240,11 +238,7 @@ HELP
 	{ name => 'select_transparent', type => 'boolean',
           desc => "Whether to consider transparent pixels for selection.
                    If TRUE, transparency is considered as a unique selectable
-                   color." },
-        { name => 'select_criterion', type => 'enum GimpSelectCriterion',
-          desc => "The criterion used to determine color similarity.
-                   SELECT_CRITERION_COMPOSITE is the standard choice.
-		   " },
+                   color." }
     );
 
     %invoke = (
@@ -262,7 +256,7 @@ HELP
                                  x, y,
                                  threshold,
                                  select_transparent,
-                                 select_criterion,
+                                 pdb_context->sample_criterion,
                                  operation,
                                  pdb_context->antialias,
                                  pdb_context->feather,



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