[gimp] app: introduce GimpItem::to_selection()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: introduce GimpItem::to_selection()
- Date: Tue, 20 Jul 2010 21:10:50 +0000 (UTC)
commit 3184c440b31e9e01a9c0d137e5b8686c1a7e7580
Author: Michael Natterer <mitch gimp org>
Date: Tue Jul 20 23:09:19 2010 +0200
app: introduce GimpItem::to_selection()
Which replaces all the deparate functions to turn layers, channels,
layer masks and vectors into selections. Use the new virtual function
all over the place instead of calling the functions in
gimpchannel-select.c manually.
app/actions/channels-commands.c | 6 +---
app/actions/layers-commands.c | 35 ++++++++------------------
app/actions/select-commands.c | 1 -
app/actions/vectors-commands.c | 15 ++++-------
app/core/gimpchannel.c | 30 +++++++++++++++++++++++
app/core/gimpitem.c | 21 ++++++++++++++++
app/core/gimpitem.h | 14 +++++++++++
app/core/gimplayer.c | 28 +++++++++++++++++++++-
app/core/gimplayermask.c | 1 +
app/pdb/paths-cmds.c | 16 ++++-------
app/pdb/selection-cmds.c | 48 ++++++++++++++-----------------------
app/pdb/vectors-cmds.c | 20 +++++----------
app/tools/gimpvectortool.c | 9 ++----
app/vectors/gimpvectors.c | 28 +++++++++++++++++++++
tools/pdbgen/pdb/paths.pdb | 16 ++++-------
tools/pdbgen/pdb/selection.pdb | 50 ++++++++++++++------------------------
tools/pdbgen/pdb/vectors.pdb | 20 +++++----------
17 files changed, 205 insertions(+), 153 deletions(-)
---
diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c
index 150c584..6a6acb1 100644
--- a/app/actions/channels-commands.c
+++ b/app/actions/channels-commands.c
@@ -311,10 +311,8 @@ channels_to_selection_cmd_callback (GtkAction *action,
GimpChannel *channel;
return_if_no_channel (image, channel, data);
- gimp_channel_select_channel (gimp_image_get_mask (image),
- _("Channel to Selection"),
- channel, 0, 0,
- op, FALSE, 0.0, 0.0);
+ gimp_item_to_selection (GIMP_ITEM (channel),
+ op, TRUE, FALSE, 0.0, 0.0);
}
gimp_image_flush (image);
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index ff1b948..bad3e1b 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -31,7 +31,6 @@
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
-#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
#include "core/gimpgrouplayer.h"
#include "core/gimpimage.h"
@@ -821,27 +820,18 @@ layers_mask_to_selection_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
- GimpChannelOps op;
- GimpImage *image;
- GimpLayer *layer;
- GimpLayerMask *mask;
+ GimpImage *image;
+ GimpLayer *layer;
+ GimpLayerMask *mask;
return_if_no_layer (image, layer, data);
- op = (GimpChannelOps) value;
-
mask = gimp_layer_get_mask (layer);
if (mask)
{
- gint off_x, off_y;
-
- gimp_item_get_offset (GIMP_ITEM (mask), &off_x, &off_y);
-
- gimp_channel_select_channel (gimp_image_get_mask (image),
- _("Layer Mask to Selection"),
- GIMP_CHANNEL (mask),
- off_x, off_y,
- op, FALSE, 0.0, 0.0);
+ gimp_item_to_selection (GIMP_ITEM (mask),
+ (GimpChannelOps) value,
+ TRUE, FALSE, 0.0, 0.0);
gimp_image_flush (image);
}
}
@@ -881,16 +871,13 @@ layers_alpha_to_selection_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
- GimpChannelOps op;
- GimpImage *image;
- GimpLayer *layer;
+ GimpImage *image;
+ GimpLayer *layer;
return_if_no_layer (image, layer, data);
- op = (GimpChannelOps) value;
-
- gimp_channel_select_alpha (gimp_image_get_mask (image),
- GIMP_DRAWABLE (layer),
- op, FALSE, 0.0, 0.0);
+ gimp_item_to_selection (GIMP_ITEM (layer),
+ (GimpChannelOps) value,
+ TRUE, FALSE, 0.0, 0.0);
gimp_image_flush (image);
}
diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c
index 4c4bc4b..04529b3 100644
--- a/app/actions/select-commands.c
+++ b/app/actions/select-commands.c
@@ -27,7 +27,6 @@
#include "core/gimp.h"
#include "core/gimpchannel.h"
-#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimpselection.h"
#include "core/gimpstrokeoptions.h"
diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c
index be13aa8..fcb0294 100644
--- a/app/actions/vectors-commands.c
+++ b/app/actions/vectors-commands.c
@@ -29,7 +29,6 @@
#include "core/gimp.h"
#include "core/gimp-utils.h"
#include "core/gimpchannel.h"
-#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-merge.h"
@@ -303,17 +302,13 @@ vectors_to_selection_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
- GimpChannelOps op;
- GimpImage *image;
- GimpVectors *vectors;
+ GimpImage *image;
+ GimpVectors *vectors;
return_if_no_vectors (image, vectors, data);
- op = (GimpChannelOps) value;
-
- gimp_channel_select_vectors (gimp_image_get_mask (image),
- _("Path to Selection"),
- vectors,
- op, TRUE, FALSE, 0, 0, TRUE);
+ gimp_item_to_selection (GIMP_ITEM (vectors),
+ (GimpChannelOps) value,
+ TRUE, FALSE, 0, 0);
gimp_image_flush (image);
}
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 1328071..5bf070f 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -48,6 +48,7 @@
#include "gimpimage-undo-push.h"
#include "gimpchannel.h"
#include "gimpchannel-project.h"
+#include "gimpchannel-select.h"
#include "gimpcontext.h"
#include "gimpdrawable-stroke.h"
#include "gimpmarshal.h"
@@ -123,6 +124,12 @@ static gboolean gimp_channel_stroke (GimpItem *item,
gboolean push_undo,
GimpProgress *progress,
GError **error);
+static void gimp_channel_to_selection (GimpItem *item,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y);
static void gimp_channel_invalidate_boundary (GimpDrawable *drawable);
static void gimp_channel_get_active_components (const GimpDrawable *drawable,
@@ -259,6 +266,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->rotate = gimp_channel_rotate;
item_class->transform = gimp_channel_transform;
item_class->stroke = gimp_channel_stroke;
+ item_class->to_selection = gimp_channel_to_selection;
item_class->get_node = gimp_channel_get_node;
item_class->default_name = _("Channel");
item_class->rename_desc = C_("undo-type", "Rename Channel");
@@ -269,6 +277,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->rotate_desc = C_("undo-type", "Rotate Channel");
item_class->transform_desc = C_("undo-type", "Transform Channel");
item_class->stroke_desc = C_("undo-type", "Stroke Channel");
+ item_class->to_selection_desc = C_("undo-type", "Channel to Selection");
item_class->reorder_desc = C_("undo-type", "Reorder Channel");
item_class->raise_desc = C_("undo-type", "Raise Channel");
item_class->raise_to_top_desc = C_("undo-type", "Raise Channel to Top");
@@ -761,6 +770,27 @@ gimp_channel_stroke (GimpItem *item,
}
static void
+gimp_channel_to_selection (GimpItem *item,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y)
+{
+ GimpChannel *channel = GIMP_CHANNEL (item);
+ GimpImage *image = gimp_item_get_image (item);
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+
+ gimp_channel_select_channel (gimp_image_get_mask (image),
+ GIMP_ITEM_GET_CLASS (item)->to_selection_desc,
+ channel, off_x, off_y,
+ op,
+ feather, feather_radius_x, feather_radius_x);
+}
+
+static void
gimp_channel_invalidate_boundary (GimpDrawable *drawable)
{
GIMP_CHANNEL (drawable)->boundary_known = FALSE;
diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c
index 4855e52..1173a60 100644
--- a/app/core/gimpitem.c
+++ b/app/core/gimpitem.c
@@ -192,6 +192,7 @@ gimp_item_class_init (GimpItemClass *klass)
klass->rotate = NULL;
klass->transform = NULL;
klass->stroke = NULL;
+ klass->to_selection = NULL;
klass->get_node = gimp_item_real_get_node;
klass->default_name = NULL;
@@ -1411,6 +1412,26 @@ gimp_item_stroke (GimpItem *item,
return retval;
}
+void
+gimp_item_to_selection (GimpItem *item,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y)
+{
+ GimpItemClass *item_class;
+
+ g_return_if_fail (GIMP_IS_ITEM (item));
+ g_return_if_fail (gimp_item_is_attached (item));
+
+ item_class = GIMP_ITEM_GET_CLASS (item);
+
+ if (item_class->to_selection)
+ item_class->to_selection (item, op, antialias,
+ feather, feather_radius_x, feather_radius_y);
+}
+
GeglNode *
gimp_item_get_node (GimpItem *item)
{
diff --git a/app/core/gimpitem.h b/app/core/gimpitem.h
index c1a535c..3cee45f 100644
--- a/app/core/gimpitem.h
+++ b/app/core/gimpitem.h
@@ -121,6 +121,12 @@ struct _GimpItemClass
gboolean push_undo,
GimpProgress *progress,
GError **error);
+ void (* to_selection) (GimpItem *item,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y);
GeglNode * (* get_node) (GimpItem *item);
@@ -132,6 +138,7 @@ struct _GimpItemClass
const gchar *flip_desc;
const gchar *rotate_desc;
const gchar *transform_desc;
+ const gchar *to_selection_desc;
const gchar *stroke_desc;
const gchar *reorder_desc;
@@ -255,6 +262,13 @@ gboolean gimp_item_stroke (GimpItem *item,
GimpProgress *progress,
GError **error);
+void gimp_item_to_selection (GimpItem *item,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y);
+
GeglNode * gimp_item_get_node (GimpItem *item);
GeglNode * gimp_item_peek_node (GimpItem *item);
GeglNode * gimp_item_get_offset_node (GimpItem *item);
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 7b242ac..ece5fd3 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -36,6 +36,7 @@
#include "gegl/gimp-gegl-utils.h"
+#include "gimpchannel-select.h"
#include "gimpcontext.h"
#include "gimpcontainer.h"
#include "gimpdrawable-convert.h"
@@ -140,8 +141,14 @@ static void gimp_layer_transform (GimpItem *item,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gint recursion_level,
- GimpTransformResize clip_result,
+ GimpTransformResize clip_result,
GimpProgress *progress);
+static void gimp_layer_to_selection (GimpItem *item,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y);
static GeglNode * gimp_layer_get_node (GimpItem *item);
static gint64 gimp_layer_estimate_memsize (const GimpDrawable *drawable,
@@ -253,6 +260,7 @@ gimp_layer_class_init (GimpLayerClass *klass)
item_class->flip = gimp_layer_flip;
item_class->rotate = gimp_layer_rotate;
item_class->transform = gimp_layer_transform;
+ item_class->to_selection = gimp_layer_to_selection;
item_class->get_node = gimp_layer_get_node;
item_class->default_name = _("Layer");
item_class->rename_desc = C_("undo-type", "Rename Layer");
@@ -262,6 +270,7 @@ gimp_layer_class_init (GimpLayerClass *klass)
item_class->flip_desc = C_("undo-type", "Flip Layer");
item_class->rotate_desc = C_("undo-type", "Rotate Layer");
item_class->transform_desc = C_("undo-type", "Transform Layer");
+ item_class->to_selection_desc = C_("undo-type", "Alpha to Selection");
item_class->reorder_desc = C_("undo-type", "Reorder Layer");
item_class->raise_desc = C_("undo-type", "Raise Layer");
item_class->raise_to_top_desc = C_("undo-type", "Raise Layer to Top");
@@ -753,6 +762,23 @@ gimp_layer_transform (GimpItem *item,
clip_result, progress);
}
+static void
+gimp_layer_to_selection (GimpItem *item,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y)
+{
+ GimpLayer *layer = GIMP_LAYER (item);
+ GimpImage *image = gimp_item_get_image (item);
+
+ gimp_channel_select_alpha (gimp_image_get_mask (image),
+ GIMP_DRAWABLE (layer),
+ op,
+ feather, feather_radius_x, feather_radius_y);
+}
+
static GeglNode *
gimp_layer_get_node (GimpItem *item)
{
diff --git a/app/core/gimplayermask.c b/app/core/gimplayermask.c
index bcacc47..0a5f57c 100644
--- a/app/core/gimplayermask.c
+++ b/app/core/gimplayermask.c
@@ -108,6 +108,7 @@ gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
item_class->duplicate = gimp_layer_mask_duplicate;
item_class->rename = gimp_layer_mask_rename;
item_class->translate_desc = C_("undo-type", "Move Layer Mask");
+ item_class->to_selection_desc = C_("undo-type", "Layer Mask to Selection");
}
static void
diff --git a/app/pdb/paths-cmds.c b/app/pdb/paths-cmds.c
index de9f5e7..3a5d84f 100644
--- a/app/pdb/paths-cmds.c
+++ b/app/pdb/paths-cmds.c
@@ -27,7 +27,6 @@
#include "pdb-types.h"
-#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "core/gimpparamspecs.h"
@@ -641,15 +640,12 @@ path_to_selection_invoker (GimpProcedure *procedure,
GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
if (vectors)
- gimp_channel_select_vectors (gimp_image_get_mask (image),
- _("Path to Selection"),
- vectors,
- op,
- antialias,
- feather,
- feather_radius_x,
- feather_radius_y,
- TRUE);
+ gimp_item_to_selection (GIMP_ITEM (vectors),
+ op,
+ antialias,
+ feather,
+ feather_radius_x,
+ feather_radius_y);
else
success = FALSE;
}
diff --git a/app/pdb/selection-cmds.c b/app/pdb/selection-cmds.c
index 1ae44b8..a78aad2 100644
--- a/app/pdb/selection-cmds.c
+++ b/app/pdb/selection-cmds.c
@@ -23,7 +23,6 @@
#include "pdb-types.h"
-#include "core/gimpchannel-select.h"
#include "core/gimpchannel.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@@ -418,11 +417,12 @@ selection_layer_alpha_invoker (GimpProcedure *procedure,
if (success)
{
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
-
- gimp_channel_select_alpha (gimp_image_get_mask (image),
- GIMP_DRAWABLE (layer),
- GIMP_CHANNEL_OP_REPLACE, FALSE, 0.0, 0.0);
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, FALSE, error))
+ gimp_item_to_selection (GIMP_ITEM (layer),
+ GIMP_CHANNEL_OP_REPLACE,
+ TRUE, FALSE, 0.0, 0.0);
+ else
+ success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@@ -444,18 +444,12 @@ selection_load_invoker (GimpProcedure *procedure,
if (success)
{
- GimpImage *image;
- gint off_x, off_y;
-
- image = gimp_item_get_image (GIMP_ITEM (channel));
- gimp_item_get_offset (GIMP_ITEM (channel), &off_x, &off_y);
-
- gimp_channel_select_channel (gimp_image_get_mask (image),
- _("Channel to Selection"),
- channel,
- off_x, off_y,
- GIMP_CHANNEL_OP_REPLACE,
- FALSE, 0.0, 0.0);
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, FALSE, error))
+ gimp_item_to_selection (GIMP_ITEM (channel),
+ GIMP_CHANNEL_OP_REPLACE,
+ TRUE, FALSE, 0.0, 0.0);
+ else
+ success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@@ -511,18 +505,12 @@ selection_combine_invoker (GimpProcedure *procedure,
if (success)
{
- GimpImage *image;
- gint off_x, off_y;
-
- image = gimp_item_get_image (GIMP_ITEM (channel));
- gimp_item_get_offset (GIMP_ITEM (channel), &off_x, &off_y);
-
- gimp_channel_select_channel (gimp_image_get_mask (image),
- _("Channel to Selection"),
- channel,
- off_x, off_y,
- operation,
- FALSE, 0.0, 0.0);
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, FALSE, error))
+ gimp_item_to_selection (GIMP_ITEM (channel),
+ operation,
+ TRUE, FALSE, 0.0, 0.0);
+ else
+ success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
diff --git a/app/pdb/vectors-cmds.c b/app/pdb/vectors-cmds.c
index 2236472..f788b21 100644
--- a/app/pdb/vectors-cmds.c
+++ b/app/pdb/vectors-cmds.c
@@ -25,7 +25,6 @@
#include "pdb-types.h"
-#include "core/gimpchannel-select.h"
#include "core/gimpimage-undo-push.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
@@ -1342,18 +1341,13 @@ vectors_to_selection_invoker (GimpProcedure *procedure,
if (success)
{
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (vectors));
-
- if (image)
- gimp_channel_select_vectors (gimp_image_get_mask (image),
- _("Path to Selection"),
- vectors,
- operation,
- antialias,
- feather,
- feather_radius_x,
- feather_radius_y,
- TRUE);
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), NULL, FALSE, error))
+ gimp_item_to_selection (GIMP_ITEM (vectors),
+ operation,
+ antialias,
+ feather,
+ feather_radius_x,
+ feather_radius_y);
else
success = FALSE;
}
diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c
index 8a47074..5a57a68 100644
--- a/app/tools/gimpvectortool.c
+++ b/app/tools/gimpvectortool.c
@@ -31,7 +31,6 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
-#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage-undo-push.h"
@@ -1953,11 +1952,9 @@ gimp_vector_tool_to_selection_extended (GimpVectorTool *vector_tool,
operation = GIMP_CHANNEL_OP_SUBTRACT;
}
- gimp_channel_select_vectors (gimp_image_get_mask (image),
- _("Path to selection"),
- vector_tool->vectors,
- operation,
- TRUE, FALSE, 0, 0, TRUE);
+ gimp_item_to_selection (GIMP_ITEM (vector_tool->vectors),
+ operation,
+ TRUE, FALSE, 0, 0);
gimp_image_flush (image);
}
diff --git a/app/vectors/gimpvectors.c b/app/vectors/gimpvectors.c
index 5f171c3..729f9cc 100644
--- a/app/vectors/gimpvectors.c
+++ b/app/vectors/gimpvectors.c
@@ -29,6 +29,7 @@
#include "vectors-types.h"
#include "core/gimp.h"
+#include "core/gimpchannel-select.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable-stroke.h"
@@ -111,6 +112,12 @@ static gboolean gimp_vectors_stroke (GimpItem *item,
gboolean push_undo,
GimpProgress *progress,
GError **error);
+static void gimp_vectors_to_selection (GimpItem *item,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y);
static void gimp_vectors_real_thaw (GimpVectors *vectors);
static void gimp_vectors_real_stroke_add (GimpVectors *vectors,
@@ -191,6 +198,7 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
item_class->rotate = gimp_vectors_rotate;
item_class->transform = gimp_vectors_transform;
item_class->stroke = gimp_vectors_stroke;
+ item_class->to_selection = gimp_vectors_to_selection;
item_class->default_name = _("Path");
item_class->rename_desc = C_("undo-type", "Rename Path");
item_class->translate_desc = C_("undo-type", "Move Path");
@@ -200,6 +208,7 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
item_class->rotate_desc = C_("undo-type", "Rotate Path");
item_class->transform_desc = C_("undo-type", "Transform Path");
item_class->stroke_desc = C_("undo-type", "Stroke Path");
+ item_class->to_selection_desc = C_("undo-type", "Path to Selection");
item_class->reorder_desc = C_("undo-type", "Reorder Path");
item_class->raise_desc = C_("undo-type", "Raise Path");
item_class->raise_to_top_desc = C_("undo-type", "Raise Path to Top");
@@ -567,6 +576,25 @@ gimp_vectors_stroke (GimpItem *item,
}
static void
+gimp_vectors_to_selection (GimpItem *item,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y)
+{
+ GimpVectors *vectors = GIMP_VECTORS (item);
+ GimpImage *image = gimp_item_get_image (item);
+
+ gimp_channel_select_vectors (gimp_image_get_mask (image),
+ GIMP_ITEM_GET_CLASS (item)->to_selection_desc,
+ vectors,
+ op, antialias,
+ feather, feather_radius_x, feather_radius_x,
+ TRUE);
+}
+
+static void
gimp_vectors_real_thaw (GimpVectors *vectors)
{
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (vectors));
diff --git a/tools/pdbgen/pdb/paths.pdb b/tools/pdbgen/pdb/paths.pdb
index 8687a0f..93f00de 100644
--- a/tools/pdbgen/pdb/paths.pdb
+++ b/tools/pdbgen/pdb/paths.pdb
@@ -556,15 +556,12 @@ sub path_to_selection {
GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
if (vectors)
- gimp_channel_select_vectors (gimp_image_get_mask (image),
- _("Path to Selection"),
- vectors,
- op,
- antialias,
- feather,
- feather_radius_x,
- feather_radius_y,
- TRUE);
+ gimp_item_to_selection (GIMP_ITEM (vectors),
+ op,
+ antialias,
+ feather,
+ feather_radius_x,
+ feather_radius_y);
else
success = FALSE;
}
@@ -601,7 +598,6 @@ CODE
@headers = qw(<string.h>
"libgimpmath/gimpmath.h"
"core/gimplist.h"
- "core/gimpchannel-select.h"
"vectors/gimpanchor.h"
"vectors/gimpbezierstroke.h"
"vectors/gimpvectors.h"
diff --git a/tools/pdbgen/pdb/selection.pdb b/tools/pdbgen/pdb/selection.pdb
index c08e014..504fe31 100644
--- a/tools/pdbgen/pdb/selection.pdb
+++ b/tools/pdbgen/pdb/selection.pdb
@@ -434,11 +434,12 @@ HELP
%invoke = (
code => <<'CODE'
{
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
-
- gimp_channel_select_alpha (gimp_image_get_mask (image),
- GIMP_DRAWABLE (layer),
- GIMP_CHANNEL_OP_REPLACE, FALSE, 0.0, 0.0);
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, FALSE, error))
+ gimp_item_to_selection (GIMP_ITEM (layer),
+ GIMP_CHANNEL_OP_REPLACE,
+ TRUE, FALSE, 0.0, 0.0);
+ else
+ success = FALSE;
}
CODE
);
@@ -461,18 +462,12 @@ HELP
%invoke = (
code => <<'CODE'
{
- GimpImage *image;
- gint off_x, off_y;
-
- image = gimp_item_get_image (GIMP_ITEM (channel));
- gimp_item_get_offset (GIMP_ITEM (channel), &off_x, &off_y);
-
- gimp_channel_select_channel (gimp_image_get_mask (image),
- _("Channel to Selection"),
- channel,
- off_x, off_y,
- GIMP_CHANNEL_OP_REPLACE,
- FALSE, 0.0, 0.0);
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, FALSE, error))
+ gimp_item_to_selection (GIMP_ITEM (channel),
+ GIMP_CHANNEL_OP_REPLACE,
+ TRUE, FALSE, 0.0, 0.0);
+ else
+ success = FALSE;
}
CODE
);
@@ -497,18 +492,12 @@ HELP
%invoke = (
code => <<'CODE'
{
- GimpImage *image;
- gint off_x, off_y;
-
- image = gimp_item_get_image (GIMP_ITEM (channel));
- gimp_item_get_offset (GIMP_ITEM (channel), &off_x, &off_y);
-
- gimp_channel_select_channel (gimp_image_get_mask (image),
- _("Channel to Selection"),
- channel,
- off_x, off_y,
- operation,
- FALSE, 0.0, 0.0);
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, FALSE, error))
+ gimp_item_to_selection (GIMP_ITEM (channel),
+ operation,
+ TRUE, FALSE, 0.0, 0.0);
+ else
+ success = FALSE;
}
CODE
);
@@ -549,8 +538,7 @@ CODE
}
- headers = qw("core/gimpchannel-select.h"
- "core/gimppickable.h"
+ headers = qw("core/gimppickable.h"
"gimppdb-utils.h"
"gimp-intl.h");
diff --git a/tools/pdbgen/pdb/vectors.pdb b/tools/pdbgen/pdb/vectors.pdb
index a9aff65..16b16d2 100644
--- a/tools/pdbgen/pdb/vectors.pdb
+++ b/tools/pdbgen/pdb/vectors.pdb
@@ -1282,18 +1282,13 @@ HELP
%invoke = (
code => <<'CODE'
{
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (vectors));
-
- if (image)
- gimp_channel_select_vectors (gimp_image_get_mask (image),
- _("Path to Selection"),
- vectors,
- operation,
- antialias,
- feather,
- feather_radius_x,
- feather_radius_y,
- TRUE);
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), NULL, FALSE, error))
+ gimp_item_to_selection (GIMP_ITEM (vectors),
+ operation,
+ antialias,
+ feather,
+ feather_radius_x,
+ feather_radius_y);
else
success = FALSE;
}
@@ -1502,7 +1497,6 @@ CODE
"core/gimplist.h"
"core/gimpimage.h"
"core/gimpimage-undo-push.h"
- "core/gimpchannel-select.h"
"text/gimptext-vectors.h"
"text/gimptextlayer.h"
"vectors/gimpanchor.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]