refactor. feat(test): add fixtures

This commit is contained in:
Tomas Aparicio 2015-04-04 16:12:45 +02:00
parent 125806e589
commit 03387b2fda
9 changed files with 82 additions and 15 deletions

39
vips.h
View file

@ -2,6 +2,24 @@
#include <vips/vips.h>
#include <vips/vips7compat.h>
enum types {
UNKNOWN = 0,
JPEG,
WEBP,
PNG,
TIFF,
MAGICK
};
/*
#define JPEG 0
#define WEBP "WEBP"
#define PNG "PNG"
#define TIFF "TIFF"
#define MAGICK "MAGICK"
#define UNKNOWN "UNKNOWN"
*/
int
vips_affine_interpolator(VipsImage *in, VipsImage **out, double a, double b, double c, double d, VipsInterpolate *interpolator)
{
@ -73,6 +91,27 @@ vips_rotate(VipsImage *in, VipsImage **buf, int angle)
return vips_rot(in, buf, rotate, NULL);
};
int
vips_init_image(void *buf, size_t len, int imageType, VipsImage **out) {
int code = 1;
if (imageType == JPEG) {
code = vips_jpegload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL);
} else if (imageType == PNG) {
code = vips_pngload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL);
} else if (imageType == WEBP) {
code = vips_webpload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL);
} else if (imageType == TIFF) {
code = vips_tiffload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL);
#if (VIPS_MAJOR_VERSION >= 8)
} else if (imageType == MAGICK) {
code = vips_magickload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL);
#endif
}
return code;
};
int
vips_embed_extend(VipsImage *in, VipsImage **out, int left, int top, int width, int height, int extend)
{