gegl-buffer-save-op.c 1.99 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/* 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 2010 Martin Nordholts <martinn@src.gnome.org>
 */

#include "config.h"
#include <glib/gi18n-lib.h>

22
#ifdef GEGL_PROPERTIES
23

24 25
property_file_path (path, _("File"), "/tmp/gegl-buffer.gegl")
  description (_("Target file path to write GeglBuffer to."))
26 27 28

#else

29 30
#define GEGL_OP_SINK
#define GEGL_OP_C_FILE       "gegl-buffer-save-op.c"
31

32
#include "gegl-op.h"
33 34 35 36 37


static gboolean
gegl_buffer_save_op_process (GeglOperation       *operation,
                             GeglBuffer          *input,
38 39
                             const GeglRectangle *result,
                             gint                 level)
40
{
41
  GeglProperties *o = GEGL_PROPERTIES (operation);
42 43 44 45 46 47 48

  gegl_buffer_save (input, o->path, result);

  return TRUE;
}

static void
49
gegl_op_class_init (GeglOpClass *klass)
50 51 52 53 54 55 56 57 58 59
{
  GeglOperationClass     *operation_class;
  GeglOperationSinkClass *sink_class;

  operation_class = GEGL_OPERATION_CLASS (klass);
  sink_class      = GEGL_OPERATION_SINK_CLASS (klass);

  sink_class->process    = gegl_buffer_save_op_process;
  sink_class->needs_full = TRUE;

60 61 62 63 64
  gegl_operation_class_set_keys (operation_class,
    "name"       , "gegl:gegl-buffer-save",
    "categories" , "hidden",
    "description", _("GeglBuffer file writer."),
    NULL);
65 66 67 68 69

  gegl_extension_handler_register_saver (".gegl", "gegl:gegl-buffer-save");
}

#endif