diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c index d4d2fb5aea..d987298814 100644 --- a/app/pdb/context-cmds.c +++ b/app/pdb/context-cmds.c @@ -1789,7 +1789,7 @@ register_context_procs (GimpPDB *pdb) gimp_procedure_set_static_strings (procedure, "gimp-context-set-antialias", "Set the antialias setting.", - "This procedure modifies the antialias setting. If antialiasing is turned on, the edges of selected region will contain intermediate values which give the appearance of a sharper, less pixelized edge. This should be set as TRUE most of the time unless a binary-only selection is wanted. This settings affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-ellipse', 'gimp-image-select-polygon', 'gimp-image-select-fuzzy', 'gimp-image-select-round-rectangle', 'gimp-image-select-item'.", + "This procedure modifies the antialias setting. If antialiasing is turned on, the edges of selected region will contain intermediate values which give the appearance of a sharper, less pixelized edge. This should be set as TRUE most of the time unless a binary-only selection is wanted. This settings affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-contiguous-color', 'gimp-image-select-round-rectangle', 'gimp-image-select-ellipse', 'gimp-image-select-polygon', 'gimp-image-select-item'.", "Michael Natterer ", "Michael Natterer", "2010", @@ -1835,7 +1835,7 @@ register_context_procs (GimpPDB *pdb) gimp_procedure_set_static_strings (procedure, "gimp-context-set-feather", "Set the feather setting.", - "This procedure modifies the feather setting. If the feather option is enabled, selections will be blurred before combining. The blur is a gaussian blur; its radii can be controlled using 'gimp-context-set-feather-radius'. This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-ellipse', 'gimp-image-select-polygon', 'gimp-image-select-fuzzy', 'gimp-image-select-rectangle', 'gimp-image-select-round-rectangle', 'gimp-image-select-item'.", + "This procedure modifies the feather setting. If the feather option is enabled, selections will be blurred before combining. The blur is a gaussian blur; its radii can be controlled using 'gimp-context-set-feather-radius'. This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-contiguous-color', 'gimp-image-select-rectangle', 'gimp-image-select-round-rectangle', 'gimp-image-select-ellipse', 'gimp-image-select-polygon', 'gimp-image-select-item'.", "Michael Natterer ", "Michael Natterer", "2010", @@ -1939,7 +1939,7 @@ register_context_procs (GimpPDB *pdb) gimp_procedure_set_static_strings (procedure, "gimp-context-set-sample-merged", "Set the sample merged setting.", - "This procedure modifies the sample merged setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether the pixel data from the specified drawable is used ('sample-merged' is FALSE), or the pixel data from the composite image ('sample-merged' is TRUE. This is equivalent to sampling for colors after merging all visible layers). This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-fuzzy'.", + "This procedure modifies the sample merged setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether the pixel data from the specified drawable is used ('sample-merged' is FALSE), or the pixel data from the composite image ('sample-merged' is TRUE. This is equivalent to sampling for colors after merging all visible layers). This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-contiguous-color'.", "Michael Natterer ", "Michael Natterer", "2011", @@ -1986,7 +1986,7 @@ register_context_procs (GimpPDB *pdb) gimp_procedure_set_static_strings (procedure, "gimp-context-set-sample-criterion", "Set the sample criterion 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'.", + "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-contiguous-color'.", "Michael Natterer ", "Michael Natterer", "2011", @@ -2033,7 +2033,7 @@ register_context_procs (GimpPDB *pdb) gimp_procedure_set_static_strings (procedure, "gimp-context-set-sample-threshold", "Set the sample threshold setting.", - "This procedure modifies the sample threshold setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls what is \"sufficiently close\" to be considered a similar color. If the sample threshold has not been set explicitly, the default threshold set in gimprc will be used. This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-fuzzy'.", + "This procedure modifies the sample threshold setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls what is \"sufficiently close\" to be considered a similar color. If the sample threshold has not been set explicitly, the default threshold set in gimprc will be used. This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-contiguous-color'.", "Michael Natterer ", "Michael Natterer", "2011", @@ -2125,7 +2125,7 @@ register_context_procs (GimpPDB *pdb) gimp_procedure_set_static_strings (procedure, "gimp-context-set-sample-transparent", "Set the sample transparent setting.", - "This procedure modifies the sample transparent setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether transparency is considered to be a unique selectable color. When this setting is TRUE, transparent areas can be selected or filled. This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-fuzzy'.", + "This procedure modifies the sample transparent setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether transparency is considered to be a unique selectable color. When this setting is TRUE, transparent areas can be selected or filled. This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-contiguous-color'.", "Michael Natterer ", "Michael Natterer", "2011", diff --git a/app/pdb/image-select-cmds.c b/app/pdb/image-select-cmds.c index 6a19018eaf..3f0f0ceb63 100644 --- a/app/pdb/image-select-cmds.c +++ b/app/pdb/image-select-cmds.c @@ -88,93 +88,12 @@ image_select_color_invoker (GimpProcedure *procedure, } static GValueArray * -image_select_ellipse_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GimpImage *image; - gint32 operation; - gdouble x; - gdouble y; - gdouble width; - gdouble height; - - image = gimp_value_get_image (&args->values[0], gimp); - operation = g_value_get_enum (&args->values[1]); - x = g_value_get_double (&args->values[2]); - y = g_value_get_double (&args->values[3]); - width = g_value_get_double (&args->values[4]); - height = g_value_get_double (&args->values[5]); - - if (success) - { - GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); - - gimp_channel_select_ellipse (gimp_image_get_mask (image), - (gint) x, (gint) y, - (gint) width, (gint) height, - operation, - pdb_context->antialias, - pdb_context->feather, - pdb_context->feather_radius_x, - pdb_context->feather_radius_y, - TRUE); - } - - return gimp_procedure_get_return_values (procedure, success, - error ? *error : NULL); -} - -static GValueArray * -image_select_polygon_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GimpImage *image; - gint32 operation; - gint32 num_segs; - const gdouble *segs; - - image = gimp_value_get_image (&args->values[0], gimp); - operation = g_value_get_enum (&args->values[1]); - num_segs = g_value_get_int (&args->values[2]); - segs = gimp_value_get_floatarray (&args->values[3]); - - if (success) - { - GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); - - gimp_channel_select_polygon (gimp_image_get_mask (image), - _("Free Select"), - num_segs / 2, - (GimpVector2 *) segs, - operation, - pdb_context->antialias, - pdb_context->feather, - pdb_context->feather_radius_x, - pdb_context->feather_radius_y, - TRUE); - } - - return gimp_procedure_get_return_values (procedure, success, - error ? *error : NULL); -} - -static GValueArray * -image_select_fuzzy_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) +image_select_contiguous_color_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) { gboolean success = TRUE; GimpImage *image; @@ -307,6 +226,87 @@ image_select_round_rectangle_invoker (GimpProcedure *procedure, error ? *error : NULL); } +static GValueArray * +image_select_ellipse_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GimpImage *image; + gint32 operation; + gdouble x; + gdouble y; + gdouble width; + gdouble height; + + image = gimp_value_get_image (&args->values[0], gimp); + operation = g_value_get_enum (&args->values[1]); + x = g_value_get_double (&args->values[2]); + y = g_value_get_double (&args->values[3]); + width = g_value_get_double (&args->values[4]); + height = g_value_get_double (&args->values[5]); + + if (success) + { + GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); + + gimp_channel_select_ellipse (gimp_image_get_mask (image), + (gint) x, (gint) y, + (gint) width, (gint) height, + operation, + pdb_context->antialias, + pdb_context->feather, + pdb_context->feather_radius_x, + pdb_context->feather_radius_y, + TRUE); + } + + return gimp_procedure_get_return_values (procedure, success, + error ? *error : NULL); +} + +static GValueArray * +image_select_polygon_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GimpImage *image; + gint32 operation; + gint32 num_segs; + const gdouble *segs; + + image = gimp_value_get_image (&args->values[0], gimp); + operation = g_value_get_enum (&args->values[1]); + num_segs = g_value_get_int (&args->values[2]); + segs = gimp_value_get_floatarray (&args->values[3]); + + if (success) + { + GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); + + gimp_channel_select_polygon (gimp_image_get_mask (image), + _("Free Select"), + num_segs / 2, + (GimpVector2 *) segs, + operation, + pdb_context->antialias, + pdb_context->feather, + pdb_context->feather_radius_x, + pdb_context->feather_radius_y, + TRUE); + } + + return gimp_procedure_get_return_values (procedure, success, + error ? *error : NULL); +} + static GValueArray * image_select_item_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -393,111 +393,16 @@ register_image_select_procs (GimpPDB *pdb) g_object_unref (procedure); /* - * gimp-image-select-ellipse + * gimp-image-select-contiguous-color */ - procedure = gimp_procedure_new (image_select_ellipse_invoker); + procedure = gimp_procedure_new (image_select_contiguous_color_invoker); gimp_object_set_static_name (GIMP_OBJECT (procedure), - "gimp-image-select-ellipse"); + "gimp-image-select-contiguous-color"); gimp_procedure_set_static_strings (procedure, - "gimp-image-select-ellipse", - "Create an elliptical selection over the specified image.", - "This tool creates an elliptical selection over the specified image. The elliptical region can be either added to, subtracted from, or replace the contents of the previous selection mask. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius'.", - "Michael Natterer ", - "Michael Natterer", - "2010", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_image_id ("image", - "image", - "The image", - pdb->gimp, FALSE, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - g_param_spec_enum ("operation", - "operation", - "The selection operation", - GIMP_TYPE_CHANNEL_OPS, - GIMP_CHANNEL_OP_ADD, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - g_param_spec_double ("x", - "x", - "x coordinate of upper-left corner of ellipse bounding box", - -G_MAXDOUBLE, G_MAXDOUBLE, 0, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - g_param_spec_double ("y", - "y", - "y coordinate of upper-left corner of ellipse bounding box", - -G_MAXDOUBLE, G_MAXDOUBLE, 0, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - g_param_spec_double ("width", - "width", - "The width of the ellipse", - 0, G_MAXDOUBLE, 0, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - g_param_spec_double ("height", - "height", - "The height of the ellipse", - 0, G_MAXDOUBLE, 0, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - - /* - * gimp-image-select-polygon - */ - procedure = gimp_procedure_new (image_select_polygon_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), - "gimp-image-select-polygon"); - gimp_procedure_set_static_strings (procedure, - "gimp-image-select-polygon", - "Create a polygonal selection over the specified image.", - "This tool creates a polygonal selection over the specified image. The polygonal region can be either added to, subtracted from, or replace the contents of the previous selection mask. The polygon is specified through an array of floating point numbers and its length. The length of array must be 2n, where n is the number of points. Each point is defined by 2 floating point values which correspond to the x and y coordinates. If the final point does not connect to the starting point, a connecting segment is automatically added. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius'.", - "Michael Natterer ", - "Michael Natterer", - "2010", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_image_id ("image", - "image", - "The image", - pdb->gimp, FALSE, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - g_param_spec_enum ("operation", - "operation", - "The selection operation", - GIMP_TYPE_CHANNEL_OPS, - GIMP_CHANNEL_OP_ADD, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - gimp_param_spec_int32 ("num-segs", - "num segs", - "Number of points (count 1 coordinate as two points)", - 2, G_MAXINT32, 2, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - gimp_param_spec_float_array ("segs", - "segs", - "Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}", - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - - /* - * gimp-image-select-fuzzy - */ - procedure = gimp_procedure_new (image_select_fuzzy_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), - "gimp-image-select-fuzzy"); - 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 current context settings. 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 and criterion context settings). 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', '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 image origin; otherwise, they are relative to the drawable's origin.", + "gimp-image-select-contiguous-color", + "Create a selection by selecting all pixels around specified coordinates with the same (or similar) color to that at the coordinates.", + "This tool creates a contiguous selection over the specified image. A contiguous color selection is determined by a seed fill under the constraints of the current context settings. 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 and criterion context settings). 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', '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 image origin; otherwise, they are relative to the drawable's origin.", "David Gowers", "David Gowers", "2010", @@ -656,6 +561,101 @@ register_image_select_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); + /* + * gimp-image-select-ellipse + */ + procedure = gimp_procedure_new (image_select_ellipse_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), + "gimp-image-select-ellipse"); + gimp_procedure_set_static_strings (procedure, + "gimp-image-select-ellipse", + "Create an elliptical selection over the specified image.", + "This tool creates an elliptical selection over the specified image. The elliptical region can be either added to, subtracted from, or replace the contents of the previous selection mask. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius'.", + "Michael Natterer ", + "Michael Natterer", + "2010", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_image_id ("image", + "image", + "The image", + pdb->gimp, FALSE, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + g_param_spec_enum ("operation", + "operation", + "The selection operation", + GIMP_TYPE_CHANNEL_OPS, + GIMP_CHANNEL_OP_ADD, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + g_param_spec_double ("x", + "x", + "x coordinate of upper-left corner of ellipse bounding box", + -G_MAXDOUBLE, G_MAXDOUBLE, 0, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + g_param_spec_double ("y", + "y", + "y coordinate of upper-left corner of ellipse bounding box", + -G_MAXDOUBLE, G_MAXDOUBLE, 0, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + g_param_spec_double ("width", + "width", + "The width of the ellipse", + 0, G_MAXDOUBLE, 0, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + g_param_spec_double ("height", + "height", + "The height of the ellipse", + 0, G_MAXDOUBLE, 0, + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + + /* + * gimp-image-select-polygon + */ + procedure = gimp_procedure_new (image_select_polygon_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), + "gimp-image-select-polygon"); + gimp_procedure_set_static_strings (procedure, + "gimp-image-select-polygon", + "Create a polygonal selection over the specified image.", + "This tool creates a polygonal selection over the specified image. The polygonal region can be either added to, subtracted from, or replace the contents of the previous selection mask. The polygon is specified through an array of floating point numbers and its length. The length of array must be 2n, where n is the number of points. Each point is defined by 2 floating point values which correspond to the x and y coordinates. If the final point does not connect to the starting point, a connecting segment is automatically added. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius'.", + "Michael Natterer ", + "Michael Natterer", + "2010", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_image_id ("image", + "image", + "The image", + pdb->gimp, FALSE, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + g_param_spec_enum ("operation", + "operation", + "The selection operation", + GIMP_TYPE_CHANNEL_OPS, + GIMP_CHANNEL_OP_ADD, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + gimp_param_spec_int32 ("num-segs", + "num segs", + "Number of points (count 1 coordinate as two points)", + 2, G_MAXINT32, 2, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + gimp_param_spec_float_array ("segs", + "segs", + "Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}", + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + /* * gimp-image-select-item */ diff --git a/app/pdb/selection-tools-cmds.c b/app/pdb/selection-tools-cmds.c index 2ce863ba2f..f0a3cce112 100644 --- a/app/pdb/selection-tools-cmds.c +++ b/app/pdb/selection-tools-cmds.c @@ -731,12 +731,12 @@ register_selection_tools_procs (GimpPDB *pdb) "gimp-fuzzy-select"); gimp_procedure_set_static_strings (procedure, "gimp-fuzzy-select", - "Deprecated: Use 'gimp-image-select-fuzzy' instead.", - "Deprecated: Use 'gimp-image-select-fuzzy' instead.", + "Deprecated: Use 'gimp-image-select-contiguous-color' instead.", + "Deprecated: Use 'gimp-image-select-contiguous-color' instead.", "", "", "", - "gimp-image-select-fuzzy"); + "gimp-image-select-contiguous-color"); gimp_procedure_add_argument (procedure, gimp_param_spec_drawable_id ("drawable", "drawable", @@ -803,12 +803,12 @@ register_selection_tools_procs (GimpPDB *pdb) "gimp-fuzzy-select-full"); gimp_procedure_set_static_strings (procedure, "gimp-fuzzy-select-full", - "Deprecated: Use 'gimp-image-select-fuzzy' instead.", - "Deprecated: Use 'gimp-image-select-fuzzy' instead.", + "Deprecated: Use 'gimp-image-select-contiguous-color' instead.", + "Deprecated: Use 'gimp-image-select-contiguous-color' instead.", "David Gowers", "David Gowers", "2006", - "gimp-image-select-fuzzy"); + "gimp-image-select-contiguous-color"); gimp_procedure_add_argument (procedure, gimp_param_spec_drawable_id ("drawable", "drawable", diff --git a/libgimp/gimp.def b/libgimp/gimp.def index 6115cb2703..204cbc9c6c 100644 --- a/libgimp/gimp.def +++ b/libgimp/gimp.def @@ -418,8 +418,8 @@ EXPORTS gimp_image_scale gimp_image_scale_full gimp_image_select_color + gimp_image_select_contiguous_color gimp_image_select_ellipse - gimp_image_select_fuzzy gimp_image_select_item gimp_image_select_polygon gimp_image_select_rectangle diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c index bb269189f1..90dc7e916f 100644 --- a/libgimp/gimpcontext_pdb.c +++ b/libgimp/gimpcontext_pdb.c @@ -907,9 +907,9 @@ gimp_context_get_antialias (void) * values which give the appearance of a sharper, less pixelized edge. * This should be set as TRUE most of the time unless a binary-only * selection is wanted. This settings affects the following procedures: - * gimp_image_select_color(), gimp_image_select_ellipse(), - * gimp_image_select_polygon(), gimp_image_select_fuzzy(), - * gimp_image_select_round_rectangle(), gimp_image_select_item(). + * gimp_image_select_color(), gimp_image_select_contiguous_color(), + * gimp_image_select_round_rectangle(), gimp_image_select_ellipse(), + * gimp_image_select_polygon(), gimp_image_select_item(). * * Returns: TRUE on success. * @@ -975,9 +975,9 @@ gimp_context_get_feather (void) * a gaussian blur; its radii can be controlled using * gimp_context_set_feather_radius(). This setting affects the * following procedures: gimp_image_select_color(), - * gimp_image_select_ellipse(), gimp_image_select_polygon(), - * gimp_image_select_fuzzy(), gimp_image_select_rectangle(), - * gimp_image_select_round_rectangle(), gimp_image_select_item(). + * gimp_image_select_contiguous_color(), gimp_image_select_rectangle(), + * gimp_image_select_round_rectangle(), gimp_image_select_ellipse(), + * gimp_image_select_polygon(), gimp_image_select_item(). * * Returns: TRUE on success. * @@ -1122,7 +1122,7 @@ gimp_context_get_sample_merged (void) * pixel data from the composite image ('sample-merged' is TRUE. This * is equivalent to sampling for colors after merging all visible * layers). This setting affects the following procedures: - * gimp_image_select_color(), gimp_image_select_fuzzy(). + * gimp_image_select_color(), gimp_image_select_contiguous_color(). * * Returns: TRUE on success. * @@ -1188,7 +1188,7 @@ gimp_context_get_sample_criterion (void) * 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(). + * gimp_image_select_color(), gimp_image_select_contiguous_color(). * * Returns: TRUE on success. * @@ -1255,7 +1255,8 @@ gimp_context_get_sample_threshold (void) * \"sufficiently close\" to be considered a similar color. If the * sample threshold has not been set explicitly, the default threshold * set in gimprc will be used. This setting affects the following - * procedures: gimp_image_select_color(), gimp_image_select_fuzzy(). + * procedures: gimp_image_select_color(), + * gimp_image_select_contiguous_color(). * * Returns: TRUE on success. * @@ -1385,7 +1386,7 @@ gimp_context_get_sample_transparent (void) * transparency is considered to be a unique selectable color. When * this setting is TRUE, transparent areas can be selected or filled. * This setting affects the following procedures: - * gimp_image_select_color(), gimp_image_select_fuzzy(). + * gimp_image_select_color(), gimp_image_select_contiguous_color(). * * Returns: TRUE on success. * diff --git a/libgimp/gimpimageselect_pdb.c b/libgimp/gimpimageselect_pdb.c index e3491714d0..45121265d6 100644 --- a/libgimp/gimpimageselect_pdb.c +++ b/libgimp/gimpimageselect_pdb.c @@ -89,121 +89,21 @@ gimp_image_select_color (gint32 image_ID, } /** - * gimp_image_select_ellipse: - * @image_ID: The image. - * @operation: The selection operation. - * @x: x coordinate of upper-left corner of ellipse bounding box. - * @y: y coordinate of upper-left corner of ellipse bounding box. - * @width: The width of the ellipse. - * @height: The height of the ellipse. - * - * Create an elliptical selection over the specified image. - * - * This tool creates an elliptical selection over the specified image. - * The elliptical region can be either added to, subtracted from, or - * replace the contents of the previous selection mask. This prodecure - * is affected by the following context setters: - * gimp_context_set_antialias(), gimp_context_set_feather(), - * gimp_context_set_feather_radius(). - * - * Returns: TRUE on success. - * - * Since: GIMP 2.8 - **/ -gboolean -gimp_image_select_ellipse (gint32 image_ID, - GimpChannelOps operation, - gdouble x, - gdouble y, - gdouble width, - gdouble height) -{ - GimpParam *return_vals; - gint nreturn_vals; - gboolean success = TRUE; - - return_vals = gimp_run_procedure ("gimp-image-select-ellipse", - &nreturn_vals, - GIMP_PDB_IMAGE, image_ID, - GIMP_PDB_INT32, operation, - GIMP_PDB_FLOAT, x, - GIMP_PDB_FLOAT, y, - GIMP_PDB_FLOAT, width, - GIMP_PDB_FLOAT, height, - GIMP_PDB_END); - - success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; - - gimp_destroy_params (return_vals, nreturn_vals); - - return success; -} - -/** - * gimp_image_select_polygon: - * @image_ID: The image. - * @operation: The selection operation. - * @num_segs: Number of points (count 1 coordinate as two points). - * @segs: Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}. - * - * Create a polygonal selection over the specified image. - * - * This tool creates a polygonal selection over the specified image. - * The polygonal region can be either added to, subtracted from, or - * replace the contents of the previous selection mask. The polygon is - * specified through an array of floating point numbers and its length. - * The length of array must be 2n, where n is the number of points. - * Each point is defined by 2 floating point values which correspond to - * the x and y coordinates. If the final point does not connect to the - * starting point, a connecting segment is automatically added. This - * prodecure is affected by the following context setters: - * gimp_context_set_antialias(), gimp_context_set_feather(), - * gimp_context_set_feather_radius(). - * - * Returns: TRUE on success. - * - * Since: GIMP 2.8 - **/ -gboolean -gimp_image_select_polygon (gint32 image_ID, - GimpChannelOps operation, - gint num_segs, - const gdouble *segs) -{ - GimpParam *return_vals; - gint nreturn_vals; - gboolean success = TRUE; - - return_vals = gimp_run_procedure ("gimp-image-select-polygon", - &nreturn_vals, - GIMP_PDB_IMAGE, image_ID, - GIMP_PDB_INT32, operation, - GIMP_PDB_INT32, num_segs, - GIMP_PDB_FLOATARRAY, segs, - GIMP_PDB_END); - - success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; - - gimp_destroy_params (return_vals, nreturn_vals); - - return success; -} - -/** - * gimp_image_select_fuzzy: + * gimp_image_select_contiguous_color: * @image_ID: The affected image. * @operation: The selection operation. * @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). * - * Create a fuzzy selection starting at the specified coordinates on - * the specified drawable. + * Create a selection by selecting all pixels around specified + * coordinates with the same (or similar) color to that at the + * coordinates. * - * This tool creates a fuzzy selection over the specified image. A - * fuzzy selection is determined by a seed fill under the constraints - * of the current context settings. Essentially, the color at the - * specified coordinates (in the drawable) is measured and the + * This tool creates a contiguous selection over the specified image. A + * contiguous color selection is determined by a seed fill under the + * constraints of the current context settings. 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 and criterion context settings). This process continues @@ -225,17 +125,17 @@ gimp_image_select_polygon (gint32 image_ID, * Since: GIMP 2.8 **/ gboolean -gimp_image_select_fuzzy (gint32 image_ID, - GimpChannelOps operation, - gint32 drawable_ID, - gdouble x, - gdouble y) +gimp_image_select_contiguous_color (gint32 image_ID, + GimpChannelOps operation, + gint32 drawable_ID, + gdouble x, + gdouble y) { GimpParam *return_vals; gint nreturn_vals; gboolean success = TRUE; - return_vals = gimp_run_procedure ("gimp-image-select-fuzzy", + return_vals = gimp_run_procedure ("gimp-image-select-contiguous-color", &nreturn_vals, GIMP_PDB_IMAGE, image_ID, GIMP_PDB_INT32, operation, @@ -359,6 +259,107 @@ gimp_image_select_round_rectangle (gint32 image_ID, return success; } +/** + * gimp_image_select_ellipse: + * @image_ID: The image. + * @operation: The selection operation. + * @x: x coordinate of upper-left corner of ellipse bounding box. + * @y: y coordinate of upper-left corner of ellipse bounding box. + * @width: The width of the ellipse. + * @height: The height of the ellipse. + * + * Create an elliptical selection over the specified image. + * + * This tool creates an elliptical selection over the specified image. + * The elliptical region can be either added to, subtracted from, or + * replace the contents of the previous selection mask. This prodecure + * is affected by the following context setters: + * gimp_context_set_antialias(), gimp_context_set_feather(), + * gimp_context_set_feather_radius(). + * + * Returns: TRUE on success. + * + * Since: GIMP 2.8 + **/ +gboolean +gimp_image_select_ellipse (gint32 image_ID, + GimpChannelOps operation, + gdouble x, + gdouble y, + gdouble width, + gdouble height) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp-image-select-ellipse", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_INT32, operation, + GIMP_PDB_FLOAT, x, + GIMP_PDB_FLOAT, y, + GIMP_PDB_FLOAT, width, + GIMP_PDB_FLOAT, height, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_image_select_polygon: + * @image_ID: The image. + * @operation: The selection operation. + * @num_segs: Number of points (count 1 coordinate as two points). + * @segs: Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}. + * + * Create a polygonal selection over the specified image. + * + * This tool creates a polygonal selection over the specified image. + * The polygonal region can be either added to, subtracted from, or + * replace the contents of the previous selection mask. The polygon is + * specified through an array of floating point numbers and its length. + * The length of array must be 2n, where n is the number of points. + * Each point is defined by 2 floating point values which correspond to + * the x and y coordinates. If the final point does not connect to the + * starting point, a connecting segment is automatically added. This + * prodecure is affected by the following context setters: + * gimp_context_set_antialias(), gimp_context_set_feather(), + * gimp_context_set_feather_radius(). + * + * Returns: TRUE on success. + * + * Since: GIMP 2.8 + **/ +gboolean +gimp_image_select_polygon (gint32 image_ID, + GimpChannelOps operation, + gint num_segs, + const gdouble *segs) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp-image-select-polygon", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_INT32, operation, + GIMP_PDB_INT32, num_segs, + GIMP_PDB_FLOATARRAY, segs, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + /** * gimp_image_select_item: * @image_ID: The image. diff --git a/libgimp/gimpimageselect_pdb.h b/libgimp/gimpimageselect_pdb.h index 2047ebb991..f544bb3d9d 100644 --- a/libgimp/gimpimageselect_pdb.h +++ b/libgimp/gimpimageselect_pdb.h @@ -28,42 +28,42 @@ 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); -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); -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); +gboolean gimp_image_select_contiguous_color (gint32 image_ID, + GimpChannelOps operation, + gint32 drawable_ID, + gdouble x, + gdouble y); +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_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_item (gint32 image_ID, + GimpChannelOps operation, + gint32 item_ID); G_END_DECLS diff --git a/libgimp/gimpselectiontools_pdb.c b/libgimp/gimpselectiontools_pdb.c index c859e3d6e0..4c41cc626b 100644 --- a/libgimp/gimpselectiontools_pdb.c +++ b/libgimp/gimpselectiontools_pdb.c @@ -252,7 +252,7 @@ gimp_free_select (gint32 image_ID, * @feather_radius: Radius for feather operation. * @sample_merged: Use the composite image, not the drawable. * - * Deprecated: Use gimp_image_select_fuzzy() instead. + * Deprecated: Use gimp_image_select_contiguous_color() instead. * * Returns: TRUE on success. **/ @@ -306,7 +306,7 @@ gimp_fuzzy_select (gint32 drawable_ID, * @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. * - * Deprecated: Use gimp_image_select_fuzzy() instead. + * Deprecated: Use gimp_image_select_contiguous_color() instead. * * Returns: TRUE on success. * diff --git a/tools/pdbgen/pdb/context.pdb b/tools/pdbgen/pdb/context.pdb index 67fced76a2..b45b7ed0d6 100644 --- a/tools/pdbgen/pdb/context.pdb +++ b/tools/pdbgen/pdb/context.pdb @@ -741,9 +741,9 @@ This should be set as TRUE most of the time unless a binary-only selection is wanted. This settings affects the following procedures: -gimp_image_select_color(), gimp_image_select_ellipse(), -gimp_image_select_polygon(), gimp_image_select_fuzzy(), -gimp_image_select_round_rectangle(), gimp_image_select_item(). +gimp_image_select_color(), gimp_image_select_contiguous_color(), +gimp_image_select_round_rectangle(), gimp_image_select_ellipse(), +gimp_image_select_polygon(), gimp_image_select_item(). HELP &mitch_pdb_misc('2010', '2.8'); @@ -799,9 +799,9 @@ gaussian blur; its radii can be controlled using gimp_context_set_feather_radius(). This setting affects the following procedures: -gimp_image_select_color(), gimp_image_select_ellipse(), -gimp_image_select_polygon(), gimp_image_select_fuzzy(), +gimp_image_select_color(), gimp_image_select_contiguous_color(), gimp_image_select_rectangle(), gimp_image_select_round_rectangle(), +gimp_image_select_ellipse(), gimp_image_select_polygon(), gimp_image_select_item(). HELP @@ -919,7 +919,7 @@ pixel data from the composite image ('sample-merged' is TRUE. This is equivalent to sampling for colors after merging all visible layers). This setting affects the following procedures: -gimp_image_select_color(), gimp_image_select_fuzzy(). +gimp_image_select_color(), gimp_image_select_contiguous_color(). HELP &mitch_pdb_misc('2011', '2.8'); @@ -975,7 +975,7 @@ 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(). +gimp_image_select_color(), gimp_image_select_contiguous_color(). HELP &mitch_pdb_misc('2011', '2.8'); @@ -1033,7 +1033,7 @@ to be considered a similar color. If the sample threshold has not been set explicitly, the default threshold set in gimprc will be used. This setting affects the following procedures: -gimp_image_select_color(), gimp_image_select_fuzzy(). +gimp_image_select_color(), gimp_image_select_contiguous_color(). HELP @@ -1148,7 +1148,7 @@ transparency is considered to be a unique selectable color. When this setting is TRUE, transparent areas can be selected or filled. This setting affects the following procedures: -gimp_image_select_color(), gimp_image_select_fuzzy(). +gimp_image_select_color(), gimp_image_select_contiguous_color(). HELP &mitch_pdb_misc('2011', '2.8'); diff --git a/tools/pdbgen/pdb/image_select.pdb b/tools/pdbgen/pdb/image_select.pdb index 4a38a83b96..23dee3bbfe 100644 --- a/tools/pdbgen/pdb/image_select.pdb +++ b/tools/pdbgen/pdb/image_select.pdb @@ -81,127 +81,23 @@ CODE } -sub image_select_ellipse { - $blurb = 'Create an elliptical selection over the specified image.'; - - $help = <<'HELP'; -This tool creates an elliptical selection over the specified -image. The elliptical region can be either added to, subtracted from, -or replace the contents of the previous selection mask. - -This prodecure is affected by the following context setters: -gimp_context_set_antialias(), gimp_context_set_feather(), -gimp_context_set_feather_radius(). -HELP - - &mitch_pdb_misc('2010', '2.8'); - - @inargs = ( - { name => 'image', type => 'image', - desc => 'The image' }, - { name => 'operation', type => 'enum GimpChannelOps', - desc => 'The selection operation' }, - { name => 'x', type => 'float', - desc => 'x coordinate of upper-left corner of ellipse bounding box' }, - { name => 'y', type => 'float', - desc => 'y coordinate of upper-left corner of ellipse bounding box' }, - { name => 'width', type => '0 < float', - desc => 'The width of the ellipse' }, - { name => 'height', type => '0 < float', - desc => 'The height of the ellipse' } - ); - - %invoke = ( - code => <<'CODE' -{ - GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); - - gimp_channel_select_ellipse (gimp_image_get_mask (image), - (gint) x, (gint) y, - (gint) width, (gint) height, - operation, - pdb_context->antialias, - pdb_context->feather, - pdb_context->feather_radius_x, - pdb_context->feather_radius_y, - TRUE); -} -CODE - ); -} - - -sub image_select_polygon { - $blurb = 'Create a polygonal selection over the specified image.'; - - $help = <<'HELP'; -This tool creates a polygonal selection over the specified image. The -polygonal region can be either added to, subtracted from, or replace -the contents of the previous selection mask. The polygon is specified -through an array of floating point numbers and its length. The length -of array must be 2n, where n is the number of points. Each point is -defined by 2 floating point values which correspond to the x and y -coordinates. If the final point does not connect to the starting -point, a connecting segment is automatically added. - -This prodecure is affected by the following context setters: -gimp_context_set_antialias(), gimp_context_set_feather(), -gimp_context_set_feather_radius(). -HELP - - &mitch_pdb_misc('2010', '2.8'); - - @inargs = ( - { name => 'image', type => 'image', - desc => 'The image' }, - { name => 'operation', type => 'enum GimpChannelOps', - desc => 'The selection operation' }, - { name => 'segs', type => 'floatarray', - desc => 'Array of points: { p1.x, p1.y, p2.x, p2.y, ..., - pn.x, pn.y}', - array => { type => '2 <= int32', - desc => 'Number of points (count 1 coordinate as two - points)' } } - ); - - %invoke = ( - code => <<'CODE' -{ - GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); - - gimp_channel_select_polygon (gimp_image_get_mask (image), - _("Free Select"), - num_segs / 2, - (GimpVector2 *) segs, - operation, - pdb_context->antialias, - pdb_context->feather, - pdb_context->feather_radius_x, - pdb_context->feather_radius_y, - TRUE); -} -CODE - ); -} - - -sub image_select_fuzzy { +sub image_select_contiguous_color { $blurb = <<'BLURB'; -Create a fuzzy selection starting at the specified coordinates on the specified -drawable. +Create a selection by selecting all pixels around specified coordinates +with the same (or similar) color to that at the coordinates. BLURB $help = <<'HELP'; -This tool creates a fuzzy selection over the specified image. A fuzzy -selection is determined by a seed fill under the constraints of the -current context settings. 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 and criterion -context settings). 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 tool creates a contiguous selection over the specified image. A +contiguous color selection is determined by a seed fill under the +constraints of the current context settings. 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 +and criterion context settings). 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(), @@ -366,6 +262,110 @@ CODE } +sub image_select_ellipse { + $blurb = 'Create an elliptical selection over the specified image.'; + + $help = <<'HELP'; +This tool creates an elliptical selection over the specified +image. The elliptical region can be either added to, subtracted from, +or replace the contents of the previous selection mask. + +This prodecure is affected by the following context setters: +gimp_context_set_antialias(), gimp_context_set_feather(), +gimp_context_set_feather_radius(). +HELP + + &mitch_pdb_misc('2010', '2.8'); + + @inargs = ( + { name => 'image', type => 'image', + desc => 'The image' }, + { name => 'operation', type => 'enum GimpChannelOps', + desc => 'The selection operation' }, + { name => 'x', type => 'float', + desc => 'x coordinate of upper-left corner of ellipse bounding box' }, + { name => 'y', type => 'float', + desc => 'y coordinate of upper-left corner of ellipse bounding box' }, + { name => 'width', type => '0 < float', + desc => 'The width of the ellipse' }, + { name => 'height', type => '0 < float', + desc => 'The height of the ellipse' } + ); + + %invoke = ( + code => <<'CODE' +{ + GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); + + gimp_channel_select_ellipse (gimp_image_get_mask (image), + (gint) x, (gint) y, + (gint) width, (gint) height, + operation, + pdb_context->antialias, + pdb_context->feather, + pdb_context->feather_radius_x, + pdb_context->feather_radius_y, + TRUE); +} +CODE + ); +} + + +sub image_select_polygon { + $blurb = 'Create a polygonal selection over the specified image.'; + + $help = <<'HELP'; +This tool creates a polygonal selection over the specified image. The +polygonal region can be either added to, subtracted from, or replace +the contents of the previous selection mask. The polygon is specified +through an array of floating point numbers and its length. The length +of array must be 2n, where n is the number of points. Each point is +defined by 2 floating point values which correspond to the x and y +coordinates. If the final point does not connect to the starting +point, a connecting segment is automatically added. + +This prodecure is affected by the following context setters: +gimp_context_set_antialias(), gimp_context_set_feather(), +gimp_context_set_feather_radius(). +HELP + + &mitch_pdb_misc('2010', '2.8'); + + @inargs = ( + { name => 'image', type => 'image', + desc => 'The image' }, + { name => 'operation', type => 'enum GimpChannelOps', + desc => 'The selection operation' }, + { name => 'segs', type => 'floatarray', + desc => 'Array of points: { p1.x, p1.y, p2.x, p2.y, ..., + pn.x, pn.y}', + array => { type => '2 <= int32', + desc => 'Number of points (count 1 coordinate as two + points)' } } + ); + + %invoke = ( + code => <<'CODE' +{ + GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); + + gimp_channel_select_polygon (gimp_image_get_mask (image), + _("Free Select"), + num_segs / 2, + (GimpVector2 *) segs, + operation, + pdb_context->antialias, + pdb_context->feather, + pdb_context->feather_radius_x, + pdb_context->feather_radius_y, + TRUE); +} +CODE + ); +} + + sub image_select_item { $blurb = 'Transforms the specified item into a selection'; @@ -420,11 +420,11 @@ CODE "gimp-intl.h"); @procs = qw(image_select_color + image_select_contiguous_color + image_select_rectangle + image_select_round_rectangle image_select_ellipse image_select_polygon - image_select_fuzzy - image_select_rectangle - image_select_round_rectangle image_select_item); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/selection_tools.pdb b/tools/pdbgen/pdb/selection_tools.pdb index 49e25055b0..09ff2d39ca 100644 --- a/tools/pdbgen/pdb/selection_tools.pdb +++ b/tools/pdbgen/pdb/selection_tools.pdb @@ -199,7 +199,7 @@ CODE sub fuzzy_select { - &std_pdb_deprecated ('gimp-image-select-fuzzy'); + &std_pdb_deprecated ('gimp-image-select-contiguous-color'); @inargs = ( { name => 'drawable', type => 'drawable', @@ -248,7 +248,7 @@ CODE sub fuzzy_select_full { - &std_pdb_deprecated ('gimp-image-select-fuzzy'); + &std_pdb_deprecated ('gimp-image-select-contiguous-color'); &david_pdb_misc("2006","2.4"); @inargs = (