[gimp] plug-ins, pdb: remove the displace plug-in and add 2 PDB compat procs



commit 3436ae46747cd81632468392a3c2eefcf58b2401
Author: Thomas Manni <thomas manni free fr>
Date:   Tue Jun 30 10:01:43 2015 +0200

    plug-ins, pdb: remove the displace plug-in and add 2 PDB compat procs

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |  338 ++++++++++++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   18 -
 plug-ins/common/displace.c          |  860 -----------------------------------
 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 |  199 ++++++++
 9 files changed, 538 insertions(+), 884 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index ca8a863..cffe5a8 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 762 procedures registered total */
+/* 764 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 c255b39..77a5649 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -169,6 +169,96 @@ wrap_in_gamma_cast (GeglNode     *node,
     }
 }
 
+static GeglNode *
+create_buffer_source_node (GeglNode     *parent,
+                           GimpDrawable *drawable)
+{
+  GeglNode   *new_node;
+  GeglBuffer *buffer;
+
+  buffer = gimp_drawable_get_buffer (drawable);
+  g_object_ref (buffer);
+  new_node = gegl_node_new_child (parent,
+                                  "operation", "gegl:buffer-source",
+                                  "buffer", buffer,
+                                  NULL);
+  g_object_unref (buffer);
+  return new_node;
+}
+
+static gboolean
+displace (GimpDrawable  *drawable,
+          gdouble        amount_x,
+          gdouble        amount_y,
+          gboolean       do_x,
+          gboolean       do_y,
+          GimpDrawable  *displace_map_x,
+          GimpDrawable  *displace_map_y,
+          gint           displace_type,
+          gint           displace_mode,
+          GimpProgress  *progress,
+          GError       **error)
+{
+  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))
+    {
+      if (do_x || do_y)
+        {
+          GeglNode *gegl;
+          GeglNode *node;
+          GeglAbyssPolicy abyss_policy = GEGL_ABYSS_NONE;
+
+          switch (displace_type)
+            {
+              case 1:
+                abyss_policy = GEGL_ABYSS_LOOP;
+                break;
+              case 2:
+                abyss_policy = GEGL_ABYSS_CLAMP;
+                break;
+              case 3:
+                abyss_policy = GEGL_ABYSS_BLACK;
+                break;
+            }
+
+          gegl = gegl_node_new ();
+
+          node = gegl_node_new_child (gegl,
+                                      "operation",     "gegl:displace",
+                                      "displace_mode", displace_mode,
+                                      "sampler_type",  GEGL_SAMPLER_CUBIC,
+                                      "abyss_policy",  abyss_policy,
+                                      "amount_x",      amount_x,
+                                      "amount_y",      amount_y,
+                                      NULL);
+
+          if (do_x)
+            {
+              GeglNode *src_node;
+              src_node = create_buffer_source_node (gegl, displace_map_x);
+              gegl_node_connect_to (src_node, "output", node, "aux");
+            }
+
+          if (do_y)
+            {
+              GeglNode *src_node;
+              src_node = create_buffer_source_node (gegl, displace_map_y);
+              gegl_node_connect_to (src_node, "output", node, "aux2");
+            }
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Displace"),
+                                         node);
+          g_object_unref (gegl);
+        }
+
+      return TRUE;
+    }
+  else
+    return FALSE;
+}
+
 static gboolean
 gaussian_blur (GimpDrawable  *drawable,
                gdouble        horizontal,
@@ -1033,6 +1123,98 @@ plug_in_diffraction_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_displace_invoker (GimpProcedure         *procedure,
+                          Gimp                  *gimp,
+                          GimpContext           *context,
+                          GimpProgress          *progress,
+                          const GimpValueArray  *args,
+                          GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gdouble amount_x;
+  gdouble amount_y;
+  gboolean do_x;
+  gboolean do_y;
+  GimpDrawable *displace_map_x;
+  GimpDrawable *displace_map_y;
+  gint32 displace_type;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  amount_x = g_value_get_double (gimp_value_array_index (args, 3));
+  amount_y = g_value_get_double (gimp_value_array_index (args, 4));
+  do_x = g_value_get_boolean (gimp_value_array_index (args, 5));
+  do_y = g_value_get_boolean (gimp_value_array_index (args, 6));
+  displace_map_x = gimp_value_get_drawable (gimp_value_array_index (args, 7), gimp);
+  displace_map_y = gimp_value_get_drawable (gimp_value_array_index (args, 8), gimp);
+  displace_type = g_value_get_int (gimp_value_array_index (args, 9));
+
+  if (success)
+    {
+      success = displace (drawable,
+                          amount_x,
+                          amount_y,
+                          do_x,
+                          do_y,
+                          displace_map_x,
+                          displace_map_y,
+                          displace_type,
+                          0,
+                          progress,
+                          error);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_displace_polar_invoker (GimpProcedure         *procedure,
+                                Gimp                  *gimp,
+                                GimpContext           *context,
+                                GimpProgress          *progress,
+                                const GimpValueArray  *args,
+                                GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gdouble amount_x;
+  gdouble amount_y;
+  gboolean do_x;
+  gboolean do_y;
+  GimpDrawable *displace_map_x;
+  GimpDrawable *displace_map_y;
+  gint32 displace_type;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  amount_x = g_value_get_double (gimp_value_array_index (args, 3));
+  amount_y = g_value_get_double (gimp_value_array_index (args, 4));
+  do_x = g_value_get_boolean (gimp_value_array_index (args, 5));
+  do_y = g_value_get_boolean (gimp_value_array_index (args, 6));
+  displace_map_x = gimp_value_get_drawable (gimp_value_array_index (args, 7), gimp);
+  displace_map_y = gimp_value_get_drawable (gimp_value_array_index (args, 8), gimp);
+  displace_type = g_value_get_int (gimp_value_array_index (args, 9));
+
+  if (success)
+    {
+      success = displace (drawable,
+                          amount_x,
+                          amount_y,
+                          do_x,
+                          do_y,
+                          displace_map_x,
+                          displace_map_y,
+                          displace_type,
+                          1,
+                          progress,
+                          error);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 plug_in_edge_invoker (GimpProcedure         *procedure,
                       Gimp                  *gimp,
                       GimpContext           *context,
@@ -4442,6 +4624,162 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-displace
+   */
+  procedure = gimp_procedure_new (plug_in_displace_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-displace");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-displace",
+                                     "Displace pixels as indicated by displacement maps",
+                                     "Displaces the contents of the specified drawable by the amounts 
specified by 'amount-x' and 'amount-y' multiplied by the luminance of corresponding pixels in the 
'displace-map' drawables.",
+                                     "Compatibility procedure. Please see 'gegl:displace' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:displace' for credits.",
+                                     "2015",
+                                     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 ("amount-x",
+                                                    "amount x",
+                                                    "Displace multiplier for x direction",
+                                                    -500.0, 500.0, -500.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("amount-y",
+                                                    "amount y",
+                                                    "Displace multiplier for y direction",
+                                                    -500.0, 500.0, -500.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("do-x",
+                                                     "do x",
+                                                     "Displace in x direction ?",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("do-y",
+                                                     "do y",
+                                                     "Displace in y direction ?",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("displace-map-x",
+                                                            "displace map x",
+                                                            "Displacement map for x direction",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("displace-map-y",
+                                                            "displace map y",
+                                                            "Displacement map for y direction",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("displace-type",
+                                                      "displace type",
+                                                      "Edge behavior { WRAP (1), SMEAR (2), BLACK (3) }",
+                                                      1, 3, 1,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-plug-in-displace-polar
+   */
+  procedure = gimp_procedure_new (plug_in_displace_polar_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-displace-polar");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-displace-polar",
+                                     "Displace pixels as indicated by displacement maps",
+                                     "Just like plug-in-displace but working in polar coordinates. The 
drawable is whirled and pinched according to the map.",
+                                     "Compatibility procedure. Please see 'gegl:displace' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:displace' for credits.",
+                                     "2015",
+                                     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 ("amount-x",
+                                                    "amount x",
+                                                    "Displace multiplier for radial direction",
+                                                    -500.0, 500.0, -500.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("amount-y",
+                                                    "amount y",
+                                                    "Displace multiplier for tangent direction",
+                                                    -500.0, 500.0, -500.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("do-x",
+                                                     "do x",
+                                                     "Displace in radial direction ?",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("do-y",
+                                                     "do y",
+                                                     "Displace in tangent direction ?",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("displace-map-x",
+                                                            "displace map x",
+                                                            "Displacement map for radial direction",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("displace-map-y",
+                                                            "displace map y",
+                                                            "Displacement map for tangent direction",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("displace-type",
+                                                      "displace type",
+                                                      "Edge behavior { WRAP (1), SMEAR (2), BLACK (3) }",
+                                                      1, 3, 1,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-plug-in-edge
    */
   procedure = gimp_procedure_new (plug_in_edge_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 9b3d1f8..3ca3d2b 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -50,8 +50,6 @@
 /despeckle.exe
 /destripe
 /destripe.exe
-/displace
-/displace.exe
 /edge-dog
 /edge-dog.exe
 /edge-neon
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 70bc258..c891646 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -68,7 +68,6 @@ libexec_PROGRAMS = \
        depth-merge \
        despeckle \
        destripe \
-       displace \
        edge-dog \
        edge-neon \
        emboss \
@@ -583,23 +582,6 @@ destripe_LDADD = \
        $(INTLLIBS)             \
        $(destripe_RC)
 
-displace_SOURCES = \
-       displace.c
-
-displace_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(displace_RC)
-
 edge_dog_SOURCES = \
        edge-dog.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 5b40760..881a38a 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -22,7 +22,6 @@ decompose_RC = decompose.rc.o
 depth_merge_RC = depth-merge.rc.o
 despeckle_RC = despeckle.rc.o
 destripe_RC = destripe.rc.o
-displace_RC = displace.rc.o
 edge_dog_RC = edge-dog.rc.o
 edge_neon_RC = edge-neon.rc.o
 emboss_RC = emboss.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index c9e719b..dfbb73d 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -23,7 +23,6 @@
     'depth-merge' => { ui => 1 },
     'despeckle' => { ui => 1 },
     'destripe' => { ui => 1 },
-    'displace' => { ui => 1 },
     'edge-dog' => { ui => 1 },
     'edge-neon' => { ui => 1 },
     'emboss' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 86712f9..57e4448 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -27,7 +27,6 @@ plug-ins/common/decompose.c
 plug-ins/common/depth-merge.c
 plug-ins/common/despeckle.c
 plug-ins/common/destripe.c
-plug-ins/common/displace.c
 plug-ins/common/edge-dog.c
 plug-ins/common/edge-neon.c
 plug-ins/common/emboss.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 5128f0a..e7120b9 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -942,6 +942,113 @@ CODE
     );
 }
 
+sub plug_in_displace {
+    $blurb = 'Displace pixels as indicated by displacement maps';
+
+    $help = <<'HELP';
+Displaces the contents of the specified drawable by the amounts specified
+by 'amount-x' and 'amount-y' multiplied by the luminance of corresponding
+pixels in the 'displace-map' drawables.
+HELP
+
+    &std_pdb_compat('gegl:displace');
+    $date = '2015';
+
+    @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 => 'amount_x', type => '-500.0 <= float <= 500.0',
+    desc => 'Displace multiplier for x direction' },
+  { name => 'amount_y', type => '-500.0 <= float <= 500.0',
+    desc => 'Displace multiplier for y direction' },
+  { name => 'do_x', type => 'boolean',
+    desc => 'Displace in x direction ?' },
+  { name => 'do_y', type => 'boolean',
+    desc => 'Displace in y direction ?' },
+  { name => 'displace_map_x', type => 'drawable',
+    desc => 'Displacement map for x direction' },
+  { name => 'displace_map_y', type => 'drawable',
+    desc => 'Displacement map for y direction' },
+  { name => 'displace_type', type => '1 <= int32 <= 3',
+    desc => 'Edge behavior { WRAP (1), SMEAR (2), BLACK (3) }' }
+    );
+
+    %invoke = (
+  code => <<'CODE'
+{
+  success = displace (drawable,
+                      amount_x,
+                      amount_y,
+                      do_x,
+                      do_y,
+                      displace_map_x,
+                      displace_map_y,
+                      displace_type,
+                      0,
+                      progress,
+                      error);
+}
+CODE
+    );
+}
+
+sub plug_in_displace_polar {
+    $blurb = 'Displace pixels as indicated by displacement maps';
+
+    $help = <<'HELP';
+Just like plug-in-displace but working in polar coordinates.
+The drawable is whirled and pinched according to the map.
+HELP
+
+    &std_pdb_compat('gegl:displace');
+    $date = '2015';
+
+    @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 => 'amount_x', type => '-500.0 <= float <= 500.0',
+    desc => 'Displace multiplier for radial direction' },
+  { name => 'amount_y', type => '-500.0 <= float <= 500.0',
+    desc => 'Displace multiplier for tangent direction' },
+  { name => 'do_x', type => 'boolean',
+    desc => 'Displace in radial direction ?' },
+  { name => 'do_y', type => 'boolean',
+    desc => 'Displace in tangent direction ?' },
+  { name => 'displace_map_x', type => 'drawable',
+    desc => 'Displacement map for radial direction' },
+  { name => 'displace_map_y', type => 'drawable',
+    desc => 'Displacement map for tangent direction' },
+  { name => 'displace_type', type => '1 <= int32 <= 3',
+    desc => 'Edge behavior { WRAP (1), SMEAR (2), BLACK (3) }' }
+    );
+
+    %invoke = (
+  code => <<'CODE'
+{
+  success = displace (drawable,
+                      amount_x,
+                      amount_y,
+                      do_x,
+                      do_y,
+                      displace_map_x,
+                      displace_map_y,
+                      displace_type,
+                      1,
+                      progress,
+                      error);
+}
+CODE
+    );
+}
+
 sub plug_in_edge {
     $blurb = 'Several simple methods for detecting edges';
 
@@ -4024,6 +4131,96 @@ wrap_in_gamma_cast (GeglNode     *node,
     }
 }
 
+static GeglNode *
+create_buffer_source_node (GeglNode     *parent,
+                           GimpDrawable *drawable)
+{
+  GeglNode   *new_node;
+  GeglBuffer *buffer;
+
+  buffer = gimp_drawable_get_buffer (drawable);
+  g_object_ref (buffer);
+  new_node = gegl_node_new_child (parent,
+                                  "operation", "gegl:buffer-source",
+                                  "buffer", buffer,
+                                  NULL);
+  g_object_unref (buffer);
+  return new_node;
+}
+
+static gboolean
+displace (GimpDrawable  *drawable,
+          gdouble        amount_x,
+          gdouble        amount_y,
+          gboolean       do_x,
+          gboolean       do_y,
+          GimpDrawable  *displace_map_x,
+          GimpDrawable  *displace_map_y,
+          gint           displace_type,
+          gint           displace_mode,
+          GimpProgress  *progress,
+          GError       **error)
+{
+  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))
+    {
+      if (do_x || do_y)
+        {
+          GeglNode *gegl;
+          GeglNode *node;
+          GeglAbyssPolicy abyss_policy = GEGL_ABYSS_NONE;
+
+          switch (displace_type)
+            {
+              case 1:
+                abyss_policy = GEGL_ABYSS_LOOP;
+                break;
+              case 2:
+                abyss_policy = GEGL_ABYSS_CLAMP;
+                break;
+              case 3:
+                abyss_policy = GEGL_ABYSS_BLACK;
+                break;
+            }
+
+          gegl = gegl_node_new ();
+
+          node = gegl_node_new_child (gegl,
+                                      "operation",     "gegl:displace",
+                                      "displace_mode", displace_mode,
+                                      "sampler_type",  GEGL_SAMPLER_CUBIC,
+                                      "abyss_policy",  abyss_policy,
+                                      "amount_x",      amount_x,
+                                      "amount_y",      amount_y,
+                                      NULL);
+
+          if (do_x)
+            {
+              GeglNode *src_node;
+              src_node = create_buffer_source_node (gegl, displace_map_x);
+              gegl_node_connect_to (src_node, "output", node, "aux");
+            }
+
+          if (do_y)
+            {
+              GeglNode *src_node;
+              src_node = create_buffer_source_node (gegl, displace_map_y);
+              gegl_node_connect_to (src_node, "output", node, "aux2");
+            }
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Displace"),
+                                         node);
+          g_object_unref (gegl);
+        }
+
+      return TRUE;
+    }
+  else
+    return FALSE;
+}
+
 static gboolean
 gaussian_blur (GimpDrawable  *drawable,
                gdouble        horizontal,
@@ -4087,6 +4284,8 @@ CODE
             plug_in_cubism
             plug_in_deinterlace
             plug_in_diffraction
+            plug_in_displace
+            plug_in_displace_polar
             plug_in_edge
             plug_in_engrave
             plug_in_exchange


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