plugins: Add compat wrappers for channel-mixer

And remove the old plugin
This commit is contained in:
Téo Mazars 2013-08-06 21:40:35 +02:00
parent e72cf05ccb
commit 145c9a86d5
9 changed files with 240 additions and 1234 deletions

View File

@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 695 procedures registered total */
/* 696 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)

View File

@ -257,6 +257,74 @@ plug_in_autocrop_layer_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
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,
@ -1437,6 +1505,102 @@ register_plug_in_compat_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
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
*/

View File

@ -24,8 +24,6 @@
/bump-map.exe
/cartoon
/cartoon.exe
/channel-mixer
/channel-mixer.exe
/checkerboard
/checkerboard.exe
/cml-explorer

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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 },

View File

@ -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

View File

@ -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