|  |  |  | VIPS Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
#include <vips/vips.h>
                    VipsInterpolate;
void                (*VipsInterpolateMethod)            (VipsInterpolate *interpolate,
                                                         void *out,
                                                         VipsRegion *in,
                                                         double x,
                                                         double y);
                    VipsInterpolateClass;
void                vips_interpolate                    (VipsInterpolate *interpolate,
                                                         void *out,
                                                         VipsRegion *in,
                                                         double x,
                                                         double y);
VipsInterpolateMethod vips_interpolate_get_method       (VipsInterpolate *interpolate);
int                 vips_interpolate_get_window_size    (VipsInterpolate *interpolate);
int                 vips_interpolate_get_window_offset  (VipsInterpolate *interpolate);
#define             VIPS_TRANSFORM_SHIFT
#define             VIPS_TRANSFORM_SCALE
#define             VIPS_INTERPOLATE_SHIFT
#define             VIPS_INTERPOLATE_SCALE
VipsInterpolate *   vips_interpolate_nearest_static     (void);
VipsInterpolate *   vips_interpolate_bilinear_static    (void);
VipsInterpolate *   vips_interpolate_new                (const char *nickname);
void (*VipsInterpolateMethod) (VipsInterpolate *interpolate,void *out,VipsRegion *in,double x,double y);
An interpolation function. It should read source pixels from in with
VIPS_REGION_ADDR(), it can look left and up from (x, y) by window_offset
pixels and it can access pixels in a window of size window_size.
The interpolated value should be written to the pixel pointed to by out.
See also: VipsInterpolateClass.
| 
 | the interpolator | 
| 
 | write the interpolated pixel here | 
| 
 | read source pixels from here | 
| 
 | interpolate value at this position | 
| 
 | interpolate value at this position | 
typedef struct {
	VipsObjectClass parent_class;
	/* Write to pixel out(x,y), interpolating from in(x,y). The caller has
	 * to set the regions up.
	 */
	VipsInterpolateMethod interpolate;
	/* This interpolator needs a window this many pixels across and down.
	 */
	int (*get_window_size)( VipsInterpolate * );
	/* Or just set this if you want a constant.
	 */
	int window_size;
	/* Stencils are offset by this much. Default to window_size / 2 - 1
	 * (centering) if get_window_offset is NULL and window_offset is -1.
	 */
	int (*get_window_offset)( VipsInterpolate * );
	int window_offset;
} VipsInterpolateClass;
The abstract base class for the various VIPS interpolation functions. Use "vips --list classes" to see all the interpolators available.
An interpolator consists of a function to perform the interpolation, plus some extra data fields which tell vips how to call the function and what data it needs.
window_size is the size of the window that the interpolator needs. For
example, a bicubic interpolator needs to see a window of 4x4 pixels to be
able to interpolate a value. 
You can either have a function in get_window_size which returns the window
that a specific interpolator needs, or you can leave get_window_size NULL
and set a constant value in window_size.
window_offset is how much to offset the window up and left of (x, y). For
example, a bicubic interpolator will want a window_offset of 1.
You can either have a function in get_window_offset which returns the
offset that a specific interpolator needs, or you can leave
get_window_offset NULL and set a constant value in window_offset.
You also need to set nickname and description in VipsObject.
See also: VipsInterpolateMethod, VipsObject, 
vips_interpolate_bilinear_static().
| VipsObjectClass  | |
| VipsInterpolateMethod  | the interpolation method | 
| return the size of the window needed by this method | |
| or just set this for a constant window size | |
| return the window offset for this method | |
| or just set this for a constant window offset | 
void vips_interpolate (VipsInterpolate *interpolate,void *out,VipsRegion *in,double x,double y);
Look up the interpolate method in the class and call it. Use
vips_interpolate_get_method() to get a direct pointer to the function and
avoid the lookup overhead.
You need to set in and out up correctly.
| 
 | interpolator to use | 
| 
 | write result here | 
| 
 | read source data from here | 
| 
 | interpolate value at this position | 
| 
 | interpolate value at this position | 
VipsInterpolateMethod vips_interpolate_get_method       (VipsInterpolate *interpolate);
Look up the interpolate method in the class and return it. Use this
instead of vips_interpolate() to cache method dispatch.
| 
 | interpolator to use | 
| Returns : | a pointer to the interpolation function | 
int                 vips_interpolate_get_window_size    (VipsInterpolate *interpolate);
Look up an interpolators desired window size.
| 
 | interpolator to use | 
| Returns : | the interpolators required window size | 
int                 vips_interpolate_get_window_offset  (VipsInterpolate *interpolate);
Look up an interpolators desired window offset.
| 
 | interpolator to use | 
| Returns : | the interpolators required window offset | 
#define VIPS_TRANSFORM_SHIFT (6)
Many of the vips interpolators use fixed-point arithmetic for coordinate calculation. This is how many bits of precision they use.
#define VIPS_TRANSFORM_SCALE (1 << VIPS_TRANSFORM_SHIFT)
VIPS_TRANSFORM_SHIFT as a multiplicative constant.
#define VIPS_INTERPOLATE_SHIFT (12)
Many of the vips interpolators use fixed-point arithmetic for value calcualtion. This is how many bits of precision they use.
#define VIPS_INTERPOLATE_SCALE (1 << VIPS_INTERPOLATE_SHIFT)
VIPS_INTERPOLATE_SHIFT as a multiplicative constant.
VipsInterpolate *   vips_interpolate_nearest_static     (void);
A convenience function that returns a nearest-neighbour interpolator you don't need to free.
| Returns : | a nearest-neighbour interpolator. [transfer none] | 
VipsInterpolate *   vips_interpolate_bilinear_static    (void);
A convenience function that returns a bilinear interpolator you don't need to free.
| Returns : | a bilinear interpolator. [transfer none] | 
VipsInterpolate *   vips_interpolate_new                (const char *nickname);
Look up an interpolator from a nickname and make one. You need to free the
result with g_object_unref() when you're done with it.
See also: vips_type_find().
| 
 | nickname for interpolator | 
| Returns : | an interpolator, or NULLon error. |