[gimp] plug-ins, pdb: remove the deinterlace plug-in and add a PDB compat proc



commit 40030e084b073e025764376fa465b0856bf0f8c8
Author: Michael Natterer <mitch gimp org>
Date:   Tue May 20 21:30:42 2014 +0200

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

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |   88 ++++++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   18 --
 plug-ins/common/deinterlace.c       |  378 -----------------------------------
 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 |   55 +++++
 9 files changed, 144 insertions(+), 402 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index ae47b35..0c24e1e 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 729 procedures registered total */
+/* 730 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 ec26e65..a14ded9 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -703,6 +703,52 @@ plug_in_cubism_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_deinterlace_invoker (GimpProcedure         *procedure,
+                             Gimp                  *gimp,
+                             GimpContext           *context,
+                             GimpProgress          *progress,
+                             const GimpValueArray  *args,
+                             GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 evenodd;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  evenodd = g_value_get_int (gimp_value_array_index (args, 3));
+
+  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;
+
+          node = gegl_node_new_child (NULL,
+                                      "operation",   "gegl:deinterlace",
+                                      "keep",        evenodd ? 0 : 1,
+                                      "orientation", 0, /* HORIZONTAL */
+                                      "size",        1,
+                                      NULL);
+
+          node = wrap_in_gamma_cast (node, drawable);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Deinterlace"),
+                                         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,
@@ -2800,6 +2846,48 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-deinterlace
+   */
+  procedure = gimp_procedure_new (plug_in_deinterlace_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-deinterlace");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-deinterlace",
+                                     "Fix images where every other row is missing",
+                                     "Deinterlace is useful for processing images from video capture cards. 
When only the odd or even fields get captured, deinterlace can be used to interpolate between the existing 
fields to correct this.",
+                                     "Compatibility procedure. Please see 'gegl:deinterlace' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:deinterlace' 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_int32 ("evenodd",
+                                                      "evenodd",
+                                                      "Which lines to keep { KEEP-ODD (0), KEEP-EVEN (1)",
+                                                      0, 1, 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 1f2aad2..29069b9 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -48,8 +48,6 @@
 /curve-bend.exe
 /decompose
 /decompose.exe
-/deinterlace
-/deinterlace.exe
 /depth-merge
 /depth-merge.exe
 /despeckle
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index d9363be..4e156b5 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -67,7 +67,6 @@ libexec_PROGRAMS = \
        crop-zealous \
        curve-bend \
        decompose \
-       deinterlace \
        depth-merge \
        despeckle \
        destripe \
@@ -581,23 +580,6 @@ decompose_LDADD = \
        $(INTLLIBS)             \
        $(decompose_RC)
 
-deinterlace_SOURCES = \
-       deinterlace.c
-
-deinterlace_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(deinterlace_RC)
-
 depth_merge_SOURCES = \
        depth-merge.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 801047d..203d999 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -21,7 +21,6 @@ convolution_matrix_RC = convolution-matrix.rc.o
 crop_zealous_RC = crop-zealous.rc.o
 curve_bend_RC = curve-bend.rc.o
 decompose_RC = decompose.rc.o
-deinterlace_RC = deinterlace.rc.o
 depth_merge_RC = depth-merge.rc.o
 despeckle_RC = despeckle.rc.o
 destripe_RC = destripe.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index c55ecda..8f10de7 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -22,7 +22,6 @@
     'crop-zealous' => {},
     'curve-bend' => { ui => 1 },
     'decompose' => { ui => 1, gegl => 1 },
-    'deinterlace' => { ui => 1 },
     'depth-merge' => { ui => 1 },
     'despeckle' => { ui => 1 },
     'destripe' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index e61f5a1..6d1cb04 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -29,7 +29,6 @@ plug-ins/common/convolution-matrix.c
 plug-ins/common/crop-zealous.c
 plug-ins/common/curve-bend.c
 plug-ins/common/decompose.c
-plug-ins/common/deinterlace.c
 plug-ins/common/depth-merge.c
 plug-ins/common/despeckle.c
 plug-ins/common/destripe.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 11aae37..bface97 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -651,6 +651,60 @@ CODE
     );
 }
 
+sub plug_in_deinterlace {
+    $blurb = 'Fix images where every other row is missing';
+
+    $help = <<'HELP';
+Deinterlace is useful for processing images from video capture
+cards. When only the odd or even fields get captured, deinterlace can
+be used to interpolate between the existing fields to correct this.
+HELP
+
+    &std_pdb_compat('gegl:deinterlace');
+    $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 => 'evenodd', type => '0 <= int32 <= 1',
+         desc => 'Which lines to keep { KEEP-ODD (0), KEEP-EVEN (1)' }
+    );
+
+    %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;
+
+      node = gegl_node_new_child (NULL,
+                                  "operation",   "gegl:deinterlace",
+                                  "keep",        evenodd ? 0 : 1,
+                                  "orientation", 0, /* HORIZONTAL */
+                                  "size",        1,
+                                  NULL);
+
+      node = wrap_in_gamma_cast (node, drawable);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Deinterlace"),
+                                     node);
+
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_gauss {
     $blurb = 'Simplest, most commonly used way of blurring';
 
@@ -2522,6 +2576,7 @@ CODE
             plug_in_colors_channel_mixer
             plug_in_colortoalpha
             plug_in_cubism
+            plug_in_deinterlace
             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]