[gegl] operations: add a commandline syntax rigged up gegl op



commit 83198f5f052031fabc17422d59e9497bc70968ea
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Mar 13 12:07:26 2016 +0100

    operations: add a commandline syntax rigged up gegl op

 operations/common/Makefile.am |    5 +-
 operations/common/gegl.c      |  105 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+), 2 deletions(-)
---
diff --git a/operations/common/Makefile.am b/operations/common/Makefile.am
index 6fce0e9..960b965 100644
--- a/operations/common/Makefile.am
+++ b/operations/common/Makefile.am
@@ -60,6 +60,7 @@ op_LTLIBRARIES = \
        gblur-1d.la \
        gegl-buffer-load-op.la \
        gegl-buffer-save-op.la \
+       gegl.la \
        grey.la \
        grid.la \
        high-pass.la \
@@ -97,7 +98,7 @@ op_LTLIBRARIES = \
        noise-simplex.la \
        noise-slur.la \
        noise-solid.la \
-        noise-spread.la \
+       noise-spread.la \
        noise-cell.la \
        oilify.la \
        opacity.la \
@@ -139,7 +140,7 @@ op_LTLIBRARIES = \
        unsharp-mask.la \
        value-invert.la \
        value-propagate.la \
-        video-degradation.la \
+       video-degradation.la \
        vignette.la \
        warp.la \
        waves.la \
diff --git a/operations/common/gegl.c b/operations/common/gegl.c
new file mode 100644
index 0000000..fad1431
--- /dev/null
+++ b/operations/common/gegl.c
@@ -0,0 +1,105 @@
+/* This file is an image processing operation for GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2006, 2010 Øyvind Kolås <pippin gimp org>
+ */
+
+#include "config.h"
+#include <glib/gi18n-lib.h>
+
+#ifdef GEGL_PROPERTIES
+
+property_string (string, _("pipeline"), "invert")
+    description(_("[op [property=value] [property=value]] [[op] [property=value]"))
+
+#else
+
+#define GEGL_OP_META
+#define GEGL_OP_C_SOURCE gegl.c
+
+#include "gegl-op.h"
+
+static void
+attach (GeglOperation *operation)
+{
+  GeglNode *gegl, *input, *output;
+
+  gegl = operation->node;
+
+  input    = gegl_node_get_input_proxy (gegl, "input");
+  output   = gegl_node_get_output_proxy (gegl, "output");
+
+  gegl_node_link_many (input, output, NULL);
+  /*
+  gegl_operation_meta_redirect (operation, "scale", multiply, "value");
+  gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-x");
+  gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-y");
+
+  gegl_operation_meta_watch_nodes (operation, add, multiply, subtract, blur, NULL);
+  */
+}
+
+#include <stdio.h>
+
+static char *cached = NULL;
+
+static void
+prepare (GeglOperation *operation)
+{
+  GeglProperties *o = GEGL_PROPERTIES (operation);
+  GeglNode *gegl, *input, *output;
+
+  gegl = operation->node;
+
+  if (!cached || !g_str_equal (cached, o->string))
+  {
+    if (cached)
+      g_free (cached);
+    cached = g_strdup (o->string);
+
+  input    = gegl_node_get_input_proxy (gegl, "input");
+  output   = gegl_node_get_output_proxy (gegl, "output");
+
+//  gegl_node_link_many (input, output, NULL);
+  gegl_create_chain (o->string, input, output);
+  /*
+  gegl_operation_meta_redirect (operation, "scale", multiply, "value");
+  gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-x");
+  gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-y");
+
+  gegl_operation_meta_watch_nodes (operation, add, multiply, subtract, blur, NULL);
+  */
+  }
+}
+
+static void
+gegl_op_class_init (GeglOpClass *klass)
+{
+  GeglOperationClass *operation_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+
+  operation_class->attach = attach;
+  operation_class->prepare = prepare;
+
+  gegl_operation_class_set_keys (operation_class,
+    "name",        "gegl:gegl",
+    "title",       _("GEGL graph"),
+    "categories",  "enhance",
+    "description", _("Program a GEGL operation, in the same manner as the GEGL commandline."),
+    NULL);
+}
+
+#endif


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