gegl r2255 - in trunk: . operations/common



Author: ok
Date: Sun Apr 27 22:21:13 2008
New Revision: 2255
URL: http://svn.gnome.org/viewvc/gegl?rev=2255&view=rev

Log:
* operations/common/write-buffer.c: added operation that allows
writing to an already existing GeglBuffer (as opposed to save-buffer
which emits a buffer.)


Added:
   trunk/operations/common/write-buffer.c
Modified:
   trunk/ChangeLog

Added: trunk/operations/common/write-buffer.c
==============================================================================
--- (empty file)
+++ trunk/operations/common/write-buffer.c	Sun Apr 27 22:21:13 2008
@@ -0,0 +1,65 @@
+/* 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 Ãyvind KolÃs <pippin gimp org>
+ */
+#ifdef GEGL_CHANT_PROPERTIES
+
+gegl_chant_object (buffer, "Buffer location",
+                   "Write to an existing GeglBuffer")
+
+#else
+
+#define GEGL_CHANT_TYPE_SINK
+#define GEGL_CHANT_C_FILE       "write-buffer.c"
+
+#include "gegl-chant.h"
+
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         const GeglRectangle *result)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+
+  if (o->buffer)
+    {
+      GeglBuffer *output = GEGL_BUFFER (o->buffer);
+
+      gegl_buffer_copy (input, result, output, result);
+    }
+
+  return TRUE;
+}
+
+
+static void
+gegl_chant_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass     *operation_class;
+  GeglOperationSinkClass *sink_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  sink_class      = GEGL_OPERATION_SINK_CLASS (klass);
+
+  sink_class->process = process;
+  sink_class->needs_full = FALSE;
+
+  operation_class->name        = "write-buffer";
+  operation_class->categories  = "programming:output";
+  operation_class->description = "A GEGL buffer destination surface.";
+}
+
+#endif



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