Blame operations/common/unsharp-mask.c

Packit Service 2781ba
/* This file is an image processing operation for GEGL
Packit Service 2781ba
 *
Packit Service 2781ba
 * GEGL is free software; you can redistribute it and/or
Packit Service 2781ba
 * modify it under the terms of the GNU Lesser General Public
Packit Service 2781ba
 * License as published by the Free Software Foundation; either
Packit Service 2781ba
 * version 3 of the License, or (at your option) any later version.
Packit Service 2781ba
 *
Packit Service 2781ba
 * GEGL is distributed in the hope that it will be useful,
Packit Service 2781ba
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 2781ba
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 2781ba
 * Lesser General Public License for more details.
Packit Service 2781ba
 *
Packit Service 2781ba
 * You should have received a copy of the GNU Lesser General Public
Packit Service 2781ba
 * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
Packit Service 2781ba
 *
Packit Service 2781ba
 * Copyright 2006, 2010 Øyvind Kolås <pippin@gimp.org>
Packit Service 2781ba
 */
Packit Service 2781ba
Packit Service 2781ba
#include "config.h"
Packit Service 2781ba
#include <glib/gi18n-lib.h>
Packit Service 2781ba
Packit Service 2781ba
#ifdef GEGL_CHANT_PROPERTIES
Packit Service 2781ba
Packit Service 2781ba
gegl_chant_double_ui (std_dev, _("Std. Dev."), 0.0, 500.0, 1.0, 0.0, 200.0, 1.5,
Packit Service 2781ba
                  _("Standard deviation (spatial scale factor)"))
Packit Service 2781ba
gegl_chant_double_ui (scale,  _("Scale"), 0.0, 100.0, 1.0, 0.0, 100.0, 1.5,
Packit Service 2781ba
                  _("Scale, strength of effect"))
Packit Service 2781ba
Packit Service 2781ba
#else
Packit Service 2781ba
Packit Service 2781ba
#define GEGL_CHANT_TYPE_META
Packit Service 2781ba
#define GEGL_CHANT_C_FILE       "unsharp-mask.c"
Packit Service 2781ba
Packit Service 2781ba
#include "gegl-chant.h"
Packit Service 2781ba
Packit Service 2781ba
static void attach (GeglOperation *operation)
Packit Service 2781ba
{
Packit Service 2781ba
  GeglNode *gegl, *input, *output, *add, *multiply, *subtract, *blur;
Packit Service 2781ba
Packit Service 2781ba
  gegl = operation->node;
Packit Service 2781ba
Packit Service 2781ba
  input    = gegl_node_get_input_proxy (gegl, "input");
Packit Service 2781ba
  output   = gegl_node_get_output_proxy (gegl, "output");
Packit Service 2781ba
  add      = gegl_node_new_child (gegl, "operation", "gegl:add", NULL);
Packit Service 2781ba
  multiply = gegl_node_new_child (gegl, "operation", "gegl:multiply", NULL);
Packit Service 2781ba
  subtract = gegl_node_new_child (gegl, "operation", "gegl:subtract", NULL);
Packit Service 2781ba
  blur     = gegl_node_new_child (gegl, "operation", "gegl:gaussian-blur",NULL);
Packit Service 2781ba
Packit Service 2781ba
  gegl_node_link_many (input, subtract, multiply, NULL);
Packit Service 2781ba
  gegl_node_link (input, blur);
Packit Service 2781ba
  gegl_node_link_many (multiply, add, output, NULL);
Packit Service 2781ba
Packit Service 2781ba
  gegl_node_connect_from (subtract, "aux",   blur,     "output");
Packit Service 2781ba
  gegl_node_connect_from (add,      "aux",   input, "output");
Packit Service 2781ba
Packit Service 2781ba
  gegl_operation_meta_redirect (operation, "scale", multiply, "value");
Packit Service 2781ba
  gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-x");
Packit Service 2781ba
  gegl_operation_meta_redirect (operation, "std-dev", blur, "std-dev-y");
Packit Service 2781ba
}
Packit Service 2781ba
Packit Service 2781ba
static void
Packit Service 2781ba
gegl_chant_class_init (GeglChantClass *klass)
Packit Service 2781ba
{
Packit Service 2781ba
  GeglOperationClass *operation_class;
Packit Service 2781ba
Packit Service 2781ba
  operation_class = GEGL_OPERATION_CLASS (klass);
Packit Service 2781ba
  operation_class->attach = attach;
Packit Service 2781ba
Packit Service 2781ba
  gegl_operation_class_set_keys (operation_class,
Packit Service 2781ba
  "name"       , "gegl:unsharp-mask",
Packit Service 2781ba
  "categories" , "meta:enhance",
Packit Service 2781ba
  "description",
Packit Service 2781ba
        _("Performs an unsharp mask on the input buffer (sharpens an image by "
Packit Service 2781ba
          "adding false mach-bands around edges)"),
Packit Service 2781ba
        NULL);
Packit Service 2781ba
}
Packit Service 2781ba
Packit Service 2781ba
#endif