[gimp] remove the ripple plugin, provide compat PDB-API



commit e6de783b3c7153de5febb2042d5cbd27ab0edf2d
Author: Simon Budig <simon budig de>
Date:   Tue Apr 24 13:02:07 2018 +0200

    remove the ripple plugin, provide compat PDB-API

 app/pdb/plug-in-compat-cmds.c  |  152 +++++++++
 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/ripple.c       |  736 ----------------------------------------
 6 files changed, 152 insertions(+), 758 deletions(-)
---
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index 7cc87e2..a766da8 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -3359,6 +3359,79 @@ plug_in_rgb_noise_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_ripple_invoker (GimpProcedure         *procedure,
+                        Gimp                  *gimp,
+                        GimpContext           *context,
+                        GimpProgress          *progress,
+                        const GimpValueArray  *args,
+                        GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gdouble period;
+  gdouble amplitude;
+  gint32 orientation;
+  gint32 edges;
+  gint32 waveform;
+  gboolean antialias;
+  gboolean tile;
+
+  /* first arg is "image", which is unused. */
+  drawable    = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  period      = g_value_get_int (gimp_value_array_index (args, 3));
+  amplitude   = g_value_get_int (gimp_value_array_index (args, 4));
+  orientation = g_value_get_int (gimp_value_array_index (args, 5));
+  edges       = g_value_get_int (gimp_value_array_index (args, 6));
+  waveform    = g_value_get_int (gimp_value_array_index (args, 7));
+  antialias   = g_value_get_boolean (gimp_value_array_index (args, 8));
+  tile        = g_value_get_boolean (gimp_value_array_index (args, 9));
+
+  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;
+          gdouble angle, phi;
+
+          angle = orientation ? 0.0 : 90.0;
+          phi = waveform ? 0.0 : 0.75;
+          if (orientation == 0 && waveform == 1)
+            phi = 0.5;
+
+          node = gegl_node_new_child (NULL,
+                                      "operation",    "gegl:ripple",
+                                      "amplitude",    amplitude,
+                                      "period",       period,
+                                      "phi",          phi,
+                                      "angle",        angle,
+                                      "sampler_type", antialias ? GEGL_SAMPLER_CUBIC : GEGL_SAMPLER_NEAREST,
+                                      "wave_type",    waveform ? 0 : 1,
+                                      "abyss_policy", edges == 0 ? GEGL_ABYSS_CLAMP :
+                                                      edges == 1 ? GEGL_ABYSS_LOOP :
+                                                      GEGL_ABYSS_NONE,
+                                      "tileable",     tile ? TRUE : FALSE,
+                                      NULL);
+
+          node = wrap_in_gamma_cast (node, drawable);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Ripple"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        {
+          success = FALSE;
+        }
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 plug_in_rotate_invoker (GimpProcedure         *procedure,
                         Gimp                  *gimp,
                         GimpContext           *context,
@@ -7549,6 +7622,85 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-ripple
+   */
+  procedure = gimp_procedure_new (plug_in_ripple_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-ripple");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-ripple",
+                                     "Displace pixels in a ripple pattern",
+                                     "Ripples the pixels of the specified drawable. Each row or column will 
be displaced a certain number of pixels coinciding with the given wave form.",
+                                     "Brian Degenhardt <bdegenha ucsd edu>",
+                                     "Brian Degenhardt",
+                                     "1997",
+                                     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 ("period",
+                                                      "period",
+                                                      "Period: number of pixels for one wave to complete",
+                                                      0, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("amplitude",
+                                                      "amplitude",
+                                                      "Amplitude: maximum displacement of wave",
+                                                      0, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("orientation",
+                                                      "orientatioon",
+                                                      "Orientation { ORIENTATION-HORIZONTAL (0), 
ORIENTATION-VERTICAL (1) }",
+                                                      0, 1, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("edges",
+                                                      "edges",
+                                                      "Edges { SMEAR (0), WRAP (1), BLANK (2) }",
+                                                      0, 2, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("waveform",
+                                                      "waveform",
+                                                      "Waveform { SAWTOOTH (0), SINE (1) }",
+                                                      0, 1, 1,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("antialias",
+                                                     "antialias",
+                                                     "Antialias { TRUE, FALSE }",
+                                                     TRUE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("tile",
+                                                     "tile",
+                                                     "Tileable { TRUE, FALSE }",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+
+  /*
    * gimp-plug-in-rotate
    */
   procedure = gimp_procedure_new (plug_in_rotate_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index c36ed9f..a5e50cf 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -156,8 +156,6 @@
 /procedure-browser.exe
 /qbist
 /qbist.exe
-/ripple
-/ripple.exe
 /sample-colorize
 /sample-colorize.exe
 /sharpen
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 0b3619b..ef81323 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -126,7 +126,6 @@ libexec_PROGRAMS = \
        plugin-browser \
        procedure-browser \
        qbist \
-       ripple \
        sample-colorize \
        sharpen \
        smooth-palette \
@@ -1526,23 +1525,6 @@ qbist_LDADD = \
        $(INTLLIBS)             \
        $(qbist_RC)
 
-ripple_SOURCES = \
-       ripple.c
-
-ripple_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(ripple_RC)
-
 sample_colorize_SOURCES = \
        sample-colorize.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 6a66bc8..3cddb15 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -75,7 +75,6 @@ photocopy_RC = photocopy.rc.o
 plugin_browser_RC = plugin-browser.rc.o
 procedure_browser_RC = procedure-browser.rc.o
 qbist_RC = qbist.rc.o
-ripple_RC = ripple.rc.o
 sample_colorize_RC = sample-colorize.rc.o
 sharpen_RC = sharpen.rc.o
 smooth_palette_RC = smooth-palette.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 2235cea..11a1885 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -76,7 +76,6 @@
     'plugin-browser' => { ui => 1 },
     'procedure-browser' => { ui => 1 },
     'qbist' => { ui => 1, gegl => 1 },
-    'ripple' => { ui => 1 },
     'sample-colorize' => { ui => 1 },
     'sharpen' => { ui => 1 },
     'smooth-palette' => { ui => 1, gegl => 1 },


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