[gimp] plugins: Add compat wrappers for alien-map
- From: Téo Mazars <teom src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plugins: Add compat wrappers for alien-map
- Date: Fri, 19 Jul 2013 20:34:46 +0000 (UTC)
commit 95c235f81f0bc1a8f89bd44dae122eb7b626485b
Author: Téo Mazars <teo mazars ensimag fr>
Date: Fri Jul 19 22:28:02 2013 +0200
plugins: Add compat wrappers for alien-map
And remove the old plugin
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 164 +++++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 18 -
plug-ins/common/alien-map.c | 684 -----------------------------------
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 | 77 ++++-
9 files changed, 241 insertions(+), 709 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 96a9e83..aa19afc 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 692 procedures registered total */
+/* 693 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 c49c8bd..937be5c 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -53,6 +53,74 @@
static GimpValueArray *
+plug_in_alienmap2_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble redfrequency;
+ gdouble redangle;
+ gdouble greenfrequency;
+ gdouble greenangle;
+ gdouble bluefrequency;
+ gdouble blueangle;
+ guint8 colormodel;
+ guint8 redmode;
+ guint8 greenmode;
+ guint8 bluemode;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ redfrequency = g_value_get_double (gimp_value_array_index (args, 3));
+ redangle = g_value_get_double (gimp_value_array_index (args, 4));
+ greenfrequency = g_value_get_double (gimp_value_array_index (args, 5));
+ greenangle = g_value_get_double (gimp_value_array_index (args, 6));
+ bluefrequency = g_value_get_double (gimp_value_array_index (args, 7));
+ blueangle = g_value_get_double (gimp_value_array_index (args, 8));
+ colormodel = g_value_get_uint (gimp_value_array_index (args, 9));
+ redmode = g_value_get_uint (gimp_value_array_index (args, 10));
+ greenmode = g_value_get_uint (gimp_value_array_index (args, 11));
+ bluemode = g_value_get_uint (gimp_value_array_index (args, 12));
+
+ 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:alien-map",
+ "color_representation", (gint) colormodel,
+ "cpn-1-frequency", (gdouble) redfrequency,
+ "cpn-2-frequency", (gdouble) greenfrequency,
+ "cpn-3-frequency", (gdouble) bluefrequency,
+ "cpn-1-phaseshift", (gdouble) redangle,
+ "cpn-2-phaseshift", (gdouble) greenangle,
+ "cpn-3-phaseshift", (gdouble) blueangle,
+ "cpn-1-keep", (gboolean) !redmode,
+ "cpn-2-keep", (gboolean) !greenmode,
+ "cpn-3-keep", (gboolean) !bluemode,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Alien Map"),
+ 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,
@@ -1090,6 +1158,102 @@ register_plug_in_compat_procs (GimpPDB *pdb)
GimpProcedure *procedure;
/*
+ * gimp-plug-in-alienmap2
+ */
+ procedure = gimp_procedure_new (plug_in_alienmap2_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-alienmap2");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-alienmap2",
+ "Alter colors in various psychedelic ways",
+ "No help yet. Just try it and you'll see!",
+ "Compatibility procedure. Please see 'gegl:alien-map' for credits.",
+ "Compatibility procedure. Please see 'gegl:alien-map' for credits.",
+ "2013",
+ 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,
+ g_param_spec_double ("redfrequency",
+ "redfrequency",
+ "Red/hue component frequency factor",
+ 0, 20, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("redangle",
+ "redangle",
+ "Red/hue component angle factor (0-360)",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("greenfrequency",
+ "greenfrequency",
+ "Green/saturation component frequency factor",
+ 0, 20, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("greenangle",
+ "greenangle",
+ "Green/saturation component angle factor (0-360)",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("bluefrequency",
+ "bluefrequency",
+ "Blue/luminance component frequency factor",
+ 0, 20, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("blueangle",
+ "blueangle",
+ "Blue/luminance component angle factor (0-360)",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("colormodel",
+ "colormodel",
+ "Color model { RGB-MODEL (0), HSL-MODEL (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("redmode",
+ "redmode",
+ "Red/hue application mode { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("greenmode",
+ "greenmode",
+ "Green/saturation application mode { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("bluemode",
+ "bluemode",
+ "Blue/luminance application mode { TRUE, FALSE }",
+ 0, 1, 0,
+ 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 d6db89a..1df723f 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -2,8 +2,6 @@
/.libs
/Makefile
/Makefile.in
-/alien-map
-/alien-map.exe
/align-layers
/align-layers.exe
/animation-optimize
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 9a51f6f..e692599 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -44,7 +44,6 @@ AM_CPPFLAGS = \
-I$(includedir)
libexec_PROGRAMS = \
- alien-map \
align-layers \
animation-optimize \
animation-play \
@@ -209,23 +208,6 @@ install-%: %
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$f
|| exit 1; \
else :; fi
-alien_map_SOURCES = \
- alien-map.c
-
-alien_map_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(alien_map_RC)
-
align_layers_SOURCES = \
align-layers.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index cad8335..44433f3 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -1,4 +1,3 @@
-alien_map_RC = alien-map.rc.o
align_layers_RC = align-layers.rc.o
animation_optimize_RC = animation-optimize.rc.o
animation_play_RC = animation-play.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index e63e720..03b0fbe 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -1,5 +1,4 @@
%plugins = (
- 'alien-map' => { ui => 1 },
'align-layers' => { ui => 1 },
'animation-optimize' => {},
'animation-play' => { ui => 1, gegl => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index d25bb0c..8fabd91 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -6,7 +6,6 @@
plug-ins/color-rotate/color-rotate-dialog.c
plug-ins/color-rotate/color-rotate-stock.c
plug-ins/color-rotate/color-rotate.c
-plug-ins/common/alien-map.c
plug-ins/common/align-layers.c
plug-ins/common/animation-optimize.c
plug-ins/common/animation-play.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 7ecfd19..8f8ad10 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -16,6 +16,80 @@
# "Perlized" from C source by Manish Singh <yosh gimp org>
+sub plug_in_alienmap2 {
+ $blurb = 'Alter colors in various psychedelic ways';
+
+ $help = <<'HELP';
+No help yet. Just try it and you'll see!
+HELP
+
+ &std_pdb_compat('gegl:alien-map');
+ $date = '2013';
+
+ @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 => 'redfrequency', type => '0 <= float <= 20',
+ desc => 'Red/hue component frequency factor' },
+ { name => 'redangle', type => '0 <= float <= 360',
+ desc => 'Red/hue component angle factor (0-360)' },
+ { name => 'greenfrequency', type => '0 <= float <= 20',
+ desc => 'Green/saturation component frequency factor' },
+ { name => 'greenangle', type => '0 <= float <= 360',
+ desc => 'Green/saturation component angle factor (0-360)' },
+ { name => 'bluefrequency', type => '0 <= float <= 20',
+ desc => 'Blue/luminance component frequency factor' },
+ { name => 'blueangle', type => '0 <= float <= 360',
+ desc => 'Blue/luminance component angle factor (0-360)' },
+ { name => 'colormodel', type => '0 <= int8 <= 1',
+ desc => 'Color model { RGB-MODEL (0), HSL-MODEL (1) }' },
+ { name => 'redmode', type => '0 <= int8 <= 1',
+ desc => 'Red/hue application mode { TRUE, FALSE }' },
+ { name => 'greenmode', type => '0 <= int8 <= 1',
+ desc => 'Green/saturation application mode { TRUE, FALSE }' },
+ { name => 'bluemode', type => '0 <= int8 <= 1',
+ desc => 'Blue/luminance application mode { TRUE, FALSE }' }
+ );
+
+ %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:alien-map",
+ "color_representation", (gint) colormodel,
+ "cpn-1-frequency", (gdouble) redfrequency,
+ "cpn-2-frequency", (gdouble) greenfrequency,
+ "cpn-3-frequency", (gdouble) bluefrequency,
+ "cpn-1-phaseshift", (gdouble) redangle,
+ "cpn-2-phaseshift", (gdouble) greenangle,
+ "cpn-3-phaseshift", (gdouble) blueangle,
+ "cpn-1-keep", (gboolean) !redmode,
+ "cpn-2-keep", (gboolean) !greenmode,
+ "cpn-3-keep", (gboolean) !bluemode,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Alien Map"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_autocrop {
$blurb = 'Remove empty borders from the image';
@@ -1209,7 +1283,8 @@ CODE
"gimppdb-utils.h"
"gimp-intl.h");
- procs = qw(plug_in_autocrop
+ procs = qw(plug_in_alienmap2
+ plug_in_autocrop
plug_in_autocrop_layer
plug_in_colortoalpha
plug_in_cubism
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]