VipsInterpolate(3) vips_interpolate_get_method,

Other Alias



#include <vips/vips.h>

typedef void (*VipsInterpolateMethod)( VipsInterpolate *,

  PEL *out, REGION *in, double x, double y );

typedef struct _VipsInterpolateClass {

  VipsObjectClass parent_class;

  VipsInterpolateMethod interpolate;

  int (*get_window_size)( VipsInterpolate * );

  int window_size;
} VipsInterpolateClass;

void vips_interpolate( VipsInterpolate *interpolate,

  PEL *out, REGION *in, double x, double y );
VipsInterpolateMethod vips_interpolate_get_method( VipsInterpolate * );
int vips_interpolate_get_window_size( VipsInterpolate *interpolate );

VipsInterpolate *vips_interpolate_nearest_static( void );
VipsInterpolate *vips_interpolate_bilinear_static( void );
VipsInterpolate *vips_interpolate_bicubic_static( void );

VipsInterpolate *vips_interpolate_new( const char *nickname );


VipsInterpolate is the base class for VIPS interpolators. It provides a simple framework that subclasses use to implement the various interpolators that VIPS ships with. You can add new interpolators by subclassing VipsInterpolated and implementing an interpolate method. You can use any interpolator in your code via the methods of VipsInterpolate.

vips_interpolate(3) looks up the interpolate method for the object and calls it for you.

vips_interpolate_get_method(3) just does the lookup and returns a pointer to the interpolate function. You can use this to take the lookup out of an inner loop.

vips_interpolate_get_window_size(3) either calls get_window_size() or if it is NULL, returns window_size.

vips_interpolate_nearest_static(3), vips_interpolate_bilinear_static(3) and vips_interpolate_bicubic_static(3) are convenience functions which return a pointer to a static instance of a nearest-neighbour, bilinear and bicubic interpolator. You can pass these to any function which needs a VipsInterpolator as an argument. No need to free the result.

vips_interpolate_new(3) is a convenience function which makes an interpolator from a nickname. Free the result with g_object_unref(3) when you're done with it.


You can list the supported interpolators with

  $ vips --list classes

look for subclasses of VipsInterpolate.


Unless otherwise noted, functions return 0 success and -1 on error.


John Cupitt