---
name: "VipsInterpolate"
section: "3"
platform: "linux"
package: "libvips-dev"
version: "7.20.7-1+b3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/VipsInterpolate"
---

# VipsInterpolate(3)

base class for VIPS interpolators

## NAME

VipsInterpolate,  vips\_interpolate, vips\_interpolate\_get\_method, vips\_interpolate\_get\_window\_size -  base class for VIPS interpolators

## SYNOPSIS

\#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 );

## DESCRIPTION

**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.

## SUPPORTED INTERPOLATORS

You can list the supported interpolators with

  $ vips --list classes

look for subclasses of  **VipsInterpolate.**

## RETURN VALUE

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

## SEE ALSO

[VipsObject(3)](/VipsObject/3.md), [VipsInterpolate(3)](/VipsInterpolate/3.md), vips\_type\_find(3), [vips(1)](/vips/1.md).

## AUTHOR

John Cupitt
