map-relative.c 2.83 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/* 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
14
 * License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
15 16 17 18 19
 *
 * Copyright 2011 Michael Muré <batolettre@gmail.com>
 *
 */

20 21
#ifdef GEGL_PROPERTIES

22 23 24 25 26 27 28
property_double (scaling, _("Scaling"), 1.0)
  description   (_("scaling factor of displacement, indicates how large spatial"
              " displacement a relative mapping value of 1.0 corresponds to."))
  value_range (0.0, 5000.0)

property_enum (sampler_type, _("Resampling method"),
    GeglSamplerType, gegl_sampler_type, GEGL_SAMPLER_CUBIC)
29

30 31 32 33
property_enum (abyss_policy, _("Abyss policy"),
               GeglAbyssPolicy, gegl_abyss_policy,
               GEGL_ABYSS_NONE)

34 35
#else

36
#define GEGL_OP_COMPOSER
37
#define GEGL_OP_NAME     map_relative
38
#define GEGL_OP_C_SOURCE map-relative.c
39

40 41
#include "config.h"
#include <glib/gi18n-lib.h>
42
#include "gegl-op.h"
43 44


45 46
#define MAP_RELATIVE
#include "map-common.h"
47 48 49


static void
50
gegl_op_class_init (GeglOpClass *klass)
51 52 53
{
  GeglOperationClass         *operation_class;
  GeglOperationComposerClass *composer_class;
54
  gchar                      *composition = 
55
    "<gegl>"
56 57 58 59 60 61 62 63 64
    "<node operation='gegl:crop' width='200' height='200'/>"
    "<node operation='gegl:over'>"
      "<node operation='gegl:map-relative'>"
      "  <params>"
      "    <param name='scaling'>30</param>"
      "  </params>"
      "  <node operation='gegl:perlin-noise' />"
      "</node>"
      "<node operation='gegl:load' path='standard-input.png'/>"
65
    "</node>"
66
    "<node operation='gegl:checkerboard' color1='rgb(0.25,0.25,0.25)' color2='rgb(0.75,0.75,0.75)'/>"
67
    "</gegl>";
68

69

70 71 72 73 74 75
  operation_class = GEGL_OPERATION_CLASS (klass);
  composer_class  = GEGL_OPERATION_COMPOSER_CLASS (klass);

  composer_class->process = process;
  operation_class->prepare = prepare;
  operation_class->get_required_for_output = get_required_for_output;
76
  operation_class->get_invalidated_by_change = get_invalidated_by_change;
77

78
  gegl_operation_class_set_keys (operation_class,
79 80
    "name",        "gegl:map-relative",
    "title",       _("Map Relative"),
81
    "categories" , "map",
82
    "reference-hash", "c662bb6323771333ee49f7a30638eb22",
83
    "description", _("sample input with an auxiliary buffer that contain relative source coordinates"),
84
    "reference-composition", composition,
85
    NULL);
86 87
}
#endif