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



commit b87d97ae6892bd1344d717a84fa9b3e827cc5ecc
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jan 8 23:39:03 2015 +0100

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

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |   96 ++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   18 -
 plug-ins/common/gimprc.common       |    1 -
 plug-ins/common/lens-flare.c        |  933 -----------------------------------
 plug-ins/common/plugin-defs.pl      |    1 -
 po-plug-ins/POTFILES.in             |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb |   56 +++
 9 files changed, 153 insertions(+), 957 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index a8cda28..1cf8186 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 748 procedures registered total */
+/* 749 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 4f02c3c..34778f5 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -1071,6 +1071,54 @@ plug_in_exchange_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_flarefx_invoker (GimpProcedure         *procedure,
+                         Gimp                  *gimp,
+                         GimpContext           *context,
+                         GimpProgress          *progress,
+                         const GimpValueArray  *args,
+                         GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 pos_x;
+  gint32 pos_y;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  pos_x = g_value_get_int (gimp_value_array_index (args, 3));
+  pos_y = g_value_get_int (gimp_value_array_index (args, 4));
+
+  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;
+          gint      width  = gimp_item_get_width  (GIMP_ITEM (drawable));
+          gint      height = gimp_item_get_height (GIMP_ITEM (drawable));
+          gdouble   x      = (gdouble) pos_x / (gdouble) width;
+          gdouble   y      = (gdouble) pos_y / (gdouble) height;
+
+          node = gegl_node_new_child (NULL,
+                                      "operation", "gegl:lens-flare",
+                                      "pos-x",     x,
+                                      "pos-y",     y,
+                                      NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Lens Flare"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 plug_in_gauss_invoker (GimpProcedure         *procedure,
                        Gimp                  *gimp,
                        GimpContext           *context,
@@ -3842,6 +3890,54 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-flarefx
+   */
+  procedure = gimp_procedure_new (plug_in_flarefx_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-flarefx");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-flarefx",
+                                     "Add a lens flare effect",
+                                     "Adds a lens flare effects. Makes your image look like it was snapped 
with a cheap camera with a lot of lens :)",
+                                     "Compatibility procedure. Please see 'gegl:lens-flare' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:lens-flare' 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,
+                               gimp_param_spec_int32 ("pos-x",
+                                                      "pos x",
+                                                      "X-Position",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("pos-y",
+                                                      "pos y",
+                                                      "Y-Position",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-plug-in-gauss
    */
   procedure = gimp_procedure_new (plug_in_gauss_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 1bcf50a..771e6ff 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -154,8 +154,6 @@
 /jigsaw.exe
 /lcms
 /lcms.exe
-/lens-flare
-/lens-flare.exe
 /mail
 /mail.exe
 /max-rgb
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index fb17409..70d237c 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -120,7 +120,6 @@ libexec_PROGRAMS = \
        hot \
        jigsaw \
        lcms \
-       lens-flare \
        $(MAIL) \
        max-rgb \
        metadata \
@@ -1528,23 +1527,6 @@ lcms_LDADD = \
        $(INTLLIBS)             \
        $(lcms_RC)
 
-lens_flare_SOURCES = \
-       lens-flare.c
-
-lens_flare_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(lens_flare_RC)
-
 mail_SOURCES = \
        mail.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 8d51bd2..101f3dc 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -74,7 +74,6 @@ guillotine_RC = guillotine.rc.o
 hot_RC = hot.rc.o
 jigsaw_RC = jigsaw.rc.o
 lcms_RC = lcms.rc.o
-lens_flare_RC = lens-flare.rc.o
 mail_RC = mail.rc.o
 max_rgb_RC = max-rgb.rc.o
 metadata_RC = metadata.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 726c0bf..1873baf 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -75,7 +75,6 @@
     'hot' => { ui => 1 },
     'jigsaw' => { ui => 1 },
     'lcms' => { ui => 1, gegl => 1, libs => 'LCMS_LIBS', cflags => 'LCMS_CFLAGS' },
-    'lens-flare' => { ui => 1 },
     'mail' => { ui => 1, optional => 1 },
     'max-rgb' => { ui => 1 },
     'metadata' => { ui => 1, libs => 'GEXIV2_LIBS', cflags => 'GEXIV2_CFLAGS' },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index e0b4e45..df083d8 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -79,7 +79,6 @@ plug-ins/common/guillotine.c
 plug-ins/common/hot.c
 plug-ins/common/jigsaw.c
 plug-ins/common/lcms.c
-plug-ins/common/lens-flare.c
 plug-ins/common/mail.c
 plug-ins/common/max-rgb.c
 plug-ins/common/metadata.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 0fbbc3d..4027712 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -989,6 +989,61 @@ CODE
     );
 }
 
+sub plug_in_flarefx {
+    $blurb = 'Add a lens flare effect';
+
+    $help = <<'HELP';
+Adds a lens flare effects. Makes your image look like it was snapped
+with a cheap camera with a lot of lens :)
+HELP
+
+    &std_pdb_compat('gegl:lens-flare');
+    $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 => 'pos_x', type => 'int32',
+         desc => 'X-Position' },
+       { name => 'pos_y', type => 'int32',
+         desc => 'Y-Position' }
+    );
+
+    %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;
+      gint      width  = gimp_item_get_width  (GIMP_ITEM (drawable));
+      gint      height = gimp_item_get_height (GIMP_ITEM (drawable));
+      gdouble   x      = (gdouble) pos_x / (gdouble) width;
+      gdouble   y      = (gdouble) pos_y / (gdouble) height;
+
+      node = gegl_node_new_child (NULL,
+                                  "operation", "gegl:lens-flare",
+                                  "pos-x",     x,
+                                  "pos-y",     y,
+                                  NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Lens Flare"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_gauss {
     $blurb = 'Simplest, most commonly used way of blurring';
 
@@ -3382,6 +3437,7 @@ CODE
             plug_in_deinterlace
             plug_in_engrave
             plug_in_exchange
+            plug_in_flarefx
             plug_in_gauss
             plug_in_gauss_iir
             plug_in_gauss_iir2


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