[gimp/goat-invasion: 284/608] pdb: add new group plug-in-compat for compat procedures of removed plug-ins
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 284/608] pdb: add new group plug-in-compat for compat procedures of removed plug-ins
- Date: Fri, 27 Apr 2012 20:49:16 +0000 (UTC)
commit 880ca5fbca69463d5ce09e40d9a1ee600f66d332
Author: Michael Natterer <mitch gimp org>
Date: Tue Mar 27 21:06:13 2012 +0200
pdb: add new group plug-in-compat for compat procedures of removed plug-ins
For now contains a pixelize implementation, but it's still called
gimp-plug-in-pixelize, not plug-in-pixelize.
app/pdb/Makefile.am | 1 +
app/pdb/internal-procs.c | 3 +-
app/pdb/internal-procs.h | 1 +
app/pdb/plug-in-compat-cmds.c | 127 +++++++++++++++++++++++++++++++++++
tools/pdbgen/Makefile.am | 1 +
tools/pdbgen/groups.pl | 1 +
tools/pdbgen/pdb/plug_in_compat.pdb | 83 +++++++++++++++++++++++
7 files changed, 216 insertions(+), 1 deletions(-)
---
diff --git a/app/pdb/Makefile.am b/app/pdb/Makefile.am
index dd5551a..74e6351 100644
--- a/app/pdb/Makefile.am
+++ b/app/pdb/Makefile.am
@@ -76,6 +76,7 @@ libappinternal_procs_a_SOURCES = \
pattern-select-cmds.c \
patterns-cmds.c \
plug-in-cmds.c \
+ plug-in-compat-cmds.c \
procedural-db-cmds.c \
progress-cmds.c \
selection-cmds.c \
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 0d0e9ed..d81e0aa 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 663 procedures registered total */
+/* 664 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
@@ -75,6 +75,7 @@ internal_procs_init (GimpPDB *pdb)
register_pattern_select_procs (pdb);
register_patterns_procs (pdb);
register_plug_in_procs (pdb);
+ register_plug_in_compat_procs (pdb);
register_procedural_db_procs (pdb);
register_progress_procs (pdb);
register_selection_procs (pdb);
diff --git a/app/pdb/internal-procs.h b/app/pdb/internal-procs.h
index f569a8b..0c82c9b 100644
--- a/app/pdb/internal-procs.h
+++ b/app/pdb/internal-procs.h
@@ -64,6 +64,7 @@ void register_pattern_procs (GimpPDB *pdb);
void register_pattern_select_procs (GimpPDB *pdb);
void register_patterns_procs (GimpPDB *pdb);
void register_plug_in_procs (GimpPDB *pdb);
+void register_plug_in_compat_procs (GimpPDB *pdb);
void register_procedural_db_procs (GimpPDB *pdb);
void register_progress_procs (GimpPDB *pdb);
void register_selection_procs (GimpPDB *pdb);
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
new file mode 100644
index 0000000..9a05016
--- /dev/null
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -0,0 +1,127 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpdrawable-operation.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GValueArray *
+plug_in_pixelize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 pixel_width;
+
+ drawable = gimp_value_get_drawable (&args->values[2], gimp);
+ pixel_width = g_value_get_int (&args->values[3]);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:pixelise",
+ "size-x", pixel_width,
+ "size-y", pixel_width,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Pixelize"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_plug_in_compat_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-plug-in-pixelize
+ */
+ procedure = gimp_procedure_new (plug_in_pixelize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plug-in-pixelize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-plug-in-pixelize",
+ "Simplify image into an array of solid-colored squares",
+ "Pixelize the contents of the specified drawable with specified pixelizing width.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ 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 ("pixel-width",
+ "pixel width",
+ "Pixel width (the decrease in resolution)",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/tools/pdbgen/Makefile.am b/tools/pdbgen/Makefile.am
index 7f44165..7dca761 100644
--- a/tools/pdbgen/Makefile.am
+++ b/tools/pdbgen/Makefile.am
@@ -42,6 +42,7 @@ pdb_sources = \
pdb/pattern_select.pdb \
pdb/patterns.pdb \
pdb/plug_in.pdb \
+ pdb/plug_in_compat.pdb \
pdb/procedural_db.pdb \
pdb/progress.pdb \
pdb/selection.pdb \
diff --git a/tools/pdbgen/groups.pl b/tools/pdbgen/groups.pl
index 98f294b..c82e90e 100644
--- a/tools/pdbgen/groups.pl
+++ b/tools/pdbgen/groups.pl
@@ -40,6 +40,7 @@
pattern_select
patterns
plug_in
+ plug_in_compat
procedural_db
progress
selection
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
new file mode 100644
index 0000000..95ef09b
--- /dev/null
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -0,0 +1,83 @@
+# GIMP - The GNU Image Manipulation Program
+# Copyright (C) 1995 Spencer Kimball and Peter Mattis
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# "Perlized" from C source by Manish Singh <yosh gimp org>
+
+sub plug_in_pixelize {
+ $blurb = 'Simplify image into an array of solid-colored squares';
+
+ $help = <<'HELP';
+Pixelize the contents of the specified drawable with specified
+pixelizing width.
+HELP
+
+ &std_pdb_misc;
+ $date = '1997';
+
+ @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 => 'pixel_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'Pixel width (the decrease in resolution)' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:pixelise",
+ "size-x", pixel_width,
+ "size-y", pixel_width,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Pixelize"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+
+ headers = qw("libgimpbase/gimpbase.h"
+ "core/gimpdrawable.h"
+ "core/gimpdrawable-operation.h"
+ "gimppdb-utils.h"
+ "gimp-intl.h");
+
+ procs = qw(plug_in_pixelize);
+
+%exports = (app => [ procs], lib => []);
+
+$desc = 'Plug-In Compat';
+$doc_title = 'plugincolor';
+$doc_short_desc = 'Compatibility for removed plug-ins.';
+$doc_long_desc = 'Functions that perform the operation of removed plug-ins using GEGL operations.';
+
+1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]