[gimp] plug-ins, pdb: remove the unsharp-mask plug-in and add a PDB compat proc
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins, pdb: remove the unsharp-mask plug-in and add a PDB compat proc
- Date: Sat, 14 Jul 2018 15:13:09 +0000 (UTC)
commit 680642e37ce40ec841d6c87d7166b186670af0e0
Author: Michael Natterer <mitch gimp org>
Date: Sat Jul 14 17:11:25 2018 +0200
plug-ins, pdb: remove the unsharp-mask plug-in and add a PDB compat proc
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 100 +++++
pdb/groups/plug_in_compat.pdb | 56 +++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 19 -
plug-ins/common/gimprc.common | 1 -
plug-ins/common/plugin-defs.pl | 1 -
plug-ins/common/unsharp-mask.c | 957 -----------------------------------------
po-plug-ins/POTFILES.in | 1 -
9 files changed, 157 insertions(+), 982 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 8193c64dd6..756455f1cb 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 a951226d67..94458db36e 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -3634,6 +3634,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,
@@ -7680,6 +7726,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
*/
diff --git a/pdb/groups/plug_in_compat.pdb b/pdb/groups/plug_in_compat.pdb
index 3646017d58..6e17b738c5 100644
--- a/pdb/groups/plug_in_compat.pdb
+++ b/pdb/groups/plug_in_compat.pdb
@@ -3748,6 +3748,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';
@@ -4649,6 +4704,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
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index eb8b65f141..d38ef2a088 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -176,8 +176,6 @@
/tile-small.exe
/unit-editor
/unit-editor.exe
-/unsharp-mask
-/unsharp-mask.exe
/van-gogh-lic
/van-gogh-lic.exe
/warp
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index eebd5f52df..9ad8fc3e51 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -133,7 +133,6 @@ sphere_designer_libexecdir = $(gimpplugindir)/plug-ins/sphere-designer
tile_libexecdir = $(gimpplugindir)/plug-ins/tile
tile_small_libexecdir = $(gimpplugindir)/plug-ins/tile-small
unit_editor_libexecdir = $(gimpplugindir)/plug-ins/unit-editor
-unsharp_mask_libexecdir = $(gimpplugindir)/plug-ins/unsharp-mask
van_gogh_lic_libexecdir = $(gimpplugindir)/plug-ins/van-gogh-lic
warp_libexecdir = $(gimpplugindir)/plug-ins/warp
wavelet_decompose_libexecdir = $(gimpplugindir)/plug-ins/wavelet-decompose
@@ -228,7 +227,6 @@ sphere_designer_libexec_PROGRAMS = sphere-designer
tile_libexec_PROGRAMS = tile
tile_small_libexec_PROGRAMS = tile-small
unit_editor_libexec_PROGRAMS = unit-editor
-unsharp_mask_libexec_PROGRAMS = unsharp-mask
van_gogh_lic_libexec_PROGRAMS = van-gogh-lic
warp_libexec_PROGRAMS = warp
wavelet_decompose_libexec_PROGRAMS = wavelet-decompose
@@ -1797,23 +1795,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
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 96390756b4..23b742eb68 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -85,7 +85,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
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 0259726f83..12a1d2f452 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -86,7 +86,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 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index b2a704a3d2..ad0aa2ee66 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -90,7 +90,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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]