[gimp] ripple: put the compat code in the proper place, fix up POTFILES.in



commit 44a931e16c4dd50acc295e50c3d7f7a35c3c2e04
Author: Simon Budig <simon budig de>
Date:   Tue Apr 24 14:26:08 2018 +0200

    ripple: put the compat code in the proper place, fix up POTFILES.in

 app/pdb/internal-procs.c      |    2 +-
 app/pdb/plug-in-compat-cmds.c |   40 ++++++++++-----------
 pdb/groups/plug_in_compat.pdb |   81 +++++++++++++++++++++++++++++++++++++++++
 po-plug-ins/POTFILES.in       |    1 -
 4 files changed, 101 insertions(+), 23 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 5763004..03f19a1 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 833 procedures registered total */
+/* 834 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 a766da8..340ede4 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -3368,23 +3368,22 @@ plug_in_ripple_invoker (GimpProcedure         *procedure,
 {
   gboolean success = TRUE;
   GimpDrawable *drawable;
-  gdouble period;
-  gdouble amplitude;
+  gint32 period;
+  gint32 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));
+  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));
+  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)
     {
@@ -3402,8 +3401,8 @@ plug_in_ripple_invoker (GimpProcedure         *procedure,
 
           node = gegl_node_new_child (NULL,
                                       "operation",    "gegl:ripple",
-                                      "amplitude",    amplitude,
-                                      "period",       period,
+                                      "amplitude",    (gdouble) amplitude,
+                                      "period",       (gdouble) period,
                                       "phi",          phi,
                                       "angle",        angle,
                                       "sampler_type", antialias ? GEGL_SAMPLER_CUBIC : GEGL_SAMPLER_NEAREST,
@@ -7631,9 +7630,9 @@ register_plug_in_compat_procs (GimpPDB *pdb)
                                      "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",
+                                     "Compatibility procedure. Please see 'gegl:ripple' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:ripple' for credits.",
+                                     "2018",
                                      NULL);
   gimp_procedure_add_argument (procedure,
                                g_param_spec_enum ("run-mode",
@@ -7658,17 +7657,17 @@ register_plug_in_compat_procs (GimpPDB *pdb)
                                gimp_param_spec_int32 ("period",
                                                       "period",
                                                       "Period: number of pixels for one wave to complete",
-                                                      0, G_MAXINT32, 0,
+                                                      G_MININT32, 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,
+                                                      G_MININT32, G_MAXINT32, 0,
                                                       GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_int32 ("orientation",
-                                                      "orientatioon",
+                                                      "orientation",
                                                       "Orientation { ORIENTATION-HORIZONTAL (0), 
ORIENTATION-VERTICAL (1) }",
                                                       0, 1, 0,
                                                       GIMP_PARAM_READWRITE));
@@ -7682,13 +7681,13 @@ register_plug_in_compat_procs (GimpPDB *pdb)
                                gimp_param_spec_int32 ("waveform",
                                                       "waveform",
                                                       "Waveform { SAWTOOTH (0), SINE (1) }",
-                                                      0, 1, 1,
+                                                      0, 1, 0,
                                                       GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
                                g_param_spec_boolean ("antialias",
                                                      "antialias",
                                                      "Antialias { TRUE, FALSE }",
-                                                     TRUE,
+                                                     FALSE,
                                                      GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
                                g_param_spec_boolean ("tile",
@@ -7699,7 +7698,6 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
-
   /*
    * gimp-plug-in-rotate
    */
diff --git a/pdb/groups/plug_in_compat.pdb b/pdb/groups/plug_in_compat.pdb
index 3f5af34..f438766 100644
--- a/pdb/groups/plug_in_compat.pdb
+++ b/pdb/groups/plug_in_compat.pdb
@@ -3417,6 +3417,86 @@ CODE
     );
 }
 
+sub plug_in_ripple {
+    $blurb = 'Displace pixels in a ripple pattern';
+
+    $help = <<'HELP';
+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.
+HELP
+
+    &std_pdb_compat('gegl:ripple');
+    $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 => 'period', type => 'int32',
+          desc => 'Period: number of pixels for one wave to complete' },
+        { name => 'amplitude', type => 'int32',
+          desc => 'Amplitude: maximum displacement of wave' },
+        { name => 'orientation', type => '0 <= int32 <= 1',
+          desc => 'Orientation { ORIENTATION-HORIZONTAL (0), ORIENTATION-VERTICAL (1) }' },
+        { name => 'edges', type => '0 <= int32 <= 2',
+          desc => 'Edges { SMEAR (0), WRAP (1), BLANK (2) }' },
+        { name => 'waveform', type => '0 <= int32 <= 1',
+          desc => 'Waveform { SAWTOOTH (0), SINE (1) }' },
+        { name => 'antialias', type => 'boolean',
+          desc => 'Antialias { TRUE, FALSE }' },
+        { name => 'tile', type => 'boolean',
+          desc => 'Tileable { TRUE, FALSE }' }
+    );
+
+    %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;
+      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",    (gdouble) amplitude,
+                                  "period",       (gdouble) 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;
+    }
+}
+CODE
+    );
+}
+
 sub plug_in_rotate {
     $blurb = 'Rotates a layer or the whole image by 90, 180 or 270 degrees';
 
@@ -4937,6 +5017,7 @@ CODE
             plug_in_randomize_pick
             plug_in_randomize_slur
             plug_in_rgb_noise
+            plug_in_ripple
             plug_in_rotate
             plug_in_noisify
             plug_in_sel_gauss
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 94fb49a..378c05b 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -80,7 +80,6 @@ plug-ins/common/photocopy.c
 plug-ins/common/plugin-browser.c
 plug-ins/common/procedure-browser.c
 plug-ins/common/qbist.c
-plug-ins/common/ripple.c
 plug-ins/common/sample-colorize.c
 plug-ins/common/sharpen.c
 plug-ins/common/smooth-palette.c


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