This commit is contained in:
seb
2026-07-14 23:30:16 +02:00
parent 245fb047d7
commit 262fa63f1b
109 changed files with 21566 additions and 367 deletions

View File

@@ -0,0 +1,144 @@
// VIPS connection wrapper
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_VCONNECTION_H
#define VIPS_VCONNECTION_H
#include <vips/vips.h>
VIPS_NAMESPACE_START
/**
* A generic source object. These supply a stream of bytes that loaders can
* use to fetch image files, see VImage::new_from_source().
*
* Methods let you can connect a source up to memory, a file or
* a file descriptor. Use vips::VSourceCustom to implement custom sources
* using GObject signals.
*/
class VSource : public VObject {
public:
/**
* Wrap a VSource around an underlying VipsSource object.
*/
explicit VSource(VipsSource *input, VSteal steal = STEAL)
: VObject((VipsObject *) input, steal)
{
}
/**
* Make a new VSource from a file descriptor.
*/
static VSource
new_from_descriptor(int descriptor);
/**
* Make a new VSource from a file on disc.
*/
static VSource
new_from_file(const char *filename);
/**
* Make a new VSource from a binary object.
*/
static VSource
new_from_blob(VipsBlob *blob);
/**
* Make a new VSource from an area of memory.
*/
static VSource
new_from_memory(const void *data, size_t size);
/**
* Make a new VSource from a set of options encoded as a string. See
* vips_source_new().
*/
static VSource
new_from_options(const char *options);
/**
* Get a pointer to the underlying VipsSoure object.
*/
VipsSource *
get_source() const
{
return (VipsSource *) VObject::get_object();
}
};
/**
* A generic target object. Savers can use these to write a stream of bytes
* somewhere, see VImage::write_to_target().
*
* Methods let you can connect a target up to memory, a file or
* a file descriptor. Use vips::VTargetCustom to implement custom targets
* using GObject signals.
*/
class VTarget : public VObject {
public:
/**
* Wrap a VTarget around an underlying VipsTarget object.
*/
explicit VTarget(VipsTarget *output, VSteal steal = STEAL)
: VObject((VipsObject *) output, steal)
{
}
/**
* Make a new VTarget which, when written to, will write to a file
* descriptor.
*/
static VTarget
new_to_descriptor(int descriptor);
/**
* Make a new VTarget which, when written to, will write to a file.
*/
static VTarget new_to_file(const char *filename);
/**
* Make a new VTarget which, when written to, will write to a file
* descriptor.
*/
static VTarget new_to_memory();
/**
* Get a pointer to the underlying VipsTarget object.
*/
VipsTarget *
get_target() const
{
return (VipsTarget *) VObject::get_object();
}
};
VIPS_NAMESPACE_END
#endif /*VIPS_VCONNECTION_H*/

View File

@@ -0,0 +1,79 @@
// Header for error type
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_VERROR_H
#define VIPS_VERROR_H
#include <cstring>
#include <ostream>
#include <exception>
#include <vips/vips.h>
VIPS_NAMESPACE_START
/**
* The libvips error class. It holds a single string containing an
* internationalized error message in utf-8 encoding.
*/
class VIPS_CPLUSPLUS_API VError : public std::exception {
std::string _what;
public:
/**
* Construct a VError, setting the error message.
*/
VError(const std::string &what) : _what(what) {}
/**
* Construct a VError, fetching the error message from the libvips
* error buffer.
*/
VError() : _what(vips_error_buffer()) {}
virtual ~VError() throw() {}
/**
* Get a reference to the underlying C string.
*/
virtual const char *
what() const throw()
{
return _what.c_str();
}
/**
* Print the error message to a stream.
*/
void ostream_print(std::ostream &) const;
};
VIPS_NAMESPACE_END
#endif /*VIPS_VERROR_H*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,74 @@
// VIPS interpolate wrapper
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_VINTERPOLATE_H
#define VIPS_VINTERPOLATE_H
#include <vips/vips.h>
VIPS_NAMESPACE_START
/**
* An interpolation. You can pass one of these to something like
* VImage::affine for it to use to interpolate pixels.
*
* The available interpolators vary a bit with your libvips version and how it
* was built, but will include `nearest`, `bilinear` and `bicubic`. Run
* vips -l interpolate` to see them all.
*/
class VInterpolate : public VObject {
public:
/**
* Create a VInterpolate that wraps a VipsInterpolate object. If steal
* is STEAL, then this VInterpolate takes over ownership of the libvips
* object and will automatically unref it.
*/
explicit VInterpolate(VipsInterpolate *interpolate, VSteal steal = STEAL)
: VObject((VipsObject *) interpolate, steal)
{
}
/**
* Create a VInterpolate from a name, for example `"bicubic"`.
*/
static VInterpolate new_from_name(const char *name, VOption *options = nullptr);
/**
* Get a pointer to the underlying VipsInterpolate object.
*/
VipsInterpolate *
get_interpolate() const
{
return (VipsInterpolate *) VObject::get_object();
}
};
VIPS_NAMESPACE_END
#endif /*VIPS_VINTERPOLATE_H*/

View File

@@ -0,0 +1,154 @@
// VIPS region wrapper
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_VREGION_H
#define VIPS_VREGION_H
#include <vips/vips.h>
VIPS_NAMESPACE_START
/**
* A region of an image. Can be used to access raw pixel data.
* */
class VRegion : public VObject {
public:
/**
* Create a VRegion that wraps a VipsRegion object. If steal
* is STEAL, then this VRegion takes over ownership of the libvips
* object and will automatically unref it.
*/
explicit VRegion(VipsRegion *region, VSteal steal = STEAL)
: VObject((VipsObject *) region, steal)
{
}
/**
* Create a VRegion from an image.
*/
static VRegion
new_from_image(VImage image);
/**
* Get a pointer to the underlying VipsRegion object.
*/
VipsRegion *
get_region() const
{
return (VipsRegion *) VObject::get_object();
}
/**
* Prepare the region from VipsRect.
*/
void
prepare(const VipsRect *rect) const
{
if (vips_region_prepare(get_region(), rect))
throw VError();
}
/**
* Prepare the region from rectangle coordinates.
*/
void
prepare(int left, int top, int width, int height) const
{
VipsRect rect = { left, top, width, height };
prepare(&rect);
}
/**
* Get valid bounds of the region.
*/
VipsRect
valid() const
{
return get_region()->valid;
}
/**
* Get pointer to the start of the region.
*/
VipsPel *
addr() const
{
return addr(0);
}
/**
* Get pointer at the given index of the region.
*/
VipsPel *
addr(size_t i) const
{
return &VIPS_REGION_ADDR_TOPLEFT(get_region())[i];
}
/**
* Get pointer at the given coordinates of the region.
*/
VipsPel *
addr(int x, int y) const
{
return VIPS_REGION_ADDR(get_region(), x, y);
}
/**
* Get the stride (bytes per row, including padding) of the region.
*/
size_t
stride() const
{
return VIPS_REGION_LSKIP(get_region());
}
/**
* Get VipsPel at the given index of the region.
*/
VipsPel
operator[](size_t i) const
{
return *addr(i);
}
/**
* Get VipsPel at the given coordinates of the region.
*/
VipsPel
operator()(int x, int y) const
{
return *addr(x, y);
}
};
VIPS_NAMESPACE_END
#endif /*VIPS_VREGION_H*/

View File

@@ -0,0 +1,467 @@
/* Old and broken stuff that we still enable by default, but don't document
* and certainly don't recommend.
*
* 30/6/09
* - from vips.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_ALMOSTDEPRECATED_H
#define IM_ALMOSTDEPRECATED_H
#ifndef VIPS_VIPS7COMPAT_H
#error Should not be included directly use vips7compat.h instead
#endif
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* Was public, now deprecated.
*/
typedef enum /*< skip >*/ {
IM_BBITS_BYTE = 8,
IM_BBITS_SHORT = 16,
IM_BBITS_INT = 32,
IM_BBITS_FLOAT = 32,
IM_BBITS_COMPLEX = 64,
IM_BBITS_DOUBLE = 64,
IM_BBITS_DPCOMPLEX = 128
} VipsBBits;
/* Used to define a region of interest for im_extract() etc. Too boring to be
* public API, see im_extract_area() etc.
*/
typedef struct {
int xstart;
int ystart;
int xsize;
int ysize;
int chsel; /* 1 2 3 or 0, for r g b or all respectively
*(channel select) */
} IMAGE_BOX;
VIPS_DEPRECATED
int im_extract(IMAGE *, IMAGE *, IMAGE_BOX *);
VIPS_DEPRECATED
DOUBLEMASK *im_measure(IMAGE *im, IMAGE_BOX *box, int h, int v,
int *sel, int nsel, const char *name);
VIPS_DEPRECATED
gboolean im_isuint(IMAGE *im);
VIPS_DEPRECATED
gboolean im_isint(IMAGE *im);
VIPS_DEPRECATED
gboolean im_isfloat(IMAGE *im);
VIPS_DEPRECATED
gboolean im_isscalar(IMAGE *im);
VIPS_DEPRECATED
gboolean im_iscomplex(IMAGE *im);
VIPS_DEPRECATED
int im_c2ps(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED
int im_clip(IMAGE *in, IMAGE *out);
#define MASK_IDEAL_HIGHPASS IM_MASK_IDEAL_HIGHPASS
#define MASK_IDEAL_LOWPASS IM_MASK_IDEAL_LOWPASS
#define MASK_BUTTERWORTH_HIGHPASS IM_MASK_BUTTERWORTH_HIGHPASS
#define MASK_BUTTERWORTH_LOWPASS IM_MASK_BUTTERWORTH_LOWPASS
#define MASK_GAUSS_HIGHPASS IM_MASK_GAUSS_HIGHPASS
#define MASK_GAUSS_LOWPASS IM_MASK_GAUSS_LOWPASS
#define MASK_IDEAL_RINGPASS IM_MASK_IDEAL_RINGPASS
#define MASK_IDEAL_RINGREJECT IM_MASK_IDEAL_RINGREJECT
#define MASK_BUTTERWORTH_RINGPASS IM_MASK_BUTTERWORTH_RINGPASS
#define MASK_BUTTERWORTH_RINGREJECT IM_MASK_BUTTERWORTH_RINGREJECT
#define MASK_GAUSS_RINGPASS IM_MASK_GAUSS_RINGPASS
#define MASK_GAUSS_RINGREJECT IM_MASK_GAUSS_RINGREJECT
#define MASK_IDEAL_BANDPASS IM_MASK_IDEAL_BANDPASS
#define MASK_IDEAL_BANDREJECT IM_MASK_IDEAL_BANDREJECT
#define MASK_BUTTERWORTH_BANDPASS IM_MASK_BUTTERWORTH_BANDPASS
#define MASK_BUTTERWORTH_BANDREJECT IM_MASK_BUTTERWORTH_BANDREJECT
#define MASK_GAUSS_BANDPASS IM_MASK_GAUSS_BANDPASS
#define MASK_GAUSS_BANDREJECT IM_MASK_GAUSS_BANDREJECT
#define MASK_FRACTAL_FLT IM_MASK_FRACTAL_FLT
#define MaskType ImMaskType
/* Copy and swap types.
*/
typedef enum /*< skip >*/ {
IM_ARCH_NATIVE,
IM_ARCH_BYTE_SWAPPED,
IM_ARCH_LSB_FIRST,
IM_ARCH_MSB_FIRST
} im_arch_type;
VIPS_DEPRECATED
gboolean im_isnative(im_arch_type arch);
VIPS_DEPRECATED
int im_copy_from(IMAGE *in, IMAGE *out, im_arch_type architecture);
/* Backwards compatibility macros.
*/
#define im_clear_error_string() im_error_clear()
#define im_errorstring() im_error_buffer()
/* Deprecated API.
*/
VIPS_DEPRECATED_FOR(vips_error)
void im_errormsg(const char *fmt, ...)
G_GNUC_PRINTF(1, 2);
VIPS_DEPRECATED_FOR(vips_verror)
void im_verrormsg(const char *fmt, va_list ap);
VIPS_DEPRECATED_FOR(vips_error_system)
void im_errormsg_system(int err, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);
VIPS_DEPRECATED_FOR(g_info)
void im_diagnostics(const char *fmt, ...)
G_GNUC_PRINTF(1, 2);
VIPS_DEPRECATED_FOR(g_warning)
void im_warning(const char *fmt, ...)
G_GNUC_PRINTF(1, 2);
VIPS_DEPRECATED_FOR(g_thread_join)
void *vips_g_thread_join(GThread *thread);
VIPS_DEPRECATED
int im_iterate(VipsImage *im,
VipsStartFn start, im_generate_fn generate, VipsStopFn stop,
void *a, void *b);
/* Async rendering.
*/
VIPS_DEPRECATED_FOR(vips_sink_screen)
int im_render_priority(VipsImage *in, VipsImage *out, VipsImage *mask,
int width, int height, int max,
int priority,
void (*notify)(VipsImage *, VipsRect *, void *), void *client);
VIPS_DEPRECATED_FOR(vips_sink_screen)
int im_cache(VipsImage *in, VipsImage *out, int width, int height, int max);
/* Deprecated operations.
*/
VIPS_DEPRECATED
int im_cmulnorm(IMAGE *in1, IMAGE *in2, IMAGE *out);
VIPS_DEPRECATED
int im_fav4(IMAGE **, IMAGE *);
VIPS_DEPRECATED
int im_gadd(double, IMAGE *, double, IMAGE *, double, IMAGE *);
VIPS_DEPRECATED
int im_litecor(IMAGE *, IMAGE *, IMAGE *, int, double);
VIPS_DEPRECATED_FOR(vips_sink_screen)
int im_render_fade(IMAGE *in, IMAGE *out, IMAGE *mask,
int width, int height, int max,
int fps, int steps,
int priority,
void (*notify)(IMAGE *, VipsRect *, void *), void *client);
VIPS_DEPRECATED_FOR(vips_sink_screen)
int im_render(IMAGE *in, IMAGE *out, IMAGE *mask,
int width, int height, int max,
void (*notify)(IMAGE *, VipsRect *, void *), void *client);
VIPS_DEPRECATED
int im_cooc_matrix(IMAGE *im, IMAGE *m,
int xp, int yp, int xs, int ys, int dx, int dy, int flag);
VIPS_DEPRECATED
int im_cooc_asm(IMAGE *m, double *asmoment);
VIPS_DEPRECATED
int im_cooc_contrast(IMAGE *m, double *contrast);
VIPS_DEPRECATED
int im_cooc_correlation(IMAGE *m, double *correlation);
VIPS_DEPRECATED
int im_cooc_entropy(IMAGE *m, double *entropy);
VIPS_DEPRECATED
int im_glds_matrix(IMAGE *im, IMAGE *m,
int xpos, int ypos, int xsize, int ysize, int dx, int dy);
VIPS_DEPRECATED
int im_glds_asm(IMAGE *m, double *asmoment);
VIPS_DEPRECATED
int im_glds_contrast(IMAGE *m, double *contrast);
VIPS_DEPRECATED
int im_glds_entropy(IMAGE *m, double *entropy);
VIPS_DEPRECATED
int im_glds_mean(IMAGE *m, double *mean);
VIPS_DEPRECATED
int im_dif_std(IMAGE *im, int xpos, int ypos, int xsize, int ysize, int dx, int dy, double *pmean, double *pstd);
VIPS_DEPRECATED
int im_simcontr(IMAGE *out, int xsize, int ysize);
VIPS_DEPRECATED
int im_spatres(IMAGE *in, IMAGE *out, int step);
VIPS_DEPRECATED
int im_stretch3(IMAGE *in, IMAGE *out, double dx, double dy);
/* Renamed operations.
*/
/* arithmetic
*/
VIPS_DEPRECATED_FOR(vips_remainder_const)
int im_remainderconst_vec(IMAGE *in, IMAGE *out, int n, double *c);
/* boolean
*/
VIPS_DEPRECATED_FOR(vips_andimage_const1)
int im_andconst(IMAGE *, IMAGE *, double);
VIPS_DEPRECATED_FOR(vips_andimage_const)
int im_and_vec(IMAGE *, IMAGE *, int, double *);
VIPS_DEPRECATED_FOR(vips_orimage_const1)
int im_orconst(IMAGE *, IMAGE *, double);
VIPS_DEPRECATED_FOR(vips_orimage_const)
int im_or_vec(IMAGE *, IMAGE *, int, double *);
VIPS_DEPRECATED_FOR(vips_eorimage_const1)
int im_eorconst(IMAGE *, IMAGE *, double);
VIPS_DEPRECATED_FOR(vips_eorimage_const)
int im_eor_vec(IMAGE *, IMAGE *, int, double *);
/* mosaicing
*/
VIPS_DEPRECATED_FOR(vips_affine)
int im_affine(IMAGE *in, IMAGE *out,
double a, double b, double c, double d, double dx, double dy,
int ox, int oy, int ow, int oh);
VIPS_DEPRECATED_FOR(vips_similarity)
int im_similarity(IMAGE *in, IMAGE *out,
double a, double b, double dx, double dy);
VIPS_DEPRECATED_FOR(vips_similarity)
int im_similarity_area(IMAGE *in, IMAGE *out,
double a, double b, double dx, double dy,
int ox, int oy, int ow, int oh);
/* colour
*/
VIPS_DEPRECATED_FOR(vips_icc_export)
int im_icc_export(IMAGE *in, IMAGE *out,
const char *output_profile_filename, int intent);
/* conversion
*/
VIPS_DEPRECATED_FOR(vips_cast)
int im_clip2dcm(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED_FOR(vips_cast)
int im_clip2cm(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED_FOR(vips_cast)
int im_clip2us(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED_FOR(vips_cast)
int im_clip2ui(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED_FOR(vips_cast)
int im_clip2s(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED_FOR(vips_cast)
int im_clip2i(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED_FOR(vips_cast)
int im_clip2d(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED_FOR(vips_cast)
int im_clip2f(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED_FOR(vips_cast)
int im_clip2c(IMAGE *in, IMAGE *out);
VIPS_DEPRECATED_FOR(vips_tilecache)
int vips_cache(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_DEPRECATED
int im_slice(IMAGE *in, IMAGE *out, double, double);
VIPS_DEPRECATED
int im_thresh(IMAGE *in, IMAGE *out, double);
VIPS_DEPRECATED_FOR(printf)
int im_print(const char *message);
VIPS_DEPRECATED
int im_convsub(IMAGE *in, IMAGE *out, INTMASK *mask, int xskip, int yskip);
VIPS_DEPRECATED
int im_bernd(const char *tiffname, int x, int y, int w, int h);
VIPS_DEPRECATED
int im_resize_linear(IMAGE *, IMAGE *, int, int);
VIPS_DEPRECATED_FOR(vips_convf)
int im_convf(IMAGE *in, IMAGE *out, DOUBLEMASK *mask);
VIPS_DEPRECATED_FOR(vips_convsep)
int im_convsepf(IMAGE *in, IMAGE *out, DOUBLEMASK *mask);
VIPS_DEPRECATED
int im_conv_raw(IMAGE *in, IMAGE *out, INTMASK *mask);
VIPS_DEPRECATED
int im_convf_raw(IMAGE *in, IMAGE *out, DOUBLEMASK *mask);
VIPS_DEPRECATED
int im_convsep_raw(IMAGE *in, IMAGE *out, INTMASK *mask);
VIPS_DEPRECATED
int im_convsepf_raw(IMAGE *in, IMAGE *out, DOUBLEMASK *mask);
VIPS_DEPRECATED
int im_fastcor_raw(IMAGE *in, IMAGE *ref, IMAGE *out);
VIPS_DEPRECATED
int im_spcor_raw(IMAGE *in, IMAGE *ref, IMAGE *out);
VIPS_DEPRECATED
int im_gradcor_raw(IMAGE *in, IMAGE *ref, IMAGE *out);
VIPS_DEPRECATED
int im_contrast_surface_raw(IMAGE *in, IMAGE *out,
int half_win_size, int spacing);
VIPS_DEPRECATED_FOR(vips_stdif)
int im_stdif_raw(IMAGE *in, IMAGE *out,
double a, double m0, double b, double s0, int xwin, int ywin);
VIPS_DEPRECATED_FOR(vips_hist_local)
int im_lhisteq_raw(IMAGE *in, IMAGE *out, int xwin, int ywin);
VIPS_DEPRECATED_FOR(vips_morph)
int im_erode_raw(IMAGE *in, IMAGE *out, INTMASK *m);
VIPS_DEPRECATED_FOR(vips_morph)
int im_dilate_raw(IMAGE *in, IMAGE *out, INTMASK *m);
VIPS_DEPRECATED
int im_rank_raw(IMAGE *in, IMAGE *out, int xsize, int ysize, int order);
/* foreign
*/
/**
* VipsForeignJpegSubsample:
* @VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO: default preset
* @VIPS_FOREIGN_JPEG_SUBSAMPLE_ON: always perform subsampling
* @VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF: never perform subsampling
*
* Set jpeg subsampling mode.
*
* DEPRECATED: use #VipsForeignSubsample
*/
typedef enum {
VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO,
VIPS_FOREIGN_JPEG_SUBSAMPLE_ON,
VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF,
VIPS_FOREIGN_JPEG_SUBSAMPLE_LAST
} VipsForeignJpegSubsample;
VIPS_DEPRECATED_FOR(vips_rawsave_target)
int vips_rawsave_fd(VipsImage *in, int fd, ...)
G_GNUC_NULL_TERMINATED;
/* inplace
*/
VIPS_DEPRECATED_FOR(vips_draw_circle)
int im_circle(IMAGE *im, int cx, int cy, int radius, int intensity);
VIPS_DEPRECATED_FOR(vips_draw_line1)
int im_line(IMAGE *, int, int, int, int, int);
VIPS_DEPRECATED_FOR(vips_labelregions)
int im_segment(IMAGE *test, IMAGE *mask, int *segments);
VIPS_DEPRECATED_FOR(vips_draw_rect)
int im_paintrect(IMAGE *im, VipsRect *r, PEL *ink);
VIPS_DEPRECATED_FOR(vips_draw_image)
int im_insertplace(IMAGE *main, IMAGE *sub, int x, int y);
VIPS_DEPRECATED_FOR(vips_draw_flood)
int im_flood_copy(IMAGE *in, IMAGE *out, int x, int y, PEL *ink);
VIPS_DEPRECATED_FOR(vips_draw_flood)
int im_flood_blob_copy(IMAGE *in, IMAGE *out, int x, int y, PEL *ink);
VIPS_DEPRECATED_FOR(vips_draw_flood)
int im_flood_other_copy(IMAGE *test, IMAGE *mark, IMAGE *out,
int x, int y, int serial);
VIPS_DEPRECATED_FOR(vips_draw_flood)
int im_flood(IMAGE *im, int x, int y, PEL *ink, VipsRect *dout);
VIPS_DEPRECATED_FOR(vips_draw_flood)
int im_flood_blob(IMAGE *im, int x, int y, PEL *ink, VipsRect *dout);
VIPS_DEPRECATED_FOR(vips_draw_flood)
int im_flood_other(IMAGE *test, IMAGE *mark,
int x, int y, int serial, VipsRect *dout);
VIPS_DEPRECATED_FOR(vips_draw_line)
int im_fastline(IMAGE *im, int x1, int y1, int x2, int y2, PEL *pel);
VIPS_DEPRECATED_FOR(vips_draw_line)
int im_fastlineuser(IMAGE *im,
int x1, int y1, int x2, int y2,
VipsPlotFn fn, void *client1, void *client2, void *client3);
VIPS_DEPRECATED_FOR(vips_draw_mask)
int im_plotmask(IMAGE *im, int ix, int iy, PEL *ink, PEL *mask, VipsRect *r);
VIPS_DEPRECATED_FOR(vips_getpoint)
int im_readpoint(IMAGE *im, int x, int y, PEL *pel);
VIPS_DEPRECATED_FOR(vips_draw_point)
int im_plotpoint(IMAGE *im, int x, int y, PEL *pel);
VIPS_DEPRECATED_FOR(vips_draw_smudge)
int im_smudge(IMAGE *image, int ix, int iy, VipsRect *r);
VIPS_DEPRECATED
int im_smear(IMAGE *im, int ix, int iy, VipsRect *r);
VIPS_DEPRECATED_FOR(g_warning)
void vips_warn(const char *domain, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);
VIPS_DEPRECATED_FOR(g_warning)
void vips_vwarn(const char *domain, const char *fmt, va_list ap);
VIPS_DEPRECATED
void vips_info_set(gboolean info);
VIPS_DEPRECATED_FOR(g_info)
void vips_info(const char *domain, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);
VIPS_DEPRECATED_FOR(g_info)
void vips_vinfo(const char *domain, const char *fmt, va_list ap);
VIPS_DEPRECATED_FOR(vips_autorot)
VipsAngle vips_autorot_get_angle(VipsImage *image);
VIPS_DEPRECATED_FOR(vips_thread_isvips)
gboolean vips_thread_isworker(void);
/* iofuncs
*/
VIPS_DEPRECATED_FOR(g_free)
int vips_free(void *buf);
VIPS_DEPRECATED_FOR(vips_target_end)
void vips_target_finish(VipsTarget *target);
VIPS_DEPRECATED_FOR(vips_cache_operation_buildp)
VipsOperation *vips_cache_operation_lookup(VipsOperation *operation);
VIPS_DEPRECATED_FOR(vips_cache_operation_buildp)
void vips_cache_operation_add(VipsOperation *operation);
VIPS_DEPRECATED_FOR(g_strlcpy)
char *vips_strncpy(char *dest, const char *src, int n);
VIPS_DEPRECATED_FOR(g_strrstr)
char *vips_strrstr(const char *haystack, const char *needle);
VIPS_DEPRECATED_FOR(g_str_has_suffix)
gboolean vips_ispostfix(const char *a, const char *b);
VIPS_DEPRECATED_FOR(g_vsnprintf)
int vips_vsnprintf(char *str, size_t size, const char *format, va_list ap);
VIPS_DEPRECATED_FOR(g_snprintf)
int vips_snprintf(char *str, size_t size, const char *format, ...)
G_GNUC_PRINTF(3, 4);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*IM_ALMOSTDEPRECATED_H*/

View File

@@ -0,0 +1,580 @@
/* Headers for arithmetic
*
* 30/6/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_ARITHMETIC_H
#define VIPS_ARITHMETIC_H
#include <glib.h>
#include <vips/image.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/**
* VipsOperationMath:
* @VIPS_OPERATION_MATH_SIN: sin(), angles in degrees
* @VIPS_OPERATION_MATH_COS: cos(), angles in degrees
* @VIPS_OPERATION_MATH_TAN: tan(), angles in degrees
* @VIPS_OPERATION_MATH_ASIN: asin(), angles in degrees
* @VIPS_OPERATION_MATH_ACOS: acos(), angles in degrees
* @VIPS_OPERATION_MATH_ATAN: atan(), angles in degrees
* @VIPS_OPERATION_MATH_LOG: log base e
* @VIPS_OPERATION_MATH_LOG10: log base 10
* @VIPS_OPERATION_MATH_EXP: e to the something
* @VIPS_OPERATION_MATH_EXP10: 10 to the something
* @VIPS_OPERATION_MATH_SINH: sinh(), angles in radians
* @VIPS_OPERATION_MATH_COSH: cosh(), angles in radians
* @VIPS_OPERATION_MATH_TANH: tanh(), angles in radians
* @VIPS_OPERATION_MATH_ASINH: asinh(), angles in radians
* @VIPS_OPERATION_MATH_ACOSH: acosh(), angles in radians
* @VIPS_OPERATION_MATH_ATANH: atanh(), angles in radians
*
* See also: vips_math().
*/
typedef enum {
VIPS_OPERATION_MATH_SIN,
VIPS_OPERATION_MATH_COS,
VIPS_OPERATION_MATH_TAN,
VIPS_OPERATION_MATH_ASIN,
VIPS_OPERATION_MATH_ACOS,
VIPS_OPERATION_MATH_ATAN,
VIPS_OPERATION_MATH_LOG,
VIPS_OPERATION_MATH_LOG10,
VIPS_OPERATION_MATH_EXP,
VIPS_OPERATION_MATH_EXP10,
VIPS_OPERATION_MATH_SINH,
VIPS_OPERATION_MATH_COSH,
VIPS_OPERATION_MATH_TANH,
VIPS_OPERATION_MATH_ASINH,
VIPS_OPERATION_MATH_ACOSH,
VIPS_OPERATION_MATH_ATANH,
VIPS_OPERATION_MATH_LAST
} VipsOperationMath;
/**
* VipsOperationMath2:
* @VIPS_OPERATION_MATH2_POW: pow(left, right)
* @VIPS_OPERATION_MATH2_WOP: pow(right, left)
* @VIPS_OPERATION_MATH2_ATAN2: atan2(left, right)
*
* See also: vips_math().
*/
typedef enum {
VIPS_OPERATION_MATH2_POW,
VIPS_OPERATION_MATH2_WOP,
VIPS_OPERATION_MATH2_ATAN2,
VIPS_OPERATION_MATH2_LAST
} VipsOperationMath2;
/**
* VipsOperationRound:
* @VIPS_OPERATION_ROUND_RINT: round to nearest
* @VIPS_OPERATION_ROUND_FLOOR: largest integral value not greater than
* @VIPS_OPERATION_ROUND_CEIL: the smallest integral value not less than
*
* See also: vips_round().
*/
typedef enum {
VIPS_OPERATION_ROUND_RINT,
VIPS_OPERATION_ROUND_CEIL,
VIPS_OPERATION_ROUND_FLOOR,
VIPS_OPERATION_ROUND_LAST
} VipsOperationRound;
/**
* VipsOperationRelational:
* @VIPS_OPERATION_RELATIONAL_EQUAL: ==
* @VIPS_OPERATION_RELATIONAL_NOTEQ: !=
* @VIPS_OPERATION_RELATIONAL_LESS: <
* @VIPS_OPERATION_RELATIONAL_LESSEQ: <=
* @VIPS_OPERATION_RELATIONAL_MORE: >
* @VIPS_OPERATION_RELATIONAL_MOREEQ: >=
*
* See also: vips_relational().
*/
typedef enum {
VIPS_OPERATION_RELATIONAL_EQUAL,
VIPS_OPERATION_RELATIONAL_NOTEQ,
VIPS_OPERATION_RELATIONAL_LESS,
VIPS_OPERATION_RELATIONAL_LESSEQ,
VIPS_OPERATION_RELATIONAL_MORE,
VIPS_OPERATION_RELATIONAL_MOREEQ,
VIPS_OPERATION_RELATIONAL_LAST
} VipsOperationRelational;
/**
* VipsOperationBoolean:
* @VIPS_OPERATION_BOOLEAN_AND: &
* @VIPS_OPERATION_BOOLEAN_OR: |
* @VIPS_OPERATION_BOOLEAN_EOR: ^
* @VIPS_OPERATION_BOOLEAN_LSHIFT: >>
* @VIPS_OPERATION_BOOLEAN_RSHIFT: <<
*
* See also: vips_boolean().
*/
typedef enum {
VIPS_OPERATION_BOOLEAN_AND,
VIPS_OPERATION_BOOLEAN_OR,
VIPS_OPERATION_BOOLEAN_EOR,
VIPS_OPERATION_BOOLEAN_LSHIFT,
VIPS_OPERATION_BOOLEAN_RSHIFT,
VIPS_OPERATION_BOOLEAN_LAST
} VipsOperationBoolean;
/**
* VipsOperationComplex:
* @VIPS_OPERATION_COMPLEX_POLAR: convert to polar coordinates
* @VIPS_OPERATION_COMPLEX_RECT: convert to rectangular coordinates
* @VIPS_OPERATION_COMPLEX_CONJ: complex conjugate
*
* See also: vips_complex().
*/
typedef enum {
VIPS_OPERATION_COMPLEX_POLAR,
VIPS_OPERATION_COMPLEX_RECT,
VIPS_OPERATION_COMPLEX_CONJ,
VIPS_OPERATION_COMPLEX_LAST
} VipsOperationComplex;
/**
* VipsOperationComplex2:
* @VIPS_OPERATION_COMPLEX2_CROSS_PHASE: convert to polar coordinates
*
* See also: vips_complex2().
*/
typedef enum {
VIPS_OPERATION_COMPLEX2_CROSS_PHASE,
VIPS_OPERATION_COMPLEX2_LAST
} VipsOperationComplex2;
/**
* VipsOperationComplexget:
* @VIPS_OPERATION_COMPLEXGET_REAL: get real component
* @VIPS_OPERATION_COMPLEXGET_IMAG: get imaginary component
*
* See also: vips_complexget().
*/
typedef enum {
VIPS_OPERATION_COMPLEXGET_REAL,
VIPS_OPERATION_COMPLEXGET_IMAG,
VIPS_OPERATION_COMPLEXGET_LAST
} VipsOperationComplexget;
VIPS_API
int vips_add(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sum(VipsImage **in, VipsImage **out, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_subtract(VipsImage *in1, VipsImage *in2, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_multiply(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_divide(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_linear(VipsImage *in, VipsImage **out,
const double *a, const double *b, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_linear1(VipsImage *in, VipsImage **out, double a, double b, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_remainder(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_remainder_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_remainder_const1(VipsImage *in, VipsImage **out,
double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_invert(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_abs(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sign(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_clamp(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_maxpair(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_minpair(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_round(VipsImage *in, VipsImage **out, VipsOperationRound round, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_floor(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_ceil(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rint(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_math(VipsImage *in, VipsImage **out,
VipsOperationMath math, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sin(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cos(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_tan(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_asin(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_acos(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_atan(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_exp(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_exp10(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_log(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_log10(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sinh(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cosh(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_tanh(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_asinh(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_acosh(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_atanh(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_complex(VipsImage *in, VipsImage **out,
VipsOperationComplex cmplx, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_polar(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rect(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_conj(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_complex2(VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationComplex2 cmplx, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cross_phase(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_complexget(VipsImage *in, VipsImage **out,
VipsOperationComplexget get, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_real(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_imag(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_complexform(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_relational(VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationRelational relational, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_equal(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_notequal(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_less(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_lesseq(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_more(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_moreeq(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_relational_const(VipsImage *in, VipsImage **out,
VipsOperationRelational relational, const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_equal_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_notequal_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_less_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_lesseq_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_more_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_moreeq_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_relational_const1(VipsImage *in, VipsImage **out,
VipsOperationRelational relational, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_equal_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_notequal_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_less_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_lesseq_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_more_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_moreeq_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_boolean(VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationBoolean boolean, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_andimage(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_orimage(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_eorimage(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_lshift(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rshift(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_boolean_const(VipsImage *in, VipsImage **out,
VipsOperationBoolean boolean, const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_andimage_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_orimage_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_eorimage_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_lshift_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rshift_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_boolean_const1(VipsImage *in, VipsImage **out,
VipsOperationBoolean boolean, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_andimage_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_orimage_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_eorimage_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_lshift_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rshift_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_math2(VipsImage *left, VipsImage *right, VipsImage **out,
VipsOperationMath2 math2, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pow(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_wop(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_atan2(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_math2_const(VipsImage *in, VipsImage **out,
VipsOperationMath2 math2, const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pow_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_wop_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_atan2_const(VipsImage *in, VipsImage **out,
const double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_math2_const1(VipsImage *in, VipsImage **out,
VipsOperationMath2 math2, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pow_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_wop_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_atan2_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_avg(VipsImage *in, double *out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_deviate(VipsImage *in, double *out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_min(VipsImage *in, double *out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_max(VipsImage *in, double *out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_stats(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_measure(VipsImage *in, VipsImage **out, int h, int v, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_find_trim(VipsImage *in,
int *left, int *top, int *width, int *height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_getpoint(VipsImage *in, double **vector, int *n, int x, int y, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_find(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_find_ndim(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_find_indexed(VipsImage *in, VipsImage *index,
VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hough_line(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hough_circle(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_project(VipsImage *in, VipsImage **columns, VipsImage **rows, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_profile(VipsImage *in, VipsImage **columns, VipsImage **rows, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_ARITHMETIC_H*/

View File

@@ -0,0 +1,117 @@
/* A few basic types needed everywhere.
*
* 27/10/11
* - from type.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_BASIC_H
#define VIPS_BASIC_H
/* Defined in config.h
*/
#ifndef _VIPS_PUBLIC
#define _VIPS_PUBLIC
#endif
#define VIPS_API _VIPS_PUBLIC extern
/* VIPS_DISABLE_DEPRECATION_WARNINGS:
*
* Disable deprecation warnings from VIPS API.
*
* Must be defined before including `vips/vips.h`.
*/
#ifdef VIPS_DISABLE_DEPRECATION_WARNINGS
#define VIPS_DEPRECATED VIPS_API
#define VIPS_DEPRECATED_FOR(f) VIPS_API
#else
#define VIPS_DEPRECATED G_DEPRECATED VIPS_API
#define VIPS_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) VIPS_API
#endif
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/**
* VipsPel:
*
* A picture element. Cast this to whatever the associated VipsBandFormat says
* to get the value.
*/
typedef unsigned char VipsPel;
/* Also used for eg. vips_local() and friends.
*/
typedef int (*VipsCallbackFn)(void *a, void *b);
/* Like GFunc, but return a value.
*/
typedef void *(*VipsSListMap2Fn)(void *item,
void *a, void *b);
typedef void *(*VipsSListMap4Fn)(void *item,
void *a, void *b, void *c, void *d);
typedef void *(*VipsSListFold2Fn)(void *item,
void *a, void *b, void *c);
typedef enum {
VIPS_PRECISION_INTEGER,
VIPS_PRECISION_FLOAT,
VIPS_PRECISION_APPROXIMATE,
VIPS_PRECISION_LAST
} VipsPrecision;
/* Just for testing.
*/
VIPS_API
char *vips_path_filename7(const char *path);
VIPS_API
char *vips_path_mode7(const char *path);
struct _VipsImage;
typedef struct _VipsImage VipsImage;
struct _VipsRegion;
typedef struct _VipsRegion VipsRegion;
struct _VipsBuf;
typedef struct _VipsBuf VipsBuf;
struct _VipsSource;
typedef struct _VipsSource VipsSource;
struct _VipsTarget;
typedef struct _VipsTarget VipsTarget;
struct _VipsInterpolate;
typedef struct _VipsInterpolate VipsInterpolate;
struct _VipsOperation;
typedef struct _VipsOperation VipsOperation;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_BASIC_H*/

View File

@@ -0,0 +1,118 @@
/* A static string buffer, with overflow protection.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_BUF_H
#define VIPS_BUF_H
#include <glib.h>
#include <glib-object.h>
#include <vips/basic.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* A string in the process of being written to ... multiple calls to
* vips_buf_append add to it. On overflow append "..." and block further
* writes.
*/
struct _VipsBuf {
/* All fields are private.
*/
/*< private >*/
char *base; /* String base */
int mx; /* Maximum length */
int i; /* Current write point */
gboolean full; /* String has filled, block writes */
int lasti; /* For read-recent */
gboolean dynamic; /* We own the string with malloc() */
};
#define VIPS_BUF_STATIC(TEXT) \
{ \
&TEXT[0], sizeof(TEXT), 0, FALSE, 0, FALSE \
}
/* Init and append to one of the above.
*/
VIPS_API
void vips_buf_rewind(VipsBuf *buf);
VIPS_API
void vips_buf_destroy(VipsBuf *buf);
VIPS_API
void vips_buf_init(VipsBuf *buf);
VIPS_API
void vips_buf_set_static(VipsBuf *buf, char *base, int mx);
VIPS_API
void vips_buf_set_dynamic(VipsBuf *buf, int mx);
VIPS_API
void vips_buf_init_static(VipsBuf *buf, char *base, int mx);
VIPS_API
void vips_buf_init_dynamic(VipsBuf *buf, int mx);
VIPS_API
gboolean vips_buf_appendns(VipsBuf *buf, const char *str, int sz);
VIPS_API
gboolean vips_buf_appends(VipsBuf *buf, const char *str);
VIPS_API
gboolean vips_buf_appendf(VipsBuf *buf, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);
VIPS_API
gboolean vips_buf_vappendf(VipsBuf *buf, const char *fmt, va_list ap);
VIPS_API
gboolean vips_buf_appendc(VipsBuf *buf, char ch);
VIPS_API
gboolean vips_buf_appendgv(VipsBuf *buf, GValue *value);
VIPS_API
gboolean vips_buf_append_size(VipsBuf *buf, size_t n);
VIPS_API
gboolean vips_buf_removec(VipsBuf *buf, char ch);
VIPS_API
gboolean vips_buf_change(VipsBuf *buf, const char *o, const char *n);
VIPS_API
gboolean vips_buf_is_empty(VipsBuf *buf);
VIPS_API
gboolean vips_buf_is_full(VipsBuf *buf);
VIPS_API
const char *vips_buf_all(VipsBuf *buf);
VIPS_API
const char *vips_buf_firstline(VipsBuf *buf);
VIPS_API
gboolean vips_buf_appendg(VipsBuf *buf, double g);
VIPS_API
gboolean vips_buf_appendd(VipsBuf *buf, int d);
VIPS_API
int vips_buf_len(VipsBuf *buf);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_BUF_H*/

View File

@@ -0,0 +1,308 @@
/* Definitions for VIPS colour package.
*
* J.Cupitt, 8/4/93
* 15/7/96 JC
* - C++ stuff added
* 20/2/98 JC
* - new display calibration added
* 26/9/05
* - added IM_ prefix to colour temps
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_COLOUR_H
#define VIPS_COLOUR_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* Areas under curves for Dxx. 2 degree observer.
*/
#define VIPS_D93_X0 (89.7400)
#define VIPS_D93_Y0 (100.0)
#define VIPS_D93_Z0 (130.7700)
#define VIPS_D75_X0 (94.9682)
#define VIPS_D75_Y0 (100.0)
#define VIPS_D75_Z0 (122.5710)
/* D65 temp 6504.
*/
#define VIPS_D65_X0 (95.0470)
#define VIPS_D65_Y0 (100.0)
#define VIPS_D65_Z0 (108.8827)
#define VIPS_D55_X0 (95.6831)
#define VIPS_D55_Y0 (100.0)
#define VIPS_D55_Z0 (92.0871)
#define VIPS_D50_X0 (96.4250)
#define VIPS_D50_Y0 (100.0)
#define VIPS_D50_Z0 (82.4680)
/* A temp 2856k.
*/
#define VIPS_A_X0 (109.8503)
#define VIPS_A_Y0 (100.0)
#define VIPS_A_Z0 (35.5849)
/* B temp 4874k.
*/
#define VIPS_B_X0 (99.0720)
#define VIPS_B_Y0 (100.0)
#define VIPS_B_Z0 (85.2230)
/* C temp 6774k.
*/
#define VIPS_C_X0 (98.0700)
#define VIPS_C_Y0 (100.0)
#define VIPS_C_Z0 (118.2300)
#define VIPS_E_X0 (100.0)
#define VIPS_E_Y0 (100.0)
#define VIPS_E_Z0 (100.0)
#define VIPS_D3250_X0 (105.6590)
#define VIPS_D3250_Y0 (100.0)
#define VIPS_D3250_Z0 (45.8501)
/* Note: constants align with those defined in lcms2.h.
*/
typedef enum {
VIPS_INTENT_PERCEPTUAL = 0,
VIPS_INTENT_RELATIVE,
VIPS_INTENT_SATURATION,
VIPS_INTENT_ABSOLUTE,
VIPS_INTENT_LAST
} VipsIntent;
typedef enum {
VIPS_PCS_LAB,
VIPS_PCS_XYZ,
VIPS_PCS_LAST
} VipsPCS;
VIPS_API
gboolean vips_colourspace_issupported(const VipsImage *image);
VIPS_API
int vips_colourspace(VipsImage *in, VipsImage **out,
VipsInterpretation space, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_LabQ2sRGB(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rad2float(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_float2rad(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_LabS2LabQ(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_LabQ2LabS(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_LabQ2Lab(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_Lab2LabQ(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_LCh2Lab(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_Lab2LCh(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_Yxy2Lab(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_CMC2XYZ(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_Lab2XYZ(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_XYZ2Lab(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_XYZ2scRGB(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_scRGB2sRGB(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_scRGB2BW(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sRGB2scRGB(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_scRGB2XYZ(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_HSV2sRGB(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sRGB2HSV(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_LCh2CMC(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_CMC2LCh(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_XYZ2Yxy(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_Yxy2XYZ(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_LabS2Lab(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_Lab2LabS(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_CMYK2XYZ(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_XYZ2CMYK(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_profile_load(const char *name, VipsBlob **profile, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_icc_present(void);
VIPS_API
int vips_icc_transform(VipsImage *in, VipsImage **out,
const char *output_profile, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_icc_import(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_icc_export(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_icc_ac2rc(VipsImage *in, VipsImage **out,
const char *profile_filename);
VIPS_API
gboolean vips_icc_is_compatible_profile(VipsImage *image,
const void *data, size_t data_length);
VIPS_API
int vips_dE76(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_dE00(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_dECMC(VipsImage *left, VipsImage *right, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
void vips_col_Lab2XYZ(float L, float a, float b,
float *X, float *Y, float *Z);
VIPS_API
void vips_col_XYZ2Lab(float X, float Y, float Z,
float *L, float *a, float *b);
VIPS_API
double vips_col_ab2h(double a, double b);
VIPS_API
void vips_col_ab2Ch(float a, float b, float *C, float *h);
VIPS_API
void vips_col_Ch2ab(float C, float h, float *a, float *b);
VIPS_API
float vips_col_L2Lcmc(float L);
VIPS_API
float vips_col_C2Ccmc(float C);
VIPS_API
float vips_col_Ch2hcmc(float C, float h);
VIPS_API
void vips_col_make_tables_CMC(void);
VIPS_API
float vips_col_Lcmc2L(float Lcmc);
VIPS_API
float vips_col_Ccmc2C(float Ccmc);
VIPS_API
float vips_col_Chcmc2h(float C, float hcmc);
VIPS_API
int vips_col_sRGB2scRGB_8(int r, int g, int b, float *R, float *G, float *B);
VIPS_API
int vips_col_sRGB2scRGB_16(int r, int g, int b, float *R, float *G, float *B);
VIPS_API
int vips_col_sRGB2scRGB_8_noclip(int r, int g, int b,
float *R, float *G, float *B);
VIPS_API
int vips_col_sRGB2scRGB_16_noclip(int r, int g, int b,
float *R, float *G, float *B);
VIPS_API
int vips_col_scRGB2XYZ(float R, float G, float B,
float *X, float *Y, float *Z);
VIPS_API
int vips_col_XYZ2scRGB(float X, float Y, float Z,
float *R, float *G, float *B);
VIPS_API
int vips_col_scRGB2sRGB_8(float R, float G, float B,
int *r, int *g, int *b, int *og);
VIPS_API
int vips_col_scRGB2sRGB_16(float R, float G, float B,
int *r, int *g, int *b, int *og);
VIPS_API
int vips_col_scRGB2BW_16(float R, float G, float B, int *g, int *og);
VIPS_API
int vips_col_scRGB2BW_8(float R, float G, float B, int *g, int *og);
VIPS_API
float vips_pythagoras(float L1, float a1, float b1,
float L2, float a2, float b2);
VIPS_API
float vips_col_dE00(
float L1, float a1, float b1, float L2, float a2, float b2);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_COLOUR_H*/

View File

@@ -0,0 +1,571 @@
/* A byte source/sink .. it can be a pipe, socket, or perhaps a node.js stream.
*
* J.Cupitt, 19/6/14
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_CONNECTION_H
#define VIPS_CONNECTION_H
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <vips/object.h>
#include <vips/type.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#define VIPS_TYPE_CONNECTION (vips_connection_get_type())
#define VIPS_CONNECTION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_CONNECTION, VipsConnection))
#define VIPS_CONNECTION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_CONNECTION, VipsConnectionClass))
#define VIPS_IS_CONNECTION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_CONNECTION))
#define VIPS_IS_CONNECTION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_CONNECTION))
#define VIPS_CONNECTION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_CONNECTION, VipsConnectionClass))
/* Communicate with something like a socket or pipe.
*/
typedef struct _VipsConnection {
VipsObject parent_object;
/*< private >*/
/* Read/write this fd if connected to a system pipe/socket. Override
* ::read() and ::write() to do something else.
*/
int descriptor;
/* A descriptor we close with vips_tracked_close().
*/
int tracked_descriptor;
/* A descriptor we close with close().
*/
int close_descriptor;
/* If descriptor is a file, the filename we opened. Handy for error
* messages.
*/
char *filename;
} VipsConnection;
typedef struct _VipsConnectionClass {
VipsObjectClass parent_class;
} VipsConnectionClass;
VIPS_API
GType vips_connection_get_type(void);
VIPS_API
const char *vips_connection_filename(VipsConnection *connection);
VIPS_API
const char *vips_connection_nick(VipsConnection *connection);
VIPS_API
void vips_pipe_read_limit_set(gint64 limit);
#define VIPS_TYPE_SOURCE (vips_source_get_type())
#define VIPS_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_SOURCE, VipsSource))
#define VIPS_SOURCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_SOURCE, VipsSourceClass))
#define VIPS_IS_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_SOURCE))
#define VIPS_IS_SOURCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_SOURCE))
#define VIPS_SOURCE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_SOURCE, VipsSourceClass))
/* Read from something like a socket, file or memory area and present the data
* with a unified seek / read / map interface.
*
* During the header phase, we save data from unseekable sources in a buffer
* so readers can rewind and read again. We don't buffer data during the
* decode stage.
*/
struct _VipsSource {
VipsConnection parent_object;
/* We have two phases:
*
* During the header phase, we save bytes read from the input (if this
* is an unseekable source) so that we can rewind and try again, if
* necessary.
*
* Once we reach decode phase, we no longer support rewind and the
* buffer of saved data is discarded.
*/
gboolean decode;
/* TRUE if this input is something like a pipe. These don't support
* seek or map -- all you can do is read() bytes sequentially.
*
* If you attempt to map or get the size of a pipe-style input, it'll
* get read entirely into memory. Seeks will cause read up to the seek
* point.
*/
gboolean have_tested_seek;
gboolean is_pipe;
/* The current read point and length.
*
* length is -1 for is_pipe sources.
*
* off_t can be 32 bits on some platforms, so make sure we have a
* full 64.
*/
gint64 read_position;
gint64 length;
/*< private >*/
/* For sources where we have the whole image in memory (from a memory
* buffer, from mmaping the file, from reading the pipe into memory),
* a pointer to the start.
*/
const void *data;
/* For is_pipe sources, save data read during header phase here. If
* we rewind and try again, serve data from this until it runs out.
*
* If we need to force the whole pipe into memory, read everything to
* this and put a copy of the pointer in data.
*/
GByteArray *header_bytes;
/* Save the first few bytes here for file type sniffing.
*/
GByteArray *sniff;
/* For a memory source, the blob we read from.
*/
VipsBlob *blob;
/* If we mmaped the file, what we need to unmmap on finalize.
*/
void *mmap_baseaddr;
size_t mmap_length;
};
typedef struct _VipsSourceClass {
VipsConnectionClass parent_class;
/* Subclasses can define these to implement other source methods.
*/
/* Read from the source into the supplied buffer, args exactly as
* read(2). Set errno on error.
*
* We must return gint64, since ssize_t is often defined as unsigned
* on Windows.
*/
gint64 (*read)(VipsSource *, void *, size_t);
/* Seek to a certain position, args exactly as lseek(2). Set errno on
* error.
*
* Unseekable sources should always return -1. VipsSource will then
* seek by _read()ing bytes into memory as required.
*
* We have to use int64 rather than off_t, since we must work on
* Windows, where off_t can be 32-bits.
*/
gint64 (*seek)(VipsSource *, gint64, int);
} VipsSourceClass;
VIPS_API
GType vips_source_get_type(void);
VIPS_API
VipsSource *vips_source_new_from_descriptor(int descriptor);
VIPS_API
VipsSource *vips_source_new_from_file(const char *filename);
VIPS_API
VipsSource *vips_source_new_from_blob(VipsBlob *blob);
VIPS_API
VipsSource *vips_source_new_from_target(VipsTarget *target);
VIPS_API
VipsSource *vips_source_new_from_memory(const void *data, size_t size);
VIPS_API
VipsSource *vips_source_new_from_options(const char *options);
VIPS_API
void vips_source_minimise(VipsSource *source);
VIPS_API
int vips_source_unminimise(VipsSource *source);
VIPS_API
int vips_source_decode(VipsSource *source);
VIPS_API
gint64 vips_source_read(VipsSource *source, void *data, size_t length);
VIPS_API
gboolean vips_source_is_mappable(VipsSource *source);
VIPS_API
gboolean vips_source_is_file(VipsSource *source);
VIPS_API
const void *vips_source_map(VipsSource *source, size_t *length);
VIPS_API
VipsBlob *vips_source_map_blob(VipsSource *source);
VIPS_API
gint64 vips_source_seek(VipsSource *source, gint64 offset, int whence);
VIPS_API
int vips_source_rewind(VipsSource *source);
VIPS_API
gint64 vips_source_sniff_at_most(VipsSource *source,
unsigned char **data, size_t length);
VIPS_API
unsigned char *vips_source_sniff(VipsSource *source, size_t length);
VIPS_API
gint64 vips_source_length(VipsSource *source);
#define VIPS_TYPE_SOURCE_CUSTOM (vips_source_custom_get_type())
#define VIPS_SOURCE_CUSTOM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_SOURCE_CUSTOM, VipsSourceCustom))
#define VIPS_SOURCE_CUSTOM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_SOURCE_CUSTOM, VipsSourceCustomClass))
#define VIPS_IS_SOURCE_CUSTOM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_SOURCE_CUSTOM))
#define VIPS_IS_SOURCE_CUSTOM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_SOURCE_CUSTOM))
#define VIPS_SOURCE_CUSTOM_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_SOURCE_CUSTOM, VipsSourceCustomClass))
/* Subclass of source_custom with signals for handlers. This is supposed to be
* useful for language bindings.
*/
typedef struct _VipsSourceCustom {
VipsSource parent_object;
} VipsSourceCustom;
typedef struct _VipsSourceCustomClass {
VipsSourceClass parent_class;
/* The action signals clients can use to implement read and seek.
* We must use gint64 everywhere since there's no G_TYPE_SIZE.
*/
gint64 (*read)(VipsSourceCustom *, void *, gint64);
gint64 (*seek)(VipsSourceCustom *, gint64, int);
} VipsSourceCustomClass;
VIPS_API
GType vips_source_custom_get_type(void);
VIPS_API
VipsSourceCustom *vips_source_custom_new(void);
/* A GInputStream that wraps a VipsSource. This lets us eg.
* hook librsvg up to libvips using their GInputStream interface.
*/
#define VIPS_TYPE_G_INPUT_STREAM (vips_g_input_stream_get_type())
#define VIPS_G_INPUT_STREAM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_G_INPUT_STREAM, VipsGInputStream))
#define VIPS_G_INPUT_STREAM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_G_INPUT_STREAM, VipsGInputStreamClass))
#define VIPS_IS_G_INPUT_STREAM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_G_INPUT_STREAM))
#define VIPS_IS_G_INPUT_STREAM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_G_INPUT_STREAM))
#define VIPS_G_INPUT_STREAM_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_G_INPUT_STREAM, VipsGInputStreamClass))
typedef struct _VipsGInputStream {
GInputStream parent_instance;
/*< private >*/
/* The VipsSource we wrap.
*/
VipsSource *source;
} VipsGInputStream;
typedef struct _VipsGInputStreamClass {
GInputStreamClass parent_class;
} VipsGInputStreamClass;
VIPS_API
GInputStream *vips_g_input_stream_new_from_source(VipsSource *source);
/* A VipsSource that wraps a GInputStream. This lets us eg. load PNGs from
* GFile objects.
*/
#define VIPS_TYPE_SOURCE_G_INPUT_STREAM (vips_source_g_input_stream_get_type())
#define VIPS_SOURCE_G_INPUT_STREAM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_SOURCE_G_INPUT_STREAM, VipsSourceGInputStream))
#define VIPS_SOURCE_G_INPUT_STREAM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_SOURCE_G_INPUT_STREAM, VipsSourceGInputStreamClass))
#define VIPS_IS_SOURCE_G_INPUT_STREAM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_SOURCE_G_INPUT_STREAM))
#define VIPS_IS_SOURCE_G_INPUT_STREAM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_SOURCE_G_INPUT_STREAM))
#define VIPS_SOURCE_G_INPUT_STREAM_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_SOURCE_G_INPUT_STREAM, VipsSourceGInputStreamClass))
typedef struct _VipsSourceGInputStream {
VipsSource parent_instance;
/*< private >*/
/* The GInputStream we wrap.
*/
GInputStream *stream;
GSeekable *seekable;
GFileInfo *info;
} VipsSourceGInputStream;
typedef struct _VipsSourceGInputStreamClass {
VipsSourceClass parent_class;
} VipsSourceGInputStreamClass;
VIPS_API
VipsSourceGInputStream *vips_source_g_input_stream_new(GInputStream *stream);
#define VIPS_TYPE_TARGET (vips_target_get_type())
#define VIPS_TARGET(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_TARGET, VipsTarget))
#define VIPS_TARGET_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_TARGET, VipsTargetClass))
#define VIPS_IS_TARGET(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_TARGET))
#define VIPS_IS_TARGET_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_TARGET))
#define VIPS_TARGET_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_TARGET, VipsTargetClass))
/* PNG writes in 8kb chunks, so we need to be a little larger than that.
*/
#define VIPS_TARGET_BUFFER_SIZE (8500)
/* Output to something like a socket, pipe or memory area.
*/
struct _VipsTarget {
VipsConnection parent_object;
/*< private >*/
/* This target should write to memory.
*/
gboolean memory;
/* The target has been ended and can no longer be written.
*/
gboolean ended;
/* Write memory output here. We use a GString rather than a
* GByteArray since we need eg. g_string_overwrite_len().
* @position tracks the current write position in this.
*/
GString *memory_buffer;
/* And return memory via this blob.
*/
VipsBlob *blob;
/* Buffer small writes here. write_point is the index of the next
* character to write.
*/
unsigned char output_buffer[VIPS_TARGET_BUFFER_SIZE];
int write_point;
/* Write position in memory_buffer.
*
* off_t can be 32 bits on some platforms, so make sure we have a
* full 64.
*/
gint64 position;
/* Temp targets on the filesystem need deleting, sometimes.
*/
gboolean delete_on_close;
char *delete_on_close_filename;
};
typedef struct _VipsTargetClass {
VipsConnectionClass parent_class;
/* Write to output. Args exactly as write(2).
*
* We must return gint64, since ssize_t is often defined as unsigned
* on Windows.
*/
gint64 (*write)(VipsTarget *, const void *, size_t);
/* Deprecated in favour of ::end.
*/
void (*finish)(VipsTarget *);
/* libtiff needs to be able to seek and read on targets,
* unfortunately.
*
* This will not work for eg. pipes, of course.
*/
/* Read from the target into the supplied buffer, args exactly as
* read(2). Set errno on error.
*
* We must return gint64, since ssize_t is often defined as unsigned
* on Windows.
*/
gint64 (*read)(VipsTarget *, void *, size_t);
/* Seek output. Args exactly as lseek(2).
*
* We have to use int64 rather than off_t, since we must work on
* Windows, where off_t can be 32-bits.
*/
gint64 (*seek)(VipsTarget *, gint64 offset, int whence);
/* Output has been generated, so do any clearing up,
* eg. copy the bytes we saved in memory to the target blob.
*/
int (*end)(VipsTarget *);
} VipsTargetClass;
VIPS_API
GType vips_target_get_type(void);
VIPS_API
VipsTarget *vips_target_new_to_descriptor(int descriptor);
VIPS_API
VipsTarget *vips_target_new_to_file(const char *filename);
VIPS_API
VipsTarget *vips_target_new_to_memory(void);
VIPS_API
VipsTarget *vips_target_new_temp(VipsTarget *target);
VIPS_API
int vips_target_write(VipsTarget *target, const void *data, size_t length);
VIPS_API
gint64 vips_target_read(VipsTarget *target, void *buffer, size_t length);
VIPS_API
gint64 vips_target_seek(VipsTarget *target, gint64 offset, int whence);
VIPS_API
int vips_target_end(VipsTarget *target);
VIPS_API
unsigned char *vips_target_steal(VipsTarget *target, size_t *length);
VIPS_API
char *vips_target_steal_text(VipsTarget *target);
VIPS_API
int vips_target_putc(VipsTarget *target, int ch);
#define VIPS_TARGET_PUTC(S, C) ( \
(S)->write_point < VIPS_TARGET_BUFFER_SIZE \
? ((S)->output_buffer[(S)->write_point++] = (C), 0) \
: vips_target_putc((S), (C)))
VIPS_API
int vips_target_writes(VipsTarget *target, const char *str);
VIPS_API
int vips_target_writef(VipsTarget *target, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);
VIPS_API
int vips_target_write_amp(VipsTarget *target, const char *str);
#define VIPS_TYPE_TARGET_CUSTOM (vips_target_custom_get_type())
#define VIPS_TARGET_CUSTOM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_TARGET_CUSTOM, VipsTargetCustom))
#define VIPS_TARGET_CUSTOM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_TARGET_CUSTOM, VipsTargetCustomClass))
#define VIPS_IS_TARGET_CUSTOM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_TARGET_CUSTOM))
#define VIPS_IS_TARGET_CUSTOM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_TARGET_CUSTOM))
#define VIPS_TARGET_CUSTOM_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_TARGET_CUSTOM, VipsTargetCustomClass))
#define VIPS_TARGET_CUSTOM_BUFFER_SIZE (4096)
/* Output to something like a socket, pipe or memory area.
*/
typedef struct _VipsTargetCustom {
VipsTarget parent_object;
} VipsTargetCustom;
typedef struct _VipsTargetCustomClass {
VipsTargetClass parent_class;
/* The action signals clients can use to implement write and finish.
* We must use gint64 everywhere since there's no G_TYPE_SIZE.
*/
gint64 (*write)(VipsTargetCustom *, const void *, gint64);
void (*finish)(VipsTargetCustom *);
gint64 (*read)(VipsTargetCustom *, void *, gint64);
gint64 (*seek)(VipsTargetCustom *, gint64, int);
int (*end)(VipsTargetCustom *);
} VipsTargetCustomClass;
VIPS_API
GType vips_target_custom_get_type(void);
VIPS_API
VipsTargetCustom *vips_target_custom_new(void);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_CONNECTION_H*/

View File

@@ -0,0 +1,354 @@
/* conversion.h
*
* 20/9/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_CONVERSION_H
#define VIPS_CONVERSION_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef enum {
VIPS_EXTEND_BLACK,
VIPS_EXTEND_COPY,
VIPS_EXTEND_REPEAT,
VIPS_EXTEND_MIRROR,
VIPS_EXTEND_WHITE,
VIPS_EXTEND_BACKGROUND,
VIPS_EXTEND_LAST
} VipsExtend;
typedef enum {
VIPS_COMPASS_DIRECTION_CENTRE,
VIPS_COMPASS_DIRECTION_NORTH,
VIPS_COMPASS_DIRECTION_EAST,
VIPS_COMPASS_DIRECTION_SOUTH,
VIPS_COMPASS_DIRECTION_WEST,
VIPS_COMPASS_DIRECTION_NORTH_EAST,
VIPS_COMPASS_DIRECTION_SOUTH_EAST,
VIPS_COMPASS_DIRECTION_SOUTH_WEST,
VIPS_COMPASS_DIRECTION_NORTH_WEST,
VIPS_COMPASS_DIRECTION_LAST
} VipsCompassDirection;
typedef enum {
VIPS_DIRECTION_HORIZONTAL,
VIPS_DIRECTION_VERTICAL,
VIPS_DIRECTION_LAST
} VipsDirection;
typedef enum {
VIPS_ALIGN_LOW,
VIPS_ALIGN_CENTRE,
VIPS_ALIGN_HIGH,
VIPS_ALIGN_LAST
} VipsAlign;
typedef enum {
VIPS_ANGLE_D0,
VIPS_ANGLE_D90,
VIPS_ANGLE_D180,
VIPS_ANGLE_D270,
VIPS_ANGLE_LAST
} VipsAngle;
typedef enum {
VIPS_ANGLE45_D0,
VIPS_ANGLE45_D45,
VIPS_ANGLE45_D90,
VIPS_ANGLE45_D135,
VIPS_ANGLE45_D180,
VIPS_ANGLE45_D225,
VIPS_ANGLE45_D270,
VIPS_ANGLE45_D315,
VIPS_ANGLE45_LAST
} VipsAngle45;
typedef enum {
VIPS_INTERESTING_NONE,
VIPS_INTERESTING_CENTRE,
VIPS_INTERESTING_ENTROPY,
VIPS_INTERESTING_ATTENTION,
VIPS_INTERESTING_LOW,
VIPS_INTERESTING_HIGH,
VIPS_INTERESTING_ALL,
VIPS_INTERESTING_LAST
} VipsInteresting;
typedef enum {
VIPS_BLEND_MODE_CLEAR,
VIPS_BLEND_MODE_SOURCE,
VIPS_BLEND_MODE_OVER,
VIPS_BLEND_MODE_IN,
VIPS_BLEND_MODE_OUT,
VIPS_BLEND_MODE_ATOP,
VIPS_BLEND_MODE_DEST,
VIPS_BLEND_MODE_DEST_OVER,
VIPS_BLEND_MODE_DEST_IN,
VIPS_BLEND_MODE_DEST_OUT,
VIPS_BLEND_MODE_DEST_ATOP,
VIPS_BLEND_MODE_XOR,
VIPS_BLEND_MODE_ADD,
VIPS_BLEND_MODE_SATURATE,
VIPS_BLEND_MODE_MULTIPLY,
VIPS_BLEND_MODE_SCREEN,
VIPS_BLEND_MODE_OVERLAY,
VIPS_BLEND_MODE_DARKEN,
VIPS_BLEND_MODE_LIGHTEN,
VIPS_BLEND_MODE_COLOUR_DODGE,
VIPS_BLEND_MODE_COLOUR_BURN,
VIPS_BLEND_MODE_HARD_LIGHT,
VIPS_BLEND_MODE_SOFT_LIGHT,
VIPS_BLEND_MODE_DIFFERENCE,
VIPS_BLEND_MODE_EXCLUSION,
VIPS_BLEND_MODE_LAST
} VipsBlendMode;
VIPS_API
int vips_copy(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_tilecache(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_linecache(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sequential(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_copy_file(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_embed(VipsImage *in, VipsImage **out,
int x, int y, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gravity(VipsImage *in, VipsImage **out,
VipsCompassDirection direction, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_flip(VipsImage *in, VipsImage **out, VipsDirection direction, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_insert(VipsImage *main, VipsImage *sub, VipsImage **out,
int x, int y, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_join(VipsImage *in1, VipsImage *in2, VipsImage **out,
VipsDirection direction, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_arrayjoin(VipsImage **in, VipsImage **out, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_extract_area(VipsImage *in, VipsImage **out,
int left, int top, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_crop(VipsImage *in, VipsImage **out,
int left, int top, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_smartcrop(VipsImage *in, VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_extract_band(VipsImage *in, VipsImage **out, int band, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_replicate(VipsImage *in, VipsImage **out, int across, int down, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_grid(VipsImage *in, VipsImage **out,
int tile_height, int across, int down, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_transpose3d(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_wrap(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rot(VipsImage *in, VipsImage **out, VipsAngle angle, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rot90(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rot180(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rot270(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rot45(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
void vips_autorot_remove_angle(VipsImage *image);
VIPS_API
int vips_autorot(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_zoom(VipsImage *in, VipsImage **out, int xfac, int yfac, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_subsample(VipsImage *in, VipsImage **out, int xfac, int yfac, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast(VipsImage *in, VipsImage **out, VipsBandFormat format, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_uchar(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_char(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_ushort(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_short(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_uint(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_int(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_float(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_double(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_complex(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_cast_dpcomplex(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_scale(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_msb(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_byteswap(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandjoin(VipsImage **in, VipsImage **out, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandjoin2(VipsImage *in1, VipsImage *in2, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandjoin_const(VipsImage *in, VipsImage **out, double *c, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandjoin_const1(VipsImage *in, VipsImage **out, double c, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandrank(VipsImage **in, VipsImage **out, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandfold(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandunfold(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandbool(VipsImage *in, VipsImage **out,
VipsOperationBoolean boolean, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandand(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandor(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandeor(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_bandmean(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_recomb(VipsImage *in, VipsImage **out, VipsImage *m, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_ifthenelse(VipsImage *cond, VipsImage *in1, VipsImage *in2,
VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_switch(VipsImage **tests, VipsImage **out, int n, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_flatten(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_addalpha(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_premultiply(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_unpremultiply(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_composite(VipsImage **in, VipsImage **out, int n, int *mode, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_composite2(VipsImage *base, VipsImage *overlay, VipsImage **out,
VipsBlendMode mode, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_falsecolour(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gamma(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_CONVERSION_H*/

View File

@@ -0,0 +1,101 @@
/* convolution.h
*
* 20/9/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_CONVOLUTION_H
#define VIPS_CONVOLUTION_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef enum {
VIPS_COMBINE_MAX,
VIPS_COMBINE_SUM,
VIPS_COMBINE_MIN,
VIPS_COMBINE_LAST
} VipsCombine;
VIPS_API
int vips_conv(VipsImage *in, VipsImage **out, VipsImage *mask, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_convf(VipsImage *in, VipsImage **out, VipsImage *mask, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_convi(VipsImage *in, VipsImage **out, VipsImage *mask, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_conva(VipsImage *in, VipsImage **out, VipsImage *mask, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_convsep(VipsImage *in, VipsImage **out, VipsImage *mask, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_convasep(VipsImage *in, VipsImage **out, VipsImage *mask, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_compass(VipsImage *in, VipsImage **out, VipsImage *mask, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gaussblur(VipsImage *in, VipsImage **out, double sigma, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sharpen(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_spcor(VipsImage *in, VipsImage *ref, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_fastcor(VipsImage *in, VipsImage *ref, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sobel(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_scharr(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_prewitt(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_canny(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_CONVOLUTION_H*/

View File

@@ -0,0 +1,172 @@
/* create.h
*
* 20/9/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_CREATE_H
#define VIPS_CREATE_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef enum {
VIPS_TEXT_WRAP_WORD = 0,
VIPS_TEXT_WRAP_CHAR,
VIPS_TEXT_WRAP_WORD_CHAR,
VIPS_TEXT_WRAP_NONE,
VIPS_TEXT_WRAP_LAST
} VipsTextWrap;
typedef enum {
VIPS_SDF_SHAPE_CIRCLE = 0,
VIPS_SDF_SHAPE_BOX,
VIPS_SDF_SHAPE_ROUNDED_BOX,
VIPS_SDF_SHAPE_LINE,
VIPS_SDF_SHAPE_LAST
} VipsSdfShape;
VIPS_API
int vips_black(VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_xyz(VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_grey(VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gaussmat(VipsImage **out, double sigma, double min_ampl, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_logmat(VipsImage **out, double sigma, double min_ampl, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_text(VipsImage **out, const char *text, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gaussnoise(VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_eye(VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sines(VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_zone(VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_sdf(VipsImage **out, int width, int height, VipsSdfShape shape, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_identity(VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_buildlut(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_invertlut(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_tonelut(VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_ideal(VipsImage **out, int width, int height,
double frequency_cutoff, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_ideal_ring(VipsImage **out, int width, int height,
double frequency_cutoff, double ringwidth, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_ideal_band(VipsImage **out, int width, int height,
double frequency_cutoff_x, double frequency_cutoff_y,
double radius, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_butterworth(VipsImage **out, int width, int height,
double order,
double frequency_cutoff, double amplitude_cutoff, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_butterworth_ring(VipsImage **out, int width, int height,
double order,
double frequency_cutoff, double amplitude_cutoff,
double ringwidth, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_butterworth_band(VipsImage **out, int width, int height,
double order,
double frequency_cutoff_x, double frequency_cutoff_y, double radius,
double amplitude_cutoff, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_gaussian(VipsImage **out, int width, int height,
double frequency_cutoff, double amplitude_cutoff, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_gaussian_ring(VipsImage **out, int width, int height,
double frequency_cutoff, double amplitude_cutoff,
double ringwidth, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_gaussian_band(VipsImage **out, int width, int height,
double frequency_cutoff_x, double frequency_cutoff_y, double radius,
double amplitude_cutoff, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mask_fractal(VipsImage **out, int width, int height,
double fractal_dimension, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_fractsurf(VipsImage **out,
int width, int height, double fractal_dimension, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_worley(VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_perlin(VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_CREATE_H*/

View File

@@ -0,0 +1,101 @@
/* A dynamic memory buffer that expands as you write.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_DBUF_H
#define VIPS_DBUF_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#include <vips/vips.h>
/* A buffer in the process of being written to.
*/
typedef struct _VipsDbuf {
/* All fields are private.
*/
/*< private >*/
/* The current base, and the size of the allocated memory area.
*/
unsigned char *data;
size_t allocated_size;
/* The size of the actual data that's been written. This will usually
* be <= allocated_size, but always >= write_point.
*/
size_t data_size;
/* The write point.
*/
size_t write_point;
} VipsDbuf;
VIPS_API
void vips_dbuf_init(VipsDbuf *dbuf);
VIPS_API
gboolean vips_dbuf_minimum_size(VipsDbuf *dbuf, size_t size);
VIPS_API
gboolean vips_dbuf_allocate(VipsDbuf *dbuf, size_t size);
VIPS_API
size_t vips_dbuf_read(VipsDbuf *dbuf, unsigned char *data, size_t size);
VIPS_API
unsigned char *vips_dbuf_get_write(VipsDbuf *dbuf, size_t *size);
VIPS_API
gboolean vips_dbuf_write(VipsDbuf *dbuf,
const unsigned char *data, size_t size);
VIPS_API
gboolean vips_dbuf_writef(VipsDbuf *dbuf, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);
VIPS_API
gboolean vips_dbuf_write_amp(VipsDbuf *dbuf, const char *str);
VIPS_API
void vips_dbuf_reset(VipsDbuf *dbuf);
VIPS_API
void vips_dbuf_destroy(VipsDbuf *dbuf);
VIPS_API
gboolean vips_dbuf_seek(VipsDbuf *dbuf, off_t offset, int whence);
VIPS_API
void vips_dbuf_truncate(VipsDbuf *dbuf);
VIPS_API
off_t vips_dbuf_tell(VipsDbuf *dbuf);
VIPS_API
unsigned char *vips_dbuf_string(VipsDbuf *dbuf, size_t *size);
VIPS_API
unsigned char *vips_dbuf_steal(VipsDbuf *dbuf, size_t *size);
#endif /*VIPS_DBUF_H*/
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@@ -0,0 +1,106 @@
/* Support for debug.c in iofuncs.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_DEBUG_H
#define VIPS_DEBUG_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#ifdef VIPS_DEBUG
#define VIPS_DEBUG_MSG(...) \
G_STMT_START \
{ \
printf(__VA_ARGS__); \
} \
G_STMT_END
#else
#define VIPS_DEBUG_MSG(...) \
G_STMT_START \
{ \
; \
} \
G_STMT_END
#endif /*VIPS_DEBUG*/
#ifdef VIPS_DEBUG_RED
#define VIPS_DEBUG_MSG_RED(...) \
G_STMT_START \
{ \
printf("red: " __VA_ARGS__); \
} \
G_STMT_END
#else
#define VIPS_DEBUG_MSG_RED(...) \
G_STMT_START \
{ \
; \
} \
G_STMT_END
#endif /*VIPS_DEBUG_RED*/
#ifdef VIPS_DEBUG_AMBER
#define VIPS_DEBUG_MSG_AMBER(...) \
G_STMT_START \
{ \
printf("amber: " __VA_ARGS__); \
} \
G_STMT_END
#else
#define VIPS_DEBUG_MSG_AMBER(...) \
G_STMT_START \
{ \
; \
} \
G_STMT_END
#endif /*VIPS_DEBUG_AMBER*/
#ifdef VIPS_DEBUG_GREEN
#define VIPS_DEBUG_MSG_GREEN(...) \
G_STMT_START \
{ \
printf("green: " __VA_ARGS__); \
} \
G_STMT_END
#else
#define VIPS_DEBUG_MSG_GREEN(...) \
G_STMT_START \
{ \
; \
} \
G_STMT_END
#endif /*VIPS_DEBUG_GREEN*/
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /* VIPS_DEBUG_H */

View File

@@ -0,0 +1,155 @@
/* Old and broken stuff we do not enable by default
*
* 30/6/09
* - from vips.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_DEPRECATED_H
#define IM_DEPRECATED_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* On win32, need to override the wingdi defs for these. Yuk!
*/
#ifdef G_OS_WIN32
#ifdef RGB
#undef RGB
#endif
#ifdef CMYK
#undef CMYK
#endif
#endif /*G_OS_WIN32*/
/* Bits per Band */
#define BBBYTE 8
#define BBSHORT 16
#define BBINT 32
#define BBFLOAT 32
#define BBCOMPLEX 64 /* complex consisting of two floats */
#define BBDOUBLE 64
#define BBDPCOMPLEX 128 /* complex consisting of two doubles */
/* picture Type */
#define MULTIBAND 0
#define B_W 1
#define LUMINACE 2
#define XRAY 3
#define IR 4
#define YUV 5
#define RED_ONLY 6 /* red channel only */
#define GREEN_ONLY 7 /* green channel only */
#define BLUE_ONLY 8 /* blue channel only */
#define POWER_SPECTRUM 9
#define HISTOGRAM 10
#define FOURIER 24
/* Colour spaces.
*/
#define LUT 11
#define XYZ 12
#define LAB 13
#define CMC 14
#define CMYK 15
#define LABQ 16
#define RGB 17
#define UCS 18
#define LCH 19
#define LABS 21
#define sRGB 22
#define YXY 23
/* BandFmt
*/
#define FMTNOTSET -1
#define FMTUCHAR 0 /* pels interpreted as unsigned chars */
#define FMTCHAR 1 /* pels interpreted as signed chars */
#define FMTUSHORT 2 /* pels interpreted as unsigned shorts */
#define FMTSHORT 3 /* pels interpreted as signed shorts */
#define FMTUINT 4 /* pels interpreted as unsigned ints */
#define FMTINT 5 /* pels interpreted as signed ints */
#define FMTFLOAT 6 /* pels interpreted as floats */
#define FMTCOMPLEX 7 /* pels interpreted as complex (2 float each) */
#define FMTDOUBLE 8 /* pels interpreted as unsigned double */
#define FMTDPCOMPLEX 9 /* pels interpreted as complex (2 double each)*/
/* Coding type
*/
#define NOCODING 0
#define COLQUANT 1
#define LABPACK 2
#define LABPACK_COMPRESSED 3
#define RGB_COMPRESSED 4
#define LUM_COMPRESSED 5
/* Compression type
*/
#define NO_COMPRESSION 0
#define TCSF_COMPRESSION 1
#define JPEG_COMPRESSION 2
#define esize(I) IM_IMAGE_SIZEOF_ELEMENT(I)
#define psize(I) IM_IMAGE_SIZEOF_PEL(I)
#define lsize(I) IM_IMAGE_SIZEOF_LINE(I)
#define niele(I) IM_IMAGE_N_ELEMENTS(I)
#define lskip(B) IM_REGION_LSKIP(B)
#define nele(B) IM_REGION_N_ELEMENTS(B)
#define rsize(B) IM_REGION_SIZEOF_LINE(B)
#define addr(B, X, Y) IM_REGION_ADDR(B, X, Y)
#ifndef MAX
#define MAX(A, B) IM_MAX(A, B)
#define MIN(A, B) IM_MIN(A, B)
#endif /*MAX*/
#define CLIP(A, V, B) IM_CLIP(A, V, B)
#define NEW(IM, A) IM_NEW(IM, A)
#define NUMBER(R) IM_NUMBER(R)
#define ARRAY(IM, N, T) IM_ARRAY(IM, N, T)
#define RINT(R) IM_RINT(R)
#define CLIP_UCHAR(V, SEQ) IM_CLIP_UCHAR(V, SEQ)
#define CLIP_USHORT(V, SEQ) IM_CLIP_USHORT(V, SEQ)
#define CLIP_CHAR(V, SEQ) IM_CLIP_CHAR(V, SEQ)
#define CLIP_SHORT(V, SEQ) IM_CLIP_SHORT(V, SEQ)
#define CLIP_NONE(V, SEQ) IM_CLIP_NONE(V, SEQ)
#define right(R) IM_RECT_RIGHT(R)
#define bottom(R) IM_RECT_BOTTOM(R)
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*IM_DEPRECATED_H*/

View File

@@ -0,0 +1,388 @@
/* VIPS function dispatch.
*
* J. Cupitt, 8/4/93.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_DISPATCH_H
#define IM_DISPATCH_H
#include <glib-object.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#include <vips/vips.h>
#include <vips/util.h>
/* Type names. You may define your own, but if you use one of these, then
* you should use the built-in VIPS type converters.
*/
#define IM_TYPE_IMAGEVEC "imagevec" /* im_object is ptr to IMAGE[] */
#define IM_TYPE_DOUBLEVEC "doublevec" /* im_object is ptr to double[] */
#define IM_TYPE_INTVEC "intvec" /* im_object is ptr to int[] */
#define IM_TYPE_DOUBLE "double" /* im_object is ptr to double */
#define IM_TYPE_INT "integer" /* 32-bit integer */
#define IM_TYPE_COMPLEX "complex" /* Pair of doubles */
#define IM_TYPE_STRING "string" /* Zero-terminated char array */
#define IM_TYPE_IMASK "intmask" /* Integer mask type */
#define IM_TYPE_DMASK "doublemask" /* Double mask type */
#define IM_TYPE_IMAGE "image" /* IMAGE descriptor */
#define IM_TYPE_DISPLAY "display" /* Display descriptor */
#define IM_TYPE_GVALUE "gvalue" /* GValue wrapper */
#define IM_TYPE_INTERPOLATE "interpolate" /* A subclass of VipsInterpolate */
typedef char *im_arg_type; /* Type of argument id */
/* Internal representation of an argument to an image processing function.
*/
typedef void *im_object;
/* These bits are ored together to make the flags in a type descriptor.
*
* IM_TYPE_OUTPUT: set to indicate output, otherwise input. If the IM_TYPE_RW
* bit is set and IM_TYPE_OUTPUT is not set, both input and output (ie. the
* operation side-effects this argument).
*
* IM_TYPE_ARG: Two ways of making an im_object --- with and without a
* command-line string to help you along. Arguments with a string are thing
* like IMAGE descriptors, which require a filename to initialise.
* Arguments without are things like output numbers, where making the object
* simply involves allocating storage.
*/
typedef enum {
IM_TYPE_NONE = 0, /* No flags */
IM_TYPE_OUTPUT = 0x1, /* Output/input object */
IM_TYPE_ARG = 0x2, /* Uses a str arg in construction */
IM_TYPE_RW = 0x4 /* Read-write */
} im_type_flags;
/* Initialise, destroy and write objects. The "str" argument to the
* init function will not be supplied if this is not an ARG type. The
* write function writes to the GString.
*/
typedef int (*im_init_obj_fn)(im_object *obj, char *str);
typedef int (*im_dest_obj_fn)(im_object obj);
/* Describe a VIPS type.
*/
typedef struct {
im_arg_type type; /* Type of argument */
int size; /* sizeof(im_object repres.) */
im_type_flags flags; /* Flags */
im_init_obj_fn init; /* Operation functions */
im_dest_obj_fn dest; /* Destroy object */
} im_type_desc;
/* Success on an argument. This is called if the image processing function
* succeeds and should be used to (for example) print output.
*/
typedef int (*im_print_obj_fn)(im_object obj);
/* Describe a VIPS command argument.
*/
typedef struct {
char *name; /* eg. "width" */
im_type_desc *desc; /* Type description */
im_print_obj_fn print; /* Print some output objects */
} im_arg_desc;
/* Type of VIPS dispatch function.
*/
typedef int (*im_dispatch_fn)(im_object *argv);
/* Maximum size of arg table.
*/
#define IM_MAX_ARGS (1000)
/* Flags for functions. These are for information only, and more may be
* added.
*/
typedef enum {
IM_FN_NONE = 0, /* No flags set */
IM_FN_PIO = 0x1, /* Is a partial function */
IM_FN_TRANSFORM = 0x2, /* Performs coordinate transformations */
IM_FN_PTOP = 0x4, /* Point-to-point ... can be done with a LUT */
IM_FN_NOCACHE = 0x8 /* Result should not be cached */
} im_fn_flags;
/* Describe a VIPS function.
*/
typedef struct {
char *name; /* eg "im_invert" */
char *desc; /* Description - eg "photographic negative" */
im_fn_flags flags; /* Flags for this function */
im_dispatch_fn disp; /* Dispatch */
int argc; /* Number of args */
im_arg_desc *argv; /* Arg table */
} im_function;
/* A set of VIPS functions forming a package.
*/
typedef struct {
char *name; /* Package name (eg "arithmetic") */
int nfuncs; /* Number of functions in package */
im_function **table; /* Array of function descriptors */
} im_package;
/* Externs for dispatch.
*/
/* Struct for mask IO to a file.
*/
typedef struct {
char *name; /* Command-line name in */
void *mask; /* Mask --- DOUBLE or INT */
} im_mask_object;
/* Struct for doublevec IO
*/
typedef struct {
int n; /* Vector length */
double *vec; /* Vector */
} im_doublevec_object;
/* Struct for intvec IO
*/
typedef struct {
int n; /* Vector length */
int *vec; /* Vector */
} im_intvec_object;
/* Struct for imagevec IO
*/
typedef struct {
int n; /* Vector length */
IMAGE **vec; /* Vector */
} im_imagevec_object;
/* Built-in VIPS types.
*/
VIPS_DEPRECATED im_type_desc im__input_int;
VIPS_DEPRECATED im_type_desc im__input_intvec;
VIPS_DEPRECATED im_type_desc im__input_imask;
VIPS_DEPRECATED im_type_desc im__output_int;
VIPS_DEPRECATED im_type_desc im__output_intvec;
VIPS_DEPRECATED im_type_desc im__output_imask;
VIPS_DEPRECATED im_type_desc im__input_double;
VIPS_DEPRECATED im_type_desc im__input_doublevec;
VIPS_DEPRECATED im_type_desc im__input_dmask;
VIPS_DEPRECATED im_type_desc im__output_double;
VIPS_DEPRECATED im_type_desc im__output_doublevec;
VIPS_DEPRECATED im_type_desc im__output_dmask;
VIPS_DEPRECATED im_type_desc im__output_dmask_screen;
VIPS_DEPRECATED im_type_desc im__output_complex;
VIPS_DEPRECATED im_type_desc im__input_string;
VIPS_DEPRECATED im_type_desc im__output_string;
VIPS_DEPRECATED im_type_desc im__input_imagevec;
VIPS_DEPRECATED im_type_desc im__input_image;
VIPS_DEPRECATED im_type_desc im__output_image;
VIPS_DEPRECATED im_type_desc im__rw_image;
VIPS_DEPRECATED im_type_desc im__input_display;
VIPS_DEPRECATED im_type_desc im__output_display;
VIPS_DEPRECATED im_type_desc im__input_gvalue;
VIPS_DEPRECATED im_type_desc im__output_gvalue;
VIPS_DEPRECATED im_type_desc im__input_interpolate;
/* VIPS print functions.
*/
VIPS_DEPRECATED int im__iprint(im_object obj); /* int */
VIPS_DEPRECATED int im__ivprint(im_object obj); /* intvec */
VIPS_DEPRECATED int im__dprint(im_object obj); /* double */
VIPS_DEPRECATED int im__dvprint(im_object obj); /* doublevec */
VIPS_DEPRECATED int im__dmsprint(im_object obj); /* DOUBLEMASK as stats */
VIPS_DEPRECATED int im__cprint(im_object obj); /* complex */
VIPS_DEPRECATED int im__sprint(im_object obj); /* string */
VIPS_DEPRECATED int im__displayprint(im_object obj);/* im_col_display */
VIPS_DEPRECATED int im__gprint(im_object obj); /* GValue */
/* Macros for convenient creation.
*/
#define IM_INPUT_INT(S) \
{ \
S, &im__input_int, NULL \
}
#define IM_INPUT_INTVEC(S) \
{ \
S, &im__input_intvec, NULL \
}
#define IM_INPUT_IMASK(S) \
{ \
S, &im__input_imask, NULL \
}
#define IM_OUTPUT_INT(S) \
{ \
S, &im__output_int, im__iprint \
}
#define IM_OUTPUT_INTVEC(S) \
{ \
S, &im__output_intvec, im__ivprint \
}
#define IM_OUTPUT_IMASK(S) \
{ \
S, &im__output_imask, NULL \
}
#define IM_INPUT_DOUBLE(S) \
{ \
S, &im__input_double, NULL \
}
#define IM_INPUT_DOUBLEVEC(S) \
{ \
S, &im__input_doublevec, NULL \
}
#define IM_INPUT_DMASK(S) \
{ \
S, &im__input_dmask, NULL \
}
#define IM_OUTPUT_DOUBLE(S) \
{ \
S, &im__output_double, im__dprint \
}
#define IM_OUTPUT_DOUBLEVEC(S) \
{ \
S, &im__output_doublevec, im__dvprint \
}
#define IM_OUTPUT_DMASK(S) \
{ \
S, &im__output_dmask, NULL \
}
#define IM_OUTPUT_DMASK_STATS(S) \
{ \
S, &im__output_dmask_screen, im__dmsprint \
}
#define IM_OUTPUT_COMPLEX(S) \
{ \
S, &im__output_complex, im__cprint \
}
#define IM_INPUT_STRING(S) \
{ \
S, &im__input_string, NULL \
}
#define IM_OUTPUT_STRING(S) \
{ \
S, &im__output_string, im__sprint \
}
#define IM_INPUT_IMAGE(S) \
{ \
S, &im__input_image, NULL \
}
#define IM_INPUT_IMAGEVEC(S) \
{ \
S, &im__input_imagevec, NULL \
}
#define IM_OUTPUT_IMAGE(S) \
{ \
S, &im__output_image, NULL \
}
#define IM_RW_IMAGE(S) \
{ \
S, &im__rw_image, NULL \
}
#define IM_INPUT_DISPLAY(S) \
{ \
S, &im__input_display, NULL \
}
#define IM_OUTPUT_DISPLAY(S) \
{ \
S, &im__output_display, im__displayprint \
}
#define IM_INPUT_GVALUE(S) \
{ \
S, &im__input_gvalue, NULL \
}
#define IM_OUTPUT_GVALUE(S) \
{ \
S, &im__output_gvalue, im__gprint \
}
#define IM_INPUT_INTERPOLATE(S) \
{ \
S, &im__input_interpolate, NULL \
}
/* Add a plug-in package.
*/
VIPS_DEPRECATED
im_package *im_load_plugin(const char *name);
VIPS_DEPRECATED
int im_load_plugins(const char *fmt, ...)
G_GNUC_PRINTF(1, 2);
/* Close all plug-ins.
*/
VIPS_DEPRECATED
int im_close_plugins(void);
/* Loop over all loaded packages.
*/
VIPS_DEPRECATED
void *im_map_packages(VipsSListMap2Fn fn, void *a);
/* Convenience functions for finding packages, functions, etc.
*/
VIPS_DEPRECATED
im_function *im_find_function(const char *name);
VIPS_DEPRECATED
im_package *im_find_package(const char *name);
VIPS_DEPRECATED
im_package *im_package_of_function(const char *name);
/* Allocate space for, and free im_object argument lists.
*/
VIPS_DEPRECATED
int im_free_vargv(im_function *fn, im_object *vargv);
VIPS_DEPRECATED
int im_allocate_vargv(im_function *fn, im_object *vargv);
/* Run a VIPS command by name.
*/
VIPS_DEPRECATED
int im_run_command(char *name, int argc, char **argv);
VIPS_DEPRECATED
int vips__input_interpolate_init(im_object *obj, char *str);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*IM_DISPATCH_H*/

View File

@@ -0,0 +1,113 @@
/* draw.h
*
* 3/11/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_DRAW_H
#define VIPS_DRAW_H
#include <glib.h>
#include <glib-object.h>
#include <vips/object.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef enum {
VIPS_COMBINE_MODE_SET,
VIPS_COMBINE_MODE_ADD,
VIPS_COMBINE_MODE_LAST
} VipsCombineMode;
VIPS_API
int vips_draw_rect(VipsImage *image,
double *ink, int n, int left, int top, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_rect1(VipsImage *image,
double ink, int left, int top, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_point(VipsImage *image, double *ink, int n, int x, int y, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_point1(VipsImage *image, double ink, int x, int y, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_image(VipsImage *image, VipsImage *sub, int x, int y, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_mask(VipsImage *image,
double *ink, int n, VipsImage *mask, int x, int y, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_mask1(VipsImage *image,
double ink, VipsImage *mask, int x, int y, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_line(VipsImage *image,
double *ink, int n, int x1, int y1, int x2, int y2, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_line1(VipsImage *image,
double ink, int x1, int y1, int x2, int y2, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_circle(VipsImage *image,
double *ink, int n, int cx, int cy, int radius, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_circle1(VipsImage *image,
double ink, int cx, int cy, int radius, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_flood(VipsImage *image, double *ink, int n, int x, int y, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_flood1(VipsImage *image, double ink, int x, int y, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_draw_smudge(VipsImage *image,
int left, int top, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_DRAW_H*/

View File

@@ -0,0 +1,188 @@
/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
#ifndef VIPS_ENUM_TYPES_H
#define VIPS_ENUM_TYPES_H
G_BEGIN_DECLS
/* enumerations from "almostdeprecated.h" */
VIPS_API
GType vips_foreign_jpeg_subsample_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_JPEG_SUBSAMPLE (vips_foreign_jpeg_subsample_get_type())
/* enumerations from "arithmetic.h" */
VIPS_API
GType vips_operation_math_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_MATH (vips_operation_math_get_type())
VIPS_API
GType vips_operation_math2_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_MATH2 (vips_operation_math2_get_type())
VIPS_API
GType vips_operation_round_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_ROUND (vips_operation_round_get_type())
VIPS_API
GType vips_operation_relational_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_RELATIONAL (vips_operation_relational_get_type())
VIPS_API
GType vips_operation_boolean_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_BOOLEAN (vips_operation_boolean_get_type())
VIPS_API
GType vips_operation_complex_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_COMPLEX (vips_operation_complex_get_type())
VIPS_API
GType vips_operation_complex2_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_COMPLEX2 (vips_operation_complex2_get_type())
VIPS_API
GType vips_operation_complexget_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_COMPLEXGET (vips_operation_complexget_get_type())
/* enumerations from "basic.h" */
VIPS_API
GType vips_precision_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_PRECISION (vips_precision_get_type())
/* enumerations from "colour.h" */
VIPS_API
GType vips_intent_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_INTENT (vips_intent_get_type())
VIPS_API
GType vips_pcs_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_PCS (vips_pcs_get_type())
/* enumerations from "conversion.h" */
VIPS_API
GType vips_extend_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_EXTEND (vips_extend_get_type())
VIPS_API
GType vips_compass_direction_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_COMPASS_DIRECTION (vips_compass_direction_get_type())
VIPS_API
GType vips_direction_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_DIRECTION (vips_direction_get_type())
VIPS_API
GType vips_align_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_ALIGN (vips_align_get_type())
VIPS_API
GType vips_angle_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_ANGLE (vips_angle_get_type())
VIPS_API
GType vips_angle45_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_ANGLE45 (vips_angle45_get_type())
VIPS_API
GType vips_interesting_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_INTERESTING (vips_interesting_get_type())
VIPS_API
GType vips_blend_mode_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_BLEND_MODE (vips_blend_mode_get_type())
/* enumerations from "convolution.h" */
VIPS_API
GType vips_combine_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_COMBINE (vips_combine_get_type())
/* enumerations from "create.h" */
VIPS_API
GType vips_text_wrap_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_TEXT_WRAP (vips_text_wrap_get_type())
VIPS_API
GType vips_sdf_shape_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_SDF_SHAPE (vips_sdf_shape_get_type())
/* enumerations from "draw.h" */
VIPS_API
GType vips_combine_mode_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_COMBINE_MODE (vips_combine_mode_get_type())
/* enumerations from "foreign.h" */
VIPS_API
GType vips_foreign_flags_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_FLAGS (vips_foreign_flags_get_type())
VIPS_API
GType vips_fail_on_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FAIL_ON (vips_fail_on_get_type())
VIPS_API
GType vips_saveable_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_SAVEABLE (vips_saveable_get_type())
VIPS_API
GType vips_foreign_keep_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_KEEP (vips_foreign_keep_get_type())
VIPS_API
GType vips_foreign_subsample_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_SUBSAMPLE (vips_foreign_subsample_get_type())
VIPS_API
GType vips_foreign_webp_preset_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_WEBP_PRESET (vips_foreign_webp_preset_get_type())
VIPS_API
GType vips_foreign_tiff_compression_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_TIFF_COMPRESSION (vips_foreign_tiff_compression_get_type())
VIPS_API
GType vips_foreign_tiff_predictor_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_TIFF_PREDICTOR (vips_foreign_tiff_predictor_get_type())
VIPS_API
GType vips_foreign_tiff_resunit_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_TIFF_RESUNIT (vips_foreign_tiff_resunit_get_type())
VIPS_API
GType vips_foreign_png_filter_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_PNG_FILTER (vips_foreign_png_filter_get_type())
VIPS_API
GType vips_foreign_ppm_format_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_PPM_FORMAT (vips_foreign_ppm_format_get_type())
VIPS_API
GType vips_foreign_dz_layout_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_DZ_LAYOUT (vips_foreign_dz_layout_get_type())
VIPS_API
GType vips_foreign_dz_depth_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_DZ_DEPTH (vips_foreign_dz_depth_get_type())
VIPS_API
GType vips_foreign_dz_container_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_DZ_CONTAINER (vips_foreign_dz_container_get_type())
VIPS_API
GType vips_foreign_heif_compression_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_HEIF_COMPRESSION (vips_foreign_heif_compression_get_type())
VIPS_API
GType vips_foreign_heif_encoder_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_HEIF_ENCODER (vips_foreign_heif_encoder_get_type())
/* enumerations from "image.h" */
VIPS_API
GType vips_demand_style_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_DEMAND_STYLE (vips_demand_style_get_type())
VIPS_API
GType vips_image_type_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_IMAGE_TYPE (vips_image_type_get_type())
VIPS_API
GType vips_interpretation_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_INTERPRETATION (vips_interpretation_get_type())
VIPS_API
GType vips_band_format_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_BAND_FORMAT (vips_band_format_get_type())
VIPS_API
GType vips_coding_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_CODING (vips_coding_get_type())
VIPS_API
GType vips_access_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_ACCESS (vips_access_get_type())
/* enumerations from "morphology.h" */
VIPS_API
GType vips_operation_morphology_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_MORPHOLOGY (vips_operation_morphology_get_type())
/* enumerations from "object.h" */
VIPS_API
GType vips_argument_flags_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_ARGUMENT_FLAGS (vips_argument_flags_get_type())
/* enumerations from "operation.h" */
VIPS_API
GType vips_operation_flags_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_OPERATION_FLAGS (vips_operation_flags_get_type())
/* enumerations from "region.h" */
VIPS_API
GType vips_region_shrink_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_REGION_SHRINK (vips_region_shrink_get_type())
/* enumerations from "resample.h" */
VIPS_API
GType vips_kernel_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_KERNEL (vips_kernel_get_type())
VIPS_API
GType vips_size_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_SIZE (vips_size_get_type())
/* enumerations from "util.h" */
VIPS_API
GType vips_token_get_type(void) G_GNUC_CONST;
#define VIPS_TYPE_TOKEN (vips_token_get_type())
G_END_DECLS
#endif /*VIPS_ENUM_TYPES_H*/
/* Generated data ends here */

View File

@@ -0,0 +1,142 @@
/* Error handling.
*/
/*
Copyright (C) 1991-2005 The National Gallery
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_ERROR_H
#define VIPS_ERROR_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
VIPS_API
const char *vips_error_buffer(void);
VIPS_API
char *vips_error_buffer_copy(void);
VIPS_API
void vips_error_clear(void);
VIPS_API
void vips_error_freeze(void);
VIPS_API
void vips_error_thaw(void);
VIPS_API
void vips_error(const char *domain, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);
VIPS_API
void vips_verror(const char *domain, const char *fmt, va_list ap);
VIPS_API
void vips_error_system(int err, const char *domain, const char *fmt, ...)
G_GNUC_PRINTF(3, 4);
VIPS_API
void vips_verror_system(int err, const char *domain,
const char *fmt, va_list ap);
VIPS_API
void vips_error_g(GError **error);
VIPS_API
void vips_g_error(GError **error);
VIPS_API
void vips_error_exit(const char *fmt, ...)
G_GNUC_NORETURN G_GNUC_PRINTF(1, 2);
VIPS_API
int vips_check_uncoded(const char *domain, VipsImage *im);
VIPS_API
int vips_check_coding(const char *domain, VipsImage *im, VipsCoding coding);
VIPS_API
int vips_check_coding_known(const char *domain, VipsImage *im);
VIPS_API
int vips_check_coding_noneorlabq(const char *domain, VipsImage *im);
VIPS_API
int vips_check_coding_same(const char *domain, VipsImage *im1, VipsImage *im2);
VIPS_API
int vips_check_mono(const char *domain, VipsImage *im);
VIPS_API
int vips_check_bands(const char *domain, VipsImage *im, int bands);
VIPS_API
int vips_check_bands_1or3(const char *domain, VipsImage *im);
VIPS_API
int vips_check_bands_atleast(const char *domain, VipsImage *im, int bands);
VIPS_API
int vips_check_bands_1orn(const char *domain, VipsImage *im1, VipsImage *im2);
VIPS_API
int vips_check_bands_1orn_unary(const char *domain, VipsImage *im, int n);
VIPS_API
int vips_check_bands_same(const char *domain, VipsImage *im1, VipsImage *im2);
VIPS_API
int vips_check_bandno(const char *domain, VipsImage *im, int bandno);
VIPS_API
int vips_check_int(const char *domain, VipsImage *im);
VIPS_API
int vips_check_uint(const char *domain, VipsImage *im);
VIPS_API
int vips_check_uintorf(const char *domain, VipsImage *im);
VIPS_API
int vips_check_noncomplex(const char *domain, VipsImage *im);
VIPS_API
int vips_check_complex(const char *domain, VipsImage *im);
VIPS_API
int vips_check_twocomponents(const char *domain, VipsImage *im);
VIPS_API
int vips_check_format(const char *domain, VipsImage *im, VipsBandFormat fmt);
VIPS_API
int vips_check_u8or16(const char *domain, VipsImage *im);
VIPS_API
int vips_check_8or16(const char *domain, VipsImage *im);
VIPS_API
int vips_check_u8or16orf(const char *domain, VipsImage *im);
VIPS_API
int vips_check_format_same(const char *domain, VipsImage *im1, VipsImage *im2);
VIPS_API
int vips_check_size_same(const char *domain, VipsImage *im1, VipsImage *im2);
VIPS_API
int vips_check_oddsquare(const char *domain, VipsImage *im);
VIPS_API
int vips_check_vector_length(const char *domain, int n, int len);
VIPS_API
int vips_check_vector(const char *domain, int n, VipsImage *im);
VIPS_API
int vips_check_hist(const char *domain, VipsImage *im);
VIPS_API
int vips_check_matrix(const char *domain, VipsImage *im, VipsImage **out);
VIPS_API
int vips_check_separable(const char *domain, VipsImage *im);
VIPS_API
int vips_check_precision_intfloat(const char *domain,
VipsPrecision precision);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_ERROR_H*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,135 @@
/* Base type for supported image formats. Subclass this to add a new
* format.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_FORMAT_H
#define VIPS_FORMAT_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#define VIPS_TYPE_FORMAT (vips_format_get_type())
#define VIPS_FORMAT(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_FORMAT, VipsFormat))
#define VIPS_FORMAT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_FORMAT, VipsFormatClass))
#define VIPS_IS_FORMAT(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_FORMAT))
#define VIPS_IS_FORMAT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_FORMAT))
#define VIPS_FORMAT_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_FORMAT, VipsFormatClass))
/* Image file properties.
*/
typedef enum {
VIPS_FORMAT_NONE = 0, /* No flags set */
VIPS_FORMAT_PARTIAL = 1, /* Lazy read OK (eg. tiled tiff) */
VIPS_FORMAT_BIGENDIAN = 2 /* Most-significant byte first */
} VipsFormatFlags;
/* Don't instantiate these things, just use the class stuff.
*/
typedef struct _VipsFormat {
VipsObject parent_object;
/*< public >*/
} VipsFormat;
typedef struct _VipsFormatClass {
VipsObjectClass parent_class;
/*< public >*/
/* Is a file in this format.
*/
gboolean (*is_a)(const char *);
/* Read just the header into the VipsImage.
*/
int (*header)(const char *, VipsImage *);
/* Load the whole image.
*/
int (*load)(const char *, VipsImage *);
/* Write the VipsImage to the file in this format.
*/
int (*save)(VipsImage *, const char *);
/* Get the flags for this file in this format.
*/
VipsFormatFlags (*get_flags)(const char *);
/* Loop over formats in this order, default 0. We need this because
* some formats can be read by several loaders (eg. tiff can be read
* by the libMagick loader as well as by the tiff loader), and we want
* to make sure the better loader comes first.
*/
int priority;
/* Null-terminated list of allowed suffixes, eg. ".tif", ".tiff".
*/
const char **suffs;
} VipsFormatClass;
VIPS_API
GType vips_format_get_type(void);
/* Map over and find formats. This uses type introspection to loop over
* subclasses of VipsFormat.
*/
VIPS_API
void *vips_format_map(VipsSListMap2Fn fn, void *a, void *b);
VIPS_API
VipsFormatClass *vips_format_for_file(const char *filename);
VIPS_API
VipsFormatClass *vips_format_for_name(const char *filename);
VIPS_API
VipsFormatFlags vips_format_get_flags(VipsFormatClass *format,
const char *filename);
/* Read/write an image convenience functions.
*/
VIPS_API
int vips_format_read(const char *filename, VipsImage *out);
VIPS_API
int vips_format_write(VipsImage *in, const char *filename);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_FORMAT_H*/

View File

@@ -0,0 +1,64 @@
/* freq_filt.h
*
* 2/11/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_FREQFILT_H
#define VIPS_FREQFILT_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
VIPS_API
int vips_fwfft(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_invfft(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_freqmult(VipsImage *in, VipsImage *mask, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_spectrum(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_phasecor(VipsImage *in1, VipsImage *in2, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_FREQFILT_H*/

View File

@@ -0,0 +1,90 @@
/* Thread profiling.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_GATE_H
#define VIPS_GATE_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#include <vips/vips.h>
#define VIPS_GATE_START(NAME) \
G_STMT_START \
{ \
if (vips__thread_profile) \
vips__thread_gate_start(NAME); \
} \
G_STMT_END
#define VIPS_GATE_STOP(NAME) \
G_STMT_START \
{ \
if (vips__thread_profile) \
vips__thread_gate_stop(NAME); \
} \
G_STMT_END
#define VIPS_GATE_MALLOC(SIZE) \
G_STMT_START \
{ \
if (vips__thread_profile) \
vips__thread_malloc_free((gint64) (SIZE)); \
} \
G_STMT_END
#define VIPS_GATE_FREE(SIZE) \
G_STMT_START \
{ \
if (vips__thread_profile) \
vips__thread_malloc_free(-((gint64) (SIZE))); \
} \
G_STMT_END
extern gboolean vips__thread_profile;
VIPS_API
void vips_profile_set(gboolean profile);
void vips__thread_profile_attach(const char *thread_name);
void vips__thread_profile_detach(void);
void vips__thread_profile_stop(void);
void vips__thread_gate_start(const char *gate_name);
void vips__thread_gate_stop(const char *gate_name);
void vips__thread_malloc_free(gint64 size);
#endif /*VIPS_GATE_H*/
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@@ -0,0 +1,92 @@
/* Generate pixels.
*
* J.Cupitt, 8/4/93
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_GENERATE_H
#define VIPS_GENERATE_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef int (*VipsRegionWrite)(VipsRegion *region, VipsRect *area, void *a);
VIPS_API
int vips_sink_disc(VipsImage *im, VipsRegionWrite write_fn, void *a);
VIPS_API
int vips_sink(VipsImage *im,
VipsStartFn start_fn, VipsGenerateFn generate_fn, VipsStopFn stop_fn,
void *a, void *b);
VIPS_API
int vips_sink_tile(VipsImage *im,
int tile_width, int tile_height,
VipsStartFn start_fn, VipsGenerateFn generate_fn, VipsStopFn stop_fn,
void *a, void *b);
typedef void (*VipsSinkNotify)(VipsImage *im, VipsRect *rect, void *a);
VIPS_API
int vips_sink_screen(VipsImage *in, VipsImage *out, VipsImage *mask,
int tile_width, int tile_height, int max_tiles,
int priority,
VipsSinkNotify notify_fn, void *a);
VIPS_API
int vips_sink_memory(VipsImage *im);
VIPS_API
void *vips_start_one(VipsImage *out, void *a, void *b);
VIPS_API
int vips_stop_one(void *seq, void *a, void *b);
VIPS_API
void *vips_start_many(VipsImage *out, void *a, void *b);
VIPS_API
int vips_stop_many(void *seq, void *a, void *b);
VIPS_API
VipsImage **vips_allocate_input_array(VipsImage *out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_image_generate(VipsImage *image,
VipsStartFn start_fn, VipsGenerateFn generate_fn, VipsStopFn stop_fn,
void *a, void *b);
VIPS_API
int vips_image_pipeline_array(VipsImage *image,
VipsDemandStyle hint, VipsImage **in);
VIPS_API
int vips_image_pipelinev(VipsImage *image, VipsDemandStyle hint, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_GENERATE_H*/

View File

@@ -0,0 +1,329 @@
/* image header funcs
*
* 20/9/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_HEADER_H
#define VIPS_HEADER_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/**
* VIPS_META_EXIF_NAME:
*
* The name that read and write operations use for the image's EXIF data.
*/
#define VIPS_META_EXIF_NAME "exif-data"
/**
* VIPS_META_XMP_NAME:
*
* The name that read and write operations use for the image's XMP data.
*/
#define VIPS_META_XMP_NAME "xmp-data"
/**
* VIPS_META_IPTC_NAME:
*
* The name that read and write operations use for the image's IPTC data.
*/
#define VIPS_META_IPTC_NAME "iptc-data"
/**
* VIPS_META_PHOTOSHOP_NAME:
*
* The name that TIFF read and write operations use for the image's
* TIFFTAG_PHOTOSHOP data.
*/
#define VIPS_META_PHOTOSHOP_NAME "photoshop-data"
/**
* VIPS_META_ICC_NAME:
*
* The name we use to attach an ICC profile. The file read and write
* operations for TIFF, JPEG, PNG and others use this item of metadata to
* attach and save ICC profiles. The profile is updated by the
* vips_icc_transform() operations.
*/
#define VIPS_META_ICC_NAME "icc-profile-data"
/**
* VIPS_META_IMAGEDESCRIPTION:
*
* The IMAGEDESCRIPTION tag. Often has useful metadata.
*/
#define VIPS_META_IMAGEDESCRIPTION "image-description"
/**
* VIPS_META_RESOLUTION_UNIT:
*
* The JPEG and TIFF read and write operations use this to record the
* file's preferred unit for resolution.
*/
#define VIPS_META_RESOLUTION_UNIT "resolution-unit"
/**
* VIPS_META_BITS_PER_SAMPLE:
*
* The bits per sample for each channel.
*/
#define VIPS_META_BITS_PER_SAMPLE "bits-per-sample"
/**
* VIPS_META_PALETTE:
*
* Does this image have a palette?
*/
#define VIPS_META_PALETTE "palette"
/**
* VIPS_META_LOADER:
*
* Record the name of the original loader here. Handy for hinting file formats
* and for debugging.
*/
#define VIPS_META_LOADER "vips-loader"
/**
* VIPS_META_SEQUENTIAL:
*
* Images loaded via vips_sequential() have this int field defined. Some
* operations (eg. vips_shrinkv()) add extra caches if they see it on their
* input.
*/
#define VIPS_META_SEQUENTIAL "vips-sequential"
/**
* VIPS_META_ORIENTATION:
*
* The orientation tag for this image. An int from 1 - 8 using the standard
* exif/tiff meanings.
*
* * 1 - The 0th row represents the visual top of the image, and the 0th column
* represents the visual left-hand side.
* * 2 - The 0th row represents the visual top of the image, and the 0th column
* represents the visual right-hand side.
* * 3 - The 0th row represents the visual bottom of the image, and the 0th
* column represents the visual right-hand side.
* * 4 - The 0th row represents the visual bottom of the image, and the 0th
* column represents the visual left-hand side.
* * 5 - The 0th row represents the visual left-hand side of the image, and the
* 0th column represents the visual top.
* * 6 - The 0th row represents the visual right-hand side of the image, and the
* 0th column represents the visual top.
* * 7 - The 0th row represents the visual right-hand side of the image, and the
* 0th column represents the visual bottom.
* * 8 - The 0th row represents the visual left-hand side of the image, and the
* 0th column represents the visual bottom.
*/
#define VIPS_META_ORIENTATION "orientation"
/**
* VIPS_META_PAGE_HEIGHT:
*
* If set, the height of each page when this image was loaded. If you save an
* image with "page-height" set to a format that supports multiple pages, such
* as tiff, the image will be saved as a series of pages.
*/
#define VIPS_META_PAGE_HEIGHT "page-height"
/**
* VIPS_META_N_PAGES:
*
* If set, the number of pages in the original file.
*/
#define VIPS_META_N_PAGES "n-pages"
/**
* VIPS_META_N_SUBIFDS:
*
* If set, the number of subifds in the first page of the file.
*/
#define VIPS_META_N_SUBIFDS "n-subifds"
/**
* VIPS_META_CONCURRENCY:
*
* If set, the suggested concurrency for this image.
*/
#define VIPS_META_CONCURRENCY "concurrency"
VIPS_API
guint64 vips_format_sizeof(VipsBandFormat format);
VIPS_API
guint64 vips_format_sizeof_unsafe(VipsBandFormat format);
VIPS_API
double vips_interpretation_max_alpha(VipsInterpretation interpretation);
VIPS_API
int vips_image_get_width(const VipsImage *image);
VIPS_API
int vips_image_get_height(const VipsImage *image);
VIPS_API
int vips_image_get_bands(const VipsImage *image);
VIPS_API
VipsBandFormat vips_image_get_format(const VipsImage *image);
VIPS_API
double vips_image_get_format_max(VipsBandFormat format);
VIPS_API
VipsBandFormat vips_image_guess_format(const VipsImage *image);
VIPS_API
VipsCoding vips_image_get_coding(const VipsImage *image);
VIPS_API
VipsInterpretation vips_image_get_interpretation(const VipsImage *image);
VIPS_API
VipsInterpretation vips_image_guess_interpretation(const VipsImage *image);
VIPS_API
double vips_image_get_xres(const VipsImage *image);
VIPS_API
double vips_image_get_yres(const VipsImage *image);
VIPS_API
int vips_image_get_xoffset(const VipsImage *image);
VIPS_API
int vips_image_get_yoffset(const VipsImage *image);
VIPS_API
const char *vips_image_get_filename(const VipsImage *image);
VIPS_API
const char *vips_image_get_mode(const VipsImage *image);
VIPS_API
double vips_image_get_scale(const VipsImage *image);
VIPS_API
double vips_image_get_offset(const VipsImage *image);
VIPS_API
int vips_image_get_page_height(VipsImage *image);
VIPS_API
int vips_image_get_n_pages(VipsImage *image);
VIPS_API
int vips_image_get_n_subifds(VipsImage *image);
VIPS_API
int vips_image_get_orientation(VipsImage *image);
VIPS_API
gboolean vips_image_get_orientation_swap(VipsImage *image);
VIPS_API
int vips_image_get_concurrency(VipsImage *image, int default_concurrency);
VIPS_API
const void *vips_image_get_data(VipsImage *image);
VIPS_API
void vips_image_init_fields(VipsImage *image,
int xsize, int ysize, int bands,
VipsBandFormat format, VipsCoding coding,
VipsInterpretation interpretation,
double xres, double yres);
VIPS_API
void vips_image_set(VipsImage *image, const char *name, GValue *value);
VIPS_API
int vips_image_get(const VipsImage *image,
const char *name, GValue *value_copy);
VIPS_API
int vips_image_get_as_string(const VipsImage *image,
const char *name, char **out);
VIPS_API
GType vips_image_get_typeof(const VipsImage *image, const char *name);
VIPS_API
gboolean vips_image_remove(VipsImage *image, const char *name);
typedef void *(*VipsImageMapFn)(VipsImage *image,
const char *name, GValue *value, void *a);
VIPS_API
void *vips_image_map(VipsImage *image, VipsImageMapFn fn, void *a);
VIPS_API
gchar **vips_image_get_fields(VipsImage *image);
VIPS_API
void vips_image_set_area(VipsImage *image,
const char *name, VipsCallbackFn free_fn, void *data);
VIPS_API
int vips_image_get_area(const VipsImage *image,
const char *name, const void **data);
VIPS_API
void vips_image_set_blob(VipsImage *image,
const char *name,
VipsCallbackFn free_fn, const void *data, size_t length);
VIPS_API
void vips_image_set_blob_copy(VipsImage *image,
const char *name, const void *data, size_t length);
VIPS_API
int vips_image_get_blob(const VipsImage *image,
const char *name, const void **data, size_t *length);
VIPS_API
int vips_image_get_int(const VipsImage *image, const char *name, int *out);
VIPS_API
void vips_image_set_int(VipsImage *image, const char *name, int i);
VIPS_API
int vips_image_get_double(const VipsImage *image,
const char *name, double *out);
VIPS_API
void vips_image_set_double(VipsImage *image, const char *name, double d);
VIPS_API
int vips_image_get_string(const VipsImage *image,
const char *name, const char **out);
VIPS_API
void vips_image_set_string(VipsImage *image,
const char *name, const char *str);
VIPS_API
void vips_image_print_field(const VipsImage *image, const char *name);
VIPS_API
int vips_image_get_image(const VipsImage *image,
const char *name, VipsImage **out);
VIPS_API
void vips_image_set_image(VipsImage *image, const char *name, VipsImage *im);
VIPS_API
void vips_image_set_array_int(VipsImage *image, const char *name,
const int *array, int n);
VIPS_API
int vips_image_get_array_int(VipsImage *image, const char *name,
int **out, int *n);
VIPS_API
int vips_image_get_array_double(VipsImage *image, const char *name,
double **out, int *n);
VIPS_API
void vips_image_set_array_double(VipsImage *image, const char *name,
const double *array, int n);
VIPS_API
int vips_image_history_printf(VipsImage *image, const char *format, ...)
G_GNUC_PRINTF(2, 3);
VIPS_API
int vips_image_history_args(VipsImage *image,
const char *name, int argc, char *argv[]);
VIPS_API
const char *vips_image_get_history(VipsImage *image);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_HEADER_H*/

View File

@@ -0,0 +1,85 @@
/* histograms_lut.h
*
* 3/11/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_HISTOGRAM_H
#define VIPS_HISTOGRAM_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
VIPS_API
int vips_maplut(VipsImage *in, VipsImage **out, VipsImage *lut, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_percent(VipsImage *in, double percent, int *threshold, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_stdif(VipsImage *in, VipsImage **out, int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_cum(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_norm(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_equal(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_plot(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_match(VipsImage *in, VipsImage *ref, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_local(VipsImage *in, VipsImage **out,
int width, int height, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_ismonotonic(VipsImage *in, gboolean *out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_hist_entropy(VipsImage *in, double *out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_case(VipsImage *index, VipsImage **cases, VipsImage **out, int n,
...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_HISTOGRAM_H*/

View File

@@ -0,0 +1,610 @@
/* VIPS image class.
*
* 7/7/09
* - from vips.h
* 2/3/11
* - move to GObject
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_IMAGE_H
#define VIPS_IMAGE_H
#include <glib.h>
#include <glib-object.h>
#include <vips/object.h>
#include <vips/connection.h>
#include <vips/rect.h>
#include <vips/region.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* If you read MSB first, you get these two values.
* intel order: byte 0 = b6
* SPARC order: byte 0 = 08
*/
#define VIPS_MAGIC_INTEL (0xb6a6f208U)
#define VIPS_MAGIC_SPARC (0x08f2a6b6U)
/* We have a maximum value for a coordinate at various points for sanity
* checking. For example, vips_black() has a max with and height. We use int
* for width/height so we could go up to 2bn, but it's good to have a lower
* value set so we can see crazy numbers early.
*
* This can be overridden with the `VIPS_MAX_COORD` env var, or the
* `--vips-max-coord` CLI arg.
*/
#define VIPS_DEFAULT_MAX_COORD (100000000)
/* Fetch the overridden value.
*/
#define VIPS_MAX_COORD (vips_max_coord_get())
typedef enum {
VIPS_DEMAND_STYLE_ERROR = -1,
VIPS_DEMAND_STYLE_SMALLTILE,
VIPS_DEMAND_STYLE_FATSTRIP,
VIPS_DEMAND_STYLE_THINSTRIP,
VIPS_DEMAND_STYLE_ANY
} VipsDemandStyle;
/* Types of image descriptor we may have. The type field is advisory only: it
* does not imply that any fields in IMAGE have valid data.
*/
typedef enum {
VIPS_IMAGE_ERROR = -1,
VIPS_IMAGE_NONE, /* no type set */
VIPS_IMAGE_SETBUF, /* malloced memory array */
VIPS_IMAGE_SETBUF_FOREIGN, /* memory array, don't free on close */
VIPS_IMAGE_OPENIN, /* input from fd with a window */
VIPS_IMAGE_MMAPIN, /* memory mapped input file */
VIPS_IMAGE_MMAPINRW, /* memory mapped read/write file */
VIPS_IMAGE_OPENOUT, /* output to fd */
VIPS_IMAGE_PARTIAL /* partial image */
} VipsImageType;
typedef enum {
VIPS_INTERPRETATION_ERROR = -1,
VIPS_INTERPRETATION_MULTIBAND = 0,
VIPS_INTERPRETATION_B_W = 1,
VIPS_INTERPRETATION_HISTOGRAM = 10,
VIPS_INTERPRETATION_XYZ = 12,
VIPS_INTERPRETATION_LAB = 13,
VIPS_INTERPRETATION_CMYK = 15,
VIPS_INTERPRETATION_LABQ = 16,
VIPS_INTERPRETATION_RGB = 17,
VIPS_INTERPRETATION_CMC = 18,
VIPS_INTERPRETATION_LCH = 19,
VIPS_INTERPRETATION_LABS = 21,
VIPS_INTERPRETATION_sRGB = 22,
VIPS_INTERPRETATION_YXY = 23,
VIPS_INTERPRETATION_FOURIER = 24,
VIPS_INTERPRETATION_RGB16 = 25,
VIPS_INTERPRETATION_GREY16 = 26,
VIPS_INTERPRETATION_MATRIX = 27,
VIPS_INTERPRETATION_scRGB = 28,
VIPS_INTERPRETATION_HSV = 29,
VIPS_INTERPRETATION_LAST = 30
} VipsInterpretation;
typedef enum {
VIPS_FORMAT_NOTSET = -1,
VIPS_FORMAT_UCHAR = 0,
VIPS_FORMAT_CHAR = 1,
VIPS_FORMAT_USHORT = 2,
VIPS_FORMAT_SHORT = 3,
VIPS_FORMAT_UINT = 4,
VIPS_FORMAT_INT = 5,
VIPS_FORMAT_FLOAT = 6,
VIPS_FORMAT_COMPLEX = 7,
VIPS_FORMAT_DOUBLE = 8,
VIPS_FORMAT_DPCOMPLEX = 9,
VIPS_FORMAT_LAST = 10
} VipsBandFormat;
typedef enum {
VIPS_CODING_ERROR = -1,
VIPS_CODING_NONE = 0,
VIPS_CODING_LABQ = 2,
VIPS_CODING_RAD = 6,
VIPS_CODING_LAST = 7
} VipsCoding;
typedef enum {
VIPS_ACCESS_RANDOM,
VIPS_ACCESS_SEQUENTIAL,
VIPS_ACCESS_SEQUENTIAL_UNBUFFERED,
VIPS_ACCESS_LAST
} VipsAccess;
typedef void *(*VipsStartFn)(VipsImage *out, void *a, void *b);
typedef int (*VipsGenerateFn)(VipsRegion *out,
void *seq, void *a, void *b, gboolean *stop);
typedef int (*VipsStopFn)(void *seq, void *a, void *b);
/* Struct we keep a record of execution time in. Passed to eval signal so
* it can assess progress.
*/
typedef struct _VipsProgress {
/*< private >*/
VipsImage *im; /* Image we are part of */
/*< public >*/
int run; /* Time we have been running */
int eta; /* Estimated seconds of computation left */
gint64 tpels; /* Number of pels we expect to calculate */
gint64 npels; /* Number of pels calculated so far */
int percent; /* Percent complete */
GTimer *start; /* Start time */
} VipsProgress;
#define VIPS_TYPE_IMAGE (vips_image_get_type())
#define VIPS_IMAGE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_IMAGE, VipsImage))
#define VIPS_IMAGE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_IMAGE, VipsImageClass))
#define VIPS_IS_IMAGE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_IMAGE))
#define VIPS_IS_IMAGE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_IMAGE))
#define VIPS_IMAGE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_IMAGE, VipsImageClass))
/* Matching typedef in basic.h.
*/
struct _VipsImage {
VipsObject parent_instance;
/*< private >*/
/* We have to keep these names for compatibility with the old API.
* Don't use them though, use vips_image_get_width() and friends.
*/
int Xsize; /* image width, in pixels */
int Ysize; /* image height, in pixels */
int Bands; /* number of image bands */
VipsBandFormat BandFmt; /* pixel format */
VipsCoding Coding; /* pixel coding */
VipsInterpretation Type; /* pixel interpretation */
double Xres; /* horizontal pixels per millimetre */
double Yres; /* vertical pixels per millimetre */
int Xoffset; /* image origin hint */
int Yoffset; /* image origin hint */
/* No longer used, the names are here for compat with very, very old
* code.
*/
int Length;
short Compression;
short Level;
int Bbits; /* was number of bits in this format */
/* Old code expects to see this member, newer code has a param on
* eval().
*/
VipsProgress *time;
/* Derived fields that some code can fiddle with. New code should use
* vips_image_get_history() and friends.
*/
char *Hist; /* don't use, see vips_image_get_history() */
char *filename; /* pointer to copy of filename */
VipsPel *data; /* start of image data for WIO */
int kill; /* set to non-zero to block eval */
/* Everything below this private and only used internally by
* VipsImage.
*/
/* During vips image read and write we need temporary float-sized
* fields in the struct for staging xres/yres. Don't use these any
* other time.
*/
float Xres_float;
float Yres_float;
char *mode; /* mode string passed to _new() */
VipsImageType dtype; /* descriptor type */
int fd; /* file descriptor */
void *baseaddr; /* pointer to the start of an mmap file */
size_t length; /* size of mmap area */
guint32 magic; /* magic from header, endian-ness of image */
/* Partial image stuff. All these fields are initialised
* to NULL and ignored unless set by vips_image_generate() etc.
*/
VipsStartFn start_fn;
VipsGenerateFn generate_fn;
VipsStopFn stop_fn;
void *client1; /* user arguments */
void *client2;
GMutex *sslock; /* start-stop lock */
GSList *regions; /* list of regions current for this image */
VipsDemandStyle dhint; /* demand style hint */
/* Extra user-defined fields ... see vips_image_get() etc.
*/
GHashTable *meta; /* GhashTable of GValue */
GSList *meta_traverse; /* traverse order for Meta */
/* Part of mmap() read ... the sizeof() the header we skip from the
* file start. Usually VIPS_SIZEOF_HEADER, but can be something else
* for binary file read.
*
* guint64 so that we can guarantee to work even on systems with
* strange ideas about large files.
*/
gint64 sizeof_header;
/* If this is a large disc image, don't map the whole thing, instead
* have a set of windows shared between the regions active on the
* image. List of VipsWindow.
*/
GSList *windows;
/* Upstream/downstream relationships, built from args to
* vips_demand_hint().
*
* We use these to invalidate downstream pixel buffers.
* Use 'serial' to spot circular dependencies.
*
* See also hint_set below.
*/
GSList *upstream;
GSList *downstream;
int serial;
/* Keep a list of recounted GValue strings so we can share hist
* efficiently.
*/
GSList *history_list;
/* The VipsImage (if any) we should signal eval progress on.
*/
VipsImage *progress_signal;
/* Record the file length here. We use this to stop ourselves mapping
* things beyond the end of the file in the case that the file has
* been truncated.
*
* gint64 so that we can guarantee to work even on systems with
* strange ideas about large files.
*/
gint64 file_length;
/* Set this when vips_demand_hint_array() is called, and check in any
* operation that will demand pixels from the image.
*
* We use vips_demand_hint_array() to build the tree of
* upstream/downstream relationships, so it's a mandatory thing.
*/
gboolean hint_set;
/* Delete-on-close is hard to do with signals and callbacks since we
* really need to do this in finalize after the fd has been closed,
* but you can't emit signals then.
*
* Also keep a private copy of the filename string to be deleted,
* since image->filename will be freed in _dispose().
*/
gboolean delete_on_close;
char *delete_on_close_filename;
};
typedef struct _VipsImageClass {
VipsObjectClass parent_class;
/* Signals we emit.
*/
/* Evaluation is starting.
*/
void (*preeval)(VipsImage *image, VipsProgress *progress, void *data);
/* Evaluation progress.
*/
void (*eval)(VipsImage *image, VipsProgress *progress, void *data);
/* Evaluation is ending.
*/
void (*posteval)(VipsImage *image, VipsProgress *progress, void *data);
/* An image has been written to.
* Used by eg. vips_image_new_mode("x.jpg", "w") to do the
* final write to jpeg.
* Set *result to non-zero to indicate an error on write.
*/
void (*written)(VipsImage *image, int *result, void *data);
/* An image has been modified in some way and all caches
* need dropping.
*/
void (*invalidate)(VipsImage *image, void *data);
/* Minimise this pipeline.
*
* This is triggered (sometimes) at the end of eval to signal that
* we're probably done and that operations involved should try to
* minimise memory use by, for example, dropping caches.
*
* See vips_tilecache().
*/
void (*minimise)(VipsImage *image, void *data);
} VipsImageClass;
/* Don't put spaces around void here, it breaks gtk-doc.
*/
VIPS_API
GType vips_image_get_type(void);
/* Has to be guint64 and not size_t/off_t since we have to be able to address
* huge images on platforms with 32-bit files.
*/
/* Pixel address calculation macros.
*/
#define VIPS_IMAGE_SIZEOF_ELEMENT(I) \
(vips_format_sizeof_unsafe((I)->BandFmt))
#define VIPS_IMAGE_SIZEOF_PEL(I) \
(VIPS_IMAGE_SIZEOF_ELEMENT(I) * (I)->Bands)
#define VIPS_IMAGE_SIZEOF_LINE(I) \
(VIPS_IMAGE_SIZEOF_PEL(I) * (I)->Xsize)
#define VIPS_IMAGE_SIZEOF_IMAGE(I) \
(VIPS_IMAGE_SIZEOF_LINE(I) * (I)->Ysize)
#define VIPS_IMAGE_N_ELEMENTS(I) \
((I)->Bands * (I)->Xsize)
#define VIPS_IMAGE_N_PELS(I) \
((guint64) (I)->Xsize * (I)->Ysize)
/* If VIPS_DEBUG is defined, add bounds checking.
*/
#ifdef VIPS_DEBUG
#define VIPS_IMAGE_ADDR(I, X, Y) \
(((X) >= 0 && (X) < VIPS_IMAGE(I)->Xsize && \
(Y) >= 0 && (Y) < VIPS_IMAGE(I)->Ysize && \
VIPS_IMAGE(I)->data) \
? (VIPS_IMAGE(I)->data + \
(Y) *VIPS_IMAGE_SIZEOF_LINE(I) + \
(X) *VIPS_IMAGE_SIZEOF_PEL(I)) \
: (fprintf(stderr, \
"VIPS_IMAGE_ADDR: point out of bounds, " \
"file \"%s\", line %d\n" \
"(point x=%d, y=%d\n" \
" should have been within VipsRect left=%d, top=%d, " \
"width=%d, height=%d)\n", \
__FILE__, __LINE__, \
(X), (Y), \
0, 0, \
VIPS_IMAGE(I)->Xsize, \
VIPS_IMAGE(I)->Ysize), \
(VipsPel *) NULL))
#else /*!VIPS_DEBUG*/
#define VIPS_IMAGE_ADDR(I, X, Y) \
((I)->data + \
(Y) *VIPS_IMAGE_SIZEOF_LINE(I) + \
(X) *VIPS_IMAGE_SIZEOF_PEL(I))
#endif /*VIPS_DEBUG*/
#ifdef VIPS_DEBUG
#define VIPS_MATRIX(I, X, Y) \
((VIPS_IMAGE(I)->BandFmt == VIPS_FORMAT_DOUBLE && \
VIPS_IMAGE(I)->Bands == 1) \
? ((double *) VIPS_IMAGE_ADDR(I, X, Y)) \
: (fprintf(stderr, "VIPS_MATRIX: not a matrix image\n"), \
(double *) NULL))
#else /*!VIPS_DEBUG*/
#define VIPS_MATRIX(I, X, Y) \
((double *) VIPS_IMAGE_ADDR(I, X, Y))
#endif /*VIPS_DEBUG*/
VIPS_API
void vips_progress_set(gboolean progress);
VIPS_API
void vips_image_invalidate_all(VipsImage *image);
VIPS_API
void vips_image_minimise_all(VipsImage *image);
VIPS_API
gboolean vips_image_is_sequential(VipsImage *image);
VIPS_API
void vips_image_set_progress(VipsImage *image, gboolean progress);
VIPS_API
gboolean vips_image_iskilled(VipsImage *image);
VIPS_API
void vips_image_set_kill(VipsImage *image, gboolean kill);
VIPS_API
char *vips_filename_get_filename(const char *vips_filename);
VIPS_API
char *vips_filename_get_options(const char *vips_filename);
VIPS_API
VipsImage *vips_image_new(void);
VIPS_API
VipsImage *vips_image_new_memory(void);
VIPS_API
VipsImage *vips_image_memory(void);
VIPS_API
VipsImage *vips_image_new_from_file(const char *name, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
VipsImage *vips_image_new_from_file_RW(const char *filename);
VIPS_API
VipsImage *vips_image_new_from_file_raw(const char *filename,
int xsize, int ysize, int bands, guint64 offset);
VIPS_API
VipsImage *vips_image_new_from_memory(const void *data, size_t size,
int width, int height, int bands, VipsBandFormat format);
VIPS_API
VipsImage *vips_image_new_from_memory_copy(const void *data, size_t size,
int width, int height, int bands, VipsBandFormat format);
VIPS_API
VipsImage *vips_image_new_from_buffer(const void *buf, size_t len,
const char *option_string, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
VipsImage *vips_image_new_from_source(VipsSource *source,
const char *option_string, ...) G_GNUC_NULL_TERMINATED;
VIPS_API
VipsImage *vips_image_new_matrix(int width, int height);
VIPS_API
VipsImage *vips_image_new_matrixv(int width, int height, ...);
VIPS_API
VipsImage *vips_image_new_matrix_from_array(int width, int height,
const double *array, int size);
VIPS_API
VipsImage *vips_image_matrix_from_array(int width, int height,
const double *array, int size);
VIPS_API
VipsImage *vips_image_new_from_image(VipsImage *image,
const double *c, int n);
VIPS_API
VipsImage *vips_image_new_from_image1(VipsImage *image, double c);
VIPS_API
void vips_image_set_delete_on_close(VipsImage *image,
gboolean delete_on_close);
VIPS_API
guint64 vips_get_disc_threshold(void);
VIPS_API
VipsImage *vips_image_new_temp_file(const char *format);
VIPS_API
int vips_image_write(VipsImage *image, VipsImage *out);
VIPS_API
int vips_image_write_to_file(VipsImage *image, const char *name, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_image_write_to_buffer(VipsImage *in,
const char *suffix, void **buf, size_t *size, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_image_write_to_target(VipsImage *in,
const char *suffix, VipsTarget *target, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
void *vips_image_write_to_memory(VipsImage *in, size_t *size);
VIPS_API
int vips_image_decode_predict(VipsImage *in,
int *bands, VipsBandFormat *format);
VIPS_API
int vips_image_decode(VipsImage *in, VipsImage **out);
VIPS_API
int vips_image_encode(VipsImage *in, VipsImage **out, VipsCoding coding);
VIPS_API
gboolean vips_image_isMSBfirst(VipsImage *image);
VIPS_API
gboolean vips_image_isfile(VipsImage *image);
VIPS_API
gboolean vips_image_ispartial(VipsImage *image);
VIPS_API
gboolean vips_image_hasalpha(VipsImage *image);
VIPS_API
VipsImage *vips_image_copy_memory(VipsImage *image);
VIPS_API
int vips_image_wio_input(VipsImage *image);
VIPS_API
int vips_image_pio_input(VipsImage *image);
VIPS_API
int vips_image_pio_output(VipsImage *image);
VIPS_API
int vips_image_inplace(VipsImage *image);
VIPS_API
int vips_image_write_prepare(VipsImage *image);
VIPS_API
int vips_image_write_line(VipsImage *image, int ypos, VipsPel *linebuffer);
VIPS_API
gboolean vips_band_format_isint(VipsBandFormat format);
VIPS_API
gboolean vips_band_format_isuint(VipsBandFormat format);
VIPS_API
gboolean vips_band_format_is8bit(VipsBandFormat format);
VIPS_API
gboolean vips_band_format_isfloat(VipsBandFormat format);
VIPS_API
gboolean vips_band_format_iscomplex(VipsBandFormat format);
VIPS_API
int vips_system(const char *cmd_format, ...)
G_GNUC_NULL_TERMINATED;
/* Defined in type.c but declared here, since they use VipsImage.
*/
VIPS_API
VipsArrayImage *vips_array_image_new(VipsImage **array, int n);
VIPS_API
VipsArrayImage *vips_array_image_newv(int n, ...);
VIPS_API
VipsArrayImage *vips_array_image_new_from_string(const char *string,
VipsAccess flags);
VIPS_API
VipsArrayImage *vips_array_image_empty(void);
VIPS_API
VipsArrayImage *vips_array_image_append(VipsArrayImage *array,
VipsImage *image);
VIPS_API
VipsImage **vips_array_image_get(VipsArrayImage *array, int *n);
VIPS_API
VipsImage **vips_value_get_array_image(const GValue *value, int *n);
VIPS_API
void vips_value_set_array_image(GValue *value, int n);
/* Defined in reorder.c, but really a function on image.
*/
VIPS_API
int vips_reorder_prepare_many(VipsImage *image,
VipsRegion **regions, VipsRect *r);
VIPS_API
void vips_reorder_margin_hint(VipsImage *image, int margin);
VIPS_API
void vips_image_free_buffer(VipsImage *image, void *buffer);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_IMAGE_H*/

View File

@@ -0,0 +1,139 @@
/* Various interpolators.
*
* J.Cupitt, 15/10/08
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_INTERPOLATE_H
#define VIPS_INTERPOLATE_H
#include <glib.h>
#include <glib-object.h>
#include <vips/object.h>
#include <vips/region.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#define VIPS_TYPE_INTERPOLATE (vips_interpolate_get_type())
#define VIPS_INTERPOLATE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_INTERPOLATE, VipsInterpolate))
#define VIPS_INTERPOLATE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_INTERPOLATE, VipsInterpolateClass))
#define VIPS_IS_INTERPOLATE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_INTERPOLATE))
#define VIPS_IS_INTERPOLATE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_INTERPOLATE))
#define VIPS_INTERPOLATE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_INTERPOLATE, VipsInterpolateClass))
struct _VipsInterpolate {
VipsObject parent_object;
};
/* An interpolation function. This is a class method, but we have a lookup
* function for it to speed up dispatch. Write to the memory at "out",
* interpolate the value at position (x, y) in "in".
*/
typedef void (*VipsInterpolateMethod)(VipsInterpolate *interpolate,
void *out, VipsRegion *in, double x, double y);
typedef struct _VipsInterpolateClass {
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 *interpolate);
/* 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 *interpolate);
int window_offset;
} VipsInterpolateClass;
/* Don't put spaces around void here, it breaks gtk-doc.
*/
VIPS_API
GType vips_interpolate_get_type(void);
VIPS_API
void vips_interpolate(VipsInterpolate *interpolate,
void *out, VipsRegion *in, double x, double y);
VIPS_API
VipsInterpolateMethod vips_interpolate_get_method(VipsInterpolate *interpolate);
VIPS_API
int vips_interpolate_get_window_size(VipsInterpolate *interpolate);
VIPS_API
int vips_interpolate_get_window_offset(VipsInterpolate *interpolate);
/* How many bits of precision we keep for transformations, ie. how many
* pre-computed matrices we have.
*/
#define VIPS_TRANSFORM_SHIFT (6)
#define VIPS_TRANSFORM_SCALE (1 << VIPS_TRANSFORM_SHIFT)
/* How many bits of precision we keep for interpolation, ie. where the decimal
* is in the fixed-point tables. For 16-bit pixels, we need 16 bits for the
* data and 4 bits to add 16 values together. That leaves 12 bits for the
* fractional part.
*/
#define VIPS_INTERPOLATE_SHIFT (12)
#define VIPS_INTERPOLATE_SCALE (1 << VIPS_INTERPOLATE_SHIFT)
/* Convenience: return static interpolators, no need to unref.
*/
VIPS_API
VipsInterpolate *vips_interpolate_nearest_static(void);
VIPS_API
VipsInterpolate *vips_interpolate_bilinear_static(void);
/* Convenience: make an interpolator from a nickname. g_object_unref() when
* you're done with it.
*/
VIPS_API
VipsInterpolate *vips_interpolate_new(const char *nickname);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_INTERPOLATE_H*/

View File

@@ -0,0 +1,18 @@
/* i18n stuff for vips. Deprecated in favour of glib/gi18n.h.
*/
#ifndef VIPS_INTL_H
#define VIPS_INTL_H
#ifdef ENABLE_NLS
#include <glib/gi18n.h>
#else /*!ENABLE_NLS*/
#define _(String) (String)
#define N_(String) (String)
#endif /* ENABLE_NLS */
#endif /* VIPS_INTL_H */

View File

@@ -0,0 +1,163 @@
/* mask.h
*
* 20/9/09
* - from proto.h
*/
/* All deprecated.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_MASK_H
#define IM_MASK_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef struct im__INTMASK {
int xsize;
int ysize;
int scale;
int offset;
int *coeff;
char *filename;
} INTMASK;
typedef struct im__DOUBLEMASK {
int xsize;
int ysize;
double scale;
double offset;
double *coeff;
char *filename;
} DOUBLEMASK;
#define IM_MASK(M, X, Y) ((M)->coeff[(X) + (Y) * (M)->xsize])
VIPS_DEPRECATED
INTMASK *im_create_imask(const char *filename, int xsize, int ysize);
VIPS_DEPRECATED
INTMASK *im_create_imaskv(const char *filename, int xsize, int ysize, ...);
VIPS_DEPRECATED
DOUBLEMASK *im_create_dmask(const char *filename, int xsize, int ysize);
VIPS_DEPRECATED
DOUBLEMASK *im_create_dmaskv(const char *filename, int xsize, int ysize, ...);
VIPS_DEPRECATED
INTMASK *im_read_imask(const char *filename);
VIPS_DEPRECATED
DOUBLEMASK *im_read_dmask(const char *filename);
VIPS_DEPRECATED
void im_print_imask(INTMASK *in);
VIPS_DEPRECATED
void im_print_dmask(DOUBLEMASK *in);
VIPS_DEPRECATED
int im_write_imask(INTMASK *in);
VIPS_DEPRECATED
int im_write_dmask(DOUBLEMASK *in);
VIPS_DEPRECATED
int im_write_imask_name(INTMASK *in, const char *filename);
VIPS_DEPRECATED
int im_write_dmask_name(DOUBLEMASK *in, const char *filename);
VIPS_DEPRECATED
int im_free_imask(INTMASK *in);
VIPS_DEPRECATED
int im_free_dmask(DOUBLEMASK *in);
VIPS_DEPRECATED
INTMASK *im_log_imask(const char *filename, double sigma, double min_ampl);
VIPS_DEPRECATED
DOUBLEMASK *im_log_dmask(const char *filename, double sigma, double min_ampl);
VIPS_DEPRECATED
INTMASK *im_gauss_imask(const char *filename, double sigma, double min_ampl);
VIPS_DEPRECATED
INTMASK *im_gauss_imask_sep(const char *filename,
double sigma, double min_ampl);
VIPS_DEPRECATED
DOUBLEMASK *im_gauss_dmask(const char *filename,
double sigma, double min_ampl);
VIPS_DEPRECATED
DOUBLEMASK *im_gauss_dmask_sep(const char *filename,
double sigma, double min_ampl);
VIPS_DEPRECATED
INTMASK *im_dup_imask(INTMASK *in, const char *filename);
VIPS_DEPRECATED
DOUBLEMASK *im_dup_dmask(DOUBLEMASK *in, const char *filename);
VIPS_DEPRECATED
INTMASK *im_scale_dmask(DOUBLEMASK *in, const char *filename);
VIPS_DEPRECATED
void im_norm_dmask(DOUBLEMASK *mask);
VIPS_DEPRECATED
DOUBLEMASK *im_imask2dmask(INTMASK *in, const char *filename);
VIPS_DEPRECATED
INTMASK *im_dmask2imask(DOUBLEMASK *in, const char *filename);
VIPS_DEPRECATED
INTMASK *im_rotate_imask90(INTMASK *in, const char *filename);
VIPS_DEPRECATED
INTMASK *im_rotate_imask45(INTMASK *in, const char *filename);
VIPS_DEPRECATED
DOUBLEMASK *im_rotate_dmask90(DOUBLEMASK *in, const char *filename);
VIPS_DEPRECATED
DOUBLEMASK *im_rotate_dmask45(DOUBLEMASK *in, const char *filename);
VIPS_DEPRECATED
DOUBLEMASK *im_mattrn(DOUBLEMASK *in, const char *filename);
VIPS_DEPRECATED
DOUBLEMASK *im_matcat(DOUBLEMASK *top, DOUBLEMASK *bottom,
const char *filename);
VIPS_DEPRECATED
DOUBLEMASK *im_matmul(DOUBLEMASK *in1, DOUBLEMASK *in2, const char *filename);
VIPS_DEPRECATED
DOUBLEMASK *im_lu_decomp(const DOUBLEMASK *mat, const char *filename);
VIPS_DEPRECATED
int im_lu_solve(const DOUBLEMASK *lu, double *vec);
VIPS_DEPRECATED
DOUBLEMASK *im_matinv(const DOUBLEMASK *mat, const char *filename);
VIPS_DEPRECATED
int im_matinv_inplace(DOUBLEMASK *mat);
VIPS_DEPRECATED
DOUBLEMASK *im_local_dmask(struct _VipsImage *out, DOUBLEMASK *mask);
VIPS_DEPRECATED
INTMASK *im_local_imask(struct _VipsImage *out, INTMASK *mask);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*IM_MASK_H*/

View File

@@ -0,0 +1,123 @@
/* memory utilities
*
* J.Cupitt, 8/4/93
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_MEMORY_H
#define VIPS_MEMORY_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#define VIPS_FREEF(F, S) \
G_STMT_START \
{ \
if (S) { \
(void) F((S)); \
(S) = 0; \
} \
} \
G_STMT_END
#define VIPS_FREE(S) VIPS_FREEF(g_free, (S));
#define VIPS_SETSTR(S, V) \
G_STMT_START \
{ \
const char *sst = (V); \
\
if ((S) != sst) { \
if (!(S) || !sst || strcmp((S), sst) != 0) { \
VIPS_FREE(S); \
if (sst) \
(S) = g_strdup(sst); \
} \
} \
} \
G_STMT_END
#define VIPS_MALLOC(OBJ, S) \
(vips_malloc(VIPS_OBJECT(OBJ), S))
#define VIPS_NEW(OBJ, T) \
((T *) VIPS_MALLOC(OBJ, sizeof(T)))
#define VIPS_ARRAY(OBJ, N, T) \
((T *) VIPS_MALLOC(OBJ, (N) * sizeof(T)))
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsImage, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsObject, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsRegion, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsConnection, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsSource, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsSourceCustom, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsGInputStream, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsSourceGInputStream, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsTarget, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsTargetCustom, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsSbuf, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsInterpolate, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsOperation, g_object_unref)
// FIXME ... need more of these
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsArrayDouble, VipsArrayDouble_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VipsArrayImage, VipsArrayImage_unref)
VIPS_API
void *vips_malloc(VipsObject *object, size_t size);
VIPS_API
char *vips_strdup(VipsObject *object, const char *str);
VIPS_API
void vips_tracked_free(void *s);
VIPS_API
void vips_tracked_aligned_free(void *s);
VIPS_API
void *vips_tracked_malloc(size_t size);
VIPS_API
void *vips_tracked_aligned_alloc(size_t size, size_t align);
VIPS_API
size_t vips_tracked_get_mem(void);
VIPS_API
size_t vips_tracked_get_mem_highwater(void);
VIPS_API
int vips_tracked_get_allocs(void);
VIPS_API
int vips_tracked_open(const char *pathname, int flags, int mode);
VIPS_API
int vips_tracked_close(int fd);
VIPS_API
int vips_tracked_get_files(void);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_MEMORY_H*/

View File

@@ -0,0 +1,73 @@
/* morphology.h
*
* 20/9/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_MORPHOLOGY_H
#define VIPS_MORPHOLOGY_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef enum {
VIPS_OPERATION_MORPHOLOGY_ERODE,
VIPS_OPERATION_MORPHOLOGY_DILATE,
VIPS_OPERATION_MORPHOLOGY_LAST
} VipsOperationMorphology;
VIPS_API
int vips_morph(VipsImage *in, VipsImage **out, VipsImage *mask,
VipsOperationMorphology morph, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rank(VipsImage *in, VipsImage **out,
int width, int height, int index, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_median(VipsImage *in, VipsImage **out, int size, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_countlines(VipsImage *in, double *nolines,
VipsDirection direction, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_labelregions(VipsImage *in, VipsImage **mask, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_fill_nearest(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_MORPHOLOGY_H*/

View File

@@ -0,0 +1,79 @@
/* mosaicing.h
*
* 20/9/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_MOSAICING_H
#define VIPS_MOSAICING_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
VIPS_API
int vips_merge(VipsImage *ref, VipsImage *sec, VipsImage **out,
VipsDirection direction, int dx, int dy, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mosaic(VipsImage *ref, VipsImage *sec, VipsImage **out,
VipsDirection direction, int xref, int yref, int xsec, int ysec, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mosaic1(VipsImage *ref, VipsImage *sec, VipsImage **out,
VipsDirection direction,
int xr1, int yr1, int xs1, int ys1,
int xr2, int yr2, int xs2, int ys2, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_match(VipsImage *ref, VipsImage *sec, VipsImage **out,
int xr1, int yr1, int xs1, int ys1,
int xr2, int yr2, int xs2, int ys2, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_globalbalance(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_remosaic(VipsImage *in, VipsImage **out,
const char *old_str, const char *new_str, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_matrixinvert(VipsImage *m, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_MOSAICING_H*/

View File

@@ -0,0 +1,720 @@
/* abstract base class for all vips objects
*/
/*
Copyright (C) 1991-2003 The National Gallery
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_OBJECT_H
#define VIPS_OBJECT_H
#include <glib.h>
#include <glib-object.h>
#include <vips/buf.h>
#include <vips/basic.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* Handy!
*/
#ifdef VIPS_DEBUG
#define VIPS_UNREF(X) \
G_STMT_START \
{ \
if (X) { \
g_assert(G_OBJECT(X)->ref_count > 0); \
g_object_unref(X); \
(X) = 0; \
} \
} \
G_STMT_END
#else /*!VIPS_DEBUG*/
#define VIPS_UNREF(X) VIPS_FREEF(g_object_unref, (X))
#endif /*VIPS_DEBUG*/
typedef struct _VipsObject VipsObject;
typedef struct _VipsObjectClass VipsObjectClass;
/* Track extra stuff for arguments to objects
*/
typedef enum /*< flags >*/ {
VIPS_ARGUMENT_NONE = 0,
VIPS_ARGUMENT_REQUIRED = 1,
VIPS_ARGUMENT_CONSTRUCT = 2,
VIPS_ARGUMENT_SET_ONCE = 4,
VIPS_ARGUMENT_SET_ALWAYS = 8,
VIPS_ARGUMENT_INPUT = 16,
VIPS_ARGUMENT_OUTPUT = 32,
VIPS_ARGUMENT_DEPRECATED = 64,
VIPS_ARGUMENT_MODIFY = 128,
VIPS_ARGUMENT_NON_HASHABLE = 256
} VipsArgumentFlags;
/* Useful flag combinations. User-visible ones are:
*
* VIPS_ARGUMENT_REQUIRED_INPUT Eg. the "left" argument for an add operation
*
* VIPS_ARGUMENT_OPTIONAL_INPUT Eg. the "caption" for an object
*
* VIPS_ARGUMENT_REQUIRED_OUTPUT Eg. the "result" of an add operation
*
* VIPS_ARGUMENT_OPTIONAL_OUTPUT Eg. the x pos of the image minimum
*
* Other combinations are used internally, eg. supplying the cast-table for an
* arithmetic operation
*/
#define VIPS_ARGUMENT_REQUIRED_INPUT \
(VIPS_ARGUMENT_INPUT | \
VIPS_ARGUMENT_REQUIRED | \
VIPS_ARGUMENT_CONSTRUCT)
#define VIPS_ARGUMENT_OPTIONAL_INPUT \
(VIPS_ARGUMENT_INPUT | \
VIPS_ARGUMENT_CONSTRUCT)
#define VIPS_ARGUMENT_REQUIRED_OUTPUT \
(VIPS_ARGUMENT_OUTPUT | \
VIPS_ARGUMENT_REQUIRED | \
VIPS_ARGUMENT_CONSTRUCT)
#define VIPS_ARGUMENT_OPTIONAL_OUTPUT \
(VIPS_ARGUMENT_OUTPUT | \
VIPS_ARGUMENT_CONSTRUCT)
#define VIPS_ARG_IMAGE(CLASS, NAME, PRIORITY, LONG, DESC, FLAGS, OFFSET) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_object((NAME), (LONG), (DESC), \
VIPS_TYPE_IMAGE, \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_OBJECT(CLASS, NAME, PRIORITY, LONG, DESC, FLAGS, OFFSET, TYPE) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_object((NAME), (LONG), (DESC), \
TYPE, \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_INTERPOLATE(CLASS, NAME, PRIORITY, LONG, DESC, FLAGS, OFFSET) \
VIPS_ARG_OBJECT(CLASS, NAME, PRIORITY, LONG, DESC, FLAGS, OFFSET, VIPS_TYPE_INTERPOLATE)
#define VIPS_ARG_BOOL(CLASS, NAME, PRIORITY, LONG, DESC, \
FLAGS, OFFSET, VALUE) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_boolean((NAME), (LONG), (DESC), \
(VALUE), \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_DOUBLE(CLASS, NAME, PRIORITY, LONG, DESC, \
FLAGS, OFFSET, MIN, MAX, VALUE) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_double((NAME), (LONG), (DESC), \
(MIN), (MAX), (VALUE), \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_BOXED(CLASS, NAME, PRIORITY, LONG, DESC, \
FLAGS, OFFSET, TYPE) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_boxed((NAME), (LONG), (DESC), \
(TYPE), \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_INT(CLASS, NAME, PRIORITY, LONG, DESC, \
FLAGS, OFFSET, MIN, MAX, VALUE) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_int((NAME), (LONG), (DESC), \
(MIN), (MAX), (VALUE), \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_UINT64(CLASS, NAME, PRIORITY, LONG, DESC, \
FLAGS, OFFSET, MIN, MAX, VALUE) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_uint64((NAME), (LONG), (DESC), \
(MIN), (MAX), (VALUE), \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_ENUM(CLASS, NAME, PRIORITY, LONG, DESC, \
FLAGS, OFFSET, TYPE, VALUE) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_enum((NAME), (LONG), (DESC), \
(TYPE), (VALUE), \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_FLAGS(CLASS, NAME, PRIORITY, LONG, DESC, \
FLAGS, OFFSET, TYPE, VALUE) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_flags((NAME), (LONG), (DESC), \
(TYPE), (VALUE), \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_STRING(CLASS, NAME, PRIORITY, LONG, DESC, FLAGS, OFFSET, \
VALUE) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_string((NAME), (LONG), (DESC), \
(VALUE), \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
#define VIPS_ARG_POINTER(CLASS, NAME, PRIORITY, LONG, DESC, FLAGS, OFFSET) \
{ \
GParamSpec *pspec; \
\
pspec = g_param_spec_pointer((NAME), (LONG), (DESC), \
(GParamFlags) (G_PARAM_READWRITE)); \
g_object_class_install_property(G_OBJECT_CLASS(CLASS), \
vips_argument_get_id(), pspec); \
vips_object_class_install_argument(VIPS_OBJECT_CLASS(CLASS), \
pspec, (VipsArgumentFlags) (FLAGS), (PRIORITY), (OFFSET)); \
}
/* Keep one of these for every argument.
*/
typedef struct _VipsArgument {
GParamSpec *pspec; /* pspec for this argument */
/* More stuff, see below */
} VipsArgument;
/* Keep one of these in the class struct for every argument.
*/
typedef struct _VipsArgumentClass {
VipsArgument parent;
/* The class of the object we are an arg for.
*/
VipsObjectClass *object_class;
VipsArgumentFlags flags;
int priority; /* Order args by this */
guint offset; /* G_STRUCT_OFFSET of member in object */
} VipsArgumentClass;
/* Keep one of these in the object struct for every argument instance.
*/
typedef struct _VipsArgumentInstance {
VipsArgument parent;
/* The class we are part of.
*/
VipsArgumentClass *argument_class;
/* The object we are attached to.
*/
VipsObject *object;
/* Has been set.
*/
gboolean assigned;
/* If this is an output argument, keep the id of our "close" handler
* here.
*/
gulong close_id;
/* We need to listen for "invalidate" on input images and send our own
* "invalidate" out. If we go, we need to disconnect.
*/
gulong invalidate_id;
} VipsArgumentInstance;
/* Need to look up our VipsArgument structs from a pspec. Just hash the
* pointer (ie. we assume pspecs are never shared, is this correct?)
*/
typedef GHashTable VipsArgumentTable;
VIPS_API
int vips_argument_get_id(void);
void vips__object_set_member(VipsObject *object, GParamSpec *pspec,
GObject **member, GObject *argument);
typedef void *(*VipsArgumentMapFn)(VipsObject *object, GParamSpec *pspec,
VipsArgumentClass *argument_class,
VipsArgumentInstance *argument_instance, void *a, void *b);
VIPS_API
void *vips_argument_map(VipsObject *object,
VipsArgumentMapFn fn, void *a, void *b);
VIPS_API
int vips_object_get_args(VipsObject *object,
const char ***names, int **flags, int *n_args);
typedef void *(*VipsArgumentClassMapFn)(VipsObjectClass *object_class,
GParamSpec *pspec,
VipsArgumentClass *argument_class, void *a, void *b);
VIPS_API
void *vips_argument_class_map(VipsObjectClass *object_class,
VipsArgumentClassMapFn fn, void *a, void *b);
VIPS_API
gboolean vips_argument_class_needsstring(VipsArgumentClass *argument_class);
VIPS_API
int vips_object_get_argument(VipsObject *object, const char *name,
GParamSpec **pspec,
VipsArgumentClass **argument_class,
VipsArgumentInstance **argument_instance);
VIPS_API
gboolean vips_object_argument_isset(VipsObject *object, const char *name);
VIPS_API
VipsArgumentFlags vips_object_get_argument_flags(VipsObject *object,
const char *name);
VIPS_API
int vips_object_get_argument_priority(VipsObject *object, const char *name);
/* We have to loop over an objects args in several places, and we can't always
* use vips_argument_map(), the preferred looper. Have the loop code as a
* macro as well for these odd cases.
*/
#define VIPS_ARGUMENT_FOR_ALL(OBJECT, PSPEC, ARG_CLASS, ARG_INSTANCE) \
{ \
VipsObjectClass *object_class = VIPS_OBJECT_GET_CLASS(OBJECT); \
GSList *p; \
\
for (p = object_class->argument_table_traverse; p; p = p->next) { \
VipsArgumentClass *ARG_CLASS = \
(VipsArgumentClass *) p->data; \
VipsArgument *argument = (VipsArgument *) argument_class; \
GParamSpec *PSPEC = argument->pspec; \
VipsArgumentInstance *ARG_INSTANCE G_GNUC_UNUSED = \
vips__argument_get_instance(argument_class, \
VIPS_OBJECT(OBJECT));
#define VIPS_ARGUMENT_FOR_ALL_END \
} \
}
/* And some macros to collect args from a va list.
*
* Use something like this:
*
* GParamSpec *pspec;
* VipsArgumentClass *argument_class;
* VipsArgumentInstance *argument_instance;
*
* if (vips_object_get_argument(VIPS_OBJECT(operation), name,
* &pspec, &argument_class, &argument_instance))
* return -1;
*
* VIPS_ARGUMENT_COLLECT_SET(pspec, argument_class, ap);
*
* GValue value holds the value of an input argument, do
* something with it
*
* VIPS_ARGUMENT_COLLECT_GET(pspec, argument_class, ap);
*
* void **arg points to where to write an output argument
*
* VIPS_ARGUMENT_COLLECT_END
*/
#define VIPS_ARGUMENT_COLLECT_SET(PSPEC, ARG_CLASS, AP) \
if ((ARG_CLASS->flags & VIPS_ARGUMENT_INPUT)) { \
GValue value = G_VALUE_INIT; \
gchar *error = NULL; \
\
/* Input args are given inline, eg. ("factor", 12.0) \
* and must be collected. \
*/ \
G_VALUE_COLLECT_INIT(&value, \
G_PARAM_SPEC_VALUE_TYPE(PSPEC), AP, 0, &error); \
\
/* Don't bother with the error message. \
*/ \
if (error) { \
VIPS_DEBUG_MSG("VIPS_OBJECT_COLLECT_SET: err\n"); \
g_free(error); \
}
#define VIPS_ARGUMENT_COLLECT_GET(PSPEC, ARG_CLASS, AP) \
g_value_unset(&value); \
} \
else if ((ARG_CLASS->flags & VIPS_ARGUMENT_OUTPUT)) \
{ \
void **arg G_GNUC_UNUSED; \
\
/* Output args are a pointer to where to send the \
* result. \
*/ \
arg = va_arg(AP, void **);
#define VIPS_ARGUMENT_COLLECT_END \
}
#define VIPS_TYPE_OBJECT (vips_object_get_type())
#define VIPS_OBJECT(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), VIPS_TYPE_OBJECT, VipsObject))
#define VIPS_OBJECT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), VIPS_TYPE_OBJECT, VipsObjectClass))
#define VIPS_IS_OBJECT(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_OBJECT))
#define VIPS_IS_OBJECT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_OBJECT))
#define VIPS_OBJECT_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), VIPS_TYPE_OBJECT, VipsObjectClass))
struct _VipsObject {
GObject parent_instance;
/* Set after ->build() has run successfully: construct is fully done
* and checked.
*/
gboolean constructed;
/* Set for static objects which are allocated at startup and never
* freed. These objects are omitted from leak reports.
*/
gboolean static_object;
/* Table of argument instances for this class and any derived classes.
*/
VipsArgumentTable *argument_table;
/* Class properties (see below), duplicated in the instance so we can
* get at them easily via the property system.
*/
char *nickname;
char *description;
/* The pre/post/close callbacks are all fire-once.
*/
gboolean preclose;
gboolean close;
gboolean postclose;
/* Total memory allocated relative to this object, handy for
* profiling.
*/
size_t local_memory;
};
struct _VipsObjectClass {
GObjectClass parent_class;
/* Build the object ... all argument properties have been set,
* now build the thing.
*/
int (*build)(VipsObject *object);
/* Just after build ... the object is fully ready for work.
*/
int (*postbuild)(VipsObject *object, void *data);
/* Try to print something about the class, handy for help displays.
* Keep to one line.
*/
void (*summary_class)(struct _VipsObjectClass *cls, VipsBuf *buf);
/* Try to print a one-line summary for the object, the user can see
* this output via things like "header fred.tif", --vips-cache-trace,
* etc.
*/
void (*summary)(VipsObject *object, VipsBuf *buf);
/* Try to print everything about the object, handy for debugging.
*/
void (*dump)(VipsObject *object, VipsBuf *buf);
/* Sanity-check the object. Print messages and stuff.
* Handy for debugging.
*/
void (*sanity)(VipsObject *object, VipsBuf *buf);
/* Rewind. Save and restore any stuff that needs to survive a
* dispose().
*/
void (*rewind)(VipsObject *object);
/* Just before close, everything is still alive.
*/
void (*preclose)(VipsObject *object);
/* Close, time to free stuff.
*/
void (*close)(VipsObject *object);
/* Post-close, everything is dead, except the VipsObject pointer.
* Useful for eg. deleting the file associated with a temp image.
*/
void (*postclose)(VipsObject *object);
/* The CLI interface. Implement these four to get CLI input and output
* for your object.
*/
/* Given a command-line arg (eg. a filename), make an instance of the
* object. Just do the g_object_new(), don't call _build().
*
* Don't call this directly, see vips_object_new_from_string().
*/
VipsObject *(*new_from_string)(const char *string);
/* The inverse of ^^. Given an object, output what ->new_from_string()
* would have been given to make that object.
*/
void (*to_string)(VipsObject *object, VipsBuf *buf);
/* Does this output arg need an arg from the command line? Image
* output, for example, needs a filename to write to.
*/
gboolean output_needs_arg;
/* Write the object to the string. Return 0 for success, or -1 on
* error, setting vips_error(). string is NULL if output_needs_arg()
* was FALSE.
*/
int (*output_to_arg)(VipsObject *object, const char *string);
/* Class nickname, eg. "VipsInterpolateBicubic" has "bicubic" as a
* nickname. Not internationalised.
*/
const char *nickname;
/* Class description. Used for help messages, so internationalised.
*/
const char *description;
/* Hash from pspec to VipsArgumentClass.
*
* This records the VipsArgumentClass for every pspec used in
* VipsObject and any subclass (ie. everywhere), so it's huge. Don't
* loop over this hash! Fine for lookups though.
*/
VipsArgumentTable *argument_table;
/* A sorted (by priority) list of the VipsArgumentClass for this class
* and any superclasses. This is small and specific to this class.
*
* Use the stored GType to work out when to restart the list for a
* subclass.
*/
GSList *argument_table_traverse;
GType argument_table_traverse_gtype;
/* This class is deprecated and therefore hidden from various UI bits.
*
* VipsOperation has a deprecated flag, use that in preference to this
* if you can.
*/
gboolean deprecated;
/* Reserved for future expansion.
*/
void (*_vips_reserved1)(void);
void (*_vips_reserved2)(void);
void (*_vips_reserved3)(void);
void (*_vips_reserved4)(void);
};
VIPS_API
gboolean vips_value_is_null(GParamSpec *psoec, const GValue *value);
VIPS_API
void vips_object_set_property(GObject *gobject,
guint property_id, const GValue *value, GParamSpec *pspec);
VIPS_API
void vips_object_get_property(GObject *gobject,
guint property_id, GValue *value, GParamSpec *pspec);
VIPS_API
void vips_object_preclose(VipsObject *object);
VIPS_API
int vips_object_build(VipsObject *object);
VIPS_API
void vips_object_summary_class(VipsObjectClass *klass, VipsBuf *buf);
VIPS_API
void vips_object_summary(VipsObject *object, VipsBuf *buf);
VIPS_API
void vips_object_dump(VipsObject *object, VipsBuf *buf);
VIPS_API
void vips_object_print_summary_class(VipsObjectClass *klass);
VIPS_API
void vips_object_print_summary(VipsObject *object);
VIPS_API
void vips_object_print_dump(VipsObject *object);
VIPS_API
void vips_object_print_name(VipsObject *object);
VIPS_API
gboolean vips_object_sanity(VipsObject *object);
/* Don't put spaces around void here, it breaks gtk-doc.
*/
VIPS_API
GType vips_object_get_type(void);
VIPS_API
void vips_object_class_install_argument(VipsObjectClass *cls,
GParamSpec *pspec, VipsArgumentFlags flags,
int priority, guint offset);
VIPS_API
int vips_object_set_argument_from_string(VipsObject *object,
const char *name, const char *value);
VIPS_API
gboolean vips_object_argument_needsstring(VipsObject *object,
const char *name);
VIPS_API
int vips_object_get_argument_to_string(VipsObject *object,
const char *name, const char *arg);
VIPS_API
int vips_object_set_required(VipsObject *object, const char *value);
typedef void *(*VipsObjectSetArguments)(VipsObject *object, void *a, void *b);
VIPS_API
VipsObject *vips_object_new(GType type,
VipsObjectSetArguments set, void *a, void *b);
VIPS_API
int vips_object_set_valist(VipsObject *object, va_list ap);
VIPS_API
int vips_object_set(VipsObject *object, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_object_set_from_string(VipsObject *object, const char *string);
VIPS_API
VipsObject *vips_object_new_from_string(VipsObjectClass *object_class,
const char *p);
VIPS_API
void vips_object_to_string(VipsObject *object, VipsBuf *buf);
VIPS_API
void *vips_object_map(VipsSListMap2Fn fn, void *a, void *b);
typedef void *(*VipsTypeMapFn)(GType type, void *a);
typedef void *(*VipsTypeMap2Fn)(GType type, void *a, void *b);
typedef void *(*VipsClassMapFn)(VipsObjectClass *cls, void *a);
VIPS_API
void *vips_type_map(GType base, VipsTypeMap2Fn fn, void *a, void *b);
VIPS_API
void *vips_type_map_all(GType base, VipsTypeMapFn fn, void *a);
VIPS_API
int vips_type_depth(GType type);
VIPS_API
GType vips_type_find(const char *basename, const char *nickname);
VIPS_API
const char *vips_nickname_find(GType type);
VIPS_API
void *vips_class_map_all(GType type, VipsClassMapFn fn, void *a);
VIPS_API
const VipsObjectClass *vips_class_find(const char *basename,
const char *nickname);
VIPS_API
VipsObject **vips_object_local_array(VipsObject *parent, int n);
VIPS_API
void vips_object_local_cb(VipsObject *vobject, GObject *gobject);
#define vips_object_local(V, G) \
(g_signal_connect(V, "close", G_CALLBACK(vips_object_local_cb), G))
VIPS_API
void vips_object_set_static(VipsObject *object, gboolean static_object);
VIPS_API
void vips_object_print_all(void);
VIPS_API
void vips_object_sanity_all(void);
VIPS_API
void vips_object_rewind(VipsObject *object);
VIPS_API
void vips_object_unref_outputs(VipsObject *object);
VIPS_API
const char *vips_object_get_description(VipsObject *object);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_OBJECT_H*/

View File

@@ -0,0 +1,178 @@
/* base class for all vips operations
*/
/*
Copyright (C) 1991-2005 The National Gallery
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_OPERATION_H
#define VIPS_OPERATION_H
#include <glib.h>
#include <glib-object.h>
#include <vips/object.h>
#include <vips/buf.h>
#include <vips/basic.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef enum /*< flags >*/ {
VIPS_OPERATION_NONE = 0,
VIPS_OPERATION_SEQUENTIAL = 1,
VIPS_OPERATION_SEQUENTIAL_UNBUFFERED = 2,
VIPS_OPERATION_NOCACHE = 4,
VIPS_OPERATION_DEPRECATED = 8,
VIPS_OPERATION_UNTRUSTED = 16,
VIPS_OPERATION_BLOCKED = 32,
VIPS_OPERATION_REVALIDATE = 64
} VipsOperationFlags;
#define VIPS_TYPE_OPERATION (vips_operation_get_type())
#define VIPS_OPERATION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_OPERATION, VipsOperation))
#define VIPS_OPERATION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_OPERATION, VipsOperationClass))
#define VIPS_IS_OPERATION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_OPERATION))
#define VIPS_IS_OPERATION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_OPERATION))
#define VIPS_OPERATION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_OPERATION, VipsOperationClass))
typedef gboolean (*VipsOperationBuildFn)(VipsObject *object);
struct _VipsOperation {
VipsObject parent_instance;
/* Keep the hash here.
*/
guint hash;
gboolean found_hash;
/* Pixels calculated ... handy for measuring over-calculation.
*/
int pixels;
};
typedef struct _VipsOperationClass {
VipsObjectClass parent_class;
/* Print the usage message.
*/
void (*usage)(struct _VipsOperationClass *cls, VipsBuf *buf);
/* Return a set of operation flags.
*/
VipsOperationFlags (*get_flags)(VipsOperation *operation);
VipsOperationFlags flags;
/* One of our input images has signalled "invalidate". The cache uses
* VipsOperation::invalidate to drop dirty ops.
*/
void (*invalidate)(VipsOperation *operation);
} VipsOperationClass;
/* Don't put spaces around void here, it breaks gtk-doc.
*/
VIPS_API
GType vips_operation_get_type(void);
VIPS_API
VipsOperationFlags vips_operation_get_flags(VipsOperation *operation);
VIPS_API
void vips_operation_class_print_usage(VipsOperationClass *operation_class);
VIPS_API
void vips_operation_invalidate(VipsOperation *operation);
VIPS_API
int vips_operation_call_valist(VipsOperation *operation, va_list ap);
VIPS_API
VipsOperation *vips_operation_new(const char *name);
VIPS_API
int vips_call_required_optional(VipsOperation **operation,
va_list required, va_list optional);
VIPS_API
int vips_call(const char *operation_name, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_call_split(const char *operation_name, va_list optional, ...);
VIPS_API
int vips_call_split_option_string(const char *operation_name,
const char *option_string, va_list optional, ...);
VIPS_API
void vips_call_options(GOptionGroup *group, VipsOperation *operation);
VIPS_API
int vips_call_argv(VipsOperation *operation, int argc, char **argv);
VIPS_API
void vips_cache_drop_all(void);
VIPS_API
int vips_cache_operation_buildp(VipsOperation **operation);
VIPS_API
VipsOperation *vips_cache_operation_build(VipsOperation *operation);
VIPS_API
void vips_cache_print(void);
VIPS_API
void vips_cache_set_max(int max);
VIPS_API
void vips_cache_set_max_mem(size_t max_mem);
VIPS_API
int vips_cache_get_max(void);
VIPS_API
int vips_cache_get_size(void);
VIPS_API
size_t vips_cache_get_max_mem(void);
VIPS_API
int vips_cache_get_max_files(void);
VIPS_API
void vips_cache_set_max_files(int max_files);
VIPS_API
void vips_cache_set_dump(gboolean dump);
VIPS_API
void vips_cache_set_trace(gboolean trace);
/* Part of threadpool, really, but we want these in a header that gets scanned
* for our typelib.
*/
VIPS_API
void vips_concurrency_set(int concurrency);
VIPS_API
int vips_concurrency_get(void);
VIPS_API
void vips_operation_block_set(const char *name, gboolean state);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_OPERATION_H*/

View File

@@ -0,0 +1,234 @@
/* Declarations which are public-facing, but private. See internal.h for
* declarations which are only used internally by vips and which are not
* externally visible.
*
* 6/7/09
* - from vips.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_PRIVATE_H
#define VIPS_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#define VIPS_SPARE (8)
/* Private to iofuncs: the minimum number of scanlines we add above and below
* the window as a margin for slop.
*/
#define VIPS__WINDOW_MARGIN_PIXELS (128)
/* Private to iofuncs: add at least this many bytes above and below the window.
* There's no point mapping just a few KB of a small image.
*/
#define VIPS__WINDOW_MARGIN_BYTES (1024 * 1024 * 10)
/* sizeof() a VIPS header on disc.
*/
#define VIPS_SIZEOF_HEADER (64)
/* What we track for each mmap window. Have a list of these on an openin
* VipsImage.
*/
typedef struct {
int ref_count; /* # of regions referencing us */
struct _VipsImage *im; /* VipsImage we are attached to */
int top; /* Area of image we have mapped, in pixels */
int height;
VipsPel *data; /* First pixel of line 'top' */
void *baseaddr; /* Base of window */
size_t length; /* Size of window */
} VipsWindow;
VIPS_API
int vips_window_unref(VipsWindow *window);
VIPS_API
void vips_window_print(VipsWindow *window);
/* Per-thread buffer state. Held in a GPrivate.
*/
typedef struct {
GHashTable *hash; /* VipsImage -> VipsBufferCache* */
GThread *thread; /* Just for sanity checking */
} VipsBufferThread;
/* Per-image buffer cache. This keeps a list of "done" VipsBuffer that this
* worker has generated. We use this to reuse results within a thread.
*
* Hash to this from VipsBufferThread::hash.
* We can't store the GSList directly in the hash table as GHashTable lacks an
* update operation and we'd need to _remove() and _insert() on every list
* operation.
*/
typedef struct _VipsBufferCache {
GSList *buffers; /* GSList of "done" VipsBuffer* */
GThread *thread; /* Just for sanity checking */
struct _VipsImage *im;
VipsBufferThread *buffer_thread;
GSList *reserve; /* VipsBuffer kept in reserve */
int n_reserve; /* Number in reserve */
} VipsBufferCache;
/* What we track for each pixel buffer. These can move between caches and
* between threads, but not between images.
*
* Moving between threads is difficult, use region ownership stuff.
*/
typedef struct _VipsBuffer {
int ref_count; /* # of regions referencing us */
struct _VipsImage *im; /* VipsImage we are attached to */
VipsRect area; /* Area this pixel buffer covers */
gboolean done; /* Calculated and in a cache */
VipsBufferCache *cache; /* The cache this buffer is published on */
VipsPel *buf; /* Private malloc() area */
size_t bsize; /* Size of private malloc() */
} VipsBuffer;
VIPS_API
void vips_buffer_dump_all(void);
VIPS_API
void vips_buffer_done(VipsBuffer *buffer);
VIPS_API
void vips_buffer_undone(VipsBuffer *buffer);
VIPS_API
void vips_buffer_unref(VipsBuffer *buffer);
VIPS_API
VipsBuffer *vips_buffer_new(struct _VipsImage *im, VipsRect *area);
VIPS_API
VipsBuffer *vips_buffer_ref(struct _VipsImage *im, VipsRect *area);
VIPS_API
VipsBuffer *vips_buffer_unref_ref(VipsBuffer *buffer,
struct _VipsImage *im, VipsRect *area);
VIPS_API
void vips_buffer_print(VipsBuffer *buffer);
void vips__render_shutdown(void);
/* Sections of region.h that are private to VIPS.
*/
/* Region types.
*/
typedef enum _RegionType {
VIPS_REGION_NONE,
VIPS_REGION_BUFFER, /* A VipsBuffer */
VIPS_REGION_OTHER_REGION, /* Memory on another region */
VIPS_REGION_OTHER_IMAGE, /* Memory on another image */
VIPS_REGION_WINDOW /* A VipsWindow on fd */
} RegionType;
/* Private to iofuncs: the size of the `tiles' requested by
* vips_image_generate() when acting as a data sink.
*/
#define VIPS__TILE_WIDTH (128)
#define VIPS__TILE_HEIGHT (128)
/* The height of the strips for the other two request styles.
*/
#define VIPS__THINSTRIP_HEIGHT (1)
#define VIPS__FATSTRIP_HEIGHT (16)
/* Functions on regions.
*/
struct _VipsRegion;
void vips__region_take_ownership(struct _VipsRegion *reg);
void vips__region_check_ownership(struct _VipsRegion *reg);
/* TODO(kleisauke): VIPS_API is required by vipsdisp.
*/
VIPS_API
void vips__region_no_ownership(struct _VipsRegion *reg);
typedef int (*VipsRegionFillFn)(struct _VipsRegion *, void *);
VIPS_API
int vips_region_fill(struct _VipsRegion *reg,
const VipsRect *r, VipsRegionFillFn fn, void *a);
int vips__image_wio_output(struct _VipsImage *image);
int vips__image_pio_output(struct _VipsImage *image);
/* VIPS_ARGUMENT_FOR_ALL() needs to have this visible.
*/
VIPS_API
VipsArgumentInstance *vips__argument_get_instance(
VipsArgumentClass *argument_class,
VipsObject *object);
VipsArgument *vips__argument_table_lookup(VipsArgumentTable *table,
GParamSpec *pspec);
/* im_demand_hint_array() needs to have this visible.
*/
#if VIPS_ENABLE_DEPRECATED
VIPS_API
#endif
void vips__demand_hint_array(struct _VipsImage *image,
int hint, struct _VipsImage **in);
/* im_cp_desc_array() needs to have this visible.
*/
#if VIPS_ENABLE_DEPRECATED
VIPS_API
#endif
int vips__image_copy_fields_array(struct _VipsImage *out,
struct _VipsImage *in[]);
void vips__region_count_pixels(struct _VipsRegion *region, const char *nickname);
VIPS_API
void vips_region_dump_all(void);
VIPS_API
int vips_region_prepare_many(struct _VipsRegion **reg, const VipsRect *r);
/* Handy for debugging.
*/
int vips__view_image(struct _VipsImage *image);
/* Pre 8.7 libvipses used this for allocating argument ids.
*/
VIPS_API
int _vips__argument_id;
void vips__meta_init(void);
// autoptr needs typed functions for autofree ... this needs to be in the
// public API since downstream projects can use our auto defs
VIPS_API
void VipsArrayDouble_unref(VipsArrayDouble *array);
VIPS_API
void VipsArrayImage_unref(VipsArrayImage *array);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_PRIVATE_H*/

View File

@@ -0,0 +1,80 @@
/* Simple rectangle algebra.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_RECT_H
#define VIPS_RECT_H
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef struct _VipsRect {
/*< public >*/
int left;
int top;
int width;
int height;
} VipsRect;
#define VIPS_RECT_RIGHT(R) ((R)->left + (R)->width)
#define VIPS_RECT_BOTTOM(R) ((R)->top + (R)->height)
#define VIPS_RECT_HCENTRE(R) ((R)->left + (R)->width / 2)
#define VIPS_RECT_VCENTRE(R) ((R)->top + (R)->height / 2)
VIPS_API
gboolean vips_rect_isempty(const VipsRect *r);
VIPS_API
gboolean vips_rect_includespoint(const VipsRect *r, int x, int y);
VIPS_API
gboolean vips_rect_includesrect(const VipsRect *r1, const VipsRect *r2);
VIPS_API
gboolean vips_rect_equalsrect(const VipsRect *r1, const VipsRect *r2);
VIPS_API
gboolean vips_rect_overlapsrect(const VipsRect *r1, const VipsRect *r2);
VIPS_API
void vips_rect_marginadjust(VipsRect *r, int n);
VIPS_API
void vips_rect_intersectrect(const VipsRect *r1, const VipsRect *r2,
VipsRect *out);
VIPS_API
void vips_rect_unionrect(const VipsRect *r1, const VipsRect *r2,
VipsRect *out);
VIPS_API
VipsRect *vips_rect_dup(const VipsRect *r);
VIPS_API
void vips_rect_normalise(VipsRect *r);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_RECT_H*/

View File

@@ -0,0 +1,238 @@
/* Definitions for partial image regions.
*
* J.Cupitt, 8/4/93
*
* 2/3/11
* - move to GObject
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_REGION_H
#define VIPS_REGION_H
#include <glib.h>
#include <glib-object.h>
#include <vips/object.h>
#include <vips/image.h>
#include <vips/rect.h>
#include <vips/private.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#define VIPS_TYPE_REGION (vips_region_get_type())
#define VIPS_REGION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_REGION, VipsRegion))
#define VIPS_REGION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_REGION, VipsRegionClass))
#define VIPS_IS_REGION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_REGION))
#define VIPS_IS_REGION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_REGION))
#define VIPS_REGION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_REGION, VipsRegionClass))
/**
* VipsRegionShrink:
* @VIPS_REGION_SHRINK_MEAN: use the average
* @VIPS_REGION_SHRINK_MEDIAN: use the median
* @VIPS_REGION_SHRINK_MODE: use the mode
* @VIPS_REGION_SHRINK_MAX: use the maximum
* @VIPS_REGION_SHRINK_MIN: use the minimum
* @VIPS_REGION_SHRINK_NEAREST: use the top-left pixel
*
* How to calculate the output pixels when shrinking a 2x2 region.
*/
typedef enum {
VIPS_REGION_SHRINK_MEAN,
VIPS_REGION_SHRINK_MEDIAN,
VIPS_REGION_SHRINK_MODE,
VIPS_REGION_SHRINK_MAX,
VIPS_REGION_SHRINK_MIN,
VIPS_REGION_SHRINK_NEAREST,
VIPS_REGION_SHRINK_LAST
} VipsRegionShrink;
/* Sub-area of image.
*
* Matching typedef in basic.h.
*/
struct _VipsRegion {
VipsObject parent_object;
/*< public >*/
/* Users may read these two fields.
*/
VipsImage *im; /* Link back to parent image */
VipsRect valid; /* Area of parent we can see */
/* The rest of VipsRegion is private.
*/
/*< private >*/
RegionType type; /* What kind of attachment */
VipsPel *data; /* Off here to get data */
int bpl; /* Bytes-per-line for data */
void *seq; /* Sequence we are using to fill region */
/* The thread that made this region. Used to assert() test that
* regions are not being shared between threads.
*/
GThread *thread;
/* Ref to the window we use for this region, if any.
*/
VipsWindow *window;
/* Ref to the buffer we use for this region, if any.
*/
VipsBuffer *buffer;
/* The image this region is on has changed and caches need to be
* dropped.
*/
gboolean invalid;
};
typedef struct _VipsRegionClass {
VipsObjectClass parent_class;
} VipsRegionClass;
/* Don't put spaces around void here, it breaks gtk-doc.
*/
VIPS_API
GType vips_region_get_type(void);
VIPS_API
VipsRegion *vips_region_new(VipsImage *image);
VIPS_API
int vips_region_buffer(VipsRegion *reg, const VipsRect *r);
VIPS_API
int vips_region_image(VipsRegion *reg, const VipsRect *r);
VIPS_API
int vips_region_region(VipsRegion *reg, VipsRegion *dest,
const VipsRect *r, int x, int y);
VIPS_API
int vips_region_equalsregion(VipsRegion *reg1, VipsRegion *reg2);
VIPS_API
int vips_region_position(VipsRegion *reg, int x, int y);
VIPS_API
void vips_region_paint(VipsRegion *reg, const VipsRect *r, int value);
VIPS_API
void vips_region_paint_pel(VipsRegion *reg,
const VipsRect *r, const VipsPel *ink);
VIPS_API
void vips_region_black(VipsRegion *reg);
VIPS_API
void vips_region_copy(VipsRegion *reg, VipsRegion *dest,
const VipsRect *r, int x, int y);
VIPS_API
int vips_region_shrink_method(VipsRegion *from, VipsRegion *to,
const VipsRect *target, VipsRegionShrink method);
VIPS_API
int vips_region_shrink(VipsRegion *from, VipsRegion *to,
const VipsRect *target);
VIPS_API
int vips_region_prepare(VipsRegion *reg, const VipsRect *r);
VIPS_API
int vips_region_prepare_to(VipsRegion *reg,
VipsRegion *dest, const VipsRect *r, int x, int y);
VIPS_API
VipsPel *vips_region_fetch(VipsRegion *region,
int left, int top, int width, int height, size_t *len);
VIPS_API
int vips_region_width(VipsRegion *region);
VIPS_API
int vips_region_height(VipsRegion *region);
VIPS_API
void vips_region_invalidate(VipsRegion *reg);
/* Use this to count pixels passing through key points. Handy for spotting bad
* overcomputation.
*/
#ifdef DEBUG_LEAK
#define VIPS_COUNT_PIXELS(R, N) vips__region_count_pixels(R, N)
#else /*!DEBUG_LEAK*/
#define VIPS_COUNT_PIXELS(R, N)
#endif /*DEBUG_LEAK*/
#define VIPS_REGION_LSKIP(R) \
((size_t) ((R)->bpl))
#define VIPS_REGION_N_ELEMENTS(R) \
((size_t) ((R)->valid.width * (R)->im->Bands))
#define VIPS_REGION_SIZEOF_ELEMENT(R) \
(VIPS_IMAGE_SIZEOF_ELEMENT((R)->im))
#define VIPS_REGION_SIZEOF_PEL(R) \
(VIPS_IMAGE_SIZEOF_PEL((R)->im))
#define VIPS_REGION_SIZEOF_LINE(R) \
((size_t) ((R)->valid.width * VIPS_REGION_SIZEOF_PEL(R)))
/* If DEBUG is defined, add bounds checking.
*/
#ifdef DEBUG
#define VIPS_REGION_ADDR(R, X, Y) \
((vips_rect_includespoint(&(R)->valid, (X), (Y))) \
? ((R)->data + ((Y) - (R)->valid.top) * VIPS_REGION_LSKIP(R) + \
((X) - (R)->valid.left) * VIPS_REGION_SIZEOF_PEL(R)) \
: (fprintf(stderr, \
"VIPS_REGION_ADDR: point out of bounds, " \
"file \"%s\", line %d\n" \
"(point x=%d, y=%d\n" \
" should have been within VipsRect left=%d, top=%d, " \
"width=%d, height=%d)\n", \
__FILE__, __LINE__, \
(X), (Y), \
(R)->valid.left, \
(R)->valid.top, \
(R)->valid.width, \
(R)->valid.height), \
abort(), (VipsPel *) NULL))
#else /*DEBUG*/
#define VIPS_REGION_ADDR(R, X, Y) \
((R)->data + \
((Y) - (R)->valid.top) * VIPS_REGION_LSKIP(R) + \
((X) - (R)->valid.left) * VIPS_REGION_SIZEOF_PEL(R))
#endif /*DEBUG*/
#define VIPS_REGION_ADDR_TOPLEFT(R) ((R)->data)
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_REGION_H*/

View File

@@ -0,0 +1,123 @@
/* resample.h
*
* 20/9/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_RESAMPLE_H
#define VIPS_RESAMPLE_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef enum {
VIPS_KERNEL_NEAREST,
VIPS_KERNEL_LINEAR,
VIPS_KERNEL_CUBIC,
VIPS_KERNEL_MITCHELL,
VIPS_KERNEL_LANCZOS2,
VIPS_KERNEL_LANCZOS3,
VIPS_KERNEL_LAST
} VipsKernel;
typedef enum {
VIPS_SIZE_BOTH,
VIPS_SIZE_UP,
VIPS_SIZE_DOWN,
VIPS_SIZE_FORCE,
VIPS_SIZE_LAST
} VipsSize;
VIPS_API
int vips_shrink(VipsImage *in, VipsImage **out,
double hshrink, double vshrink, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_shrinkh(VipsImage *in, VipsImage **out, int hshrink, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_shrinkv(VipsImage *in, VipsImage **out, int vshrink, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_reduce(VipsImage *in, VipsImage **out,
double hshrink, double vshrink, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_reduceh(VipsImage *in, VipsImage **out, double hshrink, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_reducev(VipsImage *in, VipsImage **out, double vshrink, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_thumbnail(const char *filename, VipsImage **out, int width, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_thumbnail_buffer(void *buf, size_t len, VipsImage **out,
int width, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_thumbnail_image(VipsImage *in, VipsImage **out, int width, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_thumbnail_source(VipsSource *source, VipsImage **out,
int width, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_similarity(VipsImage *in, VipsImage **out, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rotate(VipsImage *in, VipsImage **out, double angle, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_affine(VipsImage *in, VipsImage **out,
double a, double b, double c, double d, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_resize(VipsImage *in, VipsImage **out, double scale, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_mapim(VipsImage *in, VipsImage **out, VipsImage *index, ...)
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_quadratic(VipsImage *in, VipsImage **out, VipsImage *coeff, ...)
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_RESAMPLE_H*/

View File

@@ -0,0 +1,143 @@
/* Buffered inputput from a VipsSource
*
* J.Cupitt, 18/11/19
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_SBUF_H
#define VIPS_SBUF_H
#include <glib.h>
#include <glib-object.h>
#include <vips/object.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#define VIPS_TYPE_SBUF (vips_sbuf_get_type())
#define VIPS_SBUF(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_SBUF, VipsSbuf))
#define VIPS_SBUF_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_SBUF, VipsSbufClass))
#define VIPS_IS_SBUF(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_SBUF))
#define VIPS_IS_SBUF_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_SBUF))
#define VIPS_SBUF_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_SBUF, VipsSbufClass))
#define VIPS_SBUF_BUFFER_SIZE (4096)
/* Layer over source: read with an input buffer.
*
* Libraries like libjpeg do their own input buffering and need raw IO, but
* others, like radiance, need to parse the input into lines. A buffered read
* class is very convenient.
*/
typedef struct _VipsSbuf {
VipsObject parent_object;
/*< private >*/
/* The VipsSource we wrap.
*/
VipsSource *source;
/* The +1 means there's always a \0 byte at the end.
*
* Unsigned char, since we don't want >127 to be -ve.
*
* chars_in_buffer is how many chars we have in input_buffer,
* read_point is the current read position in that buffer.
*/
unsigned char input_buffer[VIPS_SBUF_BUFFER_SIZE + 1];
int chars_in_buffer;
int read_point;
/* Build lines of text here.
*/
unsigned char line[VIPS_SBUF_BUFFER_SIZE + 1];
} VipsSbuf;
typedef struct _VipsSbufClass {
VipsObjectClass parent_class;
} VipsSbufClass;
VIPS_API
GType vips_sbuf_get_type(void);
VIPS_API
VipsSbuf *vips_sbuf_new_from_source(VipsSource *source);
VIPS_API
void vips_sbuf_unbuffer(VipsSbuf *sbuf);
VIPS_API
int vips_sbuf_getc(VipsSbuf *sbuf);
#define VIPS_SBUF_GETC(S) ( \
(S)->read_point < (S)->chars_in_buffer \
? (S)->input_buffer[(S)->read_point++] \
: vips_sbuf_getc(S))
VIPS_API
void vips_sbuf_ungetc(VipsSbuf *sbuf);
#define VIPS_SBUF_UNGETC(S) \
{ \
if ((S)->read_point > 0) \
(S)->read_point -= 1; \
}
VIPS_API
int vips_sbuf_require(VipsSbuf *sbuf, int require);
#define VIPS_SBUF_REQUIRE(S, R) ( \
(S)->read_point + (R) <= (S)->chars_in_buffer \
? 0 \
: vips_sbuf_require((S), (R)))
#define VIPS_SBUF_PEEK(S) ((S)->input_buffer + (S)->read_point)
#define VIPS_SBUF_FETCH(S) ((S)->input_buffer[(S)->read_point++])
VIPS_API
const char *vips_sbuf_get_line(VipsSbuf *sbuf);
VIPS_API
char *vips_sbuf_get_line_copy(VipsSbuf *sbuf);
VIPS_API
const char *vips_sbuf_get_non_whitespace(VipsSbuf *sbuf);
VIPS_API
int vips_sbuf_skip_whitespace(VipsSbuf *sbuf);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_SBUF_H*/

View File

@@ -0,0 +1,77 @@
/* Definitions for thread support.
*
* JC, 9/5/94
* 30/7/99 RP, JC
* - reworked for posix/solaris threads
* 28/9/99 JC
* - restructured, made part of public API
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_SEMAPHORE_H
#define VIPS_SEMAPHORE_H
#include <glib.h>
#include <vips/vips.h>
#include <vips/thread.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* Implement our own semaphores.
*/
typedef struct {
char *name;
int v;
GMutex *mutex;
GCond *cond;
} VipsSemaphore;
VIPS_API
int vips_semaphore_up(VipsSemaphore *s);
VIPS_API
int vips_semaphore_upn(VipsSemaphore *s, int n);
VIPS_API
int vips_semaphore_down(VipsSemaphore *s);
VIPS_API
int vips_semaphore_downn(VipsSemaphore *s, int n);
VIPS_API
int vips_semaphore_down_timeout(VipsSemaphore *s, gint64 timeout);
VIPS_API
void vips_semaphore_destroy(VipsSemaphore *s);
VIPS_API
void vips_semaphore_init(VipsSemaphore *s, int v, char *name);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_SEMAPHORE_H*/

View File

@@ -0,0 +1,75 @@
/* Private include file ... if we've been configured without gthread, we need
* to point the g_thread_*() and g_mutex_*() functions at our own stubs.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_THREAD_H
#define VIPS_THREAD_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* We need wrappers over g_mutex_new(), it was replaced by g_mutex_init() in
* glib 2.32+
*/
VIPS_API
GMutex *vips_g_mutex_new(void);
VIPS_API
void vips_g_mutex_free(GMutex *);
/* Same for GCond.
*/
VIPS_API
GCond *vips_g_cond_new(void);
VIPS_API
void vips_g_cond_free(GCond *);
/* ... and for GThread.
*/
VIPS_API
GThread *vips_g_thread_new(const char *, GThreadFunc, gpointer);
VIPS_API
gboolean vips_thread_isvips(void);
VIPS_API
int vips_thread_execute(const char *domain, GFunc func, gpointer data);
typedef struct _VipsThreadset VipsThreadset;
VipsThreadset *vips_threadset_new(int max_threads);
int vips_threadset_run(VipsThreadset *set,
const char *domain, GFunc func, gpointer data);
void vips_threadset_free(VipsThreadset *set);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_THREAD_H*/

View File

@@ -0,0 +1,159 @@
/* Thread eval for VIPS.
*
* 29/9/99 JC
* - from thread.h
* 17/3/10
* - from threadgroup
* - rework with a simpler distributed work allocation model
* 02/02/20 kleisauke
* - reuse threads by using GLib's threadpool
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_THREADPOOL_H
#define VIPS_THREADPOOL_H
#include <glib.h>
#include <glib-object.h>
#include <vips/image.h>
#include <vips/object.h>
#include <vips/region.h>
#include <vips/rect.h>
#include <vips/semaphore.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* Per-thread state. Allocate functions can use these members to
* communicate with work functions.
*/
#define VIPS_TYPE_THREAD_STATE (vips_thread_state_get_type())
#define VIPS_THREAD_STATE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
VIPS_TYPE_THREAD_STATE, VipsThreadState))
#define VIPS_THREAD_STATE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
VIPS_TYPE_THREAD_STATE, VipsThreadStateClass))
#define VIPS_IS_THREAD_STATE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_THREAD_STATE))
#define VIPS_IS_THREAD_STATE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_THREAD_STATE))
#define VIPS_THREAD_STATE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
VIPS_TYPE_THREAD_STATE, VipsThreadStateClass))
typedef struct _VipsThreadState {
VipsObject parent_object;
/*< public >*/
/* Image we run on.
*/
VipsImage *im;
/* This region is created and destroyed by the threadpool for the
* use of the worker.
*/
VipsRegion *reg;
/* Neither used nor set, do what you like with them.
*/
VipsRect pos;
int x, y;
/* Set in work to get the allocate to signal stop.
*/
gboolean stop;
/* The client data passed to the enclosing vips_threadpool_run().
*/
void *a;
/* Set in allocate to stall this thread for a moment. Handy for
* debugging race conditions.
*/
gboolean stall;
} VipsThreadState;
typedef struct _VipsThreadStateClass {
VipsObjectClass parent_class;
/*< public >*/
} VipsThreadStateClass;
VIPS_API
void *vips_thread_state_set(VipsObject *object, void *a, void *b);
/* Don't put spaces around void here, it breaks gtk-doc.
*/
VIPS_API
GType vips_thread_state_get_type(void);
VIPS_API
VipsThreadState *vips_thread_state_new(VipsImage *im, void *a);
/* Constructor for per-thread state.
*/
typedef VipsThreadState *(*VipsThreadStartFn)(VipsImage *im, void *a);
/* A work allocate function. This is run single-threaded by a worker to
* set up a new work unit.
* Return non-zero for errors. Set *stop for "no more work to do"
*/
typedef int (*VipsThreadpoolAllocateFn)(VipsThreadState *state,
void *a, gboolean *stop);
/* A work function. This does a unit of work (eg. processing a tile or
* whatever). Return non-zero for errors.
*/
typedef int (*VipsThreadpoolWorkFn)(VipsThreadState *state, void *a);
/* A progress function. This is run by the main thread once for every
* allocation. Return an error to kill computation early.
*/
typedef int (*VipsThreadpoolProgressFn)(void *a);
VIPS_API
int vips_threadpool_run(VipsImage *im,
VipsThreadStartFn start,
VipsThreadpoolAllocateFn allocate,
VipsThreadpoolWorkFn work,
VipsThreadpoolProgressFn progress,
void *a);
VIPS_API
void vips_get_tile_size(VipsImage *im,
int *tile_width, int *tile_height, int *n_lines);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_THREADPOOL_H*/

View File

@@ -0,0 +1,89 @@
/* Affine transforms.
*/
/*
Copyright (C) 1991-2003 The National Gallery
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_TRANSFORM_H
#define VIPS_TRANSFORM_H
#include <glib.h>
#include <vips/image.h>
#include <vips/rect.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* Params for an affine transformation.
*/
typedef struct {
/* Area of input we can use. This can be smaller than the real input
* image: we expand the input to add extra pixels for interpolation.
*/
VipsRect iarea;
/* The area of the output we've been asked to generate. left/top can
* be negative.
*/
VipsRect oarea;
/* The transform.
*/
double a, b, c, d;
double idx, idy;
double odx, ody;
double ia, ib, ic, id; /* Inverse of matrix abcd */
} VipsTransformation;
void vips__transform_init(VipsTransformation *trn);
int vips__transform_calc_inverse(VipsTransformation *trn);
int vips__transform_isidentity(const VipsTransformation *trn);
int vips__transform_add(const VipsTransformation *in1,
const VipsTransformation *in2,
VipsTransformation *out);
void vips__transform_print(const VipsTransformation *trn);
void vips__transform_forward_point(const VipsTransformation *trn,
const double x, const double y, double *ox, double *oy);
void vips__transform_invert_point(const VipsTransformation *trn,
const double x, const double y, double *ox, double *oy);
void vips__transform_forward_rect(const VipsTransformation *trn,
const VipsRect *in, VipsRect *out);
void vips__transform_invert_rect(const VipsTransformation *trn,
const VipsRect *in, VipsRect *out);
void vips__transform_set_area(VipsTransformation *);
int vips__affine(VipsImage *in, VipsImage *out, VipsTransformation *trn);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_TRANSFORM_H*/

View File

@@ -0,0 +1,310 @@
/* the GTypes we define
*
* 27/10/11
* - from header.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_TYPE_H
#define VIPS_TYPE_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* A very simple boxed type for testing. Just holds an int.
*/
typedef struct _VipsThing {
int i;
} VipsThing;
/**
* VIPS_TYPE_THING:
*
* The #GType for a #VipsThing.
*/
#define VIPS_TYPE_THING (vips_thing_get_type())
VIPS_API
GType vips_thing_get_type(void);
VIPS_API
VipsThing *vips_thing_new(int i);
/* A ref-counted area of memory. Can hold arrays of things as well.
*/
typedef struct _VipsArea {
void *data;
size_t length; /* 0 if not known */
/* If this area represents an array, the number of elements in the
* array. Equal to length / sizeof(element).
*/
int n;
/*< private >*/
/* Reference count and lock.
*
* We could use an atomic int, but this is not a high-traffic data
* structure, so a simple GMutex is OK.
*/
int count;
GMutex *lock;
/* Things like ICC profiles need their own free functions.
*
* Set client to anything you like -- VipsArea doesn't use this.
*/
VipsCallbackFn free_fn;
void *client;
/* If we are holding an array (for example, an array of double), the
* GType of the elements and their size. 0 for not known.
*
* n is always length / sizeof_type, we keep it as a member for
* convenience.
*/
GType type;
size_t sizeof_type;
} VipsArea;
VIPS_API
VipsArea *vips_area_copy(VipsArea *area);
VIPS_API
int vips_area_free_cb(void *mem, VipsArea *area);
VIPS_API
void vips_area_unref(VipsArea *area);
VIPS_API
VipsArea *vips_area_new(VipsCallbackFn free_fn, void *data);
VIPS_API
VipsArea *vips_area_new_array(GType type, size_t sizeof_type, int n);
VIPS_API
VipsArea *vips_area_new_array_object(int n);
VIPS_API
void *vips_area_get_data(VipsArea *area,
size_t *length, int *n, GType *type, size_t *sizeof_type);
#ifdef VIPS_DEBUG
#define VIPS_ARRAY_ADDR(X, I) \
(((I) >= 0 && (I) < VIPS_AREA(X)->n) \
? (void *) ((VipsPel *) VIPS_AREA(X)->data + \
VIPS_AREA(X)->sizeof_type * (I)) \
: (fprintf(stderr, \
"VIPS_ARRAY_ADDR: index out of bounds, " \
"file \"%s\", line %d\n" \
"(index %d should have been within [0,%d])\n", \
__FILE__, __LINE__, \
(I), VIPS_AREA(X)->n), \
NULL))
#else /*!VIPS_DEBUG*/
#define VIPS_ARRAY_ADDR(X, I) \
((void *) ((VipsPel *) VIPS_AREA(X)->data + \
VIPS_AREA(X)->sizeof_type * (I)))
#endif /*VIPS_DEBUG*/
/**
* VIPS_TYPE_AREA:
*
* The #GType for a #VipsArea.
*/
#define VIPS_TYPE_AREA (vips_area_get_type())
#define VIPS_AREA(X) ((VipsArea *) (X))
VIPS_API
GType vips_area_get_type(void);
/**
* VIPS_TYPE_SAVE_STRING:
*
* The #GType for a #VipsSaveString.
*/
#define VIPS_TYPE_SAVE_STRING (vips_save_string_get_type())
VIPS_API
GType vips_save_string_get_type(void);
typedef struct _VipsSaveString {
char *s;
} VipsSaveString;
/**
* VIPS_TYPE_REF_STRING:
*
* The #GType for a #VipsRefString.
*/
#define VIPS_TYPE_REF_STRING (vips_ref_string_get_type())
typedef struct _VipsRefString {
VipsArea area;
} VipsRefString;
VIPS_API
VipsRefString *vips_ref_string_new(const char *str);
VIPS_API
const char *vips_ref_string_get(VipsRefString *refstr, size_t *length);
VIPS_API
GType vips_ref_string_get_type(void);
/**
* VIPS_TYPE_BLOB:
*
* The %GType for a #VipsBlob.
*/
#define VIPS_TYPE_BLOB (vips_blob_get_type())
typedef struct _VipsBlob {
VipsArea area;
} VipsBlob;
VIPS_API
VipsBlob *vips_blob_new(VipsCallbackFn free_fn,
const void *data, size_t length);
VIPS_API
VipsBlob *vips_blob_copy(const void *data, size_t length);
VIPS_API
const void *vips_blob_get(VipsBlob *blob, size_t *length);
VIPS_API
void vips_blob_set(VipsBlob *blob,
VipsCallbackFn free_fn, const void *data, size_t length);
VIPS_API
GType vips_blob_get_type(void);
/**
* VIPS_TYPE_ARRAY_DOUBLE:
*
* The #GType for a #VipsArrayDouble.
*/
#define VIPS_TYPE_ARRAY_DOUBLE (vips_array_double_get_type())
typedef struct _VipsArrayDouble {
VipsArea area;
} VipsArrayDouble;
VIPS_API
VipsArrayDouble *vips_array_double_new(const double *array, int n);
VIPS_API
VipsArrayDouble *vips_array_double_newv(int n, ...);
VIPS_API
double *vips_array_double_get(VipsArrayDouble *array, int *n);
VIPS_API
GType vips_array_double_get_type(void);
/**
* VIPS_TYPE_ARRAY_INT:
*
* The #GType for a #VipsArrayInt.
*/
#define VIPS_TYPE_ARRAY_INT (vips_array_int_get_type())
typedef struct _VipsArrayInt {
VipsArea area;
} VipsArrayInt;
VIPS_API
VipsArrayInt *vips_array_int_new(const int *array, int n);
VIPS_API
VipsArrayInt *vips_array_int_newv(int n, ...);
VIPS_API
int *vips_array_int_get(VipsArrayInt *array, int *n);
VIPS_API
GType vips_array_int_get_type(void);
/**
* VIPS_TYPE_ARRAY_IMAGE:
*
* The #GType for a #VipsArrayImage.
*/
#define VIPS_TYPE_ARRAY_IMAGE (vips_array_image_get_type())
typedef struct _VipsArrayImage {
VipsArea area;
} VipsArrayImage;
/* See image.h for vips_array_image_new() etc., they need to be declared after
* VipsImage.
*/
VIPS_API
GType vips_array_image_get_type(void);
VIPS_API
void vips_value_set_area(GValue *value, VipsCallbackFn free_fn, void *data);
VIPS_API
void *vips_value_get_area(const GValue *value, size_t *length);
VIPS_API
const char *vips_value_get_save_string(const GValue *value);
VIPS_API
void vips_value_set_save_string(GValue *value, const char *str);
VIPS_API
void vips_value_set_save_stringf(GValue *value, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);
VIPS_API
const char *vips_value_get_ref_string(const GValue *value, size_t *length);
VIPS_API
void vips_value_set_ref_string(GValue *value, const char *str);
VIPS_API
void *vips_value_get_blob(const GValue *value, size_t *length);
VIPS_API
void vips_value_set_blob(GValue *value,
VipsCallbackFn free_fn, const void *data, size_t length);
VIPS_API
void vips_value_set_blob_free(GValue *value, void *data, size_t length);
VIPS_API
void vips_value_set_array(GValue *value,
int n, GType type, size_t sizeof_type);
VIPS_API
void *vips_value_get_array(const GValue *value,
int *n, GType *type, size_t *sizeof_type);
VIPS_API
double *vips_value_get_array_double(const GValue *value, int *n);
VIPS_API
void vips_value_set_array_double(GValue *value, const double *array, int n);
VIPS_API
int *vips_value_get_array_int(const GValue *value, int *n);
VIPS_API
void vips_value_set_array_int(GValue *value, const int *array, int n);
VIPS_API
GObject **vips_value_get_array_object(const GValue *value, int *n);
VIPS_API
void vips_value_set_array_object(GValue *value, int n);
/* See also image.h, that has vips_array_image_get(), vips_array_image_new(),
* vips_value_get_array_image() and vips_value_set_array_image(). They need
* to be declared after VipsImage.
*/
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_TYPE_H*/

View File

@@ -0,0 +1,432 @@
/* Various useful definitions.
*
* J.Cupitt, 8/4/93
* 15/7/96 JC
* - C++ stuff added
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_UTIL_H
#define VIPS_UTIL_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#include <stdio.h>
#include <math.h>
/* Some platforms don't have M_PI :-(
*/
#define VIPS_PI (3.14159265358979323846)
/* Convert degrees->rads and vice-versa.
*/
#define VIPS_RAD(R) (((R) / 360.0) * 2.0 * VIPS_PI)
#define VIPS_DEG(A) (((A) / (2.0 * VIPS_PI)) * 360.0)
#define VIPS_MAX(A, B) ((A) > (B) ? (A) : (B))
#define VIPS_MIN(A, B) ((A) < (B) ? (A) : (B))
#define VIPS_CLIP(A, V, B) VIPS_MAX((A), VIPS_MIN((B), (V)))
#define VIPS_FCLIP(A, V, B) VIPS_FMAX((A), VIPS_FMIN((B), (V)))
#define VIPS_NUMBER(R) ((int) (sizeof(R) / sizeof(R[0])))
#define VIPS_ABS(X) (((X) >= 0) ? (X) : -(X))
// is something (eg. a pointer) N aligned
#define VIPS_ALIGNED(P, N) ((((guint64) (P)) & ((N) - 1)) == 0)
/* The built-in isnan and isinf functions provided by gcc 4+ and clang are
* up to 7x faster than their libc equivalent included from <math.h>.
*/
#if defined(__clang__) || (__GNUC__ >= 4)
#define VIPS_ISNAN(V) __builtin_isnan(V)
#define VIPS_FLOOR(V) __builtin_floor(V)
#define VIPS_CEIL(V) __builtin_ceil(V)
#define VIPS_RINT(V) __builtin_rint(V)
#define VIPS_ROUND(V) __builtin_round(V)
#define VIPS_FABS(V) __builtin_fabs(V)
#define VIPS_FMAX(A, B) __builtin_fmax(A, B)
#define VIPS_FMIN(A, B) __builtin_fmin(A, B)
#else
#define VIPS_ISNAN(V) isnan(V)
#define VIPS_FLOOR(V) floor(V)
#define VIPS_CEIL(V) ceil(V)
#define VIPS_RINT(V) rint(V)
#define VIPS_ROUND(V) round(V)
#define VIPS_FABS(V) VIPS_ABS(V)
#define VIPS_FMAX(A, B) VIPS_MAX(A, B)
#define VIPS_FMIN(A, B) VIPS_MIN(A, B)
#endif
/* Testing status before the function call saves a lot of time.
*/
#define VIPS_ONCE(ONCE, FUNC, CLIENT) \
G_STMT_START \
{ \
if (G_UNLIKELY((ONCE)->status != G_ONCE_STATUS_READY)) \
(void) g_once(ONCE, FUNC, CLIENT); \
} \
G_STMT_END
/* VIPS_RINT() does "bankers rounding", it rounds to the nearest even integer.
* For things like image geometry, we want strict nearest int.
*
* If you know it's unsigned, _UINT is a little faster.
*/
#define VIPS_ROUND_INT(R) ((int) ((R) > 0 ? ((R) + 0.5) : ((R) -0.5)))
#define VIPS_ROUND_UINT(R) ((int) ((R) + 0.5))
/* Round N down and up to the nearest multiple of P.
*/
#define VIPS_ROUND_DOWN(N, P) ((N) - ((N) % (P)))
#define VIPS_ROUND_UP(N, P) (VIPS_ROUND_DOWN((N) + (P) -1, (P)))
#define VIPS_SWAP(TYPE, A, B) \
G_STMT_START \
{ \
TYPE t = (A); \
(A) = (B); \
(B) = t; \
} \
G_STMT_END
/* Duff's device. Do OPERation N times in a 16-way unrolled loop.
*/
#define VIPS_UNROLL(N, OPER) \
G_STMT_START \
{ \
if ((N)) { \
int duff_count = ((N) + 15) / 16; \
\
switch ((N) % 16) { \
case 0: \
do { \
OPER; \
case 15: \
OPER; \
case 14: \
OPER; \
case 13: \
OPER; \
case 12: \
OPER; \
case 11: \
OPER; \
case 10: \
OPER; \
case 9: \
OPER; \
case 8: \
OPER; \
case 7: \
OPER; \
case 6: \
OPER; \
case 5: \
OPER; \
case 4: \
OPER; \
case 3: \
OPER; \
case 2: \
OPER; \
case 1: \
OPER; \
} while (--duff_count > 0); \
} \
} \
} \
G_STMT_END
/* Various integer range clips. Record over/under flows.
*/
#define VIPS_CLIP_UCHAR(V, SEQ) \
G_STMT_START \
{ \
if ((V) < 0) { \
(SEQ)->underflow++; \
(V) = 0; \
} \
else if ((V) > UCHAR_MAX) { \
(SEQ)->overflow++; \
(V) = UCHAR_MAX; \
} \
} \
G_STMT_END
#define VIPS_CLIP_CHAR(V, SEQ) \
G_STMT_START \
{ \
if ((V) < SCHAR_MIN) { \
(SEQ)->underflow++; \
(V) = SCHAR_MIN; \
} \
else if ((V) > SCHAR_MAX) { \
(SEQ)->overflow++; \
(V) = SCHAR_MAX; \
} \
} \
G_STMT_END
#define VIPS_CLIP_USHORT(V, SEQ) \
G_STMT_START \
{ \
if ((V) < 0) { \
(SEQ)->underflow++; \
(V) = 0; \
} \
else if ((V) > USHRT_MAX) { \
(SEQ)->overflow++; \
(V) = USHRT_MAX; \
} \
} \
G_STMT_END
#define VIPS_CLIP_SHORT(V, SEQ) \
G_STMT_START \
{ \
if ((V) < SHRT_MIN) { \
(SEQ)->underflow++; \
(V) = SHRT_MIN; \
} \
else if ((V) > SHRT_MAX) { \
(SEQ)->overflow++; \
(V) = SHRT_MAX; \
} \
} \
G_STMT_END
#define VIPS_CLIP_UINT(V, SEQ) \
G_STMT_START \
{ \
if ((V) < 0) { \
(SEQ)->underflow++; \
(V) = 0; \
} \
} \
G_STMT_END
#define VIPS_CLIP_NONE(V, SEQ) \
{ \
}
/* Not all platforms have PATH_MAX (eg. Hurd) and we don't need a platform one
* anyway, just a static buffer big enough for almost any path.
*/
#define VIPS_PATH_MAX (4096)
/* Create multiple copies of a function targeted at groups of SIMD intrinsics,
* with the most suitable selected at runtime via dynamic dispatch.
*/
#ifdef HAVE_TARGET_CLONES
#define VIPS_TARGET_CLONES(TARGETS) \
__attribute__((target_clones(TARGETS)))
#else
#define VIPS_TARGET_CLONES(TARGETS)
#endif
VIPS_API
const char *vips_enum_string(GType enm, int value);
VIPS_API
const char *vips_enum_nick(GType enm, int value);
VIPS_API
int vips_enum_from_nick(const char *domain, GType type, const char *str);
VIPS_API
int vips_flags_from_nick(const char *domain, GType type, const char *nick);
VIPS_API
gboolean vips_slist_equal(GSList *l1, GSList *l2);
VIPS_API
void *vips_slist_map2(GSList *list, VipsSListMap2Fn fn, void *a, void *b);
VIPS_API
void *vips_slist_map2_rev(GSList *list, VipsSListMap2Fn fn, void *a, void *b);
VIPS_API
void *vips_slist_map4(GSList *list,
VipsSListMap4Fn fn, void *a, void *b, void *c, void *d);
VIPS_API
void *vips_slist_fold2(GSList *list, void *start,
VipsSListFold2Fn fn, void *a, void *b);
VIPS_API
GSList *vips_slist_filter(GSList *list, VipsSListMap2Fn fn, void *a, void *b);
VIPS_API
void vips_slist_free_all(GSList *list);
VIPS_API
void *vips_map_equal(void *a, void *b);
VIPS_API
void *vips_hash_table_map(GHashTable *hash,
VipsSListMap2Fn fn, void *a, void *b);
VIPS_API
gboolean vips_iscasepostfix(const char *a, const char *b);
VIPS_API
gboolean vips_isprefix(const char *a, const char *b);
VIPS_API
char *vips_break_token(char *str, const char *brk);
VIPS_API
int vips_filename_suffix_match(const char *path, const char *suffixes[]);
VIPS_API
gint64 vips_file_length(int fd);
/* TODO(kleisauke): VIPS_API is required by vipsedit.
*/
VIPS_API
int vips__write(int fd, const void *buf, size_t count);
/* TODO(kleisauke): VIPS_API is required by test_connections.
*/
VIPS_API
int vips__open(const char *filename, int flags, int mode);
int vips__open_read(const char *filename);
FILE *vips__fopen(const char *filename, const char *mode);
FILE *vips__file_open_read(const char *filename,
const char *fallback_dir, gboolean text_mode);
FILE *vips__file_open_write(const char *filename,
gboolean text_mode);
/* TODO(kleisauke): VIPS_API is required by vipsedit.
*/
VIPS_API
char *vips__file_read(FILE *fp, const char *name, size_t *length_out);
char *vips__file_read_name(const char *name, const char *fallback_dir,
size_t *length_out);
int vips__file_write(void *data, size_t size, size_t nmemb, FILE *stream);
/* TODO(kleisauke): VIPS_API is required by the magick module.
*/
VIPS_API
gint64 vips__get_bytes(const char *filename, unsigned char buf[], gint64 len);
int vips__fgetc(FILE *fp);
GValue *vips__gvalue_ref_string_new(const char *text);
void vips__gslist_gvalue_free(GSList *list);
GSList *vips__gslist_gvalue_copy(const GSList *list);
GSList *vips__gslist_gvalue_merge(GSList *a, const GSList *b);
char *vips__gslist_gvalue_get(const GSList *list);
gint64 vips__seek_no_error(int fd, gint64 pos, int whence);
/* TODO(kleisauke): VIPS_API is required by vipsedit.
*/
VIPS_API
gint64 vips__seek(int fd, gint64 pos, int whence);
int vips__ftruncate(int fd, gint64 pos);
VIPS_API
int vips_existsf(const char *name, ...)
G_GNUC_PRINTF(1, 2);
VIPS_API
int vips_isdirf(const char *name, ...)
G_GNUC_PRINTF(1, 2);
VIPS_API
int vips_mkdirf(const char *name, ...)
G_GNUC_PRINTF(1, 2);
VIPS_API
int vips_rmdirf(const char *name, ...)
G_GNUC_PRINTF(1, 2);
VIPS_API
int vips_rename(const char *old_name, const char *new_name);
/**
* VipsToken:
* @VIPS_TOKEN_LEFT: left bracket
* @VIPS_TOKEN_RIGHT: right bracket
* @VIPS_TOKEN_STRING: string constant
* @VIPS_TOKEN_EQUALS: equals sign
* @VIPS_TOKEN_COMMA: comma
*
* Tokens returned by the vips lexical analyzer, see vips__token_get(). This
* is used to parse option strings for arguments.
*
* Left and right brackets can be any of (, {, [, <.
*
* Strings may be in double quotes, and may contain escaped quote characters,
* for example string, "string" and "str\"ing".
*
*/
typedef enum {
VIPS_TOKEN_LEFT = 1,
VIPS_TOKEN_RIGHT,
VIPS_TOKEN_STRING,
VIPS_TOKEN_EQUALS,
VIPS_TOKEN_COMMA
} VipsToken;
// we expose this one in the API for testing
VIPS_API
const char *vips__token_get(const char *buffer,
VipsToken *token, char *string, int size);
const char *vips__token_must(const char *buffer, VipsToken *token,
char *string, int size);
const char *vips__token_need(const char *buffer, VipsToken need_token,
char *string, int size);
const char *vips__token_segment(const char *p, VipsToken *token,
char *string, int size);
const char *vips__token_segment_need(const char *p, VipsToken need_token,
char *string, int size);
const char *vips__find_rightmost_brackets(const char *p);
/* TODO(kleisauke): VIPS_API is required by libvips-cpp and vipsheader.
*/
VIPS_API
void vips__filename_split8(const char *name,
char *filename, char *option_string);
VIPS_API
int vips_ispoweroftwo(int p);
VIPS_API
int vips_amiMSBfirst(void);
/* TODO(kleisauke): VIPS_API is required by jpegsave_file_fuzzer.
*/
VIPS_API
char *vips__temp_name(const char *format);
void vips__change_suffix(const char *name, char *out, int mx,
const char *new_suff, const char **olds, int nolds);
VIPS_API
char *vips_realpath(const char *path);
guint32 vips__random(guint32 seed);
guint32 vips__random_add(guint32 seed, int value);
const char *vips__icc_dir(void);
const char *vips__windows_prefix(void);
char *vips__get_iso8601(void);
VIPS_API
int vips_strtod(const char *str, double *out);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_UTIL_H*/

View File

@@ -0,0 +1,63 @@
/* helper stuff for Highway
*
* 16/03/21 kleisauke
* - from vector.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_VECTOR_H
#define VIPS_VECTOR_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/* Set from the command-line.
*/
extern gboolean vips__vector_enabled;
VIPS_API
gboolean vips_vector_isenabled(void);
VIPS_API
void vips_vector_set_enabled(gboolean enabled);
VIPS_API
gint64 vips_vector_get_builtin_targets(void);
VIPS_API
gint64 vips_vector_get_supported_targets(void);
VIPS_API
const char *vips_vector_target_name(gint64 target);
VIPS_API
void vips_vector_disable_targets(gint64 disabled_targets);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_VECTOR_H*/

View File

@@ -0,0 +1,26 @@
/* Macros for the header version.
*/
#ifndef VIPS_VERSION_H
#define VIPS_VERSION_H
#define VIPS_VERSION "8.16.1"
#define VIPS_VERSION_STRING "8.16.1"
#define VIPS_MAJOR_VERSION (8)
#define VIPS_MINOR_VERSION (16)
#define VIPS_MICRO_VERSION (1)
/* The ABI version, as used for library versioning.
*/
#define VIPS_LIBRARY_CURRENT (60)
#define VIPS_LIBRARY_REVISION (1)
#define VIPS_LIBRARY_AGE (18)
#define VIPS_CONFIG "enable debug: false\nenable deprecated: true\nenable modules: false\nenable cplusplus: true\nenable RAD load/save: true\nenable Analyze7 load: true\nenable PPM load/save: true\nenable GIF load: true\nFFTs with fftw3: true\nSIMD support with libhwy or liborc: false\nICC profile support with lcms2: false\ndeflate compression with zlib: true\ntext rendering with pangocairo: false\nfont file support with fontconfig: false\nEXIF metadata support with libexif: false\nJPEG load/save with libjpeg: true\nJXL load/save with libjxl: false (dynamic module: false)\nJPEG2000 load/save with OpenJPEG: false\nPNG load/save with libpng: true\nimage quantisation with imagequant or quantizr: false\nTIFF load/save with libtiff: false\nimage pyramid save with libarchive: false\nHEIC/AVIF load/save with libheif: false (dynamic module: false)\nWebP load/save with libwebp: true\nPDF load with PDFium or Poppler: false (dynamic module: false)\nSVG load with librsvg: false\nEXR load with OpenEXR: false\nWSI load with OpenSlide: false (dynamic module: false)\nMatlab load with Matio: false\nNIfTI load/save with libnifti: false\nFITS load/save with cfitsio: false\nGIF save with cgif: false\nMagick load/save with MagickCore: false (dynamic module: false)"
/* Not really anything to do with versions, but this is a handy place to put
* it.
*/
#define VIPS_ENABLE_DEPRECATED 1
#endif /*VIPS_VERSION_H*/

View File

@@ -0,0 +1,52 @@
/* video.h
*
* 20/9/09
* - from proto.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_VIDEO_H
#define IM_VIDEO_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
VIPS_DEPRECATED
int im_video_v4l1(VipsImage *im, const char *device,
int channel, int brightness, int colour, int contrast, int hue,
int ngrabs);
VIPS_DEPRECATED
int im_video_test(VipsImage *im, int brightness, int error);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*IM_VIDEO_H*/

View File

@@ -0,0 +1,201 @@
/* @(#) Header file for Birkbeck/VIPS Image Processing Library
* Authors: N. Dessipris, K. Martinez, Birkbeck College, London.
* Sept 94
*
* 15/7/96 JC
* - now does C++ extern stuff
* - many more protos
* 15/4/97 JC
* - protos split out
* 4/3/98 JC
* - IM_ANY added
* - sRGB colourspace added
* 28/10/98 JC
* - VASARI_MAGIC_INTEL and VASARI_MAGIC_SPARC added
* 29/9/99 JC
* - new locks for threading, no more threadgroup stuff in IMAGE
* 30/11/00 JC
* - override RGB/CMYK macros on cygwin
* 21/9/02 JC
* - new Xoffset/Yoffset fields
* - rationalized macro names
* 6/6/05 Markus Wollgarten
* - added Meta header field
* 31/7/05
* - added meta.h for new metadata API
* 22/8/05
* - scrapped stupid VAS_HD
* 30/9/05
* - added sizeof_header field for mmap window read of RAW files
* 4/10/05
* - now you have to define IM_ENABLE_DEPRECATED to get broken #defined
* 5/10/05
* - added GNUC attributes
* 8/5/06
* - added RGB16, GREY16
* 30/10/06
* - added im_window_t
* 7/11/07
* - added preclose and evalstart callbacks
* - brought time struct in here
* 7/3/08
* - MAGIC values should be unsigned
* 2/7/08
* - added invalidate callbacks
* 7/8/08
* - include <time.h>, thanks nicola
* 30/6/09
* - move deprecated stuff to its own header
* 16/5/18
* - remove old vips7 stuff, you must explicitly include it now
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_VIPS_H
#define VIPS_VIPS_H
#include <glib.h>
#include <glib/gstdio.h>
#include <gmodule.h>
#include <glib-object.h>
/* Needed for VipsGInputStream.
*/
#include <gio/gio.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#include <vips/basic.h>
#include <vips/buf.h>
#include <vips/dbuf.h>
#include <vips/util.h>
#include <vips/object.h>
#include <vips/type.h>
#include <vips/gate.h>
#include <vips/connection.h>
#include <vips/sbuf.h>
#include <vips/version.h>
#include <vips/rect.h>
#include <vips/private.h>
#include <vips/image.h>
#include <vips/memory.h>
#include <vips/error.h>
#include <vips/format.h>
#include <vips/region.h>
#include <vips/generate.h>
#include <vips/interpolate.h>
#include <vips/semaphore.h>
#include <vips/threadpool.h>
#include <vips/header.h>
#include <vips/operation.h>
#include <vips/foreign.h>
#include <vips/enumtypes.h>
#include <vips/arithmetic.h>
#include <vips/conversion.h>
#include <vips/convolution.h>
#include <vips/morphology.h>
#include <vips/mosaicing.h>
#include <vips/histogram.h>
#include <vips/freqfilt.h>
#include <vips/resample.h>
#include <vips/colour.h>
#include <vips/draw.h>
#include <vips/create.h>
/* VIPS_DISABLE_COMPAT:
*
* Disable automatically inclusion of `vips7compat.h`.
*
* This has no effect when building with `-Ddeprecated=false`.
*/
#if VIPS_ENABLE_DEPRECATED && !defined(VIPS_DISABLE_COMPAT)
#include <vips/vips7compat.h>
#endif
/* We can't use _ here since this will be compiled by our clients and they may
* not have _().
*/
#define VIPS_INIT(ARGV0) \
(vips_version(3) - vips_version(5) != \
VIPS_LIBRARY_CURRENT - VIPS_LIBRARY_AGE \
? ( \
g_warning("ABI mismatch"), \
g_warning("library has ABI version %d", \
vips_version(3) - vips_version(5)), \
g_warning("application needs ABI version %d", \
VIPS_LIBRARY_CURRENT - VIPS_LIBRARY_AGE), \
vips_error("vips_init", "ABI mismatch"), \
-1) \
: vips_init(ARGV0))
VIPS_API
int vips_max_coord_get(void);
VIPS_API
int vips_init(const char *argv0);
VIPS_API
const char *vips_get_argv0(void);
VIPS_API
const char *vips_get_prgname(void);
VIPS_API
void vips_shutdown(void);
VIPS_API
void vips_thread_shutdown(void);
VIPS_API
void vips_add_option_entries(GOptionGroup *option_group);
VIPS_API
void vips_leak_set(gboolean leak);
VIPS_API
void vips_block_untrusted_set(gboolean state);
VIPS_API
const char *vips_version_string(void);
VIPS_API
int vips_version(int flag);
VIPS_API
const char *vips_guess_prefix(const char *argv0, const char *env_name);
VIPS_API
const char *vips_guess_libdir(const char *argv0, const char *env_name);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_VIPS_H*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
// Include file to get vips C++ binding
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_CPLUSPLUS
#define VIPS_CPLUSPLUS
/* avoid conflict with Qt definitions, if they exist */
#if defined(signals) && defined(Q_SIGNALS)
#define _VIPS_QT_SIGNALS_DEFINED
#undef signals
#endif
#include <vips/version.h>
#include <glib-object.h>
/* Note: when building without Meson, it may be necessary to define
* _VIPS_PUBLIC as __declspec(dllexport) when building a DLL.
*/
#ifndef _VIPS_PUBLIC
#define _VIPS_PUBLIC
#endif
#define VIPS_CPLUSPLUS_API _VIPS_PUBLIC
#define VIPS_NAMESPACE_START namespace vips {
#define VIPS_NAMESPACE_END }
#include "VError8.h"
#include "VImage8.h"
#include "VInterpolate8.h"
#include "VRegion8.h"
#include "VConnection8.h"
/* restore Qt keywords if they were disabled for GLib inclusion */
#ifdef _VIPS_QT_SIGNALS_DEFINED
#define signals Q_SIGNALS
#undef _VIPS_QT_SIGNALS_DEFINED
#endif
#endif /*VIPS_CPLUSPLUS*/