add test implementation of jacobian inverse

parent 8e5398ff
......@@ -1066,13 +1066,13 @@ gegl_buffer_get_abyss (GeglBuffer *buffer)
}
void
gegl_buffer_sample (GeglBuffer *buffer,
gdouble x,
gdouble y,
gdouble scale,
gpointer dest,
const Babl *format,
GeglInterpolation interpolation)
gegl_buffer_sample2 (GeglBuffer *buffer,
gdouble x,
gdouble y,
GeglMatrix2 *inverse_jacobian,
gpointer dest,
const Babl *format,
GeglInterpolation interpolation)
{
GType desired_type;
g_return_if_fail (GEGL_IS_BUFFER (buffer));
......@@ -1105,9 +1105,22 @@ gegl_buffer_sample (GeglBuffer *buffer,
buffer->sampler_format = format;
gegl_sampler_prepare (buffer->sampler);
}
if (inverse_jacobian)
gegl_sampler_set_inverse_jacobian (buffer->sampler, inverse_jacobian);
gegl_sampler_get (buffer->sampler, x, y, dest);
}
/* if (scale < 1.0) do decimation, possibly using pyramid instead */
void
gegl_buffer_sample (GeglBuffer *buffer,
gdouble x,
gdouble y,
gdouble scale,
gpointer dest,
const Babl *format,
GeglInterpolation interpolation)
{
gegl_buffer_sample2 (buffer, x, y, NULL, dest, format, interpolation);
}
void
......@@ -1122,7 +1135,6 @@ gegl_buffer_sample_cleanup (GeglBuffer *buffer)
}
}
void
gegl_buffer_copy (GeglBuffer *src,
const GeglRectangle *src_rect,
......
......@@ -21,6 +21,7 @@
#include <glib-object.h>
#include <babl/babl.h>
#include <gegl/gegl-matrix.h>
G_BEGIN_DECLS
......@@ -315,6 +316,7 @@ typedef enum {
GEGL_INTERPOLATION_LOHALO
} GeglInterpolation;
/**
* gegl_buffer_sample:
* @buffer: the GeglBuffer to sample from
......@@ -323,11 +325,10 @@ typedef enum {
* @scale: the scale we're fetching at (<1.0 can lead to decimation)
* @dest: buffer capable of storing one pixel in @format.
* @format: the format to store the sampled color in.
* @interpolation: the interpolation behavior to use, currently only nearest
* neighbour is implemented for this API, bilinear, bicubic and lanczos needs
* @interpolation: the interpolation behavior to use,
* to be ported from working code. Valid values: GEGL_INTERPOLATION_NEAREST and
* GEGL_INTERPOLATION_LINEAR, GEGL_INTERPOLATION_CUBIC and
* GEGL_INTERPOLATION_LANCZOS.
* GEGL_INTERPOLATION_LINEAR, GEGL_INTERPOLATION_CUBIC,
* GEGL_INTERPOLATION_LANCZOS and GEGL_INTERPOLATION_LOHALO
*
* Query interpolate pixel values at a given coordinate using a specified form
* of interpolation. The samplers used cache for a small neighbourhood of the
......@@ -340,6 +341,14 @@ void gegl_buffer_sample (GeglBuffer *buffer,
gpointer dest,
const Babl *format,
GeglInterpolation interpolation);
void
gegl_buffer_sample2 (GeglBuffer *buffer,
gdouble x,
gdouble y,
GeglMatrix2 *inverse_jacobian,
gpointer dest,
const Babl *format,
GeglInterpolation interpolation);
/**
......
......@@ -590,3 +590,9 @@ gegl_sampler_type_from_interpolation (GeglInterpolation interpolation)
return GEGL_TYPE_SAMPLER_LINEAR;
}
}
void gegl_sampler_set_inverse_jacobian (GeglSampler *self,
GeglMatrix2 *inverse_jacobian)
{
self->inverse_jacobian = inverse_jacobian;
}
......@@ -77,6 +77,10 @@ void gegl_sampler_get (GeglSampler *self,
gdouble x,
gdouble y,
void *output);
void gegl_sampler_set_inverse_jacobian (GeglSampler *self,
GeglMatrix2 *inverse_jacobian);
gfloat * gegl_sampler_get_from_buffer (GeglSampler *sampler,
gint x,
gint y);
......
......@@ -28,6 +28,7 @@
#include <gegl-color.h>
#include <gegl-curve.h>
#include <gegl-path.h>
#include <gegl-matrix.h>
#include <gegl-version.h>
......
......@@ -181,7 +181,7 @@ do_plasma_big (PlasmaContext *context,
xm = (x1 + x2) / 2;
ym = (y1 + y2) / 2;
if (depth == -1)
// if (depth == -1)
{
random_rgba (context->gr, tl);
put_pixel (context, tl, x1, y1);
......@@ -213,7 +213,7 @@ do_plasma_big (PlasmaContext *context,
return FALSE;
}
if (!depth)
//if (!depth)
{
if (x1 == x2 && y1 == y2)
return FALSE;
......
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