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.
parent 6fde478a
......@@ -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 &&
......
......@@ -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,
......
......@@ -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);
......
......@@ -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,
......
......@@ -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
......
......@@ -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)
{
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment