[gegl/soc-2011-warp: 1/25] map-absolute, map-relative: add a property to choose the sampler



commit 5dcd6253f8290655aa216bd9e425adfe190a0ca5
Author: Michael Murà <batolettre gmail com>
Date:   Sun Jul 3 11:51:15 2011 +0200

    map-absolute, map-relative: add a property to choose the sampler

 gegl/gegl-chant.h                |    4 ++--
 operations/common/map-absolute.c |    9 ++++++---
 operations/common/map-relative.c |    7 ++++---
 3 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gegl/gegl-chant.h b/gegl/gegl-chant.h
index 1dd1a24..c455ada 100644
--- a/gegl/gegl-chant.h
+++ b/gegl/gegl-chant.h
@@ -353,7 +353,7 @@ struct _GeglChantO
 #define gegl_chant_curve(name, nick, blurb)                  GeglCurve         *name;
 #define gegl_chant_path(name, nick, blurb)                   GeglPath          *name;\
                                                           guint path_changed_handler;
-#define gegl_chant_interpolation(name, nick, def, blurb)     GeglInterpolation  name;
+#define gegl_chant_interpolation(name, nick, def, blurb)     GeglSamplerType    name;
 
 #include GEGL_CHANT_C_FILE
 
@@ -816,7 +816,7 @@ gegl_chant_class_intern_init (gpointer klass)
 #define gegl_chant_interpolation(name, nick, def, blurb)                     \
   g_object_class_install_property (object_class, PROP_##name,                \
                                    g_param_spec_enum (#name, nick, blurb,    \
-                                                      GEGL_TYPE_INTERPOLATION,\
+                                                      GEGL_TYPE_SAMPLER_TYPE,\
                                                       def,                   \
                                                       (GParamFlags) (        \
                                                       G_PARAM_READWRITE |    \
diff --git a/operations/common/map-absolute.c b/operations/common/map-absolute.c
index 5b1bf26..389960d 100644
--- a/operations/common/map-absolute.c
+++ b/operations/common/map-absolute.c
@@ -18,6 +18,10 @@
  */
 
 #ifdef GEGL_CHANT_PROPERTIES
+
+gegl_chant_interpolation (interpolation, _("Interpolation"),
+                          GEGL_INTERPOLATION_CUBIC, _("Sampler used internaly"))
+
 #else
 
 #define GEGL_CHANT_TYPE_COMPOSER
@@ -55,17 +59,16 @@ process (GeglOperation       *operation,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {
+  GeglChantO           *o = GEGL_CHANT_PROPERTIES (operation);
   Babl                 *format_io, *format_coords;
   GeglSampler          *sampler;
-  GeglSamplerType       sampler_type;
   GeglBufferIterator   *it;
   gint                  index_in, index_out, index_coords;
 
   format_io = babl_format ("RGBA float");
   format_coords = babl_format_n (babl_type ("float"), 2);
 
-  sampler_type = gegl_sampler_type_from_string ("cubic");
-  sampler = gegl_buffer_sampler_new (input, format_io, sampler_type);
+  sampler = gegl_buffer_sampler_new (input, format_io, o->interpolation);
 
   if (aux != NULL)
     {
diff --git a/operations/common/map-relative.c b/operations/common/map-relative.c
index bd0c4b3..15e4d04 100644
--- a/operations/common/map-relative.c
+++ b/operations/common/map-relative.c
@@ -23,6 +23,8 @@
 gegl_chant_double (scaling, _("Scaling"), 0.0, 5000.0, 1.0,
        _("scaling factor of displacement, indicates how large spatial"
          " displacement a relative mapping value of 1.0 corresponds to."))
+gegl_chant_interpolation (interpolation, _("Interpolation"),
+                          GEGL_INTERPOLATION_CUBIC, _("Sampler used internaly"))
 
 #else
 
@@ -61,17 +63,16 @@ process (GeglOperation       *operation,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {
+  GeglChantO           *o = GEGL_CHANT_PROPERTIES (operation);
   Babl                 *format_io, *format_coords;
   GeglSampler          *sampler;
-  GeglSamplerType       sampler_type;
   GeglBufferIterator   *it;
   gint                  index_in, index_out, index_coords;
 
   format_io = babl_format ("RGBA float");
   format_coords = babl_format_n (babl_type ("float"), 2);
 
-  sampler_type = gegl_sampler_type_from_string ("cubic");
-  sampler = gegl_buffer_sampler_new (input, format_io, sampler_type);
+  sampler = gegl_buffer_sampler_new (input, format_io, o->interpolation);
 
   if (aux != NULL)
     {



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