vips: add a vips__gaussblur method

handle both < 7.41 and higher.
Prior 7.41, vips_gaussblur took only a int param, the radius.
The radius was then divided by 2.0 (min_ampl) in vips_gaussblur.
After, you can now parameter the min_ampl and radius became sigma (and
passed from an integer to a double).
This commit is contained in:
Thomas Meson 2015-09-14 17:12:46 +02:00
parent 0f31f20ded
commit 404cbf902f
3 changed files with 29 additions and 0 deletions

12
vips.h
View file

@ -16,6 +16,9 @@
*/
#if (VIPS_MAJOR_VERSION == 7 && VIPS_MINOR_VERSION < 41)
/* we need math.h for ceil() in vips__gaussblur */
#include <math.h>
#define VIPS_ANGLE_D0 VIPS_ANGLE_0
#define VIPS_ANGLE_D90 VIPS_ANGLE_90
#define VIPS_ANGLE_D180 VIPS_ANGLE_180
@ -321,3 +324,12 @@ vips_watermark(VipsImage *in, VipsImage **out, WatermarkTextOptions *to, Waterma
g_object_unref(base);
return 0;
}
int
vips__gaussblur(VipsImage *in, VipsImage **out, double sigma, double min_ampl) {
#if (VIPS_MAJOR_VERSION == 7 && VIPS_MINOR_VERSION < 41)
return vips_gaussblur(in, out, ceil(sigma), NULL);
#else
return vips_gaussblur(in, out, sigma, NULL, "min_ampl", min_ampl);
#endif
}