[gegl/samplers-api-rework] sampler: renamed GeglInterpolation enum to GeglSamplerType



commit 09dd9da60e69f54427b9f558e063495256aa58cd
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Sun Jul 3 17:27:12 2011 +0100

    sampler: renamed GeglInterpolation enum to GeglSamplerType
    
    Also s/gegl_interpolation_from_string/gegl_sampler_type_from_string/
    this because the resampling methods specified are not only interpolation.

 gegl/buffer/gegl-buffer-access.c  |    7 +++++--
 gegl/buffer/gegl-buffer-private.h |    2 --
 gegl/buffer/gegl-buffer.h         |   17 ++++++++---------
 gegl/buffer/gegl-sampler.c        |   16 +++++++++-------
 gegl/buffer/gegl-sampler.h        |    1 -
 operations/common/map-absolute.c  |    6 +++---
 operations/common/map-relative.c  |    6 +++---
 7 files changed, 28 insertions(+), 27 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 5c815fe..fa37f37 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1064,6 +1064,9 @@ gegl_buffer_get_abyss (GeglBuffer *buffer)
   return &buffer->abyss;
 }
 
+GType
+gegl_sampler_gtype_from_enum (GeglSamplerType sampler_type);
+
 void
 gegl_buffer_sample (GeglBuffer       *buffer,
                     gdouble           x,
@@ -1071,7 +1074,7 @@ gegl_buffer_sample (GeglBuffer       *buffer,
                     GeglMatrix2      *scale,
                     gpointer          dest,
                     const Babl       *format,
-                    GeglInterpolation interpolation)
+                    GeglSamplerType   sampler_type)
 {
   GType desired_type;
   g_return_if_fail (GEGL_IS_BUFFER (buffer));
@@ -1082,7 +1085,7 @@ gegl_buffer_sample (GeglBuffer       *buffer,
   return;
 #endif
 
-  desired_type = gegl_sampler_type_from_interpolation (interpolation);
+  desired_type = gegl_sampler_gtype_from_enum (sampler_type);
 
   /* unset the cached sampler if it dosn't match the needs */
   if (buffer->sampler != NULL &&
diff --git a/gegl/buffer/gegl-buffer-private.h b/gegl/buffer/gegl-buffer-private.h
index dec56e1..23d721e 100644
--- a/gegl/buffer/gegl-buffer-private.h
+++ b/gegl/buffer/gegl-buffer-private.h
@@ -122,8 +122,6 @@ GeglBuffer *
 gegl_buffer_new_ram (const GeglRectangle *extent,
                      const Babl          *format);
 
-GType gegl_sampler_type_from_interpolation (GeglInterpolation interpolation);
-
 void            gegl_buffer_sampler           (GeglBuffer     *buffer,
                                                gdouble         x,
                                                gdouble         y,
diff --git a/gegl/buffer/gegl-buffer.h b/gegl/buffer/gegl-buffer.h
index 58a37c4..e184328 100644
--- a/gegl/buffer/gegl-buffer.h
+++ b/gegl/buffer/gegl-buffer.h
@@ -315,7 +315,7 @@ typedef enum {
   GEGL_INTERPOLATION_CUBIC,
   GEGL_INTERPOLATION_LANCZOS,
   GEGL_INTERPOLATION_LOHALO
-} GeglInterpolation;
+} GeglSamplerType;
 
 
 /**
@@ -342,7 +342,7 @@ void gegl_buffer_sample (GeglBuffer       *buffer,
                          GeglMatrix2      *scale,
                          gpointer          dest,
                          const Babl       *format,
-                         GeglInterpolation interpolation);
+                         GeglSamplerType   sampler_type);
 
 
 
@@ -361,27 +361,26 @@ void            gegl_buffer_sample_cleanup    (GeglBuffer *buffer);
 
 
 /**
- * gegl_interpolation_from_string:
+ * gegl_sampler_type_from_string:
  * @string: the string to look up
  *
  * Looks up the GeglInterpolation corresponding to a string, if no matching
- * interpolation is found returns GEGL_INTERPOLATION_NEAREST.
+ * interpolation is found GEGL_INTERPOLATION_NEAREST is returned.
  */
-GeglInterpolation gegl_interpolation_from_string (const gchar *string);
+GeglSamplerType gegl_sampler_type_from_string (const gchar *string);
 
 /**
- * gegl_buffer_sample_new:
+ * gegl_buffer_sampler_new:
  * @buffer: buffer to create a new sampler for
  * @format: format we want data back in
  * @interpolation: resampling method to create a sampler for.
  *
- * Looks up the GeglInterpolation corresponding to a string, if no matching
- * interpolation is found returns GEGL_INTERPOLATION_NEAREST.
+ * Create a new sampler.
  */
 GeglSampler *
 gegl_buffer_sampler_new (GeglBuffer       *buffer,
                          Babl             *format,
-                         GeglInterpolation interpolation);
+                         GeglSamplerType   sampler_type);
 
 void  gegl_sampler_set_scale   (GeglSampler *self,
                                 GeglMatrix2 *scale);
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c
index b7d2676..6fe3f6e 100644
--- a/gegl/buffer/gegl-sampler.c
+++ b/gegl/buffer/gegl-sampler.c
@@ -523,8 +523,8 @@ set_buffer (GeglSampler *self, GeglBuffer *buffer)
      }
 }
 
-GeglInterpolation
-gegl_interpolation_from_string (const gchar *string)
+GeglSamplerType
+gegl_sampler_type_from_string (const gchar *string)
 {
   if (g_str_equal (string, "nearest") ||
       g_str_equal (string, "none"))
@@ -545,9 +545,11 @@ gegl_interpolation_from_string (const gchar *string)
 }
 
 GType
-gegl_sampler_type_from_interpolation (GeglInterpolation interpolation)
+gegl_sampler_gtype_from_enum (GeglSamplerType sampler_type);
+GType
+gegl_sampler_gtype_from_enum (GeglSamplerType sampler_type)
 {
-  switch (interpolation)
+  switch (sampler_type)
     {
       case GEGL_INTERPOLATION_NEAREST:
         return GEGL_TYPE_SAMPLER_NEAREST;
@@ -567,14 +569,14 @@ gegl_sampler_type_from_interpolation (GeglInterpolation interpolation)
 GeglSampler *
 gegl_buffer_sampler_new (GeglBuffer       *buffer,
                          Babl             *format,
-                         GeglInterpolation interpolation)
+                         GeglSamplerType   sampler_type)
 {
   GeglSampler          *sampler;
   GType                 desired_type;
   if (format == NULL)
     format = babl_format ("RaGaBaA float");
-  desired_type = gegl_sampler_type_from_interpolation (interpolation);
-  if (interpolation == GEGL_INTERPOLATION_LANCZOS)
+  desired_type = gegl_sampler_gtype_from_enum (sampler_type);
+  if (sampler_type == GEGL_INTERPOLATION_LANCZOS)
       sampler = g_object_new (desired_type,
                               "format", format,
                               "buffer", buffer,
diff --git a/gegl/buffer/gegl-sampler.h b/gegl/buffer/gegl-sampler.h
index 78e2fe5..1fd2a67 100644
--- a/gegl/buffer/gegl-sampler.h
+++ b/gegl/buffer/gegl-sampler.h
@@ -99,7 +99,6 @@ gfloat *
 gegl_sampler_get_ptr (GeglSampler         *sampler,
                       gint                 x,
                       gint                 y);
-GType gegl_sampler_type_from_interpolation (GeglInterpolation interpolation);
 
 G_END_DECLS
 
diff --git a/operations/common/map-absolute.c b/operations/common/map-absolute.c
index dfc1250..5b1bf26 100644
--- a/operations/common/map-absolute.c
+++ b/operations/common/map-absolute.c
@@ -57,15 +57,15 @@ process (GeglOperation       *operation,
 {
   Babl                 *format_io, *format_coords;
   GeglSampler          *sampler;
-  GeglInterpolation     interpolation;
+  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);
 
-  interpolation = gegl_interpolation_from_string ("cubic");
-  sampler = gegl_buffer_sampler_new (input, format_io, interpolation);
+  sampler_type = gegl_sampler_type_from_string ("cubic");
+  sampler = gegl_buffer_sampler_new (input, format_io, sampler_type);
 
   if (aux != NULL)
     {
diff --git a/operations/common/map-relative.c b/operations/common/map-relative.c
index c1f6c74..bd0c4b3 100644
--- a/operations/common/map-relative.c
+++ b/operations/common/map-relative.c
@@ -63,15 +63,15 @@ process (GeglOperation       *operation,
 {
   Babl                 *format_io, *format_coords;
   GeglSampler          *sampler;
-  GeglInterpolation     interpolation;
+  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);
 
-  interpolation = gegl_interpolation_from_string ("cubic");
-  sampler = gegl_buffer_sampler_new (input, format_io, interpolation);
+  sampler_type = gegl_sampler_type_from_string ("cubic");
+  sampler = gegl_buffer_sampler_new (input, format_io, sampler_type);
 
   if (aux != NULL)
     {



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