mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
Change for older LIBVIPS versions. vips_bandjoin_const1 is added in libvips 8.2.
This commit is contained in:
parent
6ca6dd12de
commit
c19a86e12a
1 changed files with 15 additions and 3 deletions
18
vips.h
18
vips.h
|
|
@ -458,7 +458,19 @@ vips_sharpen_bridge(VipsImage *in, VipsImage **out, int radius, double x1, doubl
|
||||||
|
|
||||||
int
|
int
|
||||||
vips_add_band(VipsImage *in, VipsImage **out, double c) {
|
vips_add_band(VipsImage *in, VipsImage **out, double c) {
|
||||||
return vips_bandjoin_const1(in, out, c, NULL);
|
#if (VIPS_MAJOR_VERSION > 8 || (VIPS_MAJOR_VERSION >= 8 && VIPS_MINOR_VERSION >= 2))
|
||||||
|
return vips_bandjoin_const1(in, out, c, NULL);
|
||||||
|
#else
|
||||||
|
VipsImage *base = vips_image_new();
|
||||||
|
if (
|
||||||
|
vips_black(&base, in->Xsize, in->Ysize, NULL) ||
|
||||||
|
vips_linear1(base, &base, 1, c, NULL)) {
|
||||||
|
g_object_unref(base);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
g_object_unref(base);
|
||||||
|
return vips_bandjoin2(in, base, out, c, NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -471,13 +483,13 @@ vips_watermark_image(VipsImage *in, VipsImage *sub, VipsImage **out, WatermarkIm
|
||||||
t[1] = sub;
|
t[1] = sub;
|
||||||
|
|
||||||
if (has_alpha_channel(in) == 0) {
|
if (has_alpha_channel(in) == 0) {
|
||||||
vips_bandjoin_const1(in, &t[0], 255.0, NULL);
|
vips_add_band(in, &t[0], 255.0);
|
||||||
// in is no longer in the array and won't be unreffed, so add it at the end
|
// in is no longer in the array and won't be unreffed, so add it at the end
|
||||||
t[8] = in;
|
t[8] = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_alpha_channel(sub) == 0) {
|
if (has_alpha_channel(sub) == 0) {
|
||||||
vips_bandjoin_const1(sub, &t[1], 255.0, NULL);
|
vips_add_band(sub, &t[1], 255.0);
|
||||||
// sub is no longer in the array and won't be unreffed, so add it at the end
|
// sub is no longer in the array and won't be unreffed, so add it at the end
|
||||||
t[9] = sub;
|
t[9] = sub;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue