Blame operations/core/nop.c

Packit bc1512
/* This file is an image processing operation for GEGL
Packit bc1512
 *
Packit bc1512
 * GEGL is free software; you can redistribute it and/or
Packit bc1512
 * modify it under the terms of the GNU Lesser General Public
Packit bc1512
 * License as published by the Free Software Foundation; either
Packit bc1512
 * version 3 of the License, or (at your option) any later version.
Packit bc1512
 *
Packit bc1512
 * GEGL is distributed in the hope that it will be useful,
Packit bc1512
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit bc1512
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit bc1512
 * Lesser General Public License for more details.
Packit bc1512
 *
Packit bc1512
 * You should have received a copy of the GNU Lesser General Public
Packit bc1512
 * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
Packit bc1512
 *
Packit bc1512
 * Copyright 2006 Øyvind Kolås <pippin@gimp.org>
Packit bc1512
 */
Packit bc1512
Packit bc1512
#include "config.h"
Packit bc1512
#include <glib/gi18n-lib.h>
Packit bc1512
Packit bc1512
Packit bc1512
#ifdef GEGL_CHANT_PROPERTIES
Packit bc1512
Packit bc1512
   /* no properties */
Packit bc1512
Packit bc1512
#else
Packit bc1512
Packit bc1512
#define GEGL_CHANT_TYPE_FILTER
Packit bc1512
#define GEGL_CHANT_C_FILE       "nop.c"
Packit bc1512
Packit bc1512
#include "gegl-chant.h"
Packit bc1512
Packit bc1512
Packit bc1512
static gboolean
Packit bc1512
gegl_nop_process (GeglOperation        *operation,
Packit bc1512
                  GeglOperationContext *context,
Packit bc1512
                  const gchar          *output_prop,
Packit bc1512
                  const GeglRectangle  *result,
Packit bc1512
                  gint                  level)
Packit bc1512
{
Packit bc1512
  GeglBuffer *input;
Packit bc1512
Packit bc1512
  if (strcmp (output_prop, "output"))
Packit bc1512
    {
Packit bc1512
      g_warning ("requested processing of %s pad on a nop", output_prop);
Packit bc1512
      return FALSE;
Packit bc1512
    }
Packit bc1512
Packit bc1512
  input = GEGL_BUFFER (gegl_operation_context_get_object (context, "input"));
Packit bc1512
  if (!input)
Packit bc1512
    {
Packit bc1512
      g_warning ("nop received NULL input");
Packit bc1512
      return FALSE;
Packit bc1512
    }
Packit bc1512
Packit bc1512
  gegl_operation_context_take_object (context, "output", g_object_ref (G_OBJECT (input)));
Packit bc1512
  return TRUE;
Packit bc1512
}
Packit bc1512
Packit bc1512
static void
Packit bc1512
gegl_chant_class_init (GeglChantClass *klass)
Packit bc1512
{
Packit bc1512
  GeglOperationClass *operation_class;
Packit bc1512
Packit bc1512
  operation_class = GEGL_OPERATION_CLASS (klass);
Packit bc1512
  operation_class->process = gegl_nop_process;
Packit bc1512
Packit bc1512
  gegl_operation_class_set_keys (operation_class,
Packit bc1512
              "name",        "gegl:nop",
Packit bc1512
              "categories",  "core",
Packit bc1512
              "description", _("No operation (can be used as a routing point)"),
Packit bc1512
              NULL);
Packit bc1512
}
Packit bc1512
Packit bc1512
#endif