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



commit e78540e581018f244afb9dd8719773c8dadf6de9
Author: Michael Natterer <mitch gimp org>
Date:   Sun Nov 16 22:08:51 2014 +0100

    plug-ins, pdb: remove the video plug-in and add a PDB compat procedure

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |  100 ++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   18 -
 plug-ins/common/gimprc.common       |    1 -
 plug-ins/common/plugin-defs.pl      |    1 -
 plug-ins/common/video.c             | 2137 -----------------------------------
 po-plug-ins/POTFILES.in             |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb |   54 +
 9 files changed, 155 insertions(+), 2161 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 97498a4..bf6325c 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 737 procedures registered total */
+/* 738 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 9da8232..1c4888a 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -2479,6 +2479,52 @@ plug_in_threshold_alpha_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_video_invoker (GimpProcedure         *procedure,
+                       Gimp                  *gimp,
+                       GimpContext           *context,
+                       GimpProgress          *progress,
+                       const GimpValueArray  *args,
+                       GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 pattern_number;
+  gboolean additive;
+  gboolean rotated;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  pattern_number = g_value_get_int (gimp_value_array_index (args, 3));
+  additive = g_value_get_boolean (gimp_value_array_index (args, 4));
+  rotated = g_value_get_boolean (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:video-degradation",
+                                 "pattern",   pattern_number,
+                                 "additive",  additive,
+                                 "rotated",   rotated,
+                                 NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Video"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 plug_in_vinvert_invoker (GimpProcedure         *procedure,
                          Gimp                  *gimp,
                          GimpContext           *context,
@@ -5013,6 +5059,60 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-video
+   */
+  procedure = gimp_procedure_new (plug_in_video_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-video");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-video",
+                                     "Simulate distortion produced by a fuzzy or low-res monitor",
+                                     "This function simulates the degradation of being on an old 
low-dotpitch RGB video monitor to the specified drawable.",
+                                     "Compatibility procedure. Please see 'gegl:video-degradation' for 
credits.",
+                                     "Compatibility procedure. Please see 'gegl:video-degradation' 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 ("pattern-number",
+                                                      "pattern number",
+                                                      "Type of RGB pattern to use",
+                                                      0, 8, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("additive",
+                                                     "additive",
+                                                     "Whether the function adds the result to the original 
image",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("rotated",
+                                                     "rotated",
+                                                     "Whether to rotate the RGB pattern by ninety degrees",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-plug-in-vinvert
    */
   procedure = gimp_procedure_new (plug_in_vinvert_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index a95bb81..14f9187 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -216,8 +216,6 @@
 /value-propagate.exe
 /van-gogh-lic
 /van-gogh-lic.exe
-/video
-/video.exe
 /warp
 /warp.exe
 /web-browser
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 51b8a7a..d5b6242 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -151,7 +151,6 @@ libexec_PROGRAMS = \
        unsharp-mask \
        value-propagate \
        van-gogh-lic \
-       video \
        warp \
        web-browser \
        $(WEB_PAGE) \
@@ -2067,23 +2066,6 @@ van_gogh_lic_LDADD = \
        $(INTLLIBS)             \
        $(van_gogh_lic_RC)
 
-video_SOURCES = \
-       video.c
-
-video_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(video_RC)
-
 warp_SOURCES = \
        warp.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 3962c96..2f956fb 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -105,7 +105,6 @@ unit_editor_RC = unit-editor.rc.o
 unsharp_mask_RC = unsharp-mask.rc.o
 value_propagate_RC = value-propagate.rc.o
 van_gogh_lic_RC = van-gogh-lic.rc.o
-video_RC = video.rc.o
 warp_RC = warp.rc.o
 web_browser_RC = web-browser.rc.o
 web_page_RC = web-page.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 05857aa..2caeb92 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -106,7 +106,6 @@
     'unsharp-mask' => { ui => 1 },
     'value-propagate' => { ui => 1 },
     'van-gogh-lic' => { ui => 1 },
-    'video' => { ui => 1 },
     'warp' => { ui => 1 },
     'web-browser' => { ui => 1 },
     'web-page' => { ui => 1, optional => 1, libs => 'WEBKIT_LIBS', cflags => 'WEBKIT_CFLAGS' },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index e16a168..de91c2e 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -110,7 +110,6 @@ plug-ins/common/unit-editor.c
 plug-ins/common/unsharp-mask.c
 plug-ins/common/value-propagate.c
 plug-ins/common/van-gogh-lic.c
-plug-ins/common/video.c
 plug-ins/common/warp.c
 plug-ins/common/web-browser.c
 plug-ins/common/web-page.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 910cfb1..8fb7d48 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -2620,6 +2620,59 @@ CODE
     );
 }
 
+sub plug_in_video {
+    $blurb = 'Simulate distortion produced by a fuzzy or low-res monitor';
+
+    $help = <<'HELP';
+This function simulates the degradation of being on an old
+low-dotpitch RGB video monitor to the specified drawable.
+HELP
+
+    &std_pdb_compat('gegl:video-degradation');
+    $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 => 'pattern_number', type => '0 <= int32 <= 8',
+         desc => 'Type of RGB pattern to use' },
+       { name => 'additive', type => 'boolean',
+         desc => 'Whether the function adds the result to the original image' },
+       { name => 'rotated', type => 'boolean',
+         desc => 'Whether to rotate the RGB pattern by ninety degrees' }
+    );
+
+    %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:video-degradation",
+                             "pattern",   pattern_number,
+                             "additive",  additive,
+                             "rotated",   rotated,
+                             NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Video"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_vinvert {
     $blurb = 'Invert the brightness of each pixel';
 
@@ -3002,6 +3055,7 @@ CODE
             plug_in_sobel
             plug_in_spread
             plug_in_threshold_alpha
+            plug_in_video
             plug_in_vinvert
             plug_in_waves
             plug_in_whirl_pinch);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]