[gimp] plugins: add pdb compat wrappers for tile-seamless



commit b0645cf559684f32abae07a6d516e47c502a5853
Author: Téo Mazars <teo mazars ensimag fr>
Date:   Sun Jul 28 19:09:13 2013 +0200

    plugins: add pdb compat wrappers for tile-seamless
    
    and remove the old plugin

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |   74 +++++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   16 --
 plug-ins/common/gimprc.common       |    1 -
 plug-ins/common/plugin-defs.pl      |    1 -
 plug-ins/common/tile-seamless.c     |  357 -----------------------------------
 po-plug-ins/POTFILES.in             |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb |   45 +++++
 9 files changed, 120 insertions(+), 379 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index aa19afc..f1ddec7 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 693 procedures registered total */
+/* 694 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 dde2b9c..f2af65a 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -1004,6 +1004,44 @@ plug_in_threshold_alpha_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_make_seamless_invoker (GimpProcedure         *procedure,
+                               Gimp                  *gimp,
+                               GimpContext           *context,
+                               GimpProgress          *progress,
+                               const GimpValueArray  *args,
+                               GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+  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:tile-seamless",
+                                 NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Tile Seamless"),
+                                         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,
@@ -2107,6 +2145,42 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-make-seamless
+   */
+  procedure = gimp_procedure_new (plug_in_make_seamless_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-make-seamless");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-make-seamless",
+                                     "Alters edges to make the image seamlessly tileable",
+                                     "This plugin creates a seamless tileable from the input drawable.",
+                                     "Compatibility procedure. Please see 'gegl:tile-seamless' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:tile-seamless' for credits.",
+                                     "2013",
+                                     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_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 1df723f..f4a32b6 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -242,8 +242,6 @@
 /tile-glass.exe
 /tile-paper
 /tile-paper.exe
-/tile-seamless
-/tile-seamless.exe
 /tile-small
 /tile-small.exe
 /unit-editor
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 9f68826..6bc6e76 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -164,7 +164,6 @@ libexec_PROGRAMS = \
        tile \
        tile-glass \
        tile-paper \
-       tile-seamless \
        tile-small \
        unit-editor \
        unsharp-mask \
@@ -2286,21 +2285,6 @@ tile_paper_LDADD = \
        $(INTLLIBS)             \
        $(tile_paper_RC)
 
-tile_seamless_SOURCES = \
-       tile-seamless.c
-
-tile_seamless_LDADD = \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(CAIRO_LIBS)           \
-       $(GDK_PIXBUF_LIBS)      \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(tile_seamless_RC)
-
 tile_small_SOURCES = \
        tile-small.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 44433f3..e4a5f93 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -118,7 +118,6 @@ sphere_designer_RC = sphere-designer.rc.o
 tile_RC = tile.rc.o
 tile_glass_RC = tile-glass.rc.o
 tile_paper_RC = tile-paper.rc.o
-tile_seamless_RC = tile-seamless.rc.o
 tile_small_RC = tile-small.rc.o
 unit_editor_RC = unit-editor.rc.o
 unsharp_mask_RC = unsharp-mask.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index a691ec4..0275bdc 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -119,7 +119,6 @@
     'tile' => { ui => 1 },
     'tile-glass' => { ui => 1 },
     'tile-paper' => { ui => 1 },
-    'tile-seamless' => {},
     'tile-small' => { ui => 1 },
     'unit-editor' => { ui => 1 },
     'unsharp-mask' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 8fabd91..68cd92b 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -126,7 +126,6 @@ plug-ins/common/sphere-designer.c
 plug-ins/common/tile.c
 plug-ins/common/tile-glass.c
 plug-ins/common/tile-paper.c
-plug-ins/common/tile-seamless.c
 plug-ins/common/tile-small.c
 plug-ins/common/unit-editor.c
 plug-ins/common/unsharp-mask.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index e007311..3eb769e 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -1092,6 +1092,50 @@ CODE
     );
 }
 
+sub plug_in_make_seamless {
+    $blurb = 'Alters edges to make the image seamlessly tileable';
+
+    $help = <<'HELP';
+This plugin creates a seamless tileable from the input drawable.
+HELP
+
+    &std_pdb_compat('gegl:tile-seamless');
+    $date = '2013';
+
+    @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' }
+    );
+
+    %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:tile-seamless",
+                             NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Tile Seamless"),
+                                     node);
+
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_vinvert {
     $blurb = 'Invert the brightness of each pixel';
 
@@ -1301,6 +1345,7 @@ CODE
             plug_in_shift
            plug_in_spread
             plug_in_threshold_alpha
+            plug_in_make_seamless
             plug_in_vinvert
            plug_in_waves
             plug_in_whirl_pinch);


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