The change below i think would complicate the usage. Since every time accessing the interpolator the coordinates for accessing should be ajusted by the value of x, y. *GeglSampler *sampler = g_object_new (GEGL_TYPE_SAMPLER_CUBIC, "input", src, "format", babl_format ("RaGaBaA float"), "x", 50, "y", 50, "width", 200, /* or a rect could be passed, or a subbuffer of "height", 200, buffer expected to be created before making a sampler */ NULL); The api below would introduce more complexity because each implementation would need other arguments. gegl_sampler_get_quad (sampler, xc-0.5, yc-0.5, xc+0.5, yc-0.5, xc+0.5, yc+0.5, xc-0.5, yc+0.5, buf); The curren API proposal works on the complete passed buffer and should alos work for scaling and transforming. Since the fractional part of x,y determines the offset. void affine_cubic (GeglBuffer *dest, GeglBuffer *src, Matrix3 matrix) { gdouble arecip; gint x, y, i, j, pos, src_w = src->width, src_h = src->height, u, u1 = src->x, u2 = src_w - 1, pu, v, v1 = src->y, v2 = src_h - 1, pv; gfloat *src_buf, *dest_buf, *src_ptr, *dest_ptr, abyss = 0.; gdouble newval[4]; gdouble data[64]; gdouble du, dv, fu, fv; Matrix3 inverse; if (gegl_buffer_pixels (src) == 0 || gegl_buffer_pixels (dest) == 0) return; dest_buf = g_new (gfloat, gegl_buffer_pixels (dest) << 2); g_assert (src_buf && dest_buf); GeglInterpolatorCubic sampler = g_object_new (GEGL_TYPE_INTERPOLATOR_CUBIC, "input", src, "format", babl_format ("RaGaBaA float"), NULL); matrix3_copy (inverse, matrix); matrix3_invert (inverse); fu = du = inverse[0][0] * dest->x + inverse[0][1] * dest->y + inverse[0][2] - src->x; fv = dv = inverse[1][0] * dest->x + inverse[1][1] * dest->y + inverse[1][2] - src->y; for (dest_ptr = dest_buf, y = 0; y < dest->height; y++) { for (x = 0; x < dest->width; x++) { gegl_interpolator_get (interpolator, fu, fv,dest_buf); fu += inverse [0][0]; fv += inverse [1][0]; } du += inverse [0][1]; dv += inverse [1][1]; fu = du; fv = dv; } gegl_buffer_set_fmt (dest, dest_buf, babl_format ("RaGaBaA float")); g_free (dest_buf); } _______________________________________________ Gegl-developer mailing list Gegl-developer@xxxxxxxxxxxxxxxxxxxxxx https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer