[gimp] plugins: Add compat wrappers for channel-mixer
- From: Téo Mazars <teom src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plugins: Add compat wrappers for channel-mixer
- Date: Tue, 6 Aug 2013 19:46:18 +0000 (UTC)
commit 145c9a86d5c07f0e47320d3b6bdd31debd7aae51
Author: Téo Mazars <teo mazars ensimag fr>
Date: Tue Aug 6 21:40:35 2013 +0200
plugins: Add compat wrappers for channel-mixer
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/channel-mixer.c | 1210 -----------------------------------
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 | 75 +++
9 files changed, 240 insertions(+), 1234 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 89b55c4..90abfc5 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 695 procedures registered total */
+/* 696 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 ee8cbb6..0d7e718 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -258,6 +258,74 @@ plug_in_autocrop_layer_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_colors_channel_mixer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 monochrome;
+ gdouble rr_gain;
+ gdouble rg_gain;
+ gdouble rb_gain;
+ gdouble gr_gain;
+ gdouble gg_gain;
+ gdouble gb_gain;
+ gdouble br_gain;
+ gdouble bg_gain;
+ gdouble bb_gain;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ monochrome = g_value_get_int (gimp_value_array_index (args, 3));
+ rr_gain = g_value_get_double (gimp_value_array_index (args, 4));
+ rg_gain = g_value_get_double (gimp_value_array_index (args, 5));
+ rb_gain = g_value_get_double (gimp_value_array_index (args, 6));
+ gr_gain = g_value_get_double (gimp_value_array_index (args, 7));
+ gg_gain = g_value_get_double (gimp_value_array_index (args, 8));
+ gb_gain = g_value_get_double (gimp_value_array_index (args, 9));
+ br_gain = g_value_get_double (gimp_value_array_index (args, 10));
+ bg_gain = g_value_get_double (gimp_value_array_index (args, 11));
+ bb_gain = g_value_get_double (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:channel-mixer",
+ "monochrome", (gboolean) monochrome,
+ "rr-gain", (gdouble) rr_gain,
+ "rg-gain", (gdouble) rg_gain,
+ "rb-gain", (gdouble) rb_gain,
+ "gr-gain", (gdouble) gr_gain,
+ "gg-gain", (gdouble) gg_gain,
+ "gb-gain", (gdouble) gb_gain,
+ "br-gain", (gdouble) br_gain,
+ "bg-gain", (gdouble) bg_gain,
+ "bb-gain", (gdouble) bb_gain,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Channel Mixer"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_colortoalpha_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -1438,6 +1506,102 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-colors-channel-mixer
+ */
+ procedure = gimp_procedure_new (plug_in_colors_channel_mixer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-colors-channel-mixer");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-colors-channel-mixer",
+ "Alter colors by mixing RGB Channels",
+ "This plug-in mixes the RGB channels.",
+ "Compatibility procedure. Please see 'gegl:channel-mixer' for credits.",
+ "Compatibility procedure. Please see 'gegl:channel-mixer' 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,
+ gimp_param_spec_int32 ("monochrome",
+ "monochrome",
+ "Monochrome { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rr-gain",
+ "rr gain",
+ "Set the red gain for the red channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rg-gain",
+ "rg gain",
+ "Set the green gain for the red channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rb-gain",
+ "rb gain",
+ "Set the blue gain for the red channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gr-gain",
+ "gr gain",
+ "Set the red gain for the green channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gg-gain",
+ "gg gain",
+ "Set the green gain for the green channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gb-gain",
+ "gb gain",
+ "Set the blue gain for the green channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("br-gain",
+ "br gain",
+ "Set the red gain for the blue channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("bg-gain",
+ "bg gain",
+ "Set the green gain for the blue channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("bb-gain",
+ "bb gain",
+ "Set the blue gain for the blue channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-colortoalpha
*/
procedure = gimp_procedure_new (plug_in_colortoalpha_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 91b2b80..b68df8b 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -24,8 +24,6 @@
/bump-map.exe
/cartoon
/cartoon.exe
-/channel-mixer
-/channel-mixer.exe
/checkerboard
/checkerboard.exe
/cml-explorer
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 8082228..2e38dc1 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -55,7 +55,6 @@ libexec_PROGRAMS = \
border-average \
bump-map \
cartoon \
- channel-mixer \
checkerboard \
cml-explorer \
color-cube-analyze \
@@ -393,23 +392,6 @@ cartoon_LDADD = \
$(INTLLIBS) \
$(cartoon_RC)
-channel_mixer_SOURCES = \
- channel-mixer.c
-
-channel_mixer_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(channel_mixer_RC)
-
checkerboard_SOURCES = \
checkerboard.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 6cddae6..fddb20b 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -9,7 +9,6 @@ blur_gauss_selective_RC = blur-gauss-selective.rc.o
border_average_RC = border-average.rc.o
bump_map_RC = bump-map.rc.o
cartoon_RC = cartoon.rc.o
-channel_mixer_RC = channel-mixer.rc.o
checkerboard_RC = checkerboard.rc.o
cml_explorer_RC = cml-explorer.rc.o
color_cube_analyze_RC = color-cube-analyze.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index f6673f5..1cf4f10 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -10,7 +10,6 @@
'border-average' => { ui => 1, gegl => 1 },
'bump-map' => { ui => 1 },
'cartoon' => { ui => 1 },
- 'channel-mixer' => { ui => 1 },
'checkerboard' => { ui => 1 },
'cml-explorer' => { ui => 1 },
'color-cube-analyze' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index c44f091..d2768bf 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -17,7 +17,6 @@ plug-ins/common/blur-gauss-selective.c
plug-ins/common/border-average.c
plug-ins/common/bump-map.c
plug-ins/common/cartoon.c
-plug-ins/common/channel-mixer.c
plug-ins/common/checkerboard.c
plug-ins/common/cml-explorer.c
plug-ins/common/color-cube-analyze.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 452b460..6511890 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -242,6 +242,80 @@ CODE
);
}
+sub plug_in_colors_channel_mixer {
+ $blurb = 'Alter colors by mixing RGB Channels';
+
+ $help = <<'HELP';
+This plug-in mixes the RGB channels.
+HELP
+
+ &std_pdb_compat('gegl:channel-mixer');
+ $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 => 'monochrome', type => '0 <= int32 <= 1',
+ desc => 'Monochrome { TRUE, FALSE }' },
+ { name => 'rr_gain', type => '-2 <= float <= 2',
+ desc => 'Set the red gain for the red channel' },
+ { name => 'rg_gain', type => '-2 <= float <= 2',
+ desc => 'Set the green gain for the red channel' },
+ { name => 'rb_gain', type => '-2 <= float <= 2',
+ desc => 'Set the blue gain for the red channel' },
+ { name => 'gr_gain', type => '-2 <= float <= 2',
+ desc => 'Set the red gain for the green channel' },
+ { name => 'gg_gain', type => '-2 <= float <= 2',
+ desc => 'Set the green gain for the green channel' },
+ { name => 'gb_gain', type => '-2 <= float <= 2',
+ desc => 'Set the blue gain for the green channel' },
+ { name => 'br_gain', type => '-2 <= float <= 2',
+ desc => 'Set the red gain for the blue channel' },
+ { name => 'bg_gain', type => '-2 <= float <= 2',
+ desc => 'Set the green gain for the blue channel' },
+ { name => 'bb_gain', type => '-2 <= float <= 2',
+ desc => 'Set the blue gain for the blue channel' },
+ );
+
+ %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:channel-mixer",
+ "monochrome", (gboolean) monochrome,
+ "rr-gain", (gdouble) rr_gain,
+ "rg-gain", (gdouble) rg_gain,
+ "rb-gain", (gdouble) rb_gain,
+ "gr-gain", (gdouble) gr_gain,
+ "gg-gain", (gdouble) gg_gain,
+ "gb-gain", (gdouble) gb_gain,
+ "br-gain", (gdouble) br_gain,
+ "bg-gain", (gdouble) bg_gain,
+ "bb-gain", (gdouble) bb_gain,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Channel Mixer"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_colortoalpha {
$blurb = 'Convert a specified color to transparency';
@@ -1375,6 +1449,7 @@ CODE
plug_in_antialias
plug_in_autocrop
plug_in_autocrop_layer
+ plug_in_colors_channel_mixer
plug_in_colortoalpha
plug_in_cubism
plug_in_mblur
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]