[gimp] plug-ins, pdb: remove the color-exchange plug-in
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins, pdb: remove the color-exchange plug-in
- Date: Mon, 10 Nov 2014 21:41:57 +0000 (UTC)
commit effeefb84a1a299c8b08b4fe4e89fb3ff632c2e2
Author: Michael Natterer <mitch gimp org>
Date: Mon Nov 10 22:40:58 2014 +0100
plug-ins, pdb: remove the color-exchange plug-in
and add a PDB compat procedure.
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/color-exchange.c | 783 -----------------------------------
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 | 83 ++++
9 files changed, 248 insertions(+), 807 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index bcc4e4f..872acab 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 733 procedures registered total */
+/* 734 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 cf16508..9da8232 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -941,6 +941,80 @@ plug_in_deinterlace_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_exchange_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ guint8 from_red;
+ guint8 from_green;
+ guint8 from_blue;
+ guint8 to_red;
+ guint8 to_green;
+ guint8 to_blue;
+ guint8 red_threshold;
+ guint8 green_threshold;
+ guint8 blue_threshold;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ from_red = g_value_get_uint (gimp_value_array_index (args, 3));
+ from_green = g_value_get_uint (gimp_value_array_index (args, 4));
+ from_blue = g_value_get_uint (gimp_value_array_index (args, 5));
+ to_red = g_value_get_uint (gimp_value_array_index (args, 6));
+ to_green = g_value_get_uint (gimp_value_array_index (args, 7));
+ to_blue = g_value_get_uint (gimp_value_array_index (args, 8));
+ red_threshold = g_value_get_uint (gimp_value_array_index (args, 9));
+ green_threshold = g_value_get_uint (gimp_value_array_index (args, 10));
+ blue_threshold = g_value_get_uint (gimp_value_array_index (args, 11));
+
+ 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))
+ {
+ GimpRGB from;
+ GimpRGB to;
+ GeglColor *gegl_from;
+ GeglColor *gegl_to;
+ GeglNode *node;
+
+ gimp_rgb_set_uchar (&from, from_red, from_green, from_blue);
+ gimp_rgb_set_uchar (&to, to_red, to_green, to_blue);
+
+ gegl_from = gimp_gegl_color_new (&from);
+ gegl_to = gimp_gegl_color_new (&to);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:color-exchange",
+ "from-color", gegl_from,
+ "to-color", gegl_to,
+ "red-threshold", red_threshold / 255.0,
+ "green-threshold", green_threshold / 255.0,
+ "blue-threshold", blue_threshold / 255.0,
+ NULL);
+
+ g_object_unref (gegl_from);
+ g_object_unref (gegl_to);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Color Exchange"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_gauss_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -3259,6 +3333,96 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-exchange
+ */
+ procedure = gimp_procedure_new (plug_in_exchange_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-exchange");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-exchange",
+ "Swap one color with another",
+ "Exchange one color with another, optionally setting a threshold to
convert from one shade to another.",
+ "Compatibility procedure. Please see 'gegl:color-exchange' for
credits.",
+ "Compatibility procedure. Please see 'gegl:color-exchange' 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_int8 ("from-red",
+ "from red",
+ "Red value (from)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("from-green",
+ "from green",
+ "Green value (from)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("from-blue",
+ "from blue",
+ "Blue value (from)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("to-red",
+ "to red",
+ "Red value (to)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("to-green",
+ "to green",
+ "Green value (to)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("to-blue",
+ "to blue",
+ "Blue value (to)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("red-threshold",
+ "red threshold",
+ "Red threshold",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("green-threshold",
+ "green threshold",
+ "Green threshold",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("blue-threshold",
+ "blue threshold",
+ "Blue threshold",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-gauss
*/
procedure = gimp_procedure_new (plug_in_gauss_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 70bc36f..a95bb81 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -28,8 +28,6 @@
/color-cube-analyze.exe
/color-enhance
/color-enhance.exe
-/color-exchange
-/color-exchange.exe
/colorify
/colorify.exe
/colormap-remap
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 9d6a5eb..51b8a7a 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -57,7 +57,6 @@ libexec_PROGRAMS = \
cml-explorer \
color-cube-analyze \
color-enhance \
- color-exchange \
colorify \
colormap-remap \
compose \
@@ -408,23 +407,6 @@ color_enhance_LDADD = \
$(INTLLIBS) \
$(color_enhance_RC)
-color_exchange_SOURCES = \
- color-exchange.c
-
-color_exchange_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(color_exchange_RC)
-
colorify_SOURCES = \
colorify.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index e41ed6e..3962c96 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -11,7 +11,6 @@ checkerboard_RC = checkerboard.rc.o
cml_explorer_RC = cml-explorer.rc.o
color_cube_analyze_RC = color-cube-analyze.rc.o
color_enhance_RC = color-enhance.rc.o
-color_exchange_RC = color-exchange.rc.o
colorify_RC = colorify.rc.o
colormap_remap_RC = colormap-remap.rc.o
compose_RC = compose.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 610e024..05857aa 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -12,7 +12,6 @@
'cml-explorer' => { ui => 1 },
'color-cube-analyze' => { ui => 1 },
'color-enhance' => { ui => 1 },
- 'color-exchange' => { ui => 1 },
'colorify' => { ui => 1 },
'colormap-remap' => { ui => 1, gegl => 1 },
'compose' => { ui => 1, gegl => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index c72e97c..e16a168 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -16,7 +16,6 @@ plug-ins/common/checkerboard.c
plug-ins/common/cml-explorer.c
plug-ins/common/color-cube-analyze.c
plug-ins/common/color-enhance.c
-plug-ins/common/color-exchange.c
plug-ins/common/colorify.c
plug-ins/common/colormap-remap.c
plug-ins/common/compose.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 01064fc..910cfb1 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -844,6 +844,88 @@ CODE
);
}
+sub plug_in_exchange {
+ $blurb = 'Swap one color with another';
+
+ $help = <<'HELP';
+Exchange one color with another, optionally setting a threshold to
+convert from one shade to another.
+HELP
+
+ &std_pdb_compat('gegl:color-exchange');
+ $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 => 'from_red', type => 'int8',
+ desc => 'Red value (from)' },
+ { name => 'from_green', type => 'int8',
+ desc => 'Green value (from)' },
+ { name => 'from_blue', type => 'int8',
+ desc => 'Blue value (from)' },
+ { name => 'to_red', type => 'int8',
+ desc => 'Red value (to)' },
+ { name => 'to_green', type => 'int8',
+ desc => 'Green value (to)' },
+ { name => 'to_blue', type => 'int8',
+ desc => 'Blue value (to)' },
+ { name => 'red_threshold', type => 'int8',
+ desc => 'Red threshold' },
+ { name => 'green_threshold', type => 'int8',
+ desc => 'Green threshold' },
+ { name => 'blue_threshold', type => 'int8',
+ desc => 'Blue threshold' }
+ );
+
+ %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))
+ {
+ GimpRGB from;
+ GimpRGB to;
+ GeglColor *gegl_from;
+ GeglColor *gegl_to;
+ GeglNode *node;
+
+ gimp_rgb_set_uchar (&from, from_red, from_green, from_blue);
+ gimp_rgb_set_uchar (&to, to_red, to_green, to_blue);
+
+ gegl_from = gimp_gegl_color_new (&from);
+ gegl_to = gimp_gegl_color_new (&to);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:color-exchange",
+ "from-color", gegl_from,
+ "to-color", gegl_to,
+ "red-threshold", red_threshold / 255.0,
+ "green-threshold", green_threshold / 255.0,
+ "blue-threshold", blue_threshold / 255.0,
+ NULL);
+
+ g_object_unref (gegl_from);
+ g_object_unref (gegl_to);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Color Exchange"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_gauss {
$blurb = 'Simplest, most commonly used way of blurring';
@@ -2890,6 +2972,7 @@ CODE
plug_in_convmatrix
plug_in_cubism
plug_in_deinterlace
+ plug_in_exchange
plug_in_gauss
plug_in_gauss_iir
plug_in_gauss_iir2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]