chore: update node_modules with new binary files and dependencies

- Add new binary files for nodemon, onnxruntime-web, and xenova/transformers
- Update various JavaScript and TypeScript files in node_modules
- Remove unused files and dependencies
- Add new test fixtures and documentation files
This commit is contained in:
你的名字
2025-07-18 08:41:48 +08:00
parent db8c0adc79
commit 4c2f5c69a1
4655 changed files with 811329 additions and 35112 deletions

View File

@@ -0,0 +1,150 @@
// 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.
*/
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.
*/
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,76 @@
// 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,77 @@
// 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.
*/
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 = 0 );
/**
* 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,155 @@
// 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.
*/
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,571 @@
/* 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_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,113 @@
/* 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
*/
#ifdef _VIPS_PUBLIC
# define VIPS_API _VIPS_PUBLIC extern
#else
# define VIPS_API extern
#endif
/* 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;
#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_appendsc( VipsBuf *buf, gboolean quote, const char *str );
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,306 @@
/* 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)
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,570 @@
/* 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 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).
*/
off_t (*seek)( VipsTarget *, off_t 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
off_t vips_target_seek( VipsTarget *target, off_t offset, int whence );
VIPS_API
int vips_target_end( VipsTarget *target );
VIPS_DEPRECATED_FOR(vips_target_end)
void vips_target_finish( 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,357 @@
/* 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_cache( 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,95 @@
/* 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_canny( VipsImage *in, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_CONVOLUTION_H*/

View File

@@ -0,0 +1,161 @@
/* 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;
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_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,103 @@
/* 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_destroy( VipsDbuf *dbuf );
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,74 @@
/* 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,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,181 @@
/* 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 "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())
/* 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_subsample_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_FOREIGN_SUBSAMPLE (vips_foreign_subsample_get_type())
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())
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*/

View File

@@ -0,0 +1,993 @@
/* 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_FOREIGN_H
#define VIPS_FOREIGN_H
#include <glib.h>
#include <glib-object.h>
#include <vips/object.h>
#include <vips/operation.h>
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#define VIPS_TYPE_FOREIGN (vips_foreign_get_type())
#define VIPS_FOREIGN( obj ) \
(G_TYPE_CHECK_INSTANCE_CAST( (obj), \
VIPS_TYPE_FOREIGN, VipsForeign ))
#define VIPS_FOREIGN_CLASS( klass ) \
(G_TYPE_CHECK_CLASS_CAST( (klass), \
VIPS_TYPE_FOREIGN, VipsForeignClass))
#define VIPS_IS_FOREIGN( obj ) \
(G_TYPE_CHECK_INSTANCE_TYPE( (obj), VIPS_TYPE_FOREIGN ))
#define VIPS_IS_FOREIGN_CLASS( klass ) \
(G_TYPE_CHECK_CLASS_TYPE( (klass), VIPS_TYPE_FOREIGN ))
#define VIPS_FOREIGN_GET_CLASS( obj ) \
(G_TYPE_INSTANCE_GET_CLASS( (obj), \
VIPS_TYPE_FOREIGN, VipsForeignClass ))
typedef struct _VipsForeign {
VipsOperation parent_object;
/*< public >*/
} VipsForeign;
typedef struct _VipsForeignClass {
VipsOperationClass parent_class;
/*< public >*/
/* 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 recommended suffixes, eg. ".tif", ".tiff".
* This can be used by both load and save, so it's in the base class.
*/
const char **suffs;
} VipsForeignClass;
/* Don't put spaces around void here, it breaks gtk-doc.
*/
VIPS_API
GType vips_foreign_get_type(void);
/* Map over and find formats. This uses type introspection to loop over
* subclasses of VipsForeign.
*/
VIPS_API
void *vips_foreign_map( const char *base,
VipsSListMap2Fn fn, void *a, void *b );
/* Image file load properties.
*
* Keep in sync with the deprecated VipsFormatFlags, we need to be able to
* cast between them.
*/
typedef enum /*< flags >*/ {
VIPS_FOREIGN_NONE = 0, /* No flags set */
VIPS_FOREIGN_PARTIAL = 1, /* Lazy read OK (eg. tiled tiff) */
VIPS_FOREIGN_BIGENDIAN = 2, /* Most-significant byte first */
VIPS_FOREIGN_SEQUENTIAL = 4, /* Top-to-bottom lazy read OK */
VIPS_FOREIGN_ALL = 7 /* All flags set */
} VipsForeignFlags;
/**
* VipsFailOn:
* @VIPS_FAIL_ON_NONE: never stop
* @VIPS_FAIL_ON_TRUNCATED: stop on image truncated, nothing else
* @VIPS_FAIL_ON_ERROR: stop on serious error or truncation
* @VIPS_FAIL_ON_WARNING: stop on anything, even warnings
*
* How sensitive loaders are to errors, from never stop (very insensitive), to
* stop on the smallest warning (very sensitive).
*
* Each one implies the ones before it, so #VIPS_FAIL_ON_ERROR implies
* #VIPS_FAIL_ON_TRUNCATED.
*/
typedef enum {
VIPS_FAIL_ON_NONE,
VIPS_FAIL_ON_TRUNCATED,
VIPS_FAIL_ON_ERROR,
VIPS_FAIL_ON_WARNING,
VIPS_FAIL_ON_LAST
} VipsFailOn;
#define VIPS_TYPE_FOREIGN_LOAD (vips_foreign_load_get_type())
#define VIPS_FOREIGN_LOAD( obj ) \
(G_TYPE_CHECK_INSTANCE_CAST( (obj), \
VIPS_TYPE_FOREIGN_LOAD, VipsForeignLoad ))
#define VIPS_FOREIGN_LOAD_CLASS( klass ) \
(G_TYPE_CHECK_CLASS_CAST( (klass), \
VIPS_TYPE_FOREIGN_LOAD, VipsForeignLoadClass))
#define VIPS_IS_FOREIGN_LOAD( obj ) \
(G_TYPE_CHECK_INSTANCE_TYPE( (obj), VIPS_TYPE_FOREIGN_LOAD ))
#define VIPS_IS_FOREIGN_LOAD_CLASS( klass ) \
(G_TYPE_CHECK_CLASS_TYPE( (klass), VIPS_TYPE_FOREIGN_LOAD ))
#define VIPS_FOREIGN_LOAD_GET_CLASS( obj ) \
(G_TYPE_INSTANCE_GET_CLASS( (obj), \
VIPS_TYPE_FOREIGN_LOAD, VipsForeignLoadClass ))
typedef struct _VipsForeignLoad {
VipsForeign parent_object;
/*< private >*/
/* Set TRUE to force open via memory.
*/
gboolean memory;
/* Type of access upstream wants and the loader must supply.
*/
VipsAccess access;
/* Flags for this load operation.
*/
VipsForeignFlags flags;
/* Behaviour on error.
*/
VipsFailOn fail_on;
/* Deprecated and unused. Just here for compat.
*/
gboolean fail;
gboolean sequential;
/*< public >*/
/* The image we generate. This must be set by ->header().
*/
VipsImage *out;
/* The behind-the-scenes real image we decompress to. This can be a
* disc file or a memory buffer. This must be set by ->load().
*/
VipsImage *real;
/* Set this to tag the operation as nocache.
*/
gboolean nocache;
/* Deprecated: the memory option used to be called disc and default
* TRUE.
*/
gboolean disc;
/* Set if a start function fails. We want to prevent the other starts
* from also triggering the load.
*/
gboolean error;
} VipsForeignLoad;
typedef struct _VipsForeignLoadClass {
VipsForeignClass parent_class;
/*< public >*/
/* Is a file in this format.
*
* This function should return %TRUE if the file contains an image of
* this type. If you don't define this function, #VipsForeignLoad
* will use @suffs instead.
*/
gboolean (*is_a)( const char *filename );
/* Is a buffer in this format.
*
* This function should return %TRUE if the buffer contains an image of
* this type.
*/
gboolean (*is_a_buffer)( const void *data, size_t size );
/* Is a stream in this format.
*
* This function should return %TRUE if the stream contains an image of
* this type.
*/
gboolean (*is_a_source)( VipsSource *source );
/* Get the flags from a filename.
*
* This function should examine the file and return a set
* of flags. If you don't define it, vips will default to 0 (no flags
* set).
*
* This method is necessary for vips7 compatibility. Don't define
* it if you don't need vips7.
*/
VipsForeignFlags (*get_flags_filename)( const char *filename );
/* Get the flags for this load operation. Images can be loaded from
* (for example) memory areas rather than files, so you can't just use
* @get_flags_filename().
*/
VipsForeignFlags (*get_flags)( VipsForeignLoad *load );
/* Do the minimum read we can.
*
* Set the header fields in @out from @filename. If you can read the
* whole image as well with no performance cost (as with vipsload),
* or if your loader does not support reading only the header, read
* the entire image in this method and leave @load() NULL.
*
* @header() needs to set the dhint on the image .. otherwise you get
* the default SMALLTILE.
*
* Return 0 for success, -1 for error, setting vips_error().
*/
int (*header)( VipsForeignLoad *load );
/* Read the whole image into @real. The pixels will get copied to @out
* later.
*
* You can omit this method if you define a @header() method which
* loads the whole file.
*
* Return 0 for success, -1 for error, setting
* vips_error().
*/
int (*load)( VipsForeignLoad *load );
} VipsForeignLoadClass;
/* Don't put spaces around void here, it breaks gtk-doc.
*/
VIPS_API
GType vips_foreign_load_get_type(void);
VIPS_API
const char *vips_foreign_find_load( const char *filename );
VIPS_API
const char *vips_foreign_find_load_buffer( const void *data, size_t size );
VIPS_API
const char *vips_foreign_find_load_source( VipsSource *source );
VIPS_API
VipsForeignFlags vips_foreign_flags( const char *loader, const char *filename );
VIPS_API
gboolean vips_foreign_is_a( const char *loader, const char *filename );
VIPS_API
gboolean vips_foreign_is_a_buffer( const char *loader,
const void *data, size_t size );
VIPS_API
gboolean vips_foreign_is_a_source( const char *loader,
VipsSource *source );
VIPS_API
void vips_foreign_load_invalidate( VipsImage *image );
#define VIPS_TYPE_FOREIGN_SAVE (vips_foreign_save_get_type())
#define VIPS_FOREIGN_SAVE( obj ) \
(G_TYPE_CHECK_INSTANCE_CAST( (obj), \
VIPS_TYPE_FOREIGN_SAVE, VipsForeignSave ))
#define VIPS_FOREIGN_SAVE_CLASS( klass ) \
(G_TYPE_CHECK_CLASS_CAST( (klass), \
VIPS_TYPE_FOREIGN_SAVE, VipsForeignSaveClass))
#define VIPS_IS_FOREIGN_SAVE( obj ) \
(G_TYPE_CHECK_INSTANCE_TYPE( (obj), VIPS_TYPE_FOREIGN_SAVE ))
#define VIPS_IS_FOREIGN_SAVE_CLASS( klass ) \
(G_TYPE_CHECK_CLASS_TYPE( (klass), VIPS_TYPE_FOREIGN_SAVE ))
#define VIPS_FOREIGN_SAVE_GET_CLASS( obj ) \
(G_TYPE_INSTANCE_GET_CLASS( (obj), \
VIPS_TYPE_FOREIGN_SAVE, VipsForeignSaveClass ))
/**
* VipsSaveable:
* @VIPS_SAVEABLE_MONO: 1 band (eg. CSV)
* @VIPS_SAVEABLE_RGB: 1 or 3 bands (eg. PPM)
* @VIPS_SAVEABLE_RGBA: 1, 2, 3 or 4 bands (eg. PNG)
* @VIPS_SAVEABLE_RGBA_ONLY: 3 or 4 bands (eg. WEBP)
* @VIPS_SAVEABLE_RGB_CMYK: 1, 3 or 4 bands (eg. JPEG)
* @VIPS_SAVEABLE_ANY: any number of bands (eg. TIFF)
*
* See also: #VipsForeignSave.
*/
typedef enum {
VIPS_SAVEABLE_MONO,
VIPS_SAVEABLE_RGB,
VIPS_SAVEABLE_RGBA,
VIPS_SAVEABLE_RGBA_ONLY,
VIPS_SAVEABLE_RGB_CMYK,
VIPS_SAVEABLE_ANY,
VIPS_SAVEABLE_LAST
} VipsSaveable;
typedef struct _VipsForeignSave {
VipsForeign parent_object;
/* Don't attach metadata.
*/
gboolean strip;
/* If flattening out alpha, the background colour to use. Default to
* 0 (black).
*/
VipsArrayDouble *background;
/* Set to non-zero to set the page size for multi-page save.
*/
int page_height;
/*< public >*/
/* The image we are to save, as supplied by our caller.
*/
VipsImage *in;
/* @in converted to a saveable format (eg. 8-bit RGB) according to the
* instructions you give in the class fields below.
*
* This is the image you should actually write to the output.
*/
VipsImage *ready;
} VipsForeignSave;
typedef struct _VipsForeignSaveClass {
VipsForeignClass parent_class;
/*< public >*/
/* How this format treats bands.
*
* @saveable describes the bands that your saver can handle. For
* example, PPM images can have 1 or 3 bands (mono or RGB), so it
* uses #VIPS_SAVEABLE_RGB.
*/
VipsSaveable saveable;
/* How this format treats band formats.
*
* @format_table describes the band formats that your saver can
* handle. For each of the 10 #VipsBandFormat values, the array
* should give the format your saver will accept.
*/
VipsBandFormat *format_table;
/* The set of coding types this format can save. For example, jpeg can
* only save NONE, so has NONE TRUE and RAD and LABQ FALSE.
*
* Default NONE TRUE, RAD and LABQ FALSE.
*/
gboolean coding[VIPS_CODING_LAST];
} VipsForeignSaveClass;
/* Don't put spaces around void here, it breaks gtk-doc.
*/
VIPS_API
GType vips_foreign_save_get_type(void);
VIPS_API
const char *vips_foreign_find_save( const char *filename );
VIPS_API
gchar **vips_foreign_get_suffixes( void );
VIPS_API
const char *vips_foreign_find_save_buffer( const char *suffix );
VIPS_API
const char *vips_foreign_find_save_target( const char *suffix );
VIPS_API
int vips_vipsload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_vipsload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_vipssave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_vipssave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_openslideload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_openslideload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
/**
* VipsForeignSubsample:
* @VIPS_FOREIGN_SUBSAMPLE_AUTO: prevent subsampling when quality >= 90
* @VIPS_FOREIGN_SUBSAMPLE_ON: always perform subsampling
* @VIPS_FOREIGN_SUBSAMPLE_OFF: never perform subsampling
*
* Set subsampling mode.
*/
typedef enum {
VIPS_FOREIGN_SUBSAMPLE_AUTO,
VIPS_FOREIGN_SUBSAMPLE_ON,
VIPS_FOREIGN_SUBSAMPLE_OFF,
VIPS_FOREIGN_SUBSAMPLE_LAST
} VipsForeignSubsample;
/**
* 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_API
int vips_jpegload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jpegload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jpegload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jpegsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jpegsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jpegsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jpegsave_mime( VipsImage *in, ... )
G_GNUC_NULL_TERMINATED;
/**
* VipsForeignWebpPreset:
* @VIPS_FOREIGN_WEBP_PRESET_DEFAULT: default preset
* @VIPS_FOREIGN_WEBP_PRESET_PICTURE: digital picture, like portrait, inner shot
* @VIPS_FOREIGN_WEBP_PRESET_PHOTO: outdoor photograph, with natural lighting
* @VIPS_FOREIGN_WEBP_PRESET_DRAWING: hand or line drawing, with high-contrast details
* @VIPS_FOREIGN_WEBP_PRESET_ICON: small-sized colorful images
* @VIPS_FOREIGN_WEBP_PRESET_TEXT: text-like
*
* Tune lossy encoder settings for different image types.
*/
typedef enum {
VIPS_FOREIGN_WEBP_PRESET_DEFAULT,
VIPS_FOREIGN_WEBP_PRESET_PICTURE,
VIPS_FOREIGN_WEBP_PRESET_PHOTO,
VIPS_FOREIGN_WEBP_PRESET_DRAWING,
VIPS_FOREIGN_WEBP_PRESET_ICON,
VIPS_FOREIGN_WEBP_PRESET_TEXT,
VIPS_FOREIGN_WEBP_PRESET_LAST
} VipsForeignWebpPreset;
VIPS_API
int vips_webpload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_webpload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_webpload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_webpsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_webpsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_webpsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_webpsave_mime( VipsImage *in, ... )
G_GNUC_NULL_TERMINATED;
/**
* VipsForeignTiffCompression:
* @VIPS_FOREIGN_TIFF_COMPRESSION_NONE: no compression
* @VIPS_FOREIGN_TIFF_COMPRESSION_JPEG: jpeg compression
* @VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE: deflate (zip) compression
* @VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS: packbits compression
* @VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4: fax4 compression
* @VIPS_FOREIGN_TIFF_COMPRESSION_LZW: LZW compression
* @VIPS_FOREIGN_TIFF_COMPRESSION_WEBP: WEBP compression
* @VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD: ZSTD compression
* @VIPS_FOREIGN_TIFF_COMPRESSION_JP2K: JP2K compression
*
* The compression types supported by the tiff writer.
*
* Use @Q to set the jpeg compression level, default 75.
*
* Use @predictor to set the lzw or deflate prediction, default horizontal.
*
* Use @lossless to set WEBP lossless compression.
*
* Use @level to set webp and zstd compression level.
*/
typedef enum {
VIPS_FOREIGN_TIFF_COMPRESSION_NONE,
VIPS_FOREIGN_TIFF_COMPRESSION_JPEG,
VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE,
VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS,
VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4,
VIPS_FOREIGN_TIFF_COMPRESSION_LZW,
VIPS_FOREIGN_TIFF_COMPRESSION_WEBP,
VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD,
VIPS_FOREIGN_TIFF_COMPRESSION_JP2K,
VIPS_FOREIGN_TIFF_COMPRESSION_LAST
} VipsForeignTiffCompression;
/**
* VipsForeignTiffPredictor:
* @VIPS_FOREIGN_TIFF_PREDICTOR_NONE: no prediction
* @VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL: horizontal differencing
* @VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT: float predictor
*
* The predictor can help deflate and lzw compression. The values are fixed by
* the tiff library.
*/
typedef enum {
VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1,
VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2,
VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3,
VIPS_FOREIGN_TIFF_PREDICTOR_LAST
} VipsForeignTiffPredictor;
/**
* VipsForeignTiffResunit:
* @VIPS_FOREIGN_TIFF_RESUNIT_CM: use centimeters
* @VIPS_FOREIGN_TIFF_RESUNIT_INCH: use inches
*
* Use inches or centimeters as the resolution unit for a tiff file.
*/
typedef enum {
VIPS_FOREIGN_TIFF_RESUNIT_CM,
VIPS_FOREIGN_TIFF_RESUNIT_INCH,
VIPS_FOREIGN_TIFF_RESUNIT_LAST
} VipsForeignTiffResunit;
VIPS_API
int vips_tiffload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_tiffload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_tiffload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_tiffsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_tiffsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_tiffsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_openexrload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_fitsload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_fitssave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_analyzeload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rawload( const char *filename, VipsImage **out,
int width, int height, int bands, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rawsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_rawsave_fd( VipsImage *in, int fd, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_csvload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_csvload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_csvsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_csvsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_matrixload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_matrixload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_matrixsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_matrixsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_matrixprint( VipsImage *in, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_magickload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_magickload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_magicksave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_magicksave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
/**
* VipsForeignPngFilter:
* @VIPS_FOREIGN_PNG_FILTER_NONE: no filtering
* @VIPS_FOREIGN_PNG_FILTER_SUB: difference to the left
* @VIPS_FOREIGN_PNG_FILTER_UP: difference up
* @VIPS_FOREIGN_PNG_FILTER_AVG: average of left and up
* @VIPS_FOREIGN_PNG_FILTER_PAETH: pick best neighbor predictor automatically
* @VIPS_FOREIGN_PNG_FILTER_ALL: adaptive
*
* http://www.w3.org/TR/PNG-Filters.html
* The values mirror those of png.h in libpng.
*/
typedef enum /*< flags >*/ {
VIPS_FOREIGN_PNG_FILTER_NONE = 0x08,
VIPS_FOREIGN_PNG_FILTER_SUB = 0x10,
VIPS_FOREIGN_PNG_FILTER_UP = 0x20,
VIPS_FOREIGN_PNG_FILTER_AVG = 0x40,
VIPS_FOREIGN_PNG_FILTER_PAETH = 0x80,
VIPS_FOREIGN_PNG_FILTER_ALL = 0xF8
} VipsForeignPngFilter;
VIPS_API
int vips_pngload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pngload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pngload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pngsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pngsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pngsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
/**
* VipsForeignPpmFormat:
* @VIPS_FOREIGN_PPM_FORMAT_PBM: portable bitmap
* @VIPS_FOREIGN_PPM_FORMAT_PGM: portable greymap
* @VIPS_FOREIGN_PPM_FORMAT_PPM: portable pixmap
* @VIPS_FOREIGN_PPM_FORMAT_PFM: portable float map
* @VIPS_FOREIGN_PPM_FORMAT_PNM: portable anymap
*
* The netpbm file format to save as.
*
* #VIPS_FOREIGN_PPM_FORMAT_PBM images are single bit.
*
* #VIPS_FOREIGN_PPM_FORMAT_PGM images are 8, 16, or 32-bits, one band.
*
* #VIPS_FOREIGN_PPM_FORMAT_PPM images are 8, 16, or 32-bits, three bands.
*
* #VIPS_FOREIGN_PPM_FORMAT_PFM images are 32-bit float pixels.
*
* #VIPS_FOREIGN_PPM_FORMAT_PNM images are anymap images -- the image format
* is used to pick the saver.
*
*/
typedef enum {
VIPS_FOREIGN_PPM_FORMAT_PBM,
VIPS_FOREIGN_PPM_FORMAT_PGM,
VIPS_FOREIGN_PPM_FORMAT_PPM,
VIPS_FOREIGN_PPM_FORMAT_PFM,
VIPS_FOREIGN_PPM_FORMAT_PNM,
VIPS_FOREIGN_PPM_FORMAT_LAST
} VipsForeignPpmFormat;
VIPS_API
int vips_ppmload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_ppmload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_ppmsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_ppmsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_matload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_radload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_radload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_radload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_radsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_radsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_radsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pdfload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pdfload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_pdfload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_svgload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_svgload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_svgload_string( const char *str, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_svgload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gifload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gifload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gifload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gifsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gifsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_gifsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_heifload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_heifload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_heifload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_heifsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_heifsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_heifsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_niftiload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_niftiload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_niftisave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jp2kload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jp2kload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jp2kload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jp2ksave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jp2ksave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jp2ksave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jxlload_source( VipsSource *source, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jxlload_buffer( void *buf, size_t len, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jxlload( const char *filename, VipsImage **out, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jxlsave( VipsImage *in, const char *filename, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jxlsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_jxlsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
/**
* VipsForeignDzLayout:
* @VIPS_FOREIGN_DZ_LAYOUT_DZ: use DeepZoom directory layout
* @VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY: use Zoomify directory layout
* @VIPS_FOREIGN_DZ_LAYOUT_GOOGLE: use Google maps directory layout
* @VIPS_FOREIGN_DZ_LAYOUT_IIIF: use IIIF v2 directory layout
* @VIPS_FOREIGN_DZ_LAYOUT_IIIF3: use IIIF v3 directory layout
*
* What directory layout and metadata standard to use.
*/
typedef enum {
VIPS_FOREIGN_DZ_LAYOUT_DZ,
VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY,
VIPS_FOREIGN_DZ_LAYOUT_GOOGLE,
VIPS_FOREIGN_DZ_LAYOUT_IIIF,
VIPS_FOREIGN_DZ_LAYOUT_IIIF3,
VIPS_FOREIGN_DZ_LAYOUT_LAST
} VipsForeignDzLayout;
/**
* VipsForeignDzDepth:
* @VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL: create layers down to 1x1 pixel
* @VIPS_FOREIGN_DZ_DEPTH_ONETILE: create layers down to 1x1 tile
* @VIPS_FOREIGN_DZ_DEPTH_ONE: only create a single layer
*
* How many pyramid layers to create.
*/
typedef enum {
VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL,
VIPS_FOREIGN_DZ_DEPTH_ONETILE,
VIPS_FOREIGN_DZ_DEPTH_ONE,
VIPS_FOREIGN_DZ_DEPTH_LAST
} VipsForeignDzDepth;
/**
* VipsForeignDzContainer:
* @VIPS_FOREIGN_DZ_CONTAINER_FS: write tiles to the filesystem
* @VIPS_FOREIGN_DZ_CONTAINER_ZIP: write tiles to a zip file
* @VIPS_FOREIGN_DZ_CONTAINER_SZI: write to a szi file
*
* How many pyramid layers to create.
*/
typedef enum {
VIPS_FOREIGN_DZ_CONTAINER_FS,
VIPS_FOREIGN_DZ_CONTAINER_ZIP,
VIPS_FOREIGN_DZ_CONTAINER_SZI,
VIPS_FOREIGN_DZ_CONTAINER_LAST
} VipsForeignDzContainer;
VIPS_API
int vips_dzsave( VipsImage *in, const char *name, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_dzsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
G_GNUC_NULL_TERMINATED;
VIPS_API
int vips_dzsave_target( VipsImage *in, VipsTarget *target, ... )
G_GNUC_NULL_TERMINATED;
/**
* VipsForeignHeifCompression:
* @VIPS_FOREIGN_HEIF_COMPRESSION_HEVC: x265
* @VIPS_FOREIGN_HEIF_COMPRESSION_AVC: x264
* @VIPS_FOREIGN_HEIF_COMPRESSION_JPEG: jpeg
* @VIPS_FOREIGN_HEIF_COMPRESSION_AV1: aom
*
* The compression format to use inside a HEIF container.
*
* This is assumed to use the same numbering as %heif_compression_format.
*/
typedef enum {
VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1,
VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2,
VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3,
VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4,
VIPS_FOREIGN_HEIF_COMPRESSION_LAST
} VipsForeignHeifCompression;
/**
* VipsForeignHeifEncoder:
* @VIPS_FOREIGN_HEIF_ENCODER_AUTO: auto
* @VIPS_FOREIGN_HEIF_ENCODER_AOM: aom
* @VIPS_FOREIGN_HEIF_ENCODER_RAV1E: RAV1E
* @VIPS_FOREIGN_HEIF_ENCODER_SVT: SVT-AV1
* @VIPS_FOREIGN_HEIF_ENCODER_X265: x265
*
* The selected encoder to use.
* If libheif hasn't been compiled with the selected encoder,
* we will fallback to the default encoder for the compression format.
*
*/
typedef enum {
VIPS_FOREIGN_HEIF_ENCODER_AUTO,
VIPS_FOREIGN_HEIF_ENCODER_AOM,
VIPS_FOREIGN_HEIF_ENCODER_RAV1E,
VIPS_FOREIGN_HEIF_ENCODER_SVT,
VIPS_FOREIGN_HEIF_ENCODER_X265,
VIPS_FOREIGN_HEIF_ENCODER_LAST
} VipsForeignHeifEncoder;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_FOREIGN_H*/

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,82 @@
/* 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,312 @@
/* 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 JPEG 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_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
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,605 @@
/* 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 was 1m for a while, but someone found a use for a 4m wide image.
*/
#define VIPS_MAX_COORD (10000000)
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,141 @@
/* 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 ))
typedef struct _VipsInterpolate {
VipsObject parent_object;
} VipsInterpolate;
/* 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 matricies 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,96 @@
/* 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 )))
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_malloc( size_t size );
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,80 @@
/* 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,706 @@
/* 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
} 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 = { 0, }; \
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 succesfully: construct is fully done
* and checked.
*/
gboolean constructed;
/* Set for static objects which are allocated at startup and never
* freed. These objects are ommitted 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,182 @@
/* 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
} 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 );
typedef struct _VipsOperation {
VipsObject parent_instance;
/* Keep the hash here.
*/
guint hash;
gboolean found_hash;
/* Pixels calculated ... handy for measuring over-calculation.
*/
int pixels;
} VipsOperation;
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
VipsOperation *vips_cache_operation_lookup( VipsOperation *operation );
VIPS_API
void vips_cache_operation_add( VipsOperation *operation );
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,227 @@
/* 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 );
#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,144 @@
/* 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,72 @@
/* 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 );
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,160 @@
/* 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,305 @@
/* 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);
/**
* 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,406 @@
/* 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))
/* 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
/* The g_info() macro was added in 2.40.
*/
#ifndef g_info
/* Hopefully we have varargs macros. Maybe revisit this.
*/
#define g_info(...) \
g_log( G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__ )
#endif
/* 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)
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
char *vips_strncpy( char *dest, const char *src, int n );
VIPS_API
char *vips_strrstr( const char *haystack, const char *needle );
VIPS_API
gboolean vips_ispostfix( const char *a, const char *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 );
void vips__chomp( char *str );
VIPS_API
int vips_vsnprintf( char *str, size_t size, const char *format, va_list ap );
VIPS_API
int vips_snprintf( char *str, size_t size, const char *format, ... )
G_GNUC_PRINTF( 3, 4 );
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;
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,183 @@
/* helper stuff for Orc
*
* 29/10/10
* - from im_dilate hackery
*/
/*
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
/* If we are building with -fcf-protection (run-time checking of
* indirect jumps) then Orc won't work. Make sure it's off.
*
* https://gcc.gnu.org/onlinedocs/gcc/\
* Instrumentation-Options.html#index-fcf-protection
* https://gitlab.freedesktop.org/gstreamer/orc/issues/17
*
* orc 0.4.30 and later work with cf-protection.
*/
#ifdef __CET__
#ifndef HAVE_ORC_CF_PROTECTION
#undef HAVE_ORC
#endif
#endif
#ifdef HAVE_ORC
#include <orc/orc.h>
#endif /*HAVE_ORC*/
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#define VIPS_VECTOR_SOURCE_MAX (10)
/* An Orc program.
*/
typedef struct {
/* Handy for debugging.
*/
const char *name;
char *unique_name;
/* How many resources we've used so far in this codegen.
*/
int n_temp;
int n_scanline;
int n_source;
int n_destination;
int n_constant;
int n_parameter;
int n_instruction;
/* The scanline sources, and for each variable, the associated line.
* "sl0" onwards.
*/
int sl[VIPS_VECTOR_SOURCE_MAX];
int line[VIPS_VECTOR_SOURCE_MAX];
/* Non-scanline sources, "s1" etc. s[0] is the var for "s1".
*/
int s[VIPS_VECTOR_SOURCE_MAX];
/* The destination var.
*/
int d1;
#ifdef HAVE_ORC
/* The code we have generated.
*/
OrcProgram *program;
#endif /*HAVE_ORC*/
/* Compiled successfully.
*/
gboolean compiled;
} VipsVector;
/* An executor.
*/
typedef struct {
#ifdef HAVE_ORC
OrcExecutor executor;
#endif /*HAVE_ORC*/
VipsVector *vector;
} VipsExecutor;
/* Set from the command-line.
*/
extern gboolean vips__vector_enabled;
VIPS_API
void vips_vector_init( void );
VIPS_API
gboolean vips_vector_isenabled( void );
VIPS_API
void vips_vector_set_enabled( gboolean enabled );
VIPS_API
void vips_vector_free( VipsVector *vector );
VIPS_API
VipsVector *vips_vector_new( const char *name, int dsize );
VIPS_API
void vips_vector_constant( VipsVector *vector,
char *name, int value, int size );
VIPS_API
void vips_vector_source_scanline( VipsVector *vector,
char *name, int line, int size );
VIPS_API
int vips_vector_source_name( VipsVector *vector, const char *name, int size );
VIPS_API
void vips_vector_temporary( VipsVector *vector, const char *name, int size );
VIPS_API
int vips_vector_parameter( VipsVector *vector, const char *name, int size );
VIPS_API
int vips_vector_destination( VipsVector *vector, const char *name, int size );
VIPS_API
void vips_vector_asm2( VipsVector *vector,
const char *op, const char *a, const char *b );
VIPS_API
void vips_vector_asm3( VipsVector *vector,
const char *op, const char *a, const char *b, const char *c );
VIPS_API
gboolean vips_vector_full( VipsVector *vector );
VIPS_API
gboolean vips_vector_compile( VipsVector *vector );
VIPS_API
void vips_vector_print( VipsVector *vector );
VIPS_API
void vips_executor_set_program( VipsExecutor *executor,
VipsVector *vector, int n );
VIPS_API
void vips_executor_set_scanline( VipsExecutor *executor,
VipsRegion *ir, int x, int y );
VIPS_API
void vips_executor_set_destination( VipsExecutor *executor, void *value );
VIPS_API
void vips_executor_set_parameter( VipsExecutor *executor, int var, int value );
VIPS_API
void vips_executor_set_array( VipsExecutor *executor, int var, void *value );
VIPS_API
void vips_executor_run( VipsExecutor *executor );
VIPS_API
void vips_vector_to_fixed_point( double *in, int *out, int n, int scale );
#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.14.5"
#define VIPS_VERSION_STRING "8.14.5"
#define VIPS_MAJOR_VERSION (8)
#define VIPS_MINOR_VERSION (14)
#define VIPS_MICRO_VERSION (5)
/* The ABI version, as used for library versioning.
*/
#define VIPS_LIBRARY_CURRENT (58)
#define VIPS_LIBRARY_REVISION (5)
#define VIPS_LIBRARY_AGE (16)
#define VIPS_CONFIG "enable debug: false\nenable deprecated: false\nenable modules: false\nenable cplusplus: true\nenable RAD load/save: false\nenable Analyze7 load/save: false\nenable PPM load/save: false\nenable GIF load: true\nuse fftw for FFTs: false\naccelerate loops with ORC: true\nICC profile support with lcms: true\nzlib: true\ntext rendering with pangocairo: true\nfont file support with fontconfig: true\nEXIF metadata support with libexif: true\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 libspng: true\nPNG load/save with libpng: false\nselected quantisation package: imagequant\nTIFF load/save with libtiff: true\nimage pyramid save with libarchive: true\nHEIC/AVIF load/save with libheif: true (dynamic module: false)\nWebP load/save with libwebp: true\nPDF load with PDFium: false\nPDF load with poppler-glib: false (dynamic module: false)\nSVG load with librsvg: true\nEXR load with OpenEXR: false\nOpenSlide load: false (dynamic module: false)\nMatlab load with libmatio: false\nNIfTI load/save with niftiio: false\nFITS load/save with cfitsio: false\nGIF save with cgif: true\nselected Magick package: none (dynamic module: false)\nMagick API version: none\nMagick load: false\nMagick save: false"
/* Not really anything to do with versions, but this is a handy place to put
* it.
*/
#define VIPS_ENABLE_DEPRECATED 0
#endif /*VIPS_VERSION_H*/

View File

@@ -0,0 +1,194 @@
/* @(#) 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>
#if VIPS_ENABLE_DEPRECATED
#include <vips/mask.h>
#endif
#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>
#if VIPS_ENABLE_DEPRECATED
#include <vips/video.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_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*/

View File

@@ -0,0 +1,60 @@
// 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
#include <vips/version.h>
#include <glib-object.h>
/* Define VIPS_CPLUSPLUS_EXPORTS to build a DLL using MSVC.
*/
#ifdef _VIPS_PUBLIC
# define VIPS_CPLUSPLUS_API _VIPS_PUBLIC
#elif defined(_MSC_VER)
# ifdef VIPS_CPLUSPLUS_EXPORTS
# define VIPS_CPLUSPLUS_API __declspec(dllexport)
# else
# define VIPS_CPLUSPLUS_API __declspec(dllimport)
# endif
#else
# define VIPS_CPLUSPLUS_API
#endif
#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"
#endif /*VIPS_CPLUSPLUS*/