[gimp] plug-ins, pdb: remove the apply-canvas plug-in and add a compat procedure
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins, pdb: remove the apply-canvas plug-in and add a compat procedure
- Date: Wed, 1 Jan 2014 18:22:14 +0000 (UTC)
commit 2ea1c6e9a1c87ea49caeacf74d88acadbd5eb6eb
Author: Michael Natterer <mitch gimp org>
Date: Wed Jan 1 19:21:00 2014 +0100
plug-ins, pdb: remove the apply-canvas plug-in and add a compat procedure
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 92 +++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 18 -
plug-ins/common/apply-canvas.c | 1517 -----------------------------------
plug-ins/common/gimprc.common | 1 -
plug-ins/common/plugin-defs.pl | 1 -
po-plug-ins/POTFILES.in | 1 -
tools/pdbgen/pdb/plug_in_compat.pdb | 51 ++
9 files changed, 144 insertions(+), 1541 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 43aea60..292d7ed 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 705 procedures registered total */
+/* 706 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index 1833adf..3857921 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -159,6 +159,50 @@ plug_in_antialias_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_apply_canvas_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 direction;
+ gint32 depth;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ direction = g_value_get_int (gimp_value_array_index (args, 3));
+ depth = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:texturize-canvas",
+ "direction", direction,
+ "depth", depth,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Apply Canvas"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_autocrop_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -1824,6 +1868,54 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-apply-canvas
+ */
+ procedure = gimp_procedure_new (plug_in_apply_canvas_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-apply-canvas");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-apply-canvas",
+ "Add a canvas texture to the image",
+ "This function applies a canvas texture map to the drawable.",
+ "Compatibility procedure. Please see 'gegl:texturize-canvas' for
credits.",
+ "Compatibility procedure. Please see 'gegl:texturize-canvas' for
credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("direction",
+ "direction",
+ "Light direction (0 - 3)",
+ 0, 3, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("depth",
+ "depth",
+ "Texture depth (1 - 50)",
+ 1, 50, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-autocrop
*/
procedure = gimp_procedure_new (plug_in_autocrop_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 55a34b4..d82d57e 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -8,8 +8,6 @@
/animation-optimize.exe
/animation-play
/animation-play.exe
-/apply-canvas
-/apply-canvas.exe
/blinds
/blinds.exe
/blur
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 6c21e51..56acc5c 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -47,7 +47,6 @@ libexec_PROGRAMS = \
align-layers \
animation-optimize \
animation-play \
- apply-canvas \
blinds \
blur \
blur-gauss \
@@ -247,23 +246,6 @@ animation_play_LDADD = \
$(INTLLIBS) \
$(animation_play_RC)
-apply_canvas_SOURCES = \
- apply-canvas.c
-
-apply_canvas_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(apply_canvas_RC)
-
blinds_SOURCES = \
blinds.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 2ab3a75..64c3495 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -1,7 +1,6 @@
align_layers_RC = align-layers.rc.o
animation_optimize_RC = animation-optimize.rc.o
animation_play_RC = animation-play.rc.o
-apply_canvas_RC = apply-canvas.rc.o
blinds_RC = blinds.rc.o
blur_RC = blur.rc.o
blur_gauss_RC = blur-gauss.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 02bfec4..2035b43 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -2,7 +2,6 @@
'align-layers' => { ui => 1 },
'animation-optimize' => {},
'animation-play' => { ui => 1, gegl => 1 },
- 'apply-canvas' => { ui => 1 },
'blinds' => { ui => 1 },
'blur' => {},
'blur-gauss' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 9e6cf08..8d05dc8 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -9,7 +9,6 @@ plug-ins/color-rotate/color-rotate.c
plug-ins/common/align-layers.c
plug-ins/common/animation-optimize.c
plug-ins/common/animation-play.c
-plug-ins/common/apply-canvas.c
plug-ins/common/blinds.c
plug-ins/common/blur.c
plug-ins/common/blur-gauss.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 122198c..9740340 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -134,6 +134,56 @@ CODE
);
}
+sub plug_in_apply_canvas {
+ $blurb = 'Add a canvas texture to the image';
+
+ $help = <<'HELP';
+This function applies a canvas texture map to the drawable.
+HELP
+
+ &std_pdb_compat('gegl:texturize-canvas');
+ $date = '2014';
+
+ @inargs = (
+ { name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
+ desc => 'The run mode' },
+ { name => 'image', type => 'image', dead => 1,
+ desc => 'Input image (unused)' },
+ { name => 'drawable', type => 'drawable',
+ desc => 'Input drawable' },
+ { name => 'direction', type => '0 <= int32 <= 3',
+ desc => 'Light direction (0 - 3)' },
+ { name => 'depth', type => '1 <= int32 <= 50',
+ desc => 'Texture depth (1 - 50)' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:texturize-canvas",
+ "direction", direction,
+ "depth", depth,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Apply Canvas"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_autocrop {
$blurb = 'Remove empty borders from the image';
@@ -1896,6 +1946,7 @@ CODE
@procs = qw(plug_in_alienmap2
plug_in_antialias
+ plug_in_apply_canvas
plug_in_autocrop
plug_in_autocrop_layer
plug_in_autostretch_hsv
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]