Merge branch 'master' into gargsms-text-autofit
This commit is contained in:
commit
40f20e5e0a
|
@ -10,6 +10,8 @@ script:
|
|||
- make -Ctest -j$JOBS -s V=0 VERBOSE=1 check
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- os: osx
|
||||
fast_finish: true
|
||||
include:
|
||||
- os: linux
|
||||
|
|
14
ChangeLog
14
ChangeLog
|
@ -23,10 +23,14 @@
|
|||
- better svgload: larger output, handle missing width/height, thanks lovell
|
||||
- add vips_gravity() ... embed, but with direction rather than position
|
||||
- vips_text() can autofit text to a box, thanks gargsms
|
||||
- add vips_composite(): merge an array of images with porter-duff
|
||||
- better gobject-introspection annotations, thanks astavale
|
||||
|
||||
29/8/17 started 8.5.9
|
||||
- make --fail stop jpeg read on any libjpeg warning, thanks @mceachen
|
||||
- don't build enumtypes so often, removing perl as a compile dependancy
|
||||
- don't build enumtypes so often -- helps remove perl as a compile dependency
|
||||
- fix a crash with havy use of draw operations from language bindings,
|
||||
thanks @Nakilon
|
||||
|
||||
2/8/17 started 8.5.8
|
||||
- fix transparency detection in merge, thanks Haida
|
||||
|
@ -540,7 +544,7 @@
|
|||
- vips_system() now supports many input images and you can change image
|
||||
argument order
|
||||
- support 16-bit palette TIFFs, plus palette TIFFs can have an alpha
|
||||
- libgsf-1 is now an optional dependancy
|
||||
- libgsf-1 is now an optional dependency
|
||||
- dzsave can directly write a ZIP file
|
||||
- add ".vips" as an alternative suffix for vips files
|
||||
- added vips_tiffload_buffer()
|
||||
|
@ -1204,9 +1208,9 @@
|
|||
- fix gtk-doc warnings
|
||||
- small mask load/save improvements
|
||||
- mask gtk-doc done
|
||||
- add cfitsio dependancy
|
||||
- add cfitsio dependency
|
||||
- add FITS reader
|
||||
- land the vector branch and the orc dependancy ... we have SSE
|
||||
- land the vector branch and the orc dependency ... we have SSE
|
||||
erode/dilate/add/conv
|
||||
- add IM_SWAP
|
||||
- dilate/erode do (!=0) on non-uchar images
|
||||
|
@ -2059,7 +2063,7 @@
|
|||
- "," allowed as column separator in mask read
|
||||
- better at spotting singular matricies
|
||||
- small im_render() tidies
|
||||
- glib dependancy reduced to just 2.0, but untested ... helps people building
|
||||
- glib dependency reduced to just 2.0, but untested ... helps people building
|
||||
on older systems who aren't interested in nip2
|
||||
- removing leading spaces from IMAGEVEC arguments
|
||||
- load non-interlaced PNGs more efficiently
|
||||
|
|
|
@ -138,7 +138,7 @@ Clang dynamic analysis:
|
|||
|
||||
Build with the GCC auto-vectorizer and diagnostics (or just -O3):
|
||||
|
||||
$ FLAGS="-O2 -msse4.2 -ffast-math"
|
||||
$ FLAGS="-O2 -march=native -ffast-math"
|
||||
$ FLAGS="$FLAGS -ftree-vectorize -fdump-tree-vect-details"
|
||||
$ CFLAGS="$FLAGS" CXXFLAGS="$FLAGS" \
|
||||
./configure --prefix=/home/john/vips
|
||||
|
|
125
configure.ac
125
configure.ac
|
@ -60,8 +60,8 @@ GOBJECT_INTROSPECTION_CHECK([1.30.0])
|
|||
#
|
||||
# build with a glob and a list of files to exclude from scanning
|
||||
# see also IGNORE_HFILES in doc/Makefile.am
|
||||
introspection_sources=$(cd libvips ; find . -name "*.c")
|
||||
filter_list="deprecated "
|
||||
introspection_sources=$(cd libvips ; find . -name "*.c"; find . -name "*.cpp")
|
||||
filter_list="deprecated introspect.c dummy.c fuzz "
|
||||
|
||||
# contains(string, substring)
|
||||
#
|
||||
|
@ -101,18 +101,23 @@ headers="\
|
|||
image.h \
|
||||
error.h \
|
||||
foreign.h \
|
||||
freqfilt.h \
|
||||
interpolate.h \
|
||||
header.h \
|
||||
histogram.h \
|
||||
operation.h \
|
||||
enumtypes.h \
|
||||
conversion.h \
|
||||
arithmetic.h \
|
||||
colour.h \
|
||||
convolution.h \
|
||||
create.h \
|
||||
draw.h \
|
||||
morphology.h \
|
||||
mosaicing.h \
|
||||
type.h \
|
||||
rect.h \
|
||||
resample.h \
|
||||
memory.h \
|
||||
region.h"
|
||||
|
||||
|
@ -253,8 +258,6 @@ AC_PROG_AWK
|
|||
AC_PROG_CC
|
||||
AC_PROG_CC_STDC
|
||||
AC_PROG_CXX
|
||||
AC_C_CONST
|
||||
AC_C_RESTRICT
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
|
@ -302,6 +305,29 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
|
|||
ALL_LINGUAS="en_GB de"
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
|
||||
# we need to disable some features on some known-bad gcc versions
|
||||
# these will be "" for clang etc.
|
||||
#
|
||||
# I couldn't get this to work, mysterious! do it ourselves
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG([-dumpversion],
|
||||
# [ax_gcc_version_option=yes],
|
||||
# [ax_gcc_version_option=no]
|
||||
# )
|
||||
AC_MSG_CHECKING([for gcc version])
|
||||
GCC_VERSION=""
|
||||
version=$($CC -dumpversion)
|
||||
if test $? = 0; then
|
||||
GCC_VERSION=$version
|
||||
AC_MSG_RESULT([$GCC_VERSION])
|
||||
else
|
||||
AC_MSG_RESULT([-dumpversion not supported])
|
||||
fi
|
||||
|
||||
GCC_VERSION_MAJOR=$(echo $GCC_VERSION | cut -d'.' -f1)
|
||||
GCC_VERSION_MINOR=$(echo $GCC_VERSION | cut -d'.' -f2)
|
||||
GCC_VERSION_PATCH=$(echo $GCC_VERSION | cut -d'.' -f3)
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
# build list of pkg-config packages we used here
|
||||
|
@ -333,11 +359,69 @@ AC_PROVIDE([AC_LIBTOOL_WIN32_DLL])
|
|||
AC_PROG_LIBTOOL
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_RESTRICT
|
||||
AX_GCC_VAR_ATTRIBUTE(vector_size)
|
||||
AC_C_CONST
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_OFF_T
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
# g++/gcc 4.x have rather broken vector support
|
||||
AC_MSG_CHECKING([for gcc with working vector support])
|
||||
if test x$GCC_VERSION_MAJOR != x"4"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
ax_cv_have_var_attribute_vector_size=no
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
# we need to be able to shuffle vectors in C++
|
||||
if test x$ax_cv_have_var_attribute_vector_size = x"yes"; then
|
||||
AC_MSG_CHECKING([for C++ vector shuffle])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_TRY_COMPILE([
|
||||
typedef float v4f __attribute__((vector_size(4 * sizeof(float))));
|
||||
],[
|
||||
v4f f; f[3] = 99;
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
have_vector_shuffle=yes
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
have_vector_shuffle=no
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
if test x$have_vector_shuffle = x"yes"; then
|
||||
AC_DEFINE_UNQUOTED(HAVE_VECTOR_SHUFFLE, 1,
|
||||
[define if your C++ can shuffle vectors])
|
||||
fi
|
||||
fi
|
||||
|
||||
# we also need to be able to mix vector and scalar arithmetic
|
||||
if test x$have_vector_shuffle = x"yes"; then
|
||||
AC_MSG_CHECKING([for C++ vector arithmetic])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_TRY_COMPILE([
|
||||
typedef float v4f __attribute__((vector_size(4 * sizeof(float))));
|
||||
],[
|
||||
v4f f = {1, 2, 3, 4}; f *= 12.0;
|
||||
v4f g = {5, 6, 7, 8}; f = g > 0 ? g : -1 * g;
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
have_vector_arith=yes
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
have_vector_arith=no
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
if test x$have_vector_arith = x"yes"; then
|
||||
AC_DEFINE_UNQUOTED(HAVE_VECTOR_ARITH, 1,
|
||||
[define if your C++ can mix vector and scalar arithmetic])
|
||||
fi
|
||||
fi
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MEMCMP
|
||||
AC_FUNC_MMAP
|
||||
|
@ -961,40 +1045,43 @@ if test x"$with_libexif" != "xno"; then
|
|||
CPPFLAGS="$save_CPPFLAGS"
|
||||
fi
|
||||
|
||||
# make python binding?
|
||||
with_python="no (default)"
|
||||
AC_ARG_WITH([python],
|
||||
AS_HELP_STRING([--with-python],
|
||||
[build with vips7 Python bindings (default: no)]))
|
||||
# make vips7 (swig-based) py binding
|
||||
AC_ARG_ENABLE([pyvips7],
|
||||
AS_HELP_STRING([--enable-pyvips7], [build vips7 Python binding (default: no)]),
|
||||
[enable_pyvips7=$enableval
|
||||
],
|
||||
[enable_pyvips7="no (default)"
|
||||
]
|
||||
)
|
||||
|
||||
if test x"$with_python" = x"yes"; then
|
||||
if test x"$enable_pyvips7" = x"yes"; then
|
||||
if test x"$enable_cxx" = x"no"; then
|
||||
# if C++ is off, we can't do Python
|
||||
with_python=no
|
||||
enable_pyvips7=no
|
||||
AC_MSG_WARN([C++ is off, disabling vips7 Python binding])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"$with_python" = x"yes"; then
|
||||
if test x"$enable_pyvips7" = x"yes"; then
|
||||
JD_PATH_PYTHON(2.7,,
|
||||
[with_python=no
|
||||
[enable_pyvips7=no
|
||||
AC_MSG_WARN([Python >= 2.7 not found; disabling vips7 Python binding])
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
if test x"$with_python" = x"yes"; then
|
||||
if test x"$enable_pyvips7" = x"yes"; then
|
||||
# The SWIG bindings don't compile on python3 (see issue #334).
|
||||
AM_PYTHON_CHECK_VERSION([$PYTHON], [3.0],
|
||||
[with_python=no
|
||||
[enable_pyvips7=no
|
||||
AC_MSG_WARN([Python >= 3.0 found; disabling vips7 Python binding])
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
if test x"$with_python" = x"yes"; then
|
||||
if test x"$enable_pyvips7" = x"yes"; then
|
||||
AM_CHECK_PYTHON_HEADERS(,
|
||||
[with_python=no
|
||||
[enable_pyvips7=no
|
||||
AC_MSG_WARN([Python headers not found; disabling vips7 Python binding])
|
||||
]
|
||||
)
|
||||
|
@ -1003,7 +1090,7 @@ fi
|
|||
# we don't check for swig: we include the generated bindings in the
|
||||
# distribution
|
||||
|
||||
if test x"$with_python" = x"yes"; then
|
||||
if test x"$enable_pyvips7" = x"yes"; then
|
||||
AM_CONDITIONAL(HAVE_PYTHON, true)
|
||||
else
|
||||
AM_CONDITIONAL(HAVE_PYTHON, false)
|
||||
|
@ -1093,7 +1180,7 @@ enable debug: $enable_debug
|
|||
build deprecated components: $enable_deprecated
|
||||
build docs with gtkdoc: $enable_gtk_doc
|
||||
gobject introspection: $found_introspection
|
||||
build vips7 Python binding: $with_python
|
||||
build vips7 Python binding: $enable_pyvips7
|
||||
install vips8 Python overrides: $enable_pyvips8
|
||||
(requires pygobject-3.13.0 or later)
|
||||
build radiance support: $with_radiance
|
||||
|
|
|
@ -205,6 +205,30 @@ VOption::set( const char *name, std::vector<double> value )
|
|||
return( this );
|
||||
}
|
||||
|
||||
// input int array
|
||||
VOption *
|
||||
VOption::set( const char *name, std::vector<int> value )
|
||||
{
|
||||
Pair *pair = new Pair( name );
|
||||
|
||||
int *array;
|
||||
unsigned int i;
|
||||
|
||||
pair->input = true;
|
||||
|
||||
g_value_init( &pair->value, VIPS_TYPE_ARRAY_INT );
|
||||
vips_value_set_array_int( &pair->value, NULL,
|
||||
static_cast< int >( value.size() ) );
|
||||
array = vips_value_get_array_int( &pair->value, NULL );
|
||||
|
||||
for( i = 0; i < value.size(); i++ )
|
||||
array[i] = value[i];
|
||||
|
||||
options.push_back( pair );
|
||||
|
||||
return( this );
|
||||
}
|
||||
|
||||
// input image array
|
||||
VOption *
|
||||
VOption::set( const char *name, std::vector<VImage> value )
|
||||
|
@ -465,8 +489,7 @@ VImage::call_option_string( const char *operation_name,
|
|||
operation_name );
|
||||
|
||||
if( !(operation = vips_operation_new( operation_name )) ) {
|
||||
if( options )
|
||||
delete options;
|
||||
delete options;
|
||||
throw( VError() );
|
||||
}
|
||||
|
||||
|
@ -671,6 +694,17 @@ VImage::bandjoin( VImage other, VOption *options )
|
|||
return( bandjoin( vec, options ) );
|
||||
}
|
||||
|
||||
VImage
|
||||
VImage::composite( VImage other, VipsBlendMode mode, VOption *options )
|
||||
{
|
||||
VImage v[2] = { *this, other };
|
||||
std::vector<VImage> ivec( v, v + VIPS_NUMBER( v ) );
|
||||
int m[1] = { static_cast<int>( mode ) };
|
||||
std::vector<int> mvec( m, m + VIPS_NUMBER( m ) );
|
||||
|
||||
return( composite( ivec, mvec, options ) );
|
||||
}
|
||||
|
||||
std::complex<double>
|
||||
VImage::minpos( VOption *options )
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ gtype_to_cpp = {
|
|||
"gdouble" : "double",
|
||||
"gboolean" : "bool",
|
||||
"gchararray" : "char *",
|
||||
"VipsArrayInt" : "std::vector<int>",
|
||||
"VipsArrayDouble" : "std::vector<double>",
|
||||
"VipsArrayImage" : "std::vector<VImage>",
|
||||
"VipsBlob" : "VipsBlob *"
|
||||
|
|
|
@ -219,6 +219,7 @@ public:
|
|||
VOption *set( const char *name, VInterpolate value );
|
||||
VOption *set( const char *name, std::vector<VImage> value );
|
||||
VOption *set( const char *name, std::vector<double> value );
|
||||
VOption *set( const char *name, std::vector<int> value );
|
||||
VOption *set( const char *name, VipsBlob *value );
|
||||
|
||||
VOption *set( const char *name, bool *value );
|
||||
|
@ -541,6 +542,9 @@ public:
|
|||
return( bandjoin_const( other, options ) );
|
||||
}
|
||||
|
||||
VImage composite( VImage other, VipsBlendMode mode,
|
||||
VOption *options = 0 );
|
||||
|
||||
std::complex<double> minpos( VOption *options = 0 );
|
||||
|
||||
std::complex<double> maxpos( VOption *options = 0 );
|
||||
|
|
|
@ -27,6 +27,7 @@ gtype_to_cpp = {
|
|||
"gdouble" : "double",
|
||||
"gboolean" : "bool",
|
||||
"gchararray" : "char *",
|
||||
"VipsArrayInt" : "std::vector<int>",
|
||||
"VipsArrayDouble" : "std::vector<double>",
|
||||
"VipsArrayImage" : "std::vector<VImage>",
|
||||
"VipsBlob" : "VipsBlob *"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// headers for vips operations
|
||||
// Mon 13 Mar 13:22:09 GMT 2017
|
||||
// Fri 6 Oct 16:31:27 BST 2017
|
||||
// this file is generated automatically, do not edit!
|
||||
|
||||
static void system( char * cmd_format , VOption *options = 0 );
|
||||
|
@ -40,6 +40,7 @@ VImage project( VImage * rows , VOption *options = 0 );
|
|||
VImage profile( VImage * rows , VOption *options = 0 );
|
||||
VImage measure( int h , int v , VOption *options = 0 );
|
||||
std::vector<double> getpoint( int x , int y , VOption *options = 0 );
|
||||
int find_trim( int * top , int * width , int * height , VOption *options = 0 );
|
||||
VImage copy( VOption *options = 0 );
|
||||
VImage tilecache( VOption *options = 0 );
|
||||
VImage linecache( VOption *options = 0 );
|
||||
|
@ -79,6 +80,7 @@ VImage msb( VOption *options = 0 );
|
|||
VImage byteswap( VOption *options = 0 );
|
||||
VImage falsecolour( VOption *options = 0 );
|
||||
VImage gamma( VOption *options = 0 );
|
||||
static VImage composite( std::vector<VImage> in , std::vector<int> mode , VOption *options = 0 );
|
||||
static VImage black( int width , int height , VOption *options = 0 );
|
||||
static VImage gaussnoise( int width , int height , VOption *options = 0 );
|
||||
static VImage text( char * text , VOption *options = 0 );
|
||||
|
@ -156,6 +158,7 @@ VipsBlob * tiffsave_buffer( VOption *options = 0 );
|
|||
void fitssave( char * filename , VOption *options = 0 );
|
||||
static VImage thumbnail( char * filename , int width , VOption *options = 0 );
|
||||
static VImage thumbnail_buffer( VipsBlob * buffer , int width , VOption *options = 0 );
|
||||
VImage thumbnail_image( int width , VOption *options = 0 );
|
||||
VImage mapim( VImage index , VOption *options = 0 );
|
||||
VImage shrink( double hshrink , double vshrink , VOption *options = 0 );
|
||||
VImage shrinkh( int hshrink , VOption *options = 0 );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// bodies for vips operations
|
||||
// Mon 13 Mar 13:22:17 GMT 2017
|
||||
// Fri 6 Oct 16:30:42 BST 2017
|
||||
// this file is generated automatically, do not edit!
|
||||
|
||||
void VImage::system( char * cmd_format , VOption *options )
|
||||
|
@ -487,6 +487,21 @@ std::vector<double> VImage::getpoint( int x , int y , VOption *options )
|
|||
return( out_array );
|
||||
}
|
||||
|
||||
int VImage::find_trim( int * top , int * width , int * height , VOption *options )
|
||||
{
|
||||
int left;
|
||||
|
||||
call( "find_trim" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "left", &left ) ->
|
||||
set( "top", top ) ->
|
||||
set( "width", width ) ->
|
||||
set( "height", height ) );
|
||||
|
||||
return( left );
|
||||
}
|
||||
|
||||
VImage VImage::copy( VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
@ -988,6 +1003,19 @@ VImage VImage::gamma( VOption *options )
|
|||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::composite( std::vector<VImage> in , std::vector<int> mode , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "composite" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", in ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "mode", mode ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::black( int width , int height , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
@ -1904,6 +1932,19 @@ VImage VImage::thumbnail_buffer( VipsBlob * buffer , int width , VOption *option
|
|||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::thumbnail_image( int width , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "thumbnail_image" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) ->
|
||||
set( "width", width ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::mapim( VImage index , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
|
|
@ -148,6 +148,7 @@ markdown_content_files = \
|
|||
How-it-opens-files.md \
|
||||
Examples.md \
|
||||
Cite.md \
|
||||
binding.md \
|
||||
Making-image-pyramids.md
|
||||
|
||||
# converted to xml in this dir by pandoc
|
||||
|
@ -159,13 +160,11 @@ content_files = \
|
|||
using-command-line.xml \
|
||||
using-C.xml \
|
||||
using-threads.xml \
|
||||
using-python.xml \
|
||||
using-cpp.xml \
|
||||
extending.xml \
|
||||
function-list.xml \
|
||||
file-format.xml \
|
||||
${markdown_content_files_docbook} \
|
||||
binding.xml
|
||||
${markdown_content_files_docbook}
|
||||
|
||||
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
|
||||
# These files must be listed here *and* in content_files
|
||||
|
@ -174,13 +173,11 @@ expand_content_files = \
|
|||
using-command-line.xml \
|
||||
using-C.xml \
|
||||
using-threads.xml \
|
||||
using-python.xml \
|
||||
using-cpp.xml \
|
||||
extending.xml \
|
||||
function-list.xml \
|
||||
file-format.xml \
|
||||
${markdown_content_files_docbook} \
|
||||
binding.xml
|
||||
${markdown_content_files_docbook}
|
||||
|
||||
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
|
||||
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
|
||||
|
|
|
@ -0,0 +1,219 @@
|
|||
<refmeta>
|
||||
<refentrytitle>How to write bindings</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>libvips</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>Binding</refname>
|
||||
<refpurpose>Writing bindings for libvips</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
There are full libvips bindings for quite a few environments now: C, C++,
|
||||
command-line, Ruby, PHP, Python and JavaScript (node).
|
||||
|
||||
This chapter runs through the four main styles that have been found to work
|
||||
well. If you want to write a new binding, one of these should be close
|
||||
to what you need.
|
||||
|
||||
# C API
|
||||
|
||||
The libvips C API (vips_add() and so on) is very inconvenient to use from other
|
||||
languages due to its heavy use of varargs.
|
||||
|
||||
It's much better to use the layer below. This lower layer is structured as:
|
||||
create operator, set parameters, execute, extract results. For example, you can
|
||||
execute vips_invert() like this:
|
||||
|
||||
```C
|
||||
/* compile with
|
||||
*
|
||||
* gcc -g -Wall callvips.c `pkg-config vips --cflags --libs`
|
||||
*
|
||||
*/
|
||||
|
||||
#include <vips/vips.h>
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
VipsImage *in;
|
||||
VipsImage *out;
|
||||
VipsOperation *op;
|
||||
VipsOperation *new_op;
|
||||
GValue gvalue = { 0 };
|
||||
|
||||
if( VIPS_INIT( argv[0] ) )
|
||||
/* This shows the vips error buffer and quits with a fail exit
|
||||
* code.
|
||||
*/
|
||||
vips_error_exit( NULL );
|
||||
|
||||
/* This will print a table of any ref leaks on exit, very handy for
|
||||
* development.
|
||||
*/
|
||||
vips_leak_set( TRUE );
|
||||
|
||||
if( argc != 3 )
|
||||
vips_error_exit( "usage: %s input-filename output-filename",
|
||||
argv[0] );
|
||||
|
||||
if( !(in = vips_image_new_from_file( argv[1], NULL )) )
|
||||
vips_error_exit( NULL );
|
||||
|
||||
/* Create a new operator from a nickname. NULL for unknown operator.
|
||||
*/
|
||||
op = vips_operation_new( "invert" );
|
||||
|
||||
/* Init a gvalue as an image, set it to in, use the gvalue to set the
|
||||
* operator property.
|
||||
*/
|
||||
g_value_init( &gvalue, VIPS_TYPE_IMAGE );
|
||||
g_value_set_object( &gvalue, in );
|
||||
g_object_set_property( G_OBJECT( op ), "in", &gvalue );
|
||||
g_value_unset( &gvalue );
|
||||
|
||||
/* We no longer need in: op will hold a ref to it as long as it needs
|
||||
* it.
|
||||
*/
|
||||
g_object_unref( in );
|
||||
|
||||
/* Call the operation. This will look up the operation+args in the vips
|
||||
* operation cache and either return a previous operation, or build
|
||||
* this one. In either case, we have a new ref we mst release.
|
||||
*/
|
||||
if( !(new_op = vips_cache_operation_build( op )) ) {
|
||||
g_object_unref( op );
|
||||
vips_error_exit( NULL );
|
||||
}
|
||||
g_object_unref( op );
|
||||
op = new_op;
|
||||
|
||||
/* Now get the result from op. g_value_get_object() does not ref the
|
||||
* object, so we need to make a ref for out to hold.
|
||||
*/
|
||||
g_value_init( &gvalue, VIPS_TYPE_IMAGE );
|
||||
g_object_get_property( G_OBJECT( op ), "out", &gvalue );
|
||||
out = VIPS_IMAGE( g_value_get_object( &gvalue ) );
|
||||
g_object_ref( out );
|
||||
g_value_unset( &gvalue );
|
||||
|
||||
/* All done: we can unref op. The output objects from op actually hold
|
||||
* refs back to it, so before we can unref op, we must unref them.
|
||||
*/
|
||||
vips_object_unref_outputs( VIPS_OBJECT( op ) );
|
||||
g_object_unref( op );
|
||||
|
||||
if( vips_image_write_to_file( out, argv[2], NULL ) )
|
||||
vips_error_exit( NULL );
|
||||
|
||||
g_object_unref( out );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
```
|
||||
|
||||
libvips has a couple of extra things to let you fetch the arguments and types
|
||||
of an operator. Use vips_lib.vips_argument_map() to loop over all the arguments
|
||||
of an operator, and vips_object_get_argument() to fetch the type and flags
|
||||
of a specific argument.
|
||||
|
||||
Use vips_operation_get_flags() to get general information about an operator.
|
||||
|
||||
# Compiled language which can call C
|
||||
|
||||
The C++ binding uses this lower layer to define a function called
|
||||
`VImage::call()` which can call any libvips operator with a not-varargs set of
|
||||
variable arguments.
|
||||
|
||||
A small Python program walks the set of all libvips operators and generates a
|
||||
set of static bindings. For example:
|
||||
|
||||
```c++
|
||||
VImage VImage::invert( VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "invert", (options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
```
|
||||
|
||||
So from C++ you can call any libvips operator, though without type-safety, with
|
||||
`VImage::call()`, or use the member functions on `VImage` to get type-safe
|
||||
calls for at least the required operator arguments.
|
||||
|
||||
The `VImage` class also adds automatic reference counting, constant expansion,
|
||||
operator overloads, and various other useful features.
|
||||
|
||||
# Dynamic language with FFI
|
||||
|
||||
Languages like Ruby, Python, JavaScript and Lua can't call C directly, but
|
||||
they do support FFI. The bindings for these languages work rather like C++,
|
||||
but use FFI to call into libvips and run operations.
|
||||
|
||||
Since these languages are dynamic, they can add another trick: they intercept
|
||||
the method-missing hook and attempt to run any method calls not implemented by
|
||||
the `Image` class as libvips operators. This makes these bindings self-writing:
|
||||
they only contain a small amount of codeand just expose everything they find in
|
||||
the libvips class hierarchy.
|
||||
|
||||
# Dynamic langauge without FFI
|
||||
|
||||
PHP does not have FFI, unfortunately, so for this language a small native
|
||||
module implements the general `vips_call()` function for PHP language types,
|
||||
and a larger pure PHP layer makes it convenient to use.
|
||||
|
||||
# `gobject-introspection`
|
||||
|
||||
The C source code to libvips has been marked up with special comments
|
||||
describing the interface in a standard way. These comments are read by
|
||||
the `gobject-introspection` package when libvips is compiled and used to
|
||||
generate a typelib, a description of how to call the library. Many languages
|
||||
have gobject-introspection packages: all you need to do to call libvips
|
||||
from your favorite language is to start g-o-i, load the libvips typelib,
|
||||
and you should have the whole library available. For example, from Python
|
||||
it's as simple as:
|
||||
|
||||
```python
|
||||
from gi.repository import Vips
|
||||
```
|
||||
|
||||
You can now use all of the libvips introspection machinery, as noted above.
|
||||
|
||||
Unfortunately g-o-i has some strong disadvantages. It is not very portable,
|
||||
since you will need a g-o-i layer for whatever platform you are targetting;
|
||||
it does not cross-compile well, since typelibs include a lot of very-low
|
||||
level data (such as exact structure layouts); and installation for your
|
||||
users is likely to be tricky.
|
||||
|
||||
If you have a choice, I would recommend simply using FFI.
|
||||
|
||||
# Documentation
|
||||
|
||||
You can generate searchable docs from a <code>.gir</code> (the thing that
|
||||
is built from scanning libvips and which in turn turn the typelib is
|
||||
made from) with <command>g-ir-doc-tool</command>, for example:
|
||||
|
||||
```
|
||||
$ g-ir-doc-tool --language=Python -o ~/mydocs Vips-8.0.gir
|
||||
```
|
||||
|
||||
Then to view them, either:
|
||||
|
||||
```
|
||||
$ yelp ~/mydocs
|
||||
```
|
||||
|
||||
Or perhaps:
|
||||
|
||||
```
|
||||
$ cd ~/mydocs
|
||||
$ yelp-build html .
|
||||
```
|
||||
|
||||
To make HTML docs. This is an easy way to see what you can call in the
|
||||
library.
|
272
doc/binding.xml
272
doc/binding.xml
|
@ -1,94 +1,208 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- vim: set ts=2 sw=2 expandtab: -->
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="binding">
|
||||
<refmeta>
|
||||
<refentrytitle>Writing bindings for libvips</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>VIPS Library</refmiscinfo>
|
||||
</refmeta>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<refentry id="binding.md">
|
||||
|
||||
<refnamediv>
|
||||
<refname>Binding</refname>
|
||||
<refpurpose>How to write bindings for libvips</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect3 id="binding-goi">
|
||||
<title>Binding and gobject-introspection</title>
|
||||
<para>
|
||||
The C source code
|
||||
to libvips has been marked up with special comments describing the
|
||||
interface in a standard way. These comments are read by
|
||||
gobject-introspection
|
||||
when libvips is compiled and used to generate a
|
||||
typelib, a description of how to call the library. Many languages have
|
||||
gobject-introspection packages: all you need to do to call libvips
|
||||
from your favorite language is to start g-o-i, load the libvips typelib,
|
||||
and you should have the whole library available. For example, from
|
||||
Python it's as simple as:
|
||||
<para>
|
||||
<refmeta> <refentrytitle>How to write bindings</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>libvips</refmiscinfo> </refmeta>
|
||||
</para>
|
||||
<para>
|
||||
<refnamediv> <refname>Binding</refname> <refpurpose>Writing bindings for libvips</refpurpose> </refnamediv>
|
||||
</para>
|
||||
<para>
|
||||
There are full libvips bindings for quite a few environments now: C, C++, command-line, Ruby, PHP, Python and JavaScript (node).
|
||||
</para>
|
||||
<para>
|
||||
This chapter runs through the four main styles that have been found to work well. If you want to write a new binding, one of these should be close to what you need.
|
||||
</para>
|
||||
<refsect3 id="c-api">
|
||||
<title>C API</title>
|
||||
<para>
|
||||
The libvips C API (vips_add() and so on) is very inconvenient to use from other languages due to its heavy use of varargs.
|
||||
</para>
|
||||
<para>
|
||||
It’s much better to use the layer below. This lower layer is structured as: create operator, set parameters, execute, extract results. For example, you can execute vips_invert() like this:
|
||||
</para>
|
||||
<programlisting language="c">
|
||||
/* compile with
|
||||
*
|
||||
* gcc -g -Wall callvips.c `pkg-config vips --cflags --libs`
|
||||
*
|
||||
*/
|
||||
|
||||
<programlisting language="Python">
|
||||
#include <vips/vips.h>
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
VipsImage *in;
|
||||
VipsImage *out;
|
||||
VipsOperation *op;
|
||||
VipsOperation *new_op;
|
||||
GValue gvalue = { 0 };
|
||||
|
||||
if( VIPS_INIT( argv[0] ) )
|
||||
/* This shows the vips error buffer and quits with a fail exit
|
||||
* code.
|
||||
*/
|
||||
vips_error_exit( NULL );
|
||||
|
||||
/* This will print a table of any ref leaks on exit, very handy for
|
||||
* development.
|
||||
*/
|
||||
vips_leak_set( TRUE );
|
||||
|
||||
if( argc != 3 )
|
||||
vips_error_exit( "usage: %s input-filename output-filename",
|
||||
argv[0] );
|
||||
|
||||
if( !(in = vips_image_new_from_file( argv[1], NULL )) )
|
||||
vips_error_exit( NULL );
|
||||
|
||||
/* Create a new operator from a nickname. NULL for unknown operator.
|
||||
*/
|
||||
op = vips_operation_new( "invert" );
|
||||
|
||||
/* Init a gvalue as an image, set it to in, use the gvalue to set the
|
||||
* operator property.
|
||||
*/
|
||||
g_value_init( &gvalue, VIPS_TYPE_IMAGE );
|
||||
g_value_set_object( &gvalue, in );
|
||||
g_object_set_property( G_OBJECT( op ), "in", &gvalue );
|
||||
g_value_unset( &gvalue );
|
||||
|
||||
/* We no longer need in: op will hold a ref to it as long as it needs
|
||||
* it.
|
||||
*/
|
||||
g_object_unref( in );
|
||||
|
||||
/* Call the operation. This will look up the operation+args in the vips
|
||||
* operation cache and either return a previous operation, or build
|
||||
* this one. In either case, we have a new ref we mst release.
|
||||
*/
|
||||
if( !(new_op = vips_cache_operation_build( op )) ) {
|
||||
g_object_unref( op );
|
||||
vips_error_exit( NULL );
|
||||
}
|
||||
g_object_unref( op );
|
||||
op = new_op;
|
||||
|
||||
/* Now get the result from op. g_value_get_object() does not ref the
|
||||
* object, so we need to make a ref for out to hold.
|
||||
*/
|
||||
g_value_init( &gvalue, VIPS_TYPE_IMAGE );
|
||||
g_object_get_property( G_OBJECT( op ), "out", &gvalue );
|
||||
out = VIPS_IMAGE( g_value_get_object( &gvalue ) );
|
||||
g_object_ref( out );
|
||||
g_value_unset( &gvalue );
|
||||
|
||||
/* All done: we can unref op. The output objects from op actually hold
|
||||
* refs back to it, so before we can unref op, we must unref them.
|
||||
*/
|
||||
vips_object_unref_outputs( VIPS_OBJECT( op ) );
|
||||
g_object_unref( op );
|
||||
|
||||
if( vips_image_write_to_file( out, argv[2], NULL ) )
|
||||
vips_error_exit( NULL );
|
||||
|
||||
g_object_unref( out );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
libvips has a couple of extra things to let you fetch the arguments and types of an operator. Use vips_lib.vips_argument_map() to loop over all the arguments of an operator, and vips_object_get_argument() to fetch the type and flags of a specific argument.
|
||||
</para>
|
||||
<para>
|
||||
Use vips_operation_get_flags() to get general information about an operator.
|
||||
</para>
|
||||
</refsect3>
|
||||
<refsect3 id="compiled-language-which-can-call-c">
|
||||
<title>Compiled language which can call C</title>
|
||||
<para>
|
||||
The C++ binding uses this lower layer to define a function called <literal>VImage::call()</literal> which can call any libvips operator with a not-varargs set of variable arguments.
|
||||
</para>
|
||||
<para>
|
||||
A small Python program walks the set of all libvips operators and generates a set of static bindings. For example:
|
||||
</para>
|
||||
<programlisting language="cpp">
|
||||
VImage VImage::invert( VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "invert", (options ? options : VImage::option()) ->
|
||||
set( "in", *this ) ->
|
||||
set( "out", &out ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
So from C++ you can call any libvips operator, though without type-safety, with <literal>VImage::call()</literal>, or use the member functions on <literal>VImage</literal> to get type-safe calls for at least the required operator arguments.
|
||||
</para>
|
||||
<para>
|
||||
The <literal>VImage</literal> class also adds automatic reference counting, constant expansion, operator overloads, and various other useful features.
|
||||
</para>
|
||||
</refsect3>
|
||||
<refsect3 id="dynamic-language-with-ffi">
|
||||
<title>Dynamic language with FFI</title>
|
||||
<para>
|
||||
Languages like Ruby, Python, JavaScript and Lua can’t call C directly, but they do support FFI. The bindings for these languages work rather like C++, but use FFI to call into libvips and run operations.
|
||||
</para>
|
||||
<para>
|
||||
Since these languages are dynamic, they can add another trick: they intercept the method-missing hook and attempt to run any method calls not implemented by the <literal>Image</literal> class as libvips operators. This makes these bindings self-writing: they only contain a small amount of codeand just expose everything they find in the libvips class hierarchy.
|
||||
</para>
|
||||
</refsect3>
|
||||
<refsect3 id="dynamic-langauge-without-ffi">
|
||||
<title>Dynamic langauge without FFI</title>
|
||||
<para>
|
||||
PHP does not have FFI, unfortunately, so for this language a small native module implements the general <literal>vips_call()</literal> function for PHP language types, and a larger pure PHP layer makes it convenient to use.
|
||||
</para>
|
||||
</refsect3>
|
||||
<refsect3 id="gobject-introspection">
|
||||
<title><literal>gobject-introspection</literal></title>
|
||||
<para>
|
||||
The C source code to libvips has been marked up with special comments describing the interface in a standard way. These comments are read by the <literal>gobject-introspection</literal> package when libvips is compiled and used to generate a typelib, a description of how to call the library. Many languages have gobject-introspection packages: all you need to do to call libvips from your favorite language is to start g-o-i, load the libvips typelib, and you should have the whole library available. For example, from Python it’s as simple as:
|
||||
</para>
|
||||
<programlisting language="python">
|
||||
from gi.repository import Vips
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
libvips used in this way is likely to be rather bare-bones. For Python,
|
||||
we wrote a set of overrides which layer a more Pythonesque interface
|
||||
on top of the one provided for libvips by pygobject. These overrides
|
||||
are simply a set of Python classes.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To call a vips operation, you'll need to make a new operation with
|
||||
vips_operation_new() (all it does is look up the operation by name
|
||||
with vips_type_find(), then call g_object_new() for you), then
|
||||
use vips_argument_map() and friends to loop over the operation's
|
||||
arguments setting them. Once you have set all arguments, use
|
||||
vips_cache_operation_build() to look up the operation in the cache
|
||||
and either build or dup it. If something goes wrong, you'll need
|
||||
to use vips_object_unref_outputs() and g_object_unref() to free the
|
||||
partially-built object.
|
||||
The Python binding uses this technique to implement a function which
|
||||
can call any vips operation, turning optional vips arguments into
|
||||
Python keyword arguments.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If your language does not have a gobject-introspection package, you'll
|
||||
need to write something in C or C++ doing approximately the same thing.
|
||||
The C++ API takes this route.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can generate searchable docs from a <code>.gir</code> (the thing that
|
||||
is built from scanning libvips and which in turn turn the typelib is
|
||||
made from) with <command>g-ir-doc-tool</command>, for example:
|
||||
|
||||
<programlisting language="bash">
|
||||
<para>
|
||||
You can now use all of the libvips introspection machinery, as noted above.
|
||||
</para>
|
||||
<para>
|
||||
Unfortunately g-o-i has some strong disadvantages. It is not very portable, since you will need a g-o-i layer for whatever platform you are targetting; it does not cross-compile well, since typelibs include a lot of very-low level data (such as exact structure layouts); and installation for your users is likely to be tricky.
|
||||
</para>
|
||||
<para>
|
||||
If you have a choice, I would recommend simply using FFI.
|
||||
</para>
|
||||
</refsect3>
|
||||
<refsect3 id="documentation">
|
||||
<title>Documentation</title>
|
||||
<para>
|
||||
You can generate searchable docs from a <code>.gir</code> (the thing that is built from scanning libvips and which in turn turn the typelib is made from) with <command>g-ir-doc-tool</command>, for example:
|
||||
</para>
|
||||
<programlisting>
|
||||
$ g-ir-doc-tool --language=Python -o ~/mydocs Vips-8.0.gir
|
||||
</programlisting>
|
||||
|
||||
Then to view them, either:
|
||||
|
||||
<programlisting language="bash">
|
||||
<para>
|
||||
Then to view them, either:
|
||||
</para>
|
||||
<programlisting>
|
||||
$ yelp ~/mydocs
|
||||
</programlisting>
|
||||
|
||||
Or perhaps
|
||||
|
||||
<programlisting language="bash">
|
||||
<para>
|
||||
Or perhaps:
|
||||
</para>
|
||||
<programlisting>
|
||||
$ cd ~/mydocs
|
||||
$ yelp-build html .
|
||||
</programlisting>
|
||||
<para>
|
||||
To make HTML docs. This is an easy way to see what you can call in the library.
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
To make HTML docs. This is an easy way to see what you can call in the
|
||||
library.
|
||||
</para>
|
||||
|
||||
|
||||
</refsect3>
|
||||
|
||||
</refentry>
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
<xi:include href="xml/using-command-line.xml"/>
|
||||
<xi:include href="xml/using-C.xml"/>
|
||||
<xi:include href="xml/using-python.xml"/>
|
||||
<xi:include href="xml/using-cpp.xml"/>
|
||||
<xi:include href="xml/binding.xml"/>
|
||||
<xi:include href="xml/extending.xml"/>
|
||||
|
|
|
@ -1,681 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
]>
|
||||
<!-- vim: set ts=2 sw=2 expandtab: -->
|
||||
<refentry id="using-from-python">
|
||||
<refmeta>
|
||||
<refentrytitle>VIPS from Python</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>VIPS Library</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>Using VIPS</refname>
|
||||
<refpurpose>How to use the VIPS library from Python</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect3 id="python-intro">
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
VIPS comes with a convenient, high-level Python API built on
|
||||
on <code>gobject-introspection</code>. As long as you can get GOI
|
||||
for your platform, you should be able to use libvips.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To test the binding, start up Python and at the console enter:
|
||||
|
||||
<programlisting language="Python">
|
||||
>>> from gi.repository import Vips
|
||||
>>> x = Vips.Image.new_from_file("/path/to/some/image/file.jpg")
|
||||
>>> x.width
|
||||
1450
|
||||
>>>
|
||||
</programlisting>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
If import fails, check you have the Python
|
||||
gobject-introspection packages installed, that you have the
|
||||
libvips typelib installed, and that the typelib is either
|
||||
in the system area or on your <code>GI_TYPELIB_PATH</code>.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
If <code>.new_from_file()</code> fails, the vips overrides
|
||||
have not been found. Make sure <code>Vips.py</code> is in
|
||||
your system overrides area.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-example">
|
||||
<title>Example program</title>
|
||||
|
||||
<para>
|
||||
Here's a complete example program:
|
||||
|
||||
<programlisting language="Python">
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
|
||||
from gi.repository import Vips
|
||||
|
||||
im = Vips.Image.new_from_file(sys.argv[1])
|
||||
|
||||
im = im.extract_area(100, 100, im.width - 200, im.height - 200)
|
||||
im = im.similarity(scale = 0.9)
|
||||
mask = Vips.Image.new_from_array([[-1, -1, -1],
|
||||
[-1, 16, -1],
|
||||
[-1, -1, -1]], scale = 8)
|
||||
im = im.conv(mask)
|
||||
|
||||
im.write_to_file(sys.argv[2])
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Reading this code, the first interesting line is:
|
||||
|
||||
<programlisting language="Python">
|
||||
from gi.repository import Vips
|
||||
</programlisting>
|
||||
|
||||
When Python executes the import line it performs the following steps:
|
||||
</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
It searches for a file called <code>Vips-x.y.typelib</code>. This
|
||||
is a binary file generated automatically during libvips build
|
||||
by introspection of the libvips shared library plus scanning
|
||||
of the C headers. It lists all the API entry points, all the
|
||||
types the library uses, and has an extra set of hints for object
|
||||
ownership and reference counting. The typelib is searched for
|
||||
in <code>/usr/lib/gi-repository-1.0</code> and along the path
|
||||
in the environment variable <code>GI_TYPELIB_PATH</code>.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
It uses the typelib to make a basic binding for libvips. It's
|
||||
just the C API with a little very light mangling, so for
|
||||
example the enum member <code>VIPS_FORMAT_UCHAR</code>
|
||||
of the enum <code>VipsBandFormat</code> becomes
|
||||
<code>Vips.BandFormat.UCHAR</code>.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The binding you get can be rather unfriendly, so it also
|
||||
loads a set of overrides from <code>Vips.py</code> in
|
||||
<code>/usr/lib/python2.7/dist-packages/gi/overrides</code>
|
||||
(on my system at least). If you're using python3, it's
|
||||
<code>/usr/lib/python3/dist-packages/gi/overrides</code>.
|
||||
Unfortunately, as far as I know, there is no way to extend
|
||||
this search using environment variables. You MUST have
|
||||
<code>Vips.py</code> in exactly this directory. If you install
|
||||
vips via a package manager this will happen automatically,
|
||||
since vips and pygobject will have been built to the same
|
||||
prefix, but if you are installing vips from source and the
|
||||
prefix does not match, it will not be installed for you,
|
||||
you will need to copy it.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Finally, <code>Vips.py</code> makes the rest of the binding. In
|
||||
fact, <code>Vips.py</code> makes almost all the binding: it
|
||||
defines <code>__getattr__</code> on <code>Vips.Image</code>
|
||||
and binds at runtime by searching libvips for an operation of
|
||||
that name.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<para>
|
||||
The next line is:
|
||||
|
||||
<programlisting language="Python">
|
||||
im = Vips.Image.new_from_file(sys.argv[1])
|
||||
</programlisting>
|
||||
|
||||
This loads the input image. You can append
|
||||
load options to the argument list as keyword arguments, for example:
|
||||
|
||||
<programlisting language="Python">
|
||||
im = Vips.Image.new_from_file(sys.argv[1], access = Vips.Access.SEQUENTIAL)
|
||||
</programlisting>
|
||||
|
||||
See the various loaders for a list of the available options
|
||||
for each file format. The C equivalent to this function,
|
||||
vips_image_new_from_file(), has more extensive documentation. Try
|
||||
<code>help(Vips.Image)</code> to see a list of all the image
|
||||
constructors --- you can load from memory, create from an array,
|
||||
or create from a constant, for example.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The next line is:
|
||||
|
||||
<programlisting language="Python">
|
||||
im = im.extract_area(100, 100, im.width - 200, im.height - 200)
|
||||
</programlisting>
|
||||
|
||||
The arguments are left, top, width, height, so this crops 100 pixels off
|
||||
every edge. Try <code>help(im.extract_area)</code> and the C API docs
|
||||
for vips_extract_area() for details. You can use <code>.crop()</code>
|
||||
as a synonym, if you like.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<code>im.width</code> gets the image width
|
||||
in pixels, see <code>help(Vips.Image)</code> and vips_image_get_width()
|
||||
and friends for a list of the other getters.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The next line:
|
||||
|
||||
<programlisting language="Python">
|
||||
im = im.similarity(scale = 0.9)
|
||||
</programlisting>
|
||||
|
||||
shrinks by 10%. By default it uses
|
||||
bilinear interpolation, use <code>interpolate</code> to pick another
|
||||
interpolator, for example:
|
||||
|
||||
<programlisting language="Python">
|
||||
im = im.similarity(scale = 0.9, interpolate = Vips.Interpolate.new("bicubic"))
|
||||
</programlisting>
|
||||
|
||||
see vips_similarity() for full documentation. The similarity operator
|
||||
will not give good results for large resizes (more than a factor of
|
||||
two). See vips_resize() if you need to make a large change.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Next:
|
||||
|
||||
<programlisting language="Python">
|
||||
mask = Vips.Image.new_from_array([[-1, -1, -1],
|
||||
[-1, 16, -1],
|
||||
[-1, -1, -1]], scale = 8)
|
||||
im = im.conv(mask)
|
||||
</programlisting>
|
||||
|
||||
makes an image from a 2D array, then convolves with that. The
|
||||
<code>scale</code> keyword argument lets you set a divisor for
|
||||
convolution, handy for integer convolutions. You can set
|
||||
<code>offset</code> as well. See vips_conv() for details on the vips
|
||||
convolution operator.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Finally,
|
||||
|
||||
<programlisting language="Python">
|
||||
im.write_to_file(sys.argv[2])
|
||||
</programlisting>
|
||||
|
||||
sends the image back to the
|
||||
filesystem. There's also <code>.write_to_buffer()</code> to make a
|
||||
string containing the formatted image, and <code>.write()</code> to
|
||||
write to another image.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As with <code>.new_from_file()</code> you can append save options as
|
||||
keyword arguments. For example:
|
||||
|
||||
<programlisting language="Python">
|
||||
im.write_to_file("test.jpg", Q = 90)
|
||||
</programlisting>
|
||||
|
||||
will write a JPEG image with quality set to 90. See the various save
|
||||
operations for a list of all the save options, for example
|
||||
vips_jpegsave().
|
||||
</para>
|
||||
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-doc">
|
||||
<title>Getting help</title>
|
||||
<para>
|
||||
Try <code>help(Vips)</code> for everything,
|
||||
<code>help(Vips.Image)</code> for something slightly more digestible, or
|
||||
something like <code>help(Vips.Image.black)</code> for help on a
|
||||
specific class member.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can't get help on dynamically bound member functions like
|
||||
<code>.add()</code> this way. Instead, make an image and get help
|
||||
from that, for example:
|
||||
|
||||
<programlisting language="Python">
|
||||
image = Vips.Image.black(1, 1)
|
||||
help(image.add)
|
||||
</programlisting>
|
||||
|
||||
And you'll get a summary of the operator's behaviour and how the
|
||||
arguments are represented in Python.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The API docs have a <link linkend="function-list">handy table of all vips
|
||||
operations</link>, if you want to find out how to do something, try
|
||||
searching that.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <command>vips</command> command can be useful too. For example, in a
|
||||
terminal you can type <command>vips jpegsave</command> to get a
|
||||
summary of an operation:
|
||||
|
||||
<programlisting language="Python">
|
||||
$ vips jpegsave
|
||||
save image to jpeg file
|
||||
usage:
|
||||
jpegsave in filename
|
||||
where:
|
||||
in - Image to save, input VipsImage
|
||||
filename - Filename to save to, input gchararray
|
||||
optional arguments:
|
||||
Q - Q factor, input gint
|
||||
default: 75
|
||||
min: 1, max: 100
|
||||
profile - ICC profile to embed, input gchararray
|
||||
optimize-coding - Compute optimal Huffman coding tables, input gboolean
|
||||
default: false
|
||||
interlace - Generate an interlaced (progressive) jpeg, input gboolean
|
||||
default: false
|
||||
no-subsample - Disable chroma subsample, input gboolean
|
||||
default: false
|
||||
trellis-quant - Apply trellis quantisation to each 8x8 block, input gboolean
|
||||
default: false
|
||||
overshoot-deringing - Apply overshooting to samples with extreme values, input gboolean
|
||||
default: false
|
||||
optimize-scans - Split the spectrum of DCT coefficients into separate scans, input gboolean
|
||||
default: false
|
||||
strip - Strip all metadata from image, input gboolean
|
||||
default: false
|
||||
background - Background value, input VipsArrayDouble
|
||||
operation flags: sequential-unbuffered nocache
|
||||
</programlisting>
|
||||
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-basics">
|
||||
<title><code>pyvips8</code> basics</title>
|
||||
<para>
|
||||
As noted above, the Python interface comes in two main parts,
|
||||
an automatically generated binding based on the vips typelib,
|
||||
plus a set of extra features provided by overrides.
|
||||
The rest of this chapter runs through the features provided by the
|
||||
overrides.
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-wrapping">
|
||||
<title>Automatic wrapping</title>
|
||||
<para>
|
||||
The overrides intercept member lookup
|
||||
on the <code>Vips.Image</code> class and look for vips operations
|
||||
with that name. So the vips operation "add", which appears in the
|
||||
C API as vips_add(), appears in Python as
|
||||
<code>image.add()</code>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The first input image argument becomes the <code>self</code>
|
||||
argument. If there are no input image arguments, the operation
|
||||
appears as a class member. Optional input arguments become
|
||||
keyword arguments. The result is a list of all the output
|
||||
arguments, or a single output if there is only one.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Optional output arguments are enabled with a boolean keyword
|
||||
argument of that name. For example, "min" (the operation which
|
||||
appears in the C API as vips_min()), can be called like this:
|
||||
|
||||
<programlisting language="Python">
|
||||
min_value = im.min()
|
||||
</programlisting>
|
||||
|
||||
and <code>min_value</code> will be a floating point value giving
|
||||
the minimum value in the image. "min" can also find the position
|
||||
of the minimum value with the <code>x</code> and <code>y</code>
|
||||
optional output arguments. Call it like this:
|
||||
|
||||
<programlisting language="Python">
|
||||
min_value, opts = im.min(x = True, y = True)
|
||||
x = opts['x']
|
||||
y = opts['y']
|
||||
</programlisting>
|
||||
|
||||
In other words, if optional output args are requested, an extra
|
||||
dictionary is returned containing those objects.
|
||||
Of course in this case, the <code>.minpos()</code> convenience
|
||||
function would be simpler, see below.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Because operations are member functions and return the result image,
|
||||
you can chain them. For example, you can write:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = image.sin().pow(2)
|
||||
</programlisting>
|
||||
|
||||
to calculate the square of the sine for each pixel. There is also a
|
||||
full set of arithmetic operator overloads, see below.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
VIPS types are also automatically wrapped. The override looks
|
||||
at the type of argument required by the operation and converts
|
||||
the value you supply, when it can. For example, "linear" takes a
|
||||
#VipsArrayDouble as an argument for the set of constants to use for
|
||||
multiplication. You can supply this value as an integer, a float,
|
||||
or some kind of compound object and it will be converted for you.
|
||||
You can write:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = image.linear(1, 3)
|
||||
result_image = image.linear(12.4, 13.9)
|
||||
result_image = image.linear([1, 2, 3], [4, 5, 6])
|
||||
result_image = image.linear(1, [4, 5, 6])
|
||||
</programlisting>
|
||||
|
||||
And so on. A set of overloads are defined for <code>.linear()</code>,
|
||||
see below.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It does a couple of more ambitious conversions. It will
|
||||
automatically convert to and from the various vips types,
|
||||
like #VipsBlob and #VipsArrayImage. For example, you can read the
|
||||
ICC profile out of an image like this:
|
||||
|
||||
<programlisting language="Python">
|
||||
profile = im.get_value("icc-profile-data")
|
||||
</programlisting>
|
||||
|
||||
and <code>profile</code> will be a string.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can use array constants instead of images. A 2D array is simply
|
||||
changed into a one-band double image. This is handy for things like
|
||||
<code>.erode()</code>, for example:
|
||||
|
||||
<programlisting language="Python">
|
||||
im = im.erode([[128, 255, 128],
|
||||
[255, 255, 255],
|
||||
[128, 255, 128]])
|
||||
</programlisting>
|
||||
|
||||
will erode an image with a 4-connected structuring element.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If an operation takes several input images, you can use a 1D array
|
||||
constant or a number constant
|
||||
for all but one of them and the wrapper will expand it
|
||||
to an image for you. For example, <code>.ifthenelse()</code> uses
|
||||
a condition image to pick pixels between a then and an else image:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = condition_image.ifthenelse(then_image, else_image)
|
||||
</programlisting>
|
||||
|
||||
You can use a constant instead of either the then or the else
|
||||
parts, and it will be expanded to an image for you. If you use a
|
||||
constant for both then and else, it will be expanded to match the
|
||||
condition image. For example:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = condition_image.ifthenelse([0, 255, 0], [255, 0, 0])
|
||||
</programlisting>
|
||||
|
||||
Will make an image where true pixels are green and false pixels
|
||||
are red.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This is also useful for <code>.bandjoin()</code>, the thing to join
|
||||
two or more images up bandwise. You can write:
|
||||
|
||||
<programlisting language="Python">
|
||||
rgba = rgb.bandjoin(255)
|
||||
</programlisting>
|
||||
|
||||
to add a constant 255 band to an image, perhaps to add an alpha
|
||||
channel. Of course you can also write:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = image1.bandjoin(image2)
|
||||
result_image = image1.bandjoin([image2, image3])
|
||||
result_image = image1.bandjoin([image2, 255])
|
||||
</programlisting>
|
||||
|
||||
and so on.
|
||||
</para>
|
||||
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-exceptions">
|
||||
<title>Exceptions</title>
|
||||
<para>
|
||||
The wrapper spots errors from vips operations and raises the
|
||||
<code>Vips.Error</code> exception. You can catch it in the
|
||||
usual way. The <code>.detail</code> member gives the detailed
|
||||
error message.
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-memory">
|
||||
<title>Reading and writing areas of memory</title>
|
||||
<para>
|
||||
You can use the C API functions vips_image_new_from_memory(),
|
||||
vips_image_new_from_memory_copy() and
|
||||
vips_image_write_to_memory() directly from Python to read and write
|
||||
areas of memory. This can be useful if you need to get images to and
|
||||
from other other image processing libraries, like PIL or numpy.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Use them from Python like this:
|
||||
|
||||
<programlisting language="Python">
|
||||
image = Vips.Image.new_from_file("/path/to/some/image/file.jpg")
|
||||
memory_area = image.write_to_memory()
|
||||
</programlisting>
|
||||
|
||||
<code>memory_area</code> is now a string containing uncompressed binary
|
||||
image data. For an RGB image, it will have bytes
|
||||
<code>RGBRGBRGB...</code>, being
|
||||
the first three pixels of the first scanline of the image. You can pass
|
||||
this string to the numpy or PIL constructors and make an image there.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Note that <code>.write_to_memory()</code> will make a copy of the image.
|
||||
It would
|
||||
be better to use a Python buffer to pass the data, but sadly this isn't
|
||||
possible with gobject-introspection, as far as I know.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Going the other way, you can construct a vips image from a string of
|
||||
binary data. For example:
|
||||
|
||||
<programlisting language="Python">
|
||||
image = Vips.Image.new_from_file("/path/to/some/image/file.jpg")
|
||||
memory_area = image.write_to_memory()
|
||||
image2 = Vips.Image.new_from_memory(memory_area,
|
||||
image.width, image.height, image.bands,
|
||||
Vips.BandFormat.UCHAR)
|
||||
</programlisting>
|
||||
|
||||
Now <code>image2</code> should be an identical copy of <code>image</code>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Be careful: in this direction, vips does not make a copy of the memory
|
||||
area, so if <code>memory_area</code> is freed by the Python garbage
|
||||
collector and
|
||||
you later try to use <code>image2</code>, you'll get a crash.
|
||||
Make sure you keep a reference to <code>memory_area</code> around
|
||||
for as long as you need it. A simple solution is to use
|
||||
<code>new_from_memory_copy</code> instead. This will take a copy of the
|
||||
memory area for vips. Of course this will raise memory usage.
|
||||
</para>
|
||||
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-modify">
|
||||
<title>Draw operations</title>
|
||||
<para>
|
||||
Paint operations like <code>draw_circle</code> and <code>draw_line</code>
|
||||
modify their input image. This makes them hard to use with the rest of
|
||||
libvips: you need to be very careful about the order in which operations
|
||||
execute or you can get nasty crashes.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The wrapper spots operations of this type and makes a private copy of
|
||||
the image in memory before calling the operation. This stops crashes,
|
||||
but it does make it inefficient. If you draw 100 lines on an image,
|
||||
for example, you'll copy the image 100 times. The wrapper does make sure
|
||||
that memory is recycled where possible, so you won't have 100 copies in
|
||||
memory. At least you can execute these operations.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you want to avoid the copies, you'll need to call drawing
|
||||
operations yourself.
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-overloads">
|
||||
<title>Overloads</title>
|
||||
<para>
|
||||
The wrapper defines the usual set of arithmetic, boolean and
|
||||
relational overloads on
|
||||
<code>image</code>. You can mix images, constants and lists of
|
||||
constants (almost) freely. For example, you can write:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = ((image * [1, 2, 3]).abs() < 128) | 4
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The wrapper overloads <code>[]</code> to be vips_extract_band(). You
|
||||
can write:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = image[2]
|
||||
</programlisting>
|
||||
|
||||
to extract the third band of the image. It implements the usual
|
||||
slicing and negative indexes, so you can write:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = image[1:]
|
||||
result_image = image[:3]
|
||||
result_image = image[-2:]
|
||||
result_image = [x.avg() for x in image]
|
||||
</programlisting>
|
||||
|
||||
and so on.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The wrapper overloads <code>()</code> to be vips_getpoint(). You can
|
||||
write:
|
||||
|
||||
<programlisting language="Python">
|
||||
r, g, b = image(10, 10)
|
||||
</programlisting>
|
||||
|
||||
to read out the value of the pixel at coordinates (10, 10) from an RGB
|
||||
image.
|
||||
</para>
|
||||
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-expansions">
|
||||
<title>Expansions</title>
|
||||
<para>
|
||||
Some vips operators take an enum to select an action, for example
|
||||
<code>.math()</code> can be used to calculate sine of every pixel
|
||||
like this:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = image.math(Vips.OperationMath.SIN)
|
||||
</programlisting>
|
||||
|
||||
This is annoying, so the wrapper expands all these enums into
|
||||
separate members named after the enum. So you can write:
|
||||
|
||||
<programlisting language="Python">
|
||||
result_image = image.sin()
|
||||
</programlisting>
|
||||
|
||||
See <code>help(Vips.Image)</code> for a list.
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-utility">
|
||||
<title>Convenience functions</title>
|
||||
<para>
|
||||
The wrapper defines a few extra useful utility functions:
|
||||
<code>.get_value()</code>,
|
||||
<code>.set_value()</code>,
|
||||
<code>.bandsplit()</code>,
|
||||
<code>.maxpos()</code>,
|
||||
<code>.minpos()</code>,
|
||||
<code>.median()</code>.
|
||||
Again, see <code>help(Vips.Image)</code> for a list.
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="python-args">
|
||||
<title>Command-line option parsing</title>
|
||||
<para>
|
||||
GLib includes a command-line option parser, and Vips defines a set of
|
||||
standard flags you can use with it. For example:
|
||||
|
||||
<programlisting language="Python">
|
||||
import sys
|
||||
from gi.repository import GLib, Vips
|
||||
|
||||
context = GLib.OptionContext(" - test stuff")
|
||||
main_group = GLib.OptionGroup("main",
|
||||
"Main options", "Main options for this program",
|
||||
None)
|
||||
context.set_main_group(main_group)
|
||||
Vips.add_option_entries(main_group)
|
||||
context.parse(sys.argv)
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
</refsect3>
|
||||
|
||||
</refentry>
|
|
@ -253,9 +253,9 @@ vips_abs_init( VipsAbs *abs )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_abs:
|
||||
* vips_abs: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* This operation finds the absolute value of an image. It does a copy for
|
||||
|
|
|
@ -185,7 +185,7 @@ vips_add_init( VipsAdd *add )
|
|||
* vips_add:
|
||||
* @left: input image
|
||||
* @right: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* This operation calculates @in1 + @in2 and writes the result to @out.
|
||||
|
|
|
@ -240,7 +240,7 @@ vips_booleanv( VipsImage *left, VipsImage *right, VipsImage **out,
|
|||
* vips_boolean:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @boolean: boolean operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -284,7 +284,7 @@ vips_boolean( VipsImage *left, VipsImage *right, VipsImage **out,
|
|||
* vips_andimage:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_BOOLEAN_AND on a pair of images. See
|
||||
|
@ -310,7 +310,7 @@ vips_andimage( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_orimage:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_BOOLEAN_OR on a pair of images. See
|
||||
|
@ -336,7 +336,7 @@ vips_orimage( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_eorimage:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_BOOLEAN_EOR on a pair of images. See
|
||||
|
@ -362,7 +362,7 @@ vips_eorimage( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_lshift:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_BOOLEAN_LSHIFT on a pair of images. See
|
||||
|
@ -388,7 +388,7 @@ vips_lshift( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_rshift:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_BOOLEAN_RSHIFT on a pair of images. See
|
||||
|
@ -554,11 +554,11 @@ vips_boolean_constv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_boolean_const:
|
||||
* vips_boolean_const: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @boolean: boolean operation to perform
|
||||
* @c: array of constants
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -593,10 +593,10 @@ vips_boolean_const( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_andimage_const:
|
||||
* vips_andimage_const: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @c: array of constants
|
||||
* @out: (out): output image
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -622,10 +622,10 @@ vips_andimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_orimage_const:
|
||||
* vips_orimage_const: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @c: array of constants
|
||||
* @out: (out): output image
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -651,10 +651,10 @@ vips_orimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_eorimage_const:
|
||||
* vips_eorimage_const: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @c: array of constants
|
||||
* @out: (out): output image
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -680,10 +680,10 @@ vips_eorimage_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_lshift_const:
|
||||
* vips_lshift_const: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @c: array of constants
|
||||
* @out: (out): output image
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -709,10 +709,10 @@ vips_lshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_rshift_const:
|
||||
* vips_rshift_const: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @c: array of constants
|
||||
* @out: (out): output image
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -738,9 +738,9 @@ vips_rshift_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_boolean_const1:
|
||||
* vips_boolean_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @boolean: boolean operation to perform
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
|
@ -767,9 +767,9 @@ vips_boolean_const1( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_andimage_const1:
|
||||
* vips_andimage_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -795,9 +795,9 @@ vips_andimage_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_orimage_const1:
|
||||
* vips_orimage_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -823,9 +823,9 @@ vips_orimage_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_eorimage_const1:
|
||||
* vips_eorimage_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -851,9 +851,9 @@ vips_eorimage_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_lshift_const1:
|
||||
* vips_lshift_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -879,9 +879,9 @@ vips_lshift_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_rshift_const1:
|
||||
* vips_rshift_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -272,9 +272,9 @@ vips_complexv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_complex:
|
||||
* vips_complex: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @cmplx: complex operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -299,9 +299,9 @@ vips_complex( VipsImage *in, VipsImage **out, VipsOperationComplex cmplx, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_polar:
|
||||
* vips_polar: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_COMPLEX_POLAR on an image. See vips_complex().
|
||||
|
@ -322,9 +322,9 @@ vips_polar( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_rect:
|
||||
* vips_rect: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_COMPLEX_RECT on an image. See vips_complex().
|
||||
|
@ -345,9 +345,9 @@ vips_rect( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_conj:
|
||||
* vips_conj: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_COMPLEX_CONJ on an image. See vips_complex().
|
||||
|
@ -569,7 +569,7 @@ vips_complex2v( VipsImage *left, VipsImage *right, VipsImage **out,
|
|||
* vips_complex2:
|
||||
* @left: input #VipsImage
|
||||
* @right: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @cmplx: complex2 operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -598,7 +598,7 @@ vips_complex2( VipsImage *left, VipsImage *right, VipsImage **out,
|
|||
* vips_cross_phase:
|
||||
* @left: input #VipsImage
|
||||
* @right: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_COMPLEX2_CROSS_PHASE on an image.
|
||||
|
@ -781,9 +781,9 @@ vips_complexgetv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_complexget:
|
||||
* vips_complexget: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @get: complex operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -810,9 +810,9 @@ vips_complexget( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_real:
|
||||
* vips_real: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_COMPLEXGET_REAL on an image. See vips_complexget().
|
||||
|
@ -834,9 +834,9 @@ vips_real( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_imag:
|
||||
* vips_imag: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_COMPLEXGET_IMAG on an image. See vips_complexget().
|
||||
|
@ -977,7 +977,7 @@ vips_complexform_init( VipsComplexform *complexform )
|
|||
* vips_complexform:
|
||||
* @left: input image
|
||||
* @right: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Compose two real images to make a complex image. If either @left or @right
|
||||
|
|
|
@ -231,9 +231,9 @@ vips_deviate_init( VipsDeviate *deviate )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_deviate:
|
||||
* vips_deviate: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output pixel standard deviation
|
||||
* @out: (out): output pixel standard deviation
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* This operation finds the standard deviation of all pixels in @in. It
|
||||
|
|
|
@ -238,7 +238,7 @@ vips_divide_init( VipsDivide *divide )
|
|||
* vips_divide:
|
||||
* @left: input image
|
||||
* @right: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* This operation calculates @in1 / @in2 and writes the result to @out. If any
|
||||
|
|
|
@ -237,12 +237,12 @@ vips_find_trim_init( VipsFindTrim *find_trim )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_find_trim:
|
||||
* vips_find_trim: (method)
|
||||
* @in: image to find_trim
|
||||
* @left: output left edge
|
||||
* @top: output top edge
|
||||
* @width: output width
|
||||
* @height: output height
|
||||
* @left: (out): output left edge
|
||||
* @top: (out): output top edge
|
||||
* @width: (out): output width
|
||||
* @height: (out): output height
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -166,9 +166,9 @@ vips_getpoint_init( VipsGetpoint *getpoint )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_getpoint:
|
||||
* vips_getpoint: (method)
|
||||
* @in: image to read from
|
||||
* @vector: array length=n: output pixel value here
|
||||
* @vector: (out)(array length=n): output pixel value here
|
||||
* @n: length of output vector
|
||||
* @x: position to read
|
||||
* @y: position to read
|
||||
|
|
|
@ -468,9 +468,9 @@ vips_hist_find_init( VipsHistFind *hist_find )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_hist_find:
|
||||
* vips_hist_find: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -401,10 +401,10 @@ vips_hist_find_indexed_init( VipsHistFindIndexed *hist_find )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_hist_find_indexed:
|
||||
* @in: input image
|
||||
* @index: input index image
|
||||
* @out: output image
|
||||
* vips_hist_find_indexed: (method)
|
||||
* @in: input #VipsImage
|
||||
* @index: input index #VipsImage
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Make a histogram of @in, but use image @index to pick the bins. In other
|
||||
|
|
|
@ -316,9 +316,9 @@ vips_hist_find_ndim_init( VipsHistFindNDim *ndim )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_hist_find_ndim:
|
||||
* vips_hist_find_ndim: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -268,9 +268,9 @@ vips_hough_circle_init( VipsHoughCircle *hough_circle )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_hough_circle:
|
||||
* vips_hough_circle: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -162,9 +162,9 @@ vips_hough_line_init( VipsHoughLine *hough_line )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_hough_line:
|
||||
* vips_hough_line: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -175,9 +175,9 @@ vips_invert_init( VipsInvert *invert )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_invert:
|
||||
* vips_invert: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* For unsigned formats, this operation calculates (max - @in), eg. (255 -
|
||||
|
|
|
@ -40,10 +40,11 @@
|
|||
* - removed the 1-ary constant path, no faster
|
||||
* 30/11/13
|
||||
* - 1ary is back, faster with gcc 4.8
|
||||
* 3/12/13
|
||||
* - try an ORC path with the band loop unrolled
|
||||
* 14/1/14
|
||||
* - add uchar output option
|
||||
* 30/9/17
|
||||
* - squash constants with all elements equal so we use 1ary path more
|
||||
* often
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -124,7 +125,7 @@ vips_linear_build( VipsObject *object )
|
|||
|
||||
int i;
|
||||
|
||||
/* If we have a three-element vector we need to bandup the image to
|
||||
/* If we have a three-element vector, we need to bandup the image to
|
||||
* match.
|
||||
*/
|
||||
linear->n = 1;
|
||||
|
@ -150,6 +151,38 @@ vips_linear_build( VipsObject *object )
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
/* If all elements of the constants are equal, we can shrink them down
|
||||
* to a single element.
|
||||
*/
|
||||
if( linear->a ) {
|
||||
double *ary = (double *) linear->a->data;
|
||||
gboolean all_equal;
|
||||
|
||||
all_equal = TRUE;
|
||||
for( i = 1; i < linear->a->n; i++ )
|
||||
if( ary[i] != ary[0] ) {
|
||||
all_equal = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( all_equal )
|
||||
linear->a->n = 1;
|
||||
}
|
||||
if( linear->b ) {
|
||||
double *ary = (double *) linear->b->data;
|
||||
gboolean all_equal;
|
||||
|
||||
all_equal = TRUE;
|
||||
for( i = 1; i < linear->b->n; i++ )
|
||||
if( ary[i] != ary[0] ) {
|
||||
all_equal = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( all_equal )
|
||||
linear->b->n = 1;
|
||||
}
|
||||
|
||||
/* Make up-banded versions of our constants.
|
||||
*/
|
||||
linear->a_ready = VIPS_ARRAY( linear, linear->n, double );
|
||||
|
@ -438,9 +471,9 @@ vips_linearv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_linear:
|
||||
* vips_linear: (method)
|
||||
* @in: image to transform
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @a: (array length=n): array of constants for multiplication
|
||||
* @b: (array length=n): array of constants for addition
|
||||
* @n: length of constant arrays
|
||||
|
@ -480,9 +513,9 @@ vips_linear( VipsImage *in, VipsImage **out, double *a, double *b, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_linear1:
|
||||
* vips_linear1: (method)
|
||||
* @in: image to transform
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @a: constant for multiplication
|
||||
* @b: constant for addition
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
|
|
|
@ -230,9 +230,9 @@ vips_mathv( VipsImage *in, VipsImage **out, VipsOperationMath math, va_list ap )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_math:
|
||||
* vips_math: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @math: math operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -261,9 +261,9 @@ vips_math( VipsImage *in, VipsImage **out, VipsOperationMath math, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_sin:
|
||||
* vips_sin: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_SIN on an image. See vips_math().
|
||||
|
@ -284,9 +284,9 @@ vips_sin( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cos:
|
||||
* vips_cos: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_COS on an image. See vips_math().
|
||||
|
@ -307,9 +307,9 @@ vips_cos( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_tan:
|
||||
* vips_tan: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_TAN on an image. See vips_math().
|
||||
|
@ -330,9 +330,9 @@ vips_tan( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_asin:
|
||||
* vips_asin: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_ASIN on an image. See vips_math().
|
||||
|
@ -353,9 +353,9 @@ vips_asin( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_acos:
|
||||
* vips_acos: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_ACOS on an image. See vips_math().
|
||||
|
@ -376,9 +376,9 @@ vips_acos( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_atan:
|
||||
* vips_atan: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_ATAN on an image. See vips_math().
|
||||
|
@ -399,9 +399,9 @@ vips_atan( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_log:
|
||||
* vips_log: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_LOG on an image. See vips_math().
|
||||
|
@ -422,9 +422,9 @@ vips_log( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_log10:
|
||||
* vips_log10: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_LOG10 on an image. See vips_math().
|
||||
|
@ -445,9 +445,9 @@ vips_log10( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_exp:
|
||||
* vips_exp: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_EXP on an image. See vips_math().
|
||||
|
@ -468,9 +468,9 @@ vips_exp( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_exp10:
|
||||
* vips_exp10: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH_EXP10 on an image. See vips_math().
|
||||
|
|
|
@ -225,7 +225,7 @@ vips_math2v( VipsImage *left, VipsImage *right, VipsImage **out,
|
|||
* vips_math2:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @math2: math operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -272,7 +272,7 @@ vips_math2( VipsImage *left, VipsImage *right, VipsImage **out,
|
|||
* vips_pow:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH2_POW on a pair of images. See
|
||||
|
@ -297,7 +297,7 @@ vips_pow( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_wop:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_MATH2_WOP on a pair of images. See
|
||||
|
@ -441,11 +441,11 @@ vips_math2_constv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_math2_const:
|
||||
* vips_math2_const: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @math2: math operation to perform
|
||||
* @c: array of constants
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -484,10 +484,10 @@ vips_math2_const( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_pow_const:
|
||||
* vips_pow_const: (method)
|
||||
* @in: left-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @c: array of constants
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -511,10 +511,10 @@ vips_pow_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_wop_const:
|
||||
* vips_wop_const: (method)
|
||||
* @in: left-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @c: array of constants
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -538,9 +538,9 @@ vips_wop_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_math2_const1:
|
||||
* vips_math2_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @math2: math operation to perform
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
|
@ -565,9 +565,9 @@ vips_math2_const1( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_pow_const1:
|
||||
* vips_pow_const1: (method)
|
||||
* @in: left-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -591,9 +591,9 @@ vips_pow_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_wop_const1:
|
||||
* vips_wop_const1: (method)
|
||||
* @in: left-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -491,9 +491,9 @@ vips_max_init( VipsMax *max )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_max:
|
||||
* vips_max: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output pixel maximum
|
||||
* @out: (out): output pixel maximum
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -253,9 +253,9 @@ vips_measure_init( VipsMeasure *measure )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_measure:
|
||||
* vips_measure: (method)
|
||||
* @in: image to measure
|
||||
* @out: array of measurements
|
||||
* @out: (out): array of measurements
|
||||
* @h: patches across chart
|
||||
* @v: patches down chart
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
|
|
|
@ -492,9 +492,9 @@ vips_min_init( VipsMin *min )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_min:
|
||||
* vips_min: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output pixel minimum
|
||||
* @out: (out): output pixel minimum
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -186,7 +186,7 @@ vips_multiply_init( VipsMultiply *multiply )
|
|||
* vips_multiply:
|
||||
* @left: left-hand image
|
||||
* @right: right-hand image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* This operation calculates @left * @right and writes the result to @out.
|
||||
|
|
|
@ -316,10 +316,10 @@ vips_profile_init( VipsProfile *profile )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_profile:
|
||||
* vips_profile: (method)
|
||||
* @in: input image
|
||||
* @columns: distances from top edge
|
||||
* @rows: distances from left edge
|
||||
* @columns: (out): distances from top edge
|
||||
* @rows: (out): distances from left edge
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* vips_profile() searches inward from the edge of @in and finds the
|
||||
|
|
|
@ -346,10 +346,10 @@ vips_project_init( VipsProject *project )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_project:
|
||||
* vips_project: (method)
|
||||
* @in: input image
|
||||
* @columns: sums of columns
|
||||
* @rows: sums of rows
|
||||
* @columns: (out): sums of columns
|
||||
* @rows: (out): sums of rows
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Find the horizontal and vertical projections of an image, ie. the sum
|
||||
|
|
|
@ -246,7 +246,7 @@ vips_relationalv( VipsImage *left, VipsImage *right, VipsImage **out,
|
|||
* vips_relational:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @relational: relational operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -294,7 +294,7 @@ vips_relational( VipsImage *left, VipsImage *right, VipsImage **out,
|
|||
* vips_equal:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_RELATIONAL_EQUAL on a pair of images. See
|
||||
|
@ -320,7 +320,7 @@ vips_equal( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_notequal:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_RELATIONAL_NOTEQ on a pair of images. See
|
||||
|
@ -346,7 +346,7 @@ vips_notequal( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_more:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_RELATIONAL_MORE on a pair of images. See
|
||||
|
@ -372,7 +372,7 @@ vips_more( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_moreeq:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_RELATIONAL_MOREEQ on a pair of images. See
|
||||
|
@ -398,7 +398,7 @@ vips_moreeq( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_less:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_RELATIONAL_LESS on a pair of images. See
|
||||
|
@ -424,7 +424,7 @@ vips_less( VipsImage *left, VipsImage *right, VipsImage **out, ... )
|
|||
* vips_lesseq:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_RELATIONAL_LESSEQ on a pair of images. See
|
||||
|
@ -595,11 +595,11 @@ vips_relational_constv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_relational_const:
|
||||
* vips_relational_const: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @relational: relational operation to perform
|
||||
* @c: array of constants
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -634,10 +634,10 @@ vips_relational_const( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_equal_const:
|
||||
* vips_equal_const: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @c: array of constants
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -661,10 +661,10 @@ vips_equal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_notequal_const:
|
||||
* vips_notequal_const: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @c: array of constants
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -688,10 +688,10 @@ vips_notequal_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_less_const:
|
||||
* vips_less_const: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @c: array of constants
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -715,10 +715,10 @@ vips_less_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_lesseq_const:
|
||||
* vips_lesseq_const: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @c: array of constants
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -742,10 +742,10 @@ vips_lesseq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_more_const:
|
||||
* vips_more_const: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @c: array of constants
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -769,10 +769,10 @@ vips_more_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_moreeq_const:
|
||||
* vips_moreeq_const: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @c: array of constants
|
||||
* @out: (out): output #VipsImage
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -796,9 +796,9 @@ vips_moreeq_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_relational_const1:
|
||||
* vips_relational_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @relational: relational operation to perform
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
|
@ -825,9 +825,9 @@ vips_relational_const1( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_equal_const1:
|
||||
* vips_equal_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -851,9 +851,9 @@ vips_equal_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_notequal_const1:
|
||||
* vips_notequal_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -877,9 +877,9 @@ vips_notequal_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_less_const1:
|
||||
* vips_less_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -903,9 +903,9 @@ vips_less_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_lesseq_const1:
|
||||
* vips_lesseq_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -929,9 +929,9 @@ vips_lesseq_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_more_const1:
|
||||
* vips_more_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -955,9 +955,9 @@ vips_more_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_moreeq_const1:
|
||||
* vips_moreeq_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -189,7 +189,7 @@ vips_remainder_init( VipsRemainder *remainder )
|
|||
* vips_remainder:
|
||||
* @left: left-hand input #VipsImage
|
||||
* @right: right-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* This operation calculates @left % @right (remainder after integer division)
|
||||
|
@ -357,10 +357,10 @@ vips_remainder_constv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_remainder_const:
|
||||
* vips_remainder_const: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @c: array of constants
|
||||
* @out: (out): output image
|
||||
* @c: (array length=n): array of constants
|
||||
* @n: number of constants in @c
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -396,9 +396,9 @@ vips_remainder_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_remainder_const1:
|
||||
* vips_remainder_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -186,9 +186,9 @@ vips_roundv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_round:
|
||||
* vips_round: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @round: #VipsOperationRound rounding operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -218,9 +218,9 @@ vips_round( VipsImage *in, VipsImage **out, VipsOperationRound round, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_floor:
|
||||
* vips_floor: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Round to an integral value with #VIPS_OPERATION_ROUND_FLOOR. See
|
||||
|
@ -242,9 +242,9 @@ vips_floor( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_ceil:
|
||||
* vips_ceil: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Round to an integral value with #VIPS_OPERATION_ROUND_CEIL. See
|
||||
|
@ -266,9 +266,9 @@ vips_ceil( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_rint:
|
||||
* vips_rint: (method)
|
||||
* @in: input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Round to an integral value with #VIPS_OPERATION_ROUND_RINT. See
|
||||
|
|
|
@ -162,9 +162,9 @@ vips_sign_init( VipsSign *sign )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_sign:
|
||||
* vips_sign: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Finds the unit vector in the direction of the pixel value. For non-complex
|
||||
|
|
|
@ -429,9 +429,9 @@ vips_stats_init( VipsStats *stats )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_stats:
|
||||
* vips_stats: (method)
|
||||
* @in: image to scan
|
||||
* @out: image of statistics
|
||||
* @out: (out): image of statistics
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Find many image statistics in a single pass through the data. @out is a
|
||||
|
|
|
@ -175,7 +175,7 @@ vips_subtract_init( VipsSubtract *subtract )
|
|||
* vips_subtract:
|
||||
* @in1: input image
|
||||
* @in2: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* This operation calculates @in1 - @in2 and writes the result to @out.
|
||||
|
|
|
@ -165,8 +165,8 @@ vips_sumv( VipsImage **in, VipsImage **out, int n, va_list ap )
|
|||
|
||||
/**
|
||||
* vips_sum:
|
||||
* @in: array of input images
|
||||
* @out: output image
|
||||
* @in: (array length=n): array of input images
|
||||
* @out: (out): output image
|
||||
* @n: number of input images
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -132,9 +132,9 @@ vips_HSV2sRGB_init( VipsHSV2sRGB *HSV2sRGB )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_HSV2sRGB:
|
||||
* vips_HSV2sRGB: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert HSV to sRGB.
|
||||
|
|
|
@ -136,9 +136,9 @@ vips_LCh2Lab_init( VipsLCh2Lab *LCh2Lab )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_LCh2Lab:
|
||||
* vips_LCh2Lab: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Turn LCh to Lab.
|
||||
|
|
|
@ -217,9 +217,9 @@ vips_LCh2CMC_init( VipsLCh2CMC *LCh2CMC )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_LCh2CMC:
|
||||
* vips_LCh2CMC: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Turn LCh to CMC.
|
||||
|
|
|
@ -160,9 +160,9 @@ vips_Lab2LCh_init( VipsLab2LCh *Lab2LCh )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_Lab2LCh:
|
||||
* vips_Lab2LCh: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Turn Lab to LCh.
|
||||
|
|
|
@ -156,9 +156,9 @@ vips_Lab2LabQ_init( VipsLab2LabQ *Lab2LabQ )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_Lab2LabQ:
|
||||
* vips_Lab2LabQ: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert a Lab three-band float image to LabQ (#VIPS_CODING_LABQ).
|
||||
|
|
|
@ -98,9 +98,9 @@ vips_Lab2LabS_init( VipsLab2LabS *Lab2LabS )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_Lab2LabS:
|
||||
* vips_Lab2LabS: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Turn Lab to LabS, signed 16-bit int fixed point.
|
||||
|
|
|
@ -192,9 +192,9 @@ vips_Lab2XYZ_init( VipsLab2XYZ *Lab2XYZ )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_Lab2XYZ:
|
||||
* vips_Lab2XYZ: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
@ -224,9 +224,9 @@ vips_Lab2XYZ( VipsImage *in, VipsImage **out, ... )
|
|||
* @L: Input CIE Lab value
|
||||
* @a: Input CIE Lab value
|
||||
* @b: Input CIE Lab value
|
||||
* @X: Return CIE XYZ colour
|
||||
* @Y: Return CIE XYZ colour
|
||||
* @Z: Return CIE XYZ colour
|
||||
* @X: (out): Return CIE XYZ colour
|
||||
* @Y: (out): Return CIE XYZ colour
|
||||
* @Z: (out): Return CIE XYZ colour
|
||||
*
|
||||
* Calculate XYZ from Lab, D65.
|
||||
*
|
||||
|
|
|
@ -141,9 +141,9 @@ vips_LabQ2Lab_init( VipsLabQ2Lab *LabQ2Lab )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_LabQ2Lab:
|
||||
* vips_LabQ2Lab: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Unpack a LabQ (#VIPS_CODING_LABQ) image to a three-band float image.
|
||||
|
|
|
@ -121,9 +121,9 @@ vips_LabQ2LabS_init( VipsLabQ2LabS *LabQ2LabS )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_LabQ2LabS:
|
||||
* vips_LabQ2LabS: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Unpack a LabQ (#VIPS_CODING_LABQ) image to a three-band short image.
|
||||
|
|
|
@ -531,9 +531,9 @@ vips_LabQ2sRGB_init( VipsLabQ2sRGB *LabQ2sRGB )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_LabQ2sRGB:
|
||||
* vips_LabQ2sRGB: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Unpack a LabQ (#VIPS_CODING_LABQ) image to a three-band short image.
|
||||
|
|
|
@ -96,9 +96,9 @@ vips_LabS2Lab_init( VipsLabS2Lab *LabS2Lab )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_LabS2Lab:
|
||||
* vips_LabS2Lab: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert a LabS three-band signed short image to a three-band float image.
|
||||
|
|
|
@ -146,9 +146,9 @@ vips_LabS2LabQ_init( VipsLabS2LabQ *LabS2LabQ )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_LabS2LabQ:
|
||||
* vips_LabS2LabQ: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert a LabS three-band signed short image to LabQ
|
||||
|
|
|
@ -284,9 +284,9 @@ vips_CMC2LCh_init( VipsCMC2LCh *CMC2LCh )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_CMC2LCh:
|
||||
* vips_CMC2LCh: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Turn LCh to CMC.
|
||||
|
|
|
@ -245,9 +245,9 @@ vips_XYZ2Lab_init( VipsXYZ2Lab *XYZ2Lab )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_XYZ2Lab:
|
||||
* vips_XYZ2Lab: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -103,9 +103,9 @@ vips_XYZ2Yxy_init( VipsXYZ2Yxy *XYZ2Yxy )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_XYZ2Yxy:
|
||||
* vips_XYZ2Yxy: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Turn XYZ to Yxy.
|
||||
|
|
|
@ -116,9 +116,9 @@ vips_XYZ2scRGB_init( VipsXYZ2scRGB *XYZ2scRGB )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_XYZ2scRGB:
|
||||
* vips_XYZ2scRGB: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Turn XYZ to scRGB.
|
||||
|
|
|
@ -104,9 +104,9 @@ vips_Yxy2XYZ_init( VipsYxy2XYZ *Yxy2XYZ )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_Yxy2XYZ:
|
||||
* vips_Yxy2XYZ: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Turn XYZ to Yxy.
|
||||
|
|
|
@ -601,7 +601,7 @@ vips_colourspace_class_init( VipsColourspaceClass *class )
|
|||
G_STRUCT_OFFSET( VipsColourspace, space ),
|
||||
VIPS_TYPE_INTERPRETATION, VIPS_INTERPRETATION_sRGB );
|
||||
|
||||
VIPS_ARG_ENUM( class, "source-space", 6,
|
||||
VIPS_ARG_ENUM( class, "source_space", 6,
|
||||
_( "Source space" ),
|
||||
_( "Source color space" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
|
@ -617,9 +617,9 @@ vips_colourspace_init( VipsColourspace *colourspace )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_colourspace:
|
||||
* vips_colourspace: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @space: convert to this colour space
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -127,7 +127,7 @@ vips_dE76_init( VipsdE76 *dE76 )
|
|||
* vips_dE76:
|
||||
* @left: first input image
|
||||
* @right: second input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Calculate dE 76.
|
||||
|
|
|
@ -75,7 +75,7 @@ vips_dECMC_init( VipsdECMC *dECMC )
|
|||
* vips_dECMC:
|
||||
* @left: first input image
|
||||
* @right: second input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Calculate dE CMC. The input images are transformed to CMC colour space and
|
||||
|
|
|
@ -220,9 +220,9 @@ vips_float2rad_init( VipsFloat2rad *float2rad )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_float2rad:
|
||||
* vips_float2rad: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert a three-band float image to Radiance 32-bit packed format.
|
||||
|
|
|
@ -1054,9 +1054,9 @@ vips_icc_transform_init( VipsIccTransform *transform )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_icc_ac2rc:
|
||||
* vips_icc_ac2rc: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @profile_filename: use this profile
|
||||
*
|
||||
* Transform an image from absolute to relative colorimetry using the
|
||||
|
@ -1148,9 +1148,9 @@ vips_icc_ac2rc( VipsImage *in, VipsImage **out, const char *profile_filename )
|
|||
#endif /*HAVE_LCMS*/
|
||||
|
||||
/**
|
||||
* vips_icc_import:
|
||||
* vips_icc_import: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
@ -1191,9 +1191,9 @@ vips_icc_import( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_icc_export:
|
||||
* vips_icc_export: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
@ -1226,9 +1226,9 @@ vips_icc_export( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_icc_transform:
|
||||
* vips_icc_transform: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @output_profile: get the output profile from here
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -205,9 +205,9 @@ vips_rad2float_init( VipsRad2float *rad2float )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_rad2float:
|
||||
* vips_rad2float: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Unpack a RAD (#VIPS_CODING_RAD) image to a three-band float image.
|
||||
|
|
|
@ -153,9 +153,9 @@ vips_sRGB2HSV_init( VipssRGB2HSV *sRGB2HSV )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_sRGB2HSV:
|
||||
* vips_sRGB2HSV: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert to HSV.
|
||||
|
|
|
@ -259,9 +259,9 @@ vips_sRGB2scRGB_init( VipssRGB2scRGB *sRGB2scRGB )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_sRGB2scRGB:
|
||||
* vips_sRGB2scRGB: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert an sRGB image to scRGB. The input image can be 8 or 16-bit.
|
||||
|
|
|
@ -261,9 +261,9 @@ vips_scRGB2BW_init( VipsscRGB2BW *scRGB2BW )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_scRGB2BW:
|
||||
* vips_scRGB2BW: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -101,9 +101,9 @@ vips_scRGB2XYZ_init( VipsscRGB2XYZ *scRGB2XYZ )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_scRGB2XYZ:
|
||||
* vips_scRGB2XYZ: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Turn XYZ to scRGB.
|
||||
|
|
|
@ -289,9 +289,9 @@ vips_scRGB2sRGB_init( VipsscRGB2sRGB *scRGB2sRGB )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_scRGB2sRGB:
|
||||
* vips_scRGB2sRGB: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
noinst_LTLIBRARIES = libconversion.la
|
||||
|
||||
libconversion_la_SOURCES = \
|
||||
composite.cpp \
|
||||
smartcrop.c \
|
||||
conversion.c \
|
||||
pconversion.h \
|
||||
|
|
|
@ -384,7 +384,7 @@ vips_arrayjoinv( VipsImage **in, VipsImage **out, int n, va_list ap )
|
|||
/**
|
||||
* vips_arrayjoin:
|
||||
* @in: (array length=n) (transfer none): array of input images
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @n: number of input images
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -125,7 +125,7 @@ vips_autorot_remove_angle_sub( VipsImage *image,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_autorot_remove_angle:
|
||||
* vips_autorot_remove_angle: (method)
|
||||
* @image: image to remove orientation from
|
||||
*
|
||||
* Remove the orientation tag on @image. Also remove any exif orientation tags.
|
||||
|
@ -195,9 +195,9 @@ vips_autorot_init( VipsAutorot *autorot )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_autorot:
|
||||
* vips_autorot: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -239,9 +239,9 @@ vips_bandboolv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_bandbool:
|
||||
* vips_bandbool: (method)
|
||||
* @in: left-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @boolean: boolean operation to perform
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -279,9 +279,9 @@ vips_bandbool( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_bandand:
|
||||
* vips_bandand: (method)
|
||||
* @in: left-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_BOOLEAN_AND on an image. See
|
||||
|
@ -303,9 +303,9 @@ vips_bandand( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_bandor:
|
||||
* vips_bandor: (method)
|
||||
* @in: left-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_BOOLEAN_OR on an image. See
|
||||
|
@ -327,9 +327,9 @@ vips_bandor( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_bandeor:
|
||||
* vips_bandeor: (method)
|
||||
* @in: left-hand input #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Perform #VIPS_OPERATION_BOOLEAN_EOR on an image. See
|
||||
|
|
|
@ -179,9 +179,9 @@ vips_bandfold_init( VipsBandfold *bandfold )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_bandfold:
|
||||
* vips_bandfold: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -204,7 +204,7 @@ vips_bandjoinv( VipsImage **in, VipsImage **out, int n, va_list ap )
|
|||
/**
|
||||
* vips_bandjoin:
|
||||
* @in: (array length=n) (transfer none): array of input images
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @n: number of input images
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -243,7 +243,7 @@ vips_bandjoin( VipsImage **in, VipsImage **out, int n, ... )
|
|||
* vips_bandjoin2:
|
||||
* @in1: first input image
|
||||
* @in2: second input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Join a pair of images together, bandwise. See vips_bandjoin().
|
||||
|
@ -322,17 +322,35 @@ vips_bandjoin_const_buffer( VipsBandary *bandary,
|
|||
q1 = q;
|
||||
p1 = p[0];
|
||||
|
||||
for( x = 0; x < width; x++ ) {
|
||||
for( z = 0; z < ips; z++ )
|
||||
q1[z] = p1[z];
|
||||
/* Special path for 8-bit RGB -> RGBA ... it's a common case.
|
||||
*/
|
||||
if( ips == 3 &&
|
||||
ebs == 1 ) {
|
||||
int c = bandjoin->c_ready[0];
|
||||
|
||||
p1 += ips;
|
||||
q1 += ips;
|
||||
for( x = 0; x < width; x++ ) {
|
||||
q1[0] = p1[0];
|
||||
q1[1] = p1[1];
|
||||
q1[2] = p1[2];
|
||||
q1[3] = c;
|
||||
|
||||
for( z = 0; z < ebs; z++ )
|
||||
q1[z] = bandjoin->c_ready[z];
|
||||
p1 += 3;
|
||||
q1 += 4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for( x = 0; x < width; x++ ) {
|
||||
for( z = 0; z < ips; z++ )
|
||||
q1[z] = p1[z];
|
||||
|
||||
q1 += ebs;
|
||||
p1 += ips;
|
||||
q1 += ips;
|
||||
|
||||
for( z = 0; z < ebs; z++ )
|
||||
q1[z] = bandjoin->c_ready[z];
|
||||
|
||||
q1 += ebs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,9 +446,9 @@ vips_bandjoin_constv( VipsImage *in, VipsImage **out,
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_bandjoin_const:
|
||||
* @in: (array length=n) (transfer none): array of input images
|
||||
* @out: output image
|
||||
* vips_bandjoin_const: (method)
|
||||
* @in: input image
|
||||
* @out: (out): output image
|
||||
* @c: (array length=n): array of constants to append
|
||||
* @n: number of constants
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
|
@ -455,9 +473,9 @@ vips_bandjoin_const( VipsImage *in, VipsImage **out, double *c, int n, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_bandjoin_const1:
|
||||
* vips_bandjoin_const1: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @c: constant to append
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -477,3 +495,30 @@ vips_bandjoin_const1( VipsImage *in, VipsImage **out, double c, ... )
|
|||
|
||||
return( result );
|
||||
}
|
||||
|
||||
/* vips_addalpha:
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Append an alpha channel.
|
||||
*
|
||||
* See also: vips_image_hasalpha().
|
||||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int
|
||||
vips_addalpha( VipsImage *in, VipsImage **out, ... )
|
||||
{
|
||||
double max_alpha;
|
||||
|
||||
max_alpha = 255.0;
|
||||
if( in->Type == VIPS_INTERPRETATION_GREY16 ||
|
||||
in->Type == VIPS_INTERPRETATION_RGB16 )
|
||||
max_alpha = 65535;
|
||||
|
||||
if( vips_bandjoin_const1( in, out, max_alpha, NULL ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
|
|
@ -207,9 +207,9 @@ vips_bandmean_init( VipsBandmean *bandmean )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_bandmean:
|
||||
* vips_bandmean: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* This operation writes a one-band image where each pixel is the average of
|
||||
|
|
|
@ -279,8 +279,8 @@ vips_bandrankv( VipsImage **in, VipsImage **out, int n, va_list ap )
|
|||
|
||||
/**
|
||||
* vips_bandrank:
|
||||
* @in: array of input images
|
||||
* @out: output image
|
||||
* @in: (array length=n): array of input images
|
||||
* @out: (out): output image
|
||||
* @n: number of input images
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -182,9 +182,9 @@ vips_bandunfold_init( VipsBandunfold *bandunfold )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_bandunfold:
|
||||
* vips_bandunfold: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -216,9 +216,9 @@ vips_byteswap_init( VipsByteswap *byteswap )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_byteswap:
|
||||
* vips_byteswap: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Swap the byte order in an image.
|
||||
|
|
|
@ -137,9 +137,9 @@ vips_cache_init( VipsCache *cache )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cache:
|
||||
* vips_cache: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -577,9 +577,9 @@ vips_castv( VipsImage *in, VipsImage **out, VipsBandFormat format, va_list ap )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast:
|
||||
* vips_cast: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @format: format to convert to
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
@ -616,9 +616,9 @@ vips_cast( VipsImage *in, VipsImage **out, VipsBandFormat format, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_uchar:
|
||||
* vips_cast_uchar: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_UCHAR. See vips_cast().
|
||||
|
@ -639,9 +639,9 @@ vips_cast_uchar( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_char:
|
||||
* vips_cast_char: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_CHAR. See vips_cast().
|
||||
|
@ -662,9 +662,9 @@ vips_cast_char( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_ushort:
|
||||
* vips_cast_ushort: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_USHORT. See vips_cast().
|
||||
|
@ -685,9 +685,9 @@ vips_cast_ushort( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_short:
|
||||
* vips_cast_short: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_SHORT. See vips_cast().
|
||||
|
@ -708,9 +708,9 @@ vips_cast_short( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_uint:
|
||||
* vips_cast_uint: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_UINT. See vips_cast().
|
||||
|
@ -731,9 +731,9 @@ vips_cast_uint( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_int:
|
||||
* vips_cast_int: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_INT. See vips_cast().
|
||||
|
@ -754,9 +754,9 @@ vips_cast_int( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_float:
|
||||
* vips_cast_float: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_FLOAT. See vips_cast().
|
||||
|
@ -777,9 +777,9 @@ vips_cast_float( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_double:
|
||||
* vips_cast_double: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_DOUBLE. See vips_cast().
|
||||
|
@ -800,9 +800,9 @@ vips_cast_double( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_complex:
|
||||
* vips_cast_complex: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_COMPLEX. See vips_cast().
|
||||
|
@ -823,9 +823,9 @@ vips_cast_complex( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_cast_dpcomplex:
|
||||
* vips_cast_dpcomplex: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Convert @in to #VIPS_FORMAT_DPCOMPLEX. See vips_cast().
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -290,6 +290,7 @@ vips_conversion_operation_init( void )
|
|||
extern GType vips_xyz_get_type( void );
|
||||
extern GType vips_falsecolour_get_type( void );
|
||||
extern GType vips_gamma_get_type( void );
|
||||
extern GType vips_composite_get_type( void );
|
||||
|
||||
vips_copy_get_type();
|
||||
vips_tile_cache_get_type();
|
||||
|
@ -338,4 +339,5 @@ vips_conversion_operation_init( void )
|
|||
vips_xyz_get_type();
|
||||
vips_falsecolour_get_type();
|
||||
vips_gamma_get_type();
|
||||
vips_composite_get_type();
|
||||
}
|
||||
|
|
|
@ -359,9 +359,9 @@ vips_copy_init( VipsCopy *copy )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_copy:
|
||||
* vips_copy: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
@ -403,9 +403,9 @@ vips_copy( VipsImage *in, VipsImage **out, ... )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_copy_file:
|
||||
* vips_copy_file: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* A simple convenience function to copy an image to a file, then copy
|
||||
|
|
|
@ -676,9 +676,9 @@ vips_embed_init( VipsEmbed *embed )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_embed:
|
||||
* vips_embed: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @x: place @in at this x position in @out
|
||||
* @y: place @in at this y position in @out
|
||||
* @width: @out should be this many pixels across
|
||||
|
|
|
@ -232,9 +232,9 @@ vips_extract_area_init( VipsExtractArea *extract )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_extract_area:
|
||||
* vips_extract_area: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @left: left edge of area to extract
|
||||
* @top: top edge of area to extract
|
||||
* @width: width of area to extract
|
||||
|
@ -291,9 +291,9 @@ vips_crop_get_type( void )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_crop:
|
||||
* vips_crop: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @left: left edge of area to extract
|
||||
* @top: top edge of area to extract
|
||||
* @width: width of area to extract
|
||||
|
@ -442,9 +442,9 @@ vips_extract_band_init( VipsExtractBand *extract )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_extract_band:
|
||||
* vips_extract_band: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @band: band to extract
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -391,9 +391,9 @@ vips_falsecolour_init( VipsFalsecolour *falsecolour )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_falsecolour:
|
||||
* vips_falsecolour: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Force @in to 1 band, 8-bit, then transform to
|
||||
|
|
|
@ -112,8 +112,7 @@ G_DEFINE_TYPE( VipsFlatten, vips_flatten, VIPS_TYPE_CONVERSION );
|
|||
int b; \
|
||||
\
|
||||
for( b = 0; b < bands - 1; b++ ) \
|
||||
q[b] = (p[b] * alpha) / max_alpha + \
|
||||
(bg[b] * nalpha) / max_alpha; \
|
||||
q[b] = (p[b] * alpha + bg[b] * nalpha) / max_alpha; \
|
||||
\
|
||||
p += bands; \
|
||||
q += bands - 1; \
|
||||
|
@ -150,8 +149,8 @@ G_DEFINE_TYPE( VipsFlatten, vips_flatten, VIPS_TYPE_CONVERSION );
|
|||
int b; \
|
||||
\
|
||||
for( b = 0; b < bands - 1; b++ ) \
|
||||
q[b] = ((double) p[b] * alpha) / max_alpha + \
|
||||
((double) bg[b] * nalpha) / max_alpha; \
|
||||
q[b] = ((double) p[b] * alpha + \
|
||||
(double) bg[b] * nalpha) / max_alpha; \
|
||||
\
|
||||
p += bands; \
|
||||
q += bands - 1; \
|
||||
|
@ -412,9 +411,9 @@ vips_flatten_init( VipsFlatten *flatten )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_flatten:
|
||||
* vips_flatten: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -256,9 +256,9 @@ vips_flip_init( VipsFlip *flip )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_flip:
|
||||
* vips_flip: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @direction: flip horizontally or vertically
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -161,9 +161,9 @@ vips_gamma_init( VipsGamma *gamma )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_gamma:
|
||||
* vips_gamma: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -233,9 +233,9 @@ vips_grid_init( VipsGrid *grid )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_grid:
|
||||
* vips_grid: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @tile_height: chop into tiles this high
|
||||
* @across: tiles across
|
||||
* @down: tiles down
|
||||
|
|
|
@ -515,7 +515,7 @@ vips_ifthenelse_init( VipsIfthenelse *ifthenelse )
|
|||
* @cond: condition #VipsImage
|
||||
* @in1: then #VipsImage
|
||||
* @in2: else #VipsImage
|
||||
* @out: output #VipsImage
|
||||
* @out: (out): output #VipsImage
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -556,10 +556,10 @@ vips_insert_init( VipsInsert *insert )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_insert:
|
||||
* vips_insert: (method)
|
||||
* @main: big image
|
||||
* @sub: small image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @x: left position of @sub
|
||||
* @y: top position of @sub
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
|
|
|
@ -295,7 +295,7 @@ vips_join_init( VipsJoin *join )
|
|||
* vips_join:
|
||||
* @in1: first input image
|
||||
* @in2: second input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @direction: join horizontally or vertically
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
|
|
|
@ -262,9 +262,9 @@ vips_msb_init( VipsMsb *msb )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_msb:
|
||||
* vips_msb: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
|
@ -276,9 +276,9 @@ vips_premultiply_init( VipsPremultiply *premultiply )
|
|||
}
|
||||
|
||||
/**
|
||||
* vips_premultiply:
|
||||
* vips_premultiply: (method)
|
||||
* @in: input image
|
||||
* @out: output image
|
||||
* @out: (out): output image
|
||||
* @...: %NULL-terminated list of optional named arguments
|
||||
*
|
||||
* Optional arguments:
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue