Commit e747cbad authored by Michael Natterer's avatar Michael Natterer 😴

plug-ins, pdb: remove the unsharp-mask plug-in and add a PDB compat proc

(cherry picked from commit 680642e3)
parent 9e71fc09
......@@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 840 procedures registered total */
/* 841 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
......
......@@ -3981,6 +3981,52 @@ plug_in_threshold_alpha_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GimpValueArray *
plug_in_unsharp_mask_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gdouble radius;
gdouble amount;
gint32 threshold;
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
radius = g_value_get_double (gimp_value_array_index (args, 3));
amount = g_value_get_double (gimp_value_array_index (args, 4));
threshold = g_value_get_int (gimp_value_array_index (args, 5));
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:unsharp-mask",
"std-dev", radius,
"scale", amount,
"threshold", threshold / 255.0,
NULL);
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Sharpen (Unsharp Mask)"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
plug_in_video_invoker (GimpProcedure *procedure,
Gimp *gimp,
......@@ -8276,6 +8322,60 @@ register_plug_in_compat_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-plug-in-unsharp-mask
*/
procedure = gimp_procedure_new (plug_in_unsharp_mask_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"plug-in-unsharp-mask");
gimp_procedure_set_static_strings (procedure,
"plug-in-unsharp-mask",
"The most widely useful method for sharpening an image",
"The unsharp mask is a sharpening filter that works by comparing using the difference of the image and a blurred version of the image. It is commonly used on photographic images, and is provides a much more pleasing result than the standard sharpen filter.",
"Compatibility procedure. Please see 'gegl:unsharp-mask' for credits.",
"Compatibility procedure. Please see 'gegl:unsharp-mask' for credits.",
"2018",
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 ("radius",
"radius",
"Radius of gaussian blur",
0.0, 300.0, 0.0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("amount",
"amount",
"Strength of effect",
0.0, 300.0, 0.0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("threshold",
"threshold",
"Threshold",
0, 255, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-plug-in-video
*/
......
......@@ -4120,6 +4120,61 @@ CODE
);
}
sub plug_in_unsharp_mask {
$blurb = "The most widely useful method for sharpening an image";
$help = <<'HELP';
The unsharp mask is a sharpening filter that works by comparing using
the difference of the image and a blurred version of the image. It is
commonly used on photographic images, and is provides a much more
pleasing result than the standard sharpen filter.
HELP
&std_pdb_compat('gegl:unsharp-mask');
$date = '2018';
@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 => 'radius', type => '0.0 <= float <= 300.0',
desc => 'Radius of gaussian blur' },
{ name => 'amount', type => '0.0 <= float <= 300.0',
desc => 'Strength of effect' },
{ name => 'threshold', type => '0 <= int32 <= 255',
desc => '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))
{
GeglNode *node =
gegl_node_new_child (NULL,
"operation", "gegl:unsharp-mask",
"std-dev", radius,
"scale", amount,
"threshold", threshold / 255.0,
NULL);
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Sharpen (Unsharp Mask)"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
CODE
);
}
sub plug_in_video {
$blurb = 'Simulate distortion produced by a fuzzy or low-res monitor';
......@@ -5028,6 +5083,7 @@ CODE
plug_in_solid_noise
plug_in_spread
plug_in_threshold_alpha
plug_in_unsharp_mask
plug_in_video
plug_in_vinvert
plug_in_vpropagate
......
......@@ -178,8 +178,6 @@
/tile-small.exe
/unit-editor
/unit-editor.exe
/unsharp-mask
/unsharp-mask.exe
/van-gogh-lic
/van-gogh-lic.exe
/warp
......
......@@ -137,7 +137,6 @@ libexec_PROGRAMS = \
tile \
tile-small \
unit-editor \
unsharp-mask \
van-gogh-lic \
warp \
wavelet-decompose \
......@@ -1722,23 +1721,6 @@ unit_editor_LDADD = \
$(INTLLIBS) \
$(unit_editor_RC)
unsharp_mask_SOURCES = \
unsharp-mask.c
unsharp_mask_LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpmodule) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(unsharp_mask_RC)
van_gogh_lic_SOURCES = \
van-gogh-lic.c
......
......@@ -86,7 +86,6 @@ sphere_designer_RC = sphere-designer.rc.o
tile_RC = tile.rc.o
tile_small_RC = tile-small.rc.o
unit_editor_RC = unit-editor.rc.o
unsharp_mask_RC = unsharp-mask.rc.o
van_gogh_lic_RC = van-gogh-lic.rc.o
warp_RC = warp.rc.o
wavelet_decompose_RC = wavelet-decompose.rc.o
......
......@@ -87,7 +87,6 @@
'tile' => { ui => 1, gegl => 1 },
'tile-small' => { ui => 1 },
'unit-editor' => { ui => 1 },
'unsharp-mask' => { ui => 1 },
'van-gogh-lic' => { ui => 1 },
'warp' => { ui => 1 },
'wavelet-decompose' => { ui => 1, gegl => 1 },
......
This diff is collapsed.
......@@ -91,7 +91,6 @@ plug-ins/common/sphere-designer.c
plug-ins/common/tile.c
plug-ins/common/tile-small.c
plug-ins/common/unit-editor.c
plug-ins/common/unsharp-mask.c
plug-ins/common/van-gogh-lic.c
plug-ins/common/warp.c
plug-ins/common/wavelet-decompose.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment