remove old c++ and py interfaces

Instead, use the new(er) vips8 C++ interface, and the new(er) python
interface in pypi.

https://pypi.org/project/pyvips
This commit is contained in:
John Cupitt 2019-04-12 16:27:28 +01:00
parent 91d0e7e3d0
commit bae484ba2c
58 changed files with 6 additions and 11987 deletions

View File

@ -30,6 +30,7 @@
- add vips_region_fetch() / _width() / _height() for language bindings
- vips_text() supports justification
- move vips_image_set_kill() and iskilled() to the public API
- remove old c++ and python interfaces
4/1/19 started 8.7.4
- magickload with magick6 API did not chain exceptions correctly causing a

View File

@ -1,33 +1,3 @@
# build deprecated vips7 Python interface
if HAVE_PYTHON
P_COMPILE_DIR = swig
P_DIST_DIR =
else
P_COMPILE_DIR =
P_DIST_DIR = swig
endif
# build deprecated vips8 Python interface
if ENABLE_PYVIPS8
P8_COMPILE_DIR = python
P8_DIST_DIR =
else
P8_COMPILE_DIR =
P8_DIST_DIR = python
endif
# build deprecated vips7 C++ API
if ENABLE_CPP7
CPP7_COMPILE_DIR = libvipsCC
CPP7_DIST_DIR =
CPP7_PKG = vipsCC.pc
else
CPP7_COMPILE_DIR =
CPP7_DIST_DIR = libvipsCC
CPP7_PKG =
endif
SUBDIRS = \
libvips \
cplusplus \
@ -35,10 +5,7 @@ SUBDIRS = \
po \
man \
doc \
test \
$(CPP7_COMPILE_DIR) \
$(P_COMPILE_DIR) \
$(P8_COMPILE_DIR)
test
EXTRA_DIST = \
m4 \
@ -49,13 +16,10 @@ EXTRA_DIST = \
vips-cpp.pc.in \
libvips.supp \
depcomp \
README.md \
$(CPP7_DIST_DIR) \
$(P_DIST_DIR) \
$(P8_DIST_DIR)
README.md
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = vips.pc $(CPP7_PKG) vips-cpp.pc
pkgconfig_DATA = vips.pc vips-cpp.pc
dist-hook:
# make sure we don't get any .svn dirs from EXTRA_DIST

View File

@ -100,10 +100,10 @@ Checkout the latest sources with:
$ git clone git://github.com/libvips/libvips.git
Building from git needs more packages, you'll need at least `swig`, `gtk-doc`
Building from git needs more packages, you'll need at least `gtk-doc`
and `gobject-introspection`, see the dependencies section below. For example:
$ brew install gtk-doc swig
$ brew install gtk-doc
Then build the build system with:

View File

@ -1358,57 +1358,6 @@ if test x"$with_libexif" != x"no"; then
CPPFLAGS="$save_CPPFLAGS"
fi
# 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"$enable_pyvips7" = x"yes"; then
if test x"$enable_cxx" = x"no"; then
# if C++ is off, we can't do Python
enable_pyvips7=no
AC_MSG_WARN([C++ is off, disabling vips7 Python binding])
fi
fi
if test x"$enable_pyvips7" = x"yes"; then
JD_PATH_PYTHON(2.7,,
[enable_pyvips7=no
AC_MSG_WARN([Python >= 2.7 not found; disabling vips7 Python binding])
]
)
fi
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],
[enable_pyvips7=no
AC_MSG_WARN([Python >= 3.0 found; disabling vips7 Python binding])
]
)
fi
if test x"$enable_pyvips7" = x"yes"; then
AM_CHECK_PYTHON_HEADERS(,
[enable_pyvips7=no
AC_MSG_WARN([Python headers not found; disabling vips7 Python binding])
]
)
fi
# we don't check for swig: we include the generated bindings in the
# distribution
if test x"$enable_pyvips7" = x"yes"; then
AM_CONDITIONAL(HAVE_PYTHON, true)
else
AM_CONDITIONAL(HAVE_PYTHON, false)
fi
# Gather all up for VIPS_CFLAGS, VIPS_INCLUDES, VIPS_LIBS
# sort includes to get longer, more specific dirs first
# helps, for example, selecting graphicsmagick over imagemagick
@ -1457,9 +1406,6 @@ AC_OUTPUT([
libvips/mosaicing/Makefile
libvips/create/Makefile
libvips/resample/Makefile
libvipsCC/include/Makefile
libvipsCC/include/vips/Makefile
libvipsCC/Makefile
cplusplus/include/Makefile
cplusplus/include/vips/Makefile
cplusplus/Makefile
@ -1469,16 +1415,10 @@ AC_OUTPUT([
tools/batch_rubber_sheet
tools/light_correct
tools/shrink_width
python/Makefile
python/packages/Makefile
python/packages/gi/Makefile
python/packages/gi/overrides/Makefile
test/Makefile
test/variables.sh
test/test-suite/Makefile
test/test-suite/helpers/Makefile
swig/Makefile
swig/vipsCC/Makefile
man/Makefile
doc/Makefile
doc/libvips-docs.xml
@ -1494,10 +1434,6 @@ enable debug: $enable_debug
enable deprecated library components: $enable_deprecated
enable docs with gtkdoc: $enable_gtk_doc
gobject introspection: $found_introspection
enable vips7 C++ API: $enable_cpp7
enable vips7 Python binding: $enable_pyvips7
enable vips8 Python overrides: $enable_pyvips8
(requires pygobject-3.13.0 or later)
enable radiance support: $with_radiance
enable analyze support: $with_analyze
enable PPM support: $with_ppm
@ -1555,41 +1491,6 @@ You may need to add this directory to your typelib path, for example:
esac
fi
if test x"$enable_pyvips8" = x"yes"; then
expand $pyexecdir
VIPS_PYEXECDIR=$expanded_value
case "$VIPS_PYEXECDIR" in
/usr/local/Cellar/vips/*)
;; # ingnore for homebrew
*)
syspygipath=`$PYTHON -c "
import sys
sys.path.append('$VIPS_PYEXECDIR')
try: import gi; print(gi._overridesdir)
except: pass"`
if test x"$syspygipath" = x""; then
AC_MSG_RESULT([dnl
Your python gi module could not be loaded.
You should change your PYTHONPATH environment
variable to include the pygobject3 gi module
and re-run configure to check if the Vips.py
overrides are installed in the correct location.
])
elif test x"$VIPS_PYEXECDIR/gi/overrides" != x"$syspygipath"; then
AC_MSG_RESULT([dnl
The vips Python overrides file will be installed to
$VIPS_PYEXECDIR/gi/overrides/Vips.py, but your
system gi overrides seem to be $syspygipath.
You may need to copy this file, for example:
cp $VIPS_PYEXECDIR/gi/overrides/Vips.* $syspygipath
])
fi
;;
esac
fi
if test x"$vips_os_win32" = x"yes"; then
if test x"$have_g_win32_get_command_line" != x"yes"; then
AC_MSG_RESULT([dnl

View File

@ -11,6 +11,3 @@ vips-operators.h:
date >> vips-operators.h; \
echo "// this file is generated automatically, do not edit!" >> vips-operators.h; \
./../../gen-operators.py -g h >> vips-operators.h
EXTRA_DIST = \
gen-operators-h.py

View File

@ -1,39 +0,0 @@
SUBDIRS = \
include
AM_CPPFLAGS = \
-I$(top_srcdir)/libvips/include \
-I$(top_srcdir)/libvipsCC/include \
@VIPS_CFLAGS@
lib_LTLIBRARIES = libvipsCC.la
libvipsCC_la_SOURCES = \
VImage.cc \
VError.cc \
VDisplay.cc \
VMask.cc
libvipsCC_la_LDFLAGS = \
-no-undefined \
-version-info @LIBRARY_CURRENT@:@LIBRARY_REVISION@:@LIBRARY_AGE@
libvipsCC_la_LIBADD = \
$(top_builddir)/libvips/libvips.la @VIPS_LIBS@
# swap the 'awk' line for this:
# awk '{if($$1!="deprecated") print $$1}'` ; \
# to not generate the wrappers for deprecated functions
vipsc++.cc:
packages=`vips list packages | \
awk '{print $$1}'` ; \
echo > vipsc++.cc ; \
for name in $$packages; do \
echo "// bodies for package $$name" >> vipsc++.cc ; \
vips cppc $$name >> vipsc++.cc ; \
echo >> vipsc++.cc ; \
done
EXTRA_DIST = \
README.txt \
vipsc++.cc

View File

@ -1,3 +0,0 @@
This is the old vips7 C++ API. Use the vips8 one in preference for new
projects.

View File

@ -1,153 +0,0 @@
// Object part of VDisplay class
/*
Copyright (C) 1991-2001 The National Gallery
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <cstdlib>
#include <cstring>
#include <vips/vips.h>
#include <vips/vips7compat.h>
#include <vips/internal.h>
#include <vips/vipscpp.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
VIPS_NAMESPACE_START
/* Refcounting stuff first.
*/
// Free an im_col_display
static void
free_display( im_col_display *d )
{
}
// Dupe an im_col_display
static im_col_display *
dup_display( im_col_display *in )
{
return( in );
}
// Remove lut
void VDisplay::refblock::cleanlut()
{
if( luts ) {
im_free( luts );
luts = 0;
}
}
// Remove attached things
void VDisplay::refblock::cleanref()
{
if( disp && priv ) {
free_display( disp );
disp = 0;
priv = 0;
}
cleanlut();
}
// Get ready to write to disp
void VDisplay::refblock::wready()
{
cleanlut();
if( !priv ) {
disp = dup_display( disp );
priv = 1;
}
}
// Check that luts are up-to-date
void VDisplay::refblock::cluts()
{
}
VDisplay::~VDisplay()
{
ref->nrefs--;
if( !ref->nrefs )
delete ref;
}
VDisplay &VDisplay::operator=( const VDisplay &a )
{
ref->nrefs--;
if( ref->nrefs > 0 )
// Need fresh
ref = new refblock;
else
// Recycle old
ref->cleanref();
ref = a.ref;
ref->nrefs++;
return( *this );
}
VDisplay::VDisplay( const char *name )
{
// Install display
ref = new refblock;
ref->disp = NULL;
}
VDisplay::VDisplay()
{
// Just use sRGB
ref = new refblock;
ref->disp = im_col_displays( 7 );
}
/*
Setters and getters. We used to have a lot of code of the form:
float &VDisplay::YCW()
{ ref->wready(); return( ((im_col_display*)ref->disp)->d_YCW ); }
This should be split to separate setters/getters so we can exploit const. Too
annoying to do this on such a useless class (I'm certain no one used these
functions anyway), fix in vips8.
*/
VIPS_NAMESPACE_END

View File

@ -1,101 +0,0 @@
// Code for error type
/*
Copyright (C) 1991-2001 The National Gallery
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vips/vips.h>
#include <vips/vips7compat.h>
#include <vips/vipscpp.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
VIPS_NAMESPACE_START
void VError::perror()
{
std::cerr << _what;
exit( 1 );
}
void VError::perror( const char *name )
{
std::cerr << name << ": " << _what;
exit( 1 );
}
// Add a new bit to the end of the error buffer
VError &VError::app( const int i )
{
char buf[ 256 ];
sprintf( buf, "%d", i );
_what += buf;
return( *this );
}
VError &VError::app( std::string txt )
{
_what += txt;
return( *this );
};
void VError::ostream_print( std::ostream &file ) const
{
file << _what;
}
void verror( std::string str )
{
VError err;
err.app( "VIPS error: " );
if( str == "" ) {
err.app( im_error_buffer() );
im_error_clear();
}
else
err.app( str ).app( "\n" );
throw( err );
}
VIPS_NAMESPACE_END

View File

@ -1,538 +0,0 @@
// Object part of VImage class
/*
Copyright (C) 1991-2001 The National Gallery
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vips/vips.h>
#include <vips/vips7compat.h>
#include <vips/internal.h>
#include <vips/debug.h>
#include <vips/vipscpp.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
/*
#define DEBUG
*/
VIPS_NAMESPACE_START
/* Useful to have these as C++ functions.
*/
bool init( const char *argv0 )
{
return( vips__init( argv0 ) == 0 );
}
void shutdown()
{
vips_shutdown();
}
void thread_shutdown()
{
vips_thread_shutdown();
}
void VImage::refblock::debug_print()
{
std::list<refblock *>::iterator i;
printf( "refblock %p:\n", this );
printf( " im = %p", im );
if( im && im->filename )
printf( " (im->filename = \"%s\")", im->filename );
printf( "\n" );
printf( " close_on_delete = %d\n", close_on_delete );
printf( " nrefs (refs to us) = %d\n", nrefs );
printf( " orefs (refs we make) = refblocks " );
for( i = orefs.begin(); i != orefs.end(); ++i )
printf( "%p ", *i );
printf( "\n" );
}
// dump all refblocks for debugging
void VImage::print_all()
{
#ifdef DEBUG
std::list<VImage::refblock *>::iterator i;
printf( "*** VImage::refblock::print_all() start\n" );
for( i = all_refblock.begin(); i != all_refblock.end(); ++i )
(*i)->debug_print();
printf( "*** VImage::refblock::print_all() end\n" );
#endif /*DEBUG*/
}
// easy call from C version
void im__ccp_print_all()
{
VImage::print_all();
}
// constructor
VImage::refblock::refblock()
{
im = 0;
close_on_delete = 1;
nrefs = 1;
#ifdef DEBUG
all_refblock.push_front( this );
#endif /*DEBUG*/
}
// Add a ref - this (output image) depends upon VipsImage in
void VImage::refblock::addref( refblock *in )
{
if( this == in )
verror( "sanity failure" );
in->nrefs++;
orefs.push_front( in );
}
VImage::refblock::~refblock()
{
#ifdef DEBUG
printf( "VImage::refblock::removeref(): death!\n" );
debug_print();
#endif /*DEBUG*/
std::list<refblock *>::iterator i;
if( close_on_delete && im ) {
if( im_close( im ) )
verror();
im = 0;
}
// remove any refs we have ... may trigger other destructs in turn
for( i = orefs.begin(); i != orefs.end(); ++i )
(*i)->removeref();
#ifdef DEBUG
all_refblock.remove( this );
#endif /*DEBUG*/
}
// Remove a ref
void VImage::refblock::removeref()
{
nrefs--;
if( nrefs < 0 )
verror( "too many closes!" );
if( nrefs == 0 )
delete this;
}
// Init with name ... mode defaults to "rd"
VImage::VImage( const char *name, const char *mode )
{
_ref = new refblock;
if( !(_ref->im = im_open( name, mode )) )
verror();
_ref->close_on_delete = 1;
#ifdef DEBUG
printf( "VImage::VImage( \"%s\", \"%s\" )\n", name, mode );
_ref->debug_print();
#endif /*DEBUG*/
}
// Build a VImage from an VipsImage structure
VImage::VImage( _VipsImage *in )
{
_ref = new refblock;
_ref->im = in;
_ref->close_on_delete = 0;
#ifdef DEBUG
printf( "VImage::VImage( VipsImage* %p )\n", in );
_ref->debug_print();
#endif /*DEBUG*/
}
// Build from memory buffer
VImage::VImage( void *buffer, int width, int height, int bands, TBandFmt format )
{
_ref = new refblock;
if( !(_ref->im = im_image( buffer, width, height,
bands, VipsBandFmt( format ) )) )
verror();
_ref->close_on_delete = 1;
#ifdef DEBUG
printf( "VImage::VImage( void* %p, %d, %d )\n",
buffer, width, height );
_ref->debug_print();
#endif /*DEBUG*/
}
// Empty init ... means open intermediate
VImage::VImage()
{
static int id = 0;
char filename[256];
_ref = new refblock;
/* This is not safe with threading ... but it doesn't really matter.
*/
im_snprintf( filename, 256, "intermediate image #%d", id++ );
if( !(_ref->im = im_open( filename, "p" )) )
verror();
_ref->close_on_delete = 1;
#ifdef DEBUG
printf( "VImage::VImage()\n" );
_ref->debug_print();
#endif /*DEBUG*/
}
// Copy constructor
VImage::VImage( const VImage &a )
{
_ref = a._ref;
_ref->nrefs++;
}
// Assignment
VImage &VImage::operator=( const VImage &a )
{
_ref->removeref();
_ref = a._ref;
_ref->nrefs++;
return( *this );
}
// Extract underlying data pointer
void *VImage::data() const
{
if( im_incheck( _ref->im ) )
verror();
return( (void *) _ref->im->data );
}
void VImage::debug_print()
{
im_printdesc( image() );
}
// Like jpeg2vips, but convert to a disc file rather than to memory
// We can handle huge files without running out of RAM
VImage VImage::convert2disc( const char* convert,
const char* in, const char* disc )
{
VImage out( disc, "w" );
Vargv _vec( convert );
_vec.data(0) = (im_object) in;
_vec.data(1) = out.image();
_vec.call();
return( out );
}
// Write this to a VImage
VImage VImage::write( VImage out )
{
if( im_copy( _ref->im, out._ref->im ) )
verror();
out._ref->addref( _ref );
return( out );
}
VImage VImage::write( const char *name )
{
VImage out( name, "w" );
if( im_copy( _ref->im, out._ref->im ) )
verror();
out._ref->addref( _ref );
return( out );
}
VImage VImage::write()
{
VImage out( "VImage:w1", "t" );
if( im_copy( _ref->im, out._ref->im ) )
verror();
out._ref->addref( _ref );
return( out );
}
// Projection functions to get header fields
int VImage::Xsize() { return( _ref->im->Xsize ); }
int VImage::Ysize() { return( _ref->im->Ysize ); }
int VImage::Bands() { return( _ref->im->Bands ); }
VImage::TBandFmt VImage::BandFmt()
{ return( (TBandFmt) _ref->im->BandFmt ); }
VImage::TCoding VImage::Coding()
{ return( (TCoding) _ref->im->Coding ); }
VImage::TType VImage::Type() { return( (TType) _ref->im->Type ); }
float VImage::Xres() { return( _ref->im->Xres ); }
float VImage::Yres() { return( _ref->im->Yres ); }
int VImage::Length() { return( _ref->im->Length ); }
VImage::TCompression VImage::Compression()
{ return( (TCompression) _ref->im->Compression ); }
short VImage::Level() { return( _ref->im->Level ); }
int VImage::Xoffset() { return( _ref->im->Xoffset ); }
int VImage::Yoffset() { return( _ref->im->Yoffset ); }
// Derived fields
const char *VImage::filename() { return( _ref->im->filename ); }
const char *VImage::Hist() { return( im_history_get( _ref->im ) ); }
VImage VImage::hough_circle( int scale, int min_radius, int max_radius )
{
VImage in = *this;
VipsImage *x;
VImage out;
if( vips_hough_circle( in.image(), &x,
"scale", scale,
"min_radius", min_radius,
"max_radius", max_radius,
NULL ) )
verror();
if( vips_image_write( x, out.image() ) ) {
g_object_unref( x );
verror();
}
g_object_unref( x );
return( out );
}
// metadata
// base functionality
void VImage::meta_set( const char *field, GValue *value )
{
if( im_meta_set( _ref->im, field, value ) )
verror();
}
gboolean VImage::meta_remove( const char *field )
{
return( im_meta_remove( _ref->im, field ) );
}
void VImage::meta_get( const char *field, GValue *value_copy )
{
if( im_meta_get( _ref->im, field, value_copy ) )
verror();
}
GType VImage::meta_get_typeof( const char *field )
{
return( im_meta_get_typeof( _ref->im, field ) );
}
// convenience functions
int VImage::meta_get_int( const char *field )
{
int result;
if( im_meta_get_int( _ref->im, field, &result ) )
verror();
return( result );
}
double VImage::meta_get_double( const char *field )
{
double result;
if( im_meta_get_double( _ref->im, field, &result ) )
verror();
return( result );
}
const char *VImage::meta_get_string( const char *field )
{
const char *result;
if( im_meta_get_string( _ref->im, field, &result ) )
verror();
return( result );
}
void *VImage::meta_get_area( const char *field )
{
void *result;
if( im_meta_get_area( _ref->im, field, &result ) )
verror();
return( result );
}
void *VImage::meta_get_blob( const char *field, size_t *length )
{
void *result;
if( im_meta_get_blob( _ref->im, field, &result, length ) )
verror();
return( result );
}
void VImage::meta_set( const char *field, int value )
{
if( im_meta_set_int( _ref->im, field, value ) )
verror();
}
void VImage::meta_set( const char *field, double value )
{
if( im_meta_set_double( _ref->im, field, value ) )
verror();
}
void VImage::meta_set( const char *field, const char *value )
{
if( im_meta_set_string( _ref->im, field, value ) )
verror();
}
void VImage::meta_set( const char *field, VCallback free_fn, void *value )
{
if( im_meta_set_area( _ref->im, field, free_fn, value ) )
verror();
}
void VImage::meta_set( const char *field,
VCallback free_fn, void *value, size_t length )
{
if( im_meta_set_blob( _ref->im, field, free_fn, value, length ) )
verror();
}
// Set header fields and setbuf() in one go.
void VImage::initdesc( int x, int y, int b,
TBandFmt f, TCoding c, TType t, float xr, float yr, int xo, int yo )
{
im_initdesc( _ref->im, x, y, b, 0,
VipsBandFmt( f ), VipsCoding( c ), VipsType( t ),
xr, yr, xo, yo );
if( im_setupout( _ref->im ) )
verror();
}
// Create a Vargv from a name
Vargv::Vargv( const char *name )
{
im_function *f = im_find_function( (char *) name );
if( !f )
verror();
fn = (im__function *) f;
base = new im_object[f->argc];
if( im_allocate_vargv( f, base ) ) {
delete[] base;
verror();
}
}
// Destroy a Vargv
Vargv::~Vargv()
{
im_function *f = (im_function *) fn;
// free any memory allocated for input vectors
// this is the stuff allocated in each function during _object* build,
// see vipsc++.cc
for( int i = 0; i < f->argc; i++ ) {
im_type_desc *ty = f->argv[i].desc;
if( !(ty->flags & IM_TYPE_OUTPUT) ) {
if( strcmp( ty->type, IM_TYPE_IMAGEVEC ) == 0 ||
strcmp( ty->type, IM_TYPE_DOUBLEVEC ) == 0 ||
strcmp( ty->type, IM_TYPE_INTVEC ) == 0 ) {
// will work for doublevec and intvec too
im_imagevec_object *io =
(im_imagevec_object *) base[i];
if( io->vec ) {
delete[] io->vec;
io->vec = NULL;
}
}
else if( strcmp( ty->type, IM_TYPE_INTERPOLATE ) == 0 )
g_object_unref( base[i] );
}
}
im_free_vargv( f, base );
delete[] base;
}
// Call the function
void
Vargv::call()
{
im_function *f = (im_function *) fn;
if( f->disp( base ) )
verror();
}
/* Insert automatically generated wrappers for VIPS image processing
* functions.
*/
#include "vipsc++.cc"
VIPS_NAMESPACE_END

View File

@ -1,656 +0,0 @@
// Object part of VMask class
/*
Copyright (C) 1991-2001 The National Gallery
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <cstdlib>
#include <cmath>
#include <vips/vips.h>
#include <vips/vips7compat.h>
#include <vips/vipscpp.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
VIPS_NAMESPACE_START
/* Functions for VMask - refcounting layer over VPMask.
*/
VMask::~VMask()
{
ref->nrefs--;
if( !ref->nrefs )
delete ref;
}
VMask &VMask::operator=( const VMask &a )
{
// Loosing ref to LHS
ref->nrefs--;
if( ref->nrefs > 0 )
// Need fresh refblock
ref = new refblock;
else
// Recycle old refblock
delete ref->pmask;
// LHS now points to RHS
ref = a.ref;
ref->nrefs++;
return( *this );
}
// Make sure this is a private copy of pmask --- dup if nrefs != 1
void VMask::make_private()
{
if( ref->nrefs > 1 ) {
// Make fresh refblock
refblock *ref2 = new refblock;
// And copy the mask
ref2->pmask = ref->pmask->dup();
ref->nrefs--;
ref = ref2;
}
}
void VMask::ostream_print( std::ostream &file ) const
{
file << *(ref->pmask);
}
// Embed INTMASK in VIMask
void VIMask::embed( INTMASK *i )
{
if( ref->pmask )
verror( "embed: VIMask not empty" );
ref->pmask = new _private_detail::VPIMask( i );
}
// Type conversions: implicit INTMASK to DOUBLEMASK
VIMask::operator VDMask()
{
VDMask out( xsize(), ysize() );
out.mask().dptr->scale = scale();
out.mask().dptr->offset = offset();
for( int i = 0; i < size(); i++ )
out[i] = (*this)[i];
return( out );
}
// Forward ref of VImage class
class VImage;
// Type conversions: implicit DOUBLEMASK to INTMASK
VDMask::operator VIMask()
{
VIMask out( xsize(), ysize() );
out.mask().iptr->scale = int( scale() );
out.mask().iptr->offset = int( offset() );
for( int i = 0; i < size(); i++ )
out[i] = (int) rint( (*this)[i] );
return( out );
}
// Type conversions: implicit DOUBLEMASK to VImage
VDMask::operator VImage()
{
VImage out;
if( im_mask2vips( mask().dptr, out.image() ) )
verror();
return( out );
}
// ... and INTMASK to VImage
VIMask::operator VImage() { return( VImage( VDMask( *this ) ) ); }
// Embed DOUBLEMASK in VDMask
void VDMask::embed( DOUBLEMASK *i )
{
if( ref->pmask )
verror( "embed: VDMask not empty" );
ref->pmask = new _private_detail::VPDMask( i );
}
/* Functions for P*Mask - layer over im_*_*mask() functions.
*/
// Create empty imask
_private_detail::VPIMask::VPIMask( int xsize, int ysize )
{
if( !(data.iptr = im_create_imask( "VPIMask::VPIMask", xsize, ysize )) )
verror();
type = _private_detail::VPMask::INT;
}
// Init from vector
_private_detail::VPIMask::VPIMask( int xsize, int ysize,
int scale, int offset, std::vector<int> coeff )
{
int i;
if( !(data.iptr = im_create_imask( "VPIMask::VPIMask", xsize, ysize )) )
verror();
type = _private_detail::VPMask::INT;
data.iptr->scale = scale;
data.iptr->offset = offset;
for( i = 0; i < xsize * ysize; i++ )
data.iptr->coeff[i] = coeff[i];
}
// Create from filename
_private_detail::VPIMask::VPIMask( const char *name )
{
if( !(data.iptr = im_read_imask( (char *) name )) )
verror();
type = _private_detail::VPMask::INT;
}
// Create from existing INTMASK
_private_detail::VPIMask::VPIMask( INTMASK *imask )
{
data.iptr = imask;
type = _private_detail::VPMask::INT;
}
// Create empty
_private_detail::VPIMask::VPIMask()
{
data.iptr = 0;
type = _private_detail::VPMask::UNASSIGNED;
}
_private_detail::VPIMask::~VPIMask()
{
if( data.iptr ) {
im_free_imask( data.iptr );
data.iptr = 0;
type = _private_detail::VPMask::UNASSIGNED;
}
}
// Duplicate -- we are a VPIMask, return a new VPIMask which is a copy of us.
// Return as a VPMask tho'.
_private_detail::VPMask *_private_detail::VPIMask::dup() const
{
_private_detail::VPIMask *out = new _private_detail::VPIMask();
INTMASK *msk;
if( !(msk = im_dup_imask( data.iptr, "VPIMask::dup" )) ) {
delete out;
verror();
}
out->embed( msk );
return( out );
}
// Insert INTMASK pointer
void _private_detail::VPIMask::embed( INTMASK *msk )
{
if( type != _private_detail::VPMask::UNASSIGNED )
verror( "VPIMask::embed: VPIMask not empty" );
data.iptr = msk;
type = _private_detail::VPMask::INT;
}
int _private_detail::VPIMask::xsize() const
{
if( !data.iptr )
verror( "xsize: mask not set" );
return( data.iptr->xsize );
}
int _private_detail::VPIMask::ysize() const
{
if( !data.iptr )
verror( "ysize: mask not set" );
return( data.iptr->ysize );
}
int _private_detail::VPIMask::scale() const
{
if( !data.iptr )
verror( "scale: mask not set" );
return( data.iptr->scale );
}
int _private_detail::VPIMask::offset() const
{
if( !data.iptr )
verror( "offset: mask not set" );
return( data.iptr->offset );
}
const char *_private_detail::VPIMask::filename() const
{
if( !data.iptr )
verror( "filename: mask not set" );
return( data.iptr->filename );
}
void _private_detail::VPIMask::ostream_print( std::ostream &file ) const
{
if( !data.iptr )
verror( "internal error #7447234" );
int i, j;
int *p = data.iptr->coeff;
file << this->xsize() << "\t" << this->ysize() << "\t";
file << this->scale() << "\t" << this->offset() << "\n";
for( i = 0; i < this->ysize(); i++ ) {
for( j = 0; j < this->xsize(); j++ )
file << *p++ << "\t";
file << "\n";
}
}
// Extract start of int array
int *_private_detail::VPIMask::array() const
{
return( data.iptr->coeff );
}
// Create empty dmask
_private_detail::VPDMask::VPDMask( int xsize, int ysize )
{
if( !(data.dptr = im_create_dmask( "VPDMask::VPDMask", xsize, ysize )) )
verror();
type = _private_detail::VPMask::DOUBLE;
}
// Create from vector
_private_detail::VPDMask::VPDMask( int xsize, int ysize,
double scale, double offset, std::vector<double> coeff )
{
int i;
if( !(data.dptr = im_create_dmask( "VPDMask::VPDMask", xsize, ysize )) )
verror();
type = _private_detail::VPMask::DOUBLE;
data.dptr->scale = scale;
data.dptr->offset = offset;
for( i = 0; i < xsize * ysize; i++ )
data.dptr->coeff[i] = coeff[i];
}
// Create from filename
_private_detail::VPDMask::VPDMask( const char *name )
{
if( !(data.dptr = im_read_dmask( (char *) name )) )
verror();
type = _private_detail::VPMask::DOUBLE;
}
// Create empty
_private_detail::VPDMask::VPDMask()
{
data.dptr = 0;
type = _private_detail::VPMask::UNASSIGNED;
}
// Create from existing DOUBLEMASK
_private_detail::VPDMask::VPDMask( DOUBLEMASK *dmask )
{
data.dptr = dmask;
type = _private_detail::VPMask::DOUBLE;
}
_private_detail::VPDMask::~VPDMask()
{
if( data.dptr ) {
im_free_dmask( data.dptr );
data.dptr = 0;
type = _private_detail::VPMask::UNASSIGNED;
}
}
// Duplicate -- we are a VPIMask, return a new VPIMask which is a copy of us.
// Return as a VPMask tho'.
_private_detail::VPMask *_private_detail::VPDMask::dup() const
{
_private_detail::VPDMask *out = new _private_detail::VPDMask();
DOUBLEMASK *msk;
if( !(msk = im_dup_dmask( data.dptr, "VPDMask::dup" )) ) {
delete out;
verror();
}
out->embed( msk );
return( out );
}
// Insert DOUBLEMASK pointer
void _private_detail::VPDMask::embed( DOUBLEMASK *msk )
{
if( type != _private_detail::VPMask::UNASSIGNED )
verror( "VPDMask::embed: VPDMask not empty" );
data.dptr = msk;
type = _private_detail::VPMask::DOUBLE;
}
int _private_detail::VPDMask::xsize() const
{
if( !data.dptr )
verror( "xsize: mask not set" );
return( data.dptr->xsize );
}
int _private_detail::VPDMask::ysize() const
{
if( !data.dptr )
verror( "ysize: mask not set" );
return( data.dptr->ysize );
}
double _private_detail::VPDMask::scale() const
{
if( !data.dptr )
verror( "scale: mask not set" );
return( data.dptr->scale );
}
double _private_detail::VPDMask::offset() const
{
if( !data.dptr )
verror( "offset: mask not set" );
return( data.dptr->offset );
}
const char *_private_detail::VPDMask::filename() const
{
if( !data.dptr )
verror( "filename: mask not set" );
return( data.dptr->filename );
}
void _private_detail::VPDMask::ostream_print( std::ostream &file ) const
{
if( !data.dptr )
verror( "internal error #7447234" );
int i, j;
double *p = data.dptr->coeff;
file << this->xsize() << "\t" << this->ysize() << "\t";
file << this->scale() << "\t" << this->offset() << "\n";
for( i = 0; i < this->ysize(); i++ ) {
for( j = 0; j < this->xsize(); j++ )
file << *p++ << "\t";
file << "\n";
}
}
// Extract data pointer
double *_private_detail::VPDMask::array() const
{
return( data.dptr->coeff );
}
// Build functions
VIMask VIMask::gauss( double sig, double minamp )
{
VIMask out;
INTMASK *msk;
if( !(msk = im_gauss_imask( "VIMask::gauss", sig, minamp )) )
verror();
out.embed( msk );
return( out );
}
VIMask VIMask::gauss_sep( double sig, double minamp )
{
VIMask out;
INTMASK *msk;
if( !(msk = im_gauss_imask_sep( "VIMask::gauss", sig, minamp )) )
verror();
out.embed( msk );
return( out );
}
VDMask VDMask::gauss( double sig, double minamp )
{
VDMask out;
DOUBLEMASK *msk;
if( !(msk = im_gauss_dmask( "VDMask::gauss", sig, minamp )) )
verror();
out.embed( msk );
return( out );
}
VIMask VIMask::log( double sig, double minamp )
{
VIMask out;
INTMASK *msk;
if( !(msk = im_log_imask( "VIMask::log", sig, minamp )) )
verror();
out.embed( msk );
return( out );
}
VDMask VDMask::log( double sig, double minamp )
{
VDMask out;
DOUBLEMASK *msk;
if( !(msk = im_log_dmask( "VDMask::log", sig, minamp )) )
verror();
out.embed( msk );
return( out );
}
// Manipulation functions
VIMask VIMask::rotate45()
{
VIMask out;
INTMASK *msk;
if( !(msk = im_rotate_imask45( mask().iptr, "VIMask::rotate45" )) )
verror();
out.embed( msk );
return( out );
}
VIMask VIMask::rotate90()
{
VIMask out;
INTMASK *msk;
if( !(msk = im_rotate_imask90( mask().iptr, "VIMask::rotate90" )) )
verror();
out.embed( msk );
return( out );
}
VDMask VDMask::rotate45()
{
VDMask out;
DOUBLEMASK *msk;
if( !(msk = im_rotate_dmask45( mask().dptr, "VDMask::rotate45" )) )
verror();
out.embed( msk );
return( out );
}
VDMask VDMask::rotate90()
{
VDMask out;
DOUBLEMASK *msk;
if( !(msk = im_rotate_dmask90( mask().dptr, "VDMask::rotate90" )) )
verror();
out.embed( msk );
return( out );
}
VDMask VDMask::trn()
{
VDMask out;
DOUBLEMASK *msk;
if( !(msk = im_mattrn( mask().dptr, "VDMask::trn" )) )
verror();
out.embed( msk );
return( out );
}
VDMask VDMask::inv()
{
VDMask out;
DOUBLEMASK *msk;
if( !(msk = im_matinv( mask().dptr, "VDMask::inv" )) )
verror();
out.embed( msk );
return( out );
}
VDMask VDMask::mul( VDMask m )
{
VDMask out;
DOUBLEMASK *msk;
if( !(msk = im_matmul( mask().dptr, m.mask().dptr, "VDMask::mul" )) )
verror();
out.embed( msk );
return( out );
}
VDMask VDMask::cat( VDMask m )
{
VDMask out;
DOUBLEMASK *msk;
if( !(msk = im_matcat( mask().dptr, m.mask().dptr, "VDMask::cat" )) )
verror();
out.embed( msk );
return( out );
}
VIMask VDMask::scalei()
{
VIMask out;
INTMASK *msk;
if( !(msk = im_scale_dmask( mask().dptr, "VDMask::scalei" )) )
verror();
out.embed( msk );
return( out );
}
// Arithmetic on a VIMask ... just cast and use VDMask
VDMask VIMask::trn() { return( ((VDMask)*this).trn() ); }
VDMask VIMask::inv() { return( ((VDMask)*this).inv() ); }
VDMask VIMask::cat( VDMask a ) { return( ((VDMask)*this).cat( a ) ); }
VDMask VIMask::mul( VDMask a ) { return( ((VDMask)*this).mul( a ) ); }
// Overload [] to get linear array subscript.
// Our caller may write to the result, so make sure we have a private
// copy.
// Involves function call, slow anyway, so do range checking
int &VIMask::operator[]( int x )
{
if( ref->nrefs != 1 )
make_private();
if( x > size() )
verror( "VIMask::operator[]: subscript out of range" );
return( ((_private_detail::VPIMask *)ref->pmask)->array()[x] );
}
double &VDMask::operator[]( int x )
{
if( ref->nrefs != 1 )
make_private();
if( x > size() )
verror( "VDMask::operator[]: subscript out of range" );
return( ((_private_detail::VPDMask *)ref->pmask)->array()[x] );
}
VIPS_NAMESPACE_END

View File

@ -1,2 +0,0 @@
SUBDIRS = vips

View File

@ -1,21 +0,0 @@
pkginclude_HEADERS = \
VDisplay.h \
VError.h \
VImage.h \
VMask.h \
vipscpp.h \
vips \
vipsc++.h
# swap the 'awk' line for this:
# awk '{if($$1!="deprecated") print $$1}'` ; \
# to not generate the wrappers for deprecated functions
vipsc++.h:
packages=`vips list packages | \
awk '{print $$1}'` ; \
echo > vipsc++.h ; \
for name in $$packages; do \
echo "// headers for package $$name" >> vipsc++.h ; \
vips cpph $$name >> vipsc++.h ; \
echo >> vipsc++.h ; \
done

View File

@ -1,113 +0,0 @@
/* VIPS display class.
*
* Hide details of im_col_display API.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_VDISPLAY_H
#define IM_VDISPLAY_H
/* SWIG includes this file directly rather than going through vipscpp.h ... so
* we have to define these macros here as well.
*/
#ifdef SWIG
#define VIPS_NAMESPACE_START namespace vips {
#define VIPS_NAMESPACE_END }
#endif /*SWIG*/
/* Wrap pointers to these, but we don't want to import all the old C API. Just
* declare them.
*/
extern "C" {
struct im_col_display;
struct im_col_tab_disp;
}
VIPS_NAMESPACE_START
// Wrapper over im_col_display with ref counting
class VIPS_CC_API VDisplay {
struct refblock {
im_col_display *disp; // im_col_display struct
im_col_tab_disp *luts; // luts built from this display
int priv; // disp is ours, or system
int nrefs; // Refs to us
// Invalidate lut
void cleanlut();
// Break attached stuff
void cleanref();
// Get ready to write
void wready();
// Check that luts are up-to-date
void cluts();
refblock() : disp(0), luts(0), priv(0), nrefs(1) {}
~refblock() { cleanref(); }
};
refblock *ref;
public:
enum VDisplayType {
BARCO, // Does many corrections for us
DUMB // Needs many corrections
};
// Get named display
VDisplay( const char *name );
// Get default display
VDisplay();
// Copy constructor
VDisplay( const VDisplay &a ) { ref = a.ref; ref->nrefs++; }
// Assignment
VDisplay &operator=( const VDisplay &a );
// Destructor
virtual ~VDisplay();
// The matrix type we use
typedef float matrix[3][3];
// Extract display pointer
void *disp() const { return( ref->disp ); }
// Extract luts pointer, rebuilding luts if necessary
im_col_tab_disp *luts() const { ref->cluts(); return( ref->luts ); }
};
VIPS_NAMESPACE_END
#endif /*IM_VDISPLAY_H*/

View File

@ -1,84 +0,0 @@
// Header for error type
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_VERROR_H
#define IM_VERROR_H
/* SWIG includes this file directly rather than going through vipscpp.h ... so
* we have to define these macros here as well.
*/
#ifdef SWIG
#define VIPS_NAMESPACE_START namespace vips {
#define VIPS_NAMESPACE_END }
#define VIPS_CC_API
#endif /*SWIG*/
/* Don't include these when parsing for SWIG.
*/
#ifndef SWIG
# include <string>
# include <iosfwd>
# include <exception>
#endif /*!SWIG*/
VIPS_NAMESPACE_START
// Error type
class VIPS_CC_API VError : public std::exception {
std::string _what;
public:
VError( std::string what ) : _what( what ) {}
VError() {}
virtual ~VError() throw() {}
// Print message and exit
void perror( const char * );
void perror();
// Append some more text to the message
VError &app( std::string txt );
VError &app( const int i );
// Extract string
virtual const char *what() const throw() { return _what.c_str(); }
void ostream_print( std::ostream & ) const;
};
inline std::ostream &operator<<( std::ostream &file, const VError &err )
{
err.ostream_print( file );
return( file );
}
void VIPS_CC_API verror( std::string str = "" );
VIPS_NAMESPACE_END
#endif /*IM_VERROR_H*/

View File

@ -1,456 +0,0 @@
// VIPS image wrapper
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_VIMAGE_H
#define IM_VIMAGE_H
/* SWIG includes this file directly rather than going through vipscpp.h ... so
* we have to define these macros here as well.
*/
#ifdef SWIG
# define VIPS_NAMESPACE_START namespace vips {
# define VIPS_NAMESPACE_END }
#endif /*SWIG*/
/* Don't include these when parsing for SWIG.
*/
#ifndef SWIG
# include <list>
# include <complex>
# include <vector>
#endif /*!SWIG*/
/* Wrap pointers to these, but we don't want to import all the old C API. Just
* declare them.
*/
extern "C" {
struct _VipsImage;
/* Needed by Vargv, see below.
*/
struct im__function;
typedef void *im__object;
}
VIPS_NAMESPACE_START
/* vips_init() and vips_shutdown as namespaced C++ functions.
*/
bool init( const char *argv0 = "nothing" );
void thread_shutdown( void );
void shutdown( void );
/* A VIPS callback, our name for im_callback_fn.
*/
typedef int (*VCallback)( void *, void * );
/* VIPS image class.
*
* Slightly tricky: we have two sorts of sharing. Several VImage can share one
* refblock (while results are being returned from functions, for example),
* and several other refblocks can have IMAGEs which depend upon this IMAGE
* for their result.
*/
class VIPS_CC_API VImage {
/* We'd like this to be protected so that user subclasses can define
* their own member wrappers. But sadly C++ doesn't work like that:
* subclasses of VImage can only refer to protected members via
* this->, which isn't what we need. Just make it public and hope no
* one touches it.
*/
public:
/* Doesn't need to be wrapped.
*/
#ifndef SWIG
// Count ref etc. in one of these. One for each open VIPS image.
VIPS_CC_API struct refblock {
_VipsImage *im; // IMAGE pointer
int close_on_delete; // Set if we must im_close()
int nrefs; // Number of refs to us
std::list<refblock*> orefs; // Refs im makes
// Construct/destruct
refblock();
virtual ~refblock();
// Add a ref - this (output image) depends upon IMAGE in
VIPS_CC_API void addref( refblock *in );
// Remove a ref
void removeref();
// Debugging
void debug_print();
// Linked list needs "==" -- use address equivalence
friend int operator==( const refblock &left,
const refblock &right ) { return( &left == &right ); }
};
refblock *_ref;
#endif /*!SWIG*/
public:
#ifdef DEBUG
/* All the refblocks in the world.
*/
static std::list<refblock*> all_refblock;
#endif /*DEBUG*/
/* Print all refblocks ... debugging. Compile with DEBUG to enable
* this.
*/
static void print_all();
/* Typedefs and enums we need.
*/
// Type type
enum TType {
MULTIBAND = 0,
B_W = 1,
LUMINACE = 2,
XRAY = 3,
IR = 4,
YUV = 5,
RED_ONLY = 6,
GREEN_ONLY = 7,
BLUE_ONLY = 8,
POWER_SPECTRUM = 9,
HISTOGRAM = 10,
LUT = 11,
XYZ = 12,
LAB = 13,
CMC = 14,
CMYK = 15,
LABQ = 16,
RGB = 17,
UCS = 18,
LCH = 19,
LABS = 21,
sRGB = 22,
YXY = 23,
FOURIER = 24,
RGB16 = 25,
GREY16 = 26
};
// Format type
enum TBandFmt {
FMTNOTSET = -1,
FMTUCHAR = 0,
FMTCHAR = 1,
FMTUSHORT = 2,
FMTSHORT = 3,
FMTUINT = 4,
FMTINT = 5,
FMTFLOAT = 6,
FMTCOMPLEX = 7,
FMTDOUBLE = 8,
FMTDPCOMPLEX = 9
};
// Coding type
enum TCoding {
NOCODING = 0,
COLQUANT = 1,
LABPACK = 2,
LABPACK_COMPRESSED = 3,
RGB_COMPRESSED = 4,
LUM_COMPRESSED = 5,
RAD = 6
};
// Compression type
enum TCompression {
NO_COMPRESSION = 0,
TCSF_COMPRESSION = 1,
JPEG_COMPRESSION = 2
};
/* Start of wrappers for iofuncs.
*/
// Plain constructors
VImage( const char *name, const char *mode = "rd" );
VImage( void *data, int width, int height, int bands, TBandFmt format );
VImage( _VipsImage *image );
VImage();
// Convert to a disc file, eg:
// VImage fred = VImage::convert2disc( "im_jpeg2vips",
// "file.jpg", "temp.v" );
// Runs im_jpeg2vips to the temp file, then opens that and returns
// it. Useful for opening very large files without using a lot of RAM.
// Now superseded by the format API, though that's not yet wrapped in
// C++
// Also replaced by the new default "rd" mode
static VImage convert2disc( const char* convert,
const char* in, const char* disc );
// Copy constructor
VImage( const VImage &a );
// Assignment - delete old ref
VImage &operator=( const VImage &a );
// Destructor
virtual ~VImage() { _ref->removeref(); }
// Extract underlying IMAGE* pointer
_VipsImage *image() const { return( _ref->im ); }
// Extract underlying data pointer
void *data() const;
// Write this to another VImage, to a file, or to a mem buffer
VImage write( VImage out );
VImage write( const char *name );
VImage write();
// Debugging ... print header fields
void debug_print();
// Projection functions to get header fields
int Xsize();
int Ysize();
int Bands();
TBandFmt BandFmt();
TCoding Coding();
TType Type();
float Xres();
float Yres();
int Length();
TCompression Compression();
short Level();
int Xoffset();
int Yoffset();
// Derived fields
const char *filename();
const char *Hist();
// need the hough circle stuff for the rode python GUI
VImage hough_circle( int scale, int min_radius, int max_radius );
// metadata
#ifndef SWIG
// base functionality
// we don't wrap GValue, so we can't wrap these for now
void meta_set( const char *field, GValue *value );
void meta_get( const char *field, GValue *value_copy );
#endif /*SWIG*/
// We can wrap these, fwiw
gboolean meta_remove( const char *field );
GType meta_get_typeof( const char *field );
// convenience functions
int meta_get_int( const char *field );
double meta_get_double( const char *field );
const char *meta_get_string( const char *field );
void *meta_get_area( const char *field );
void *meta_get_blob( const char *field, size_t *length );
void meta_set( const char *field, int value );
void meta_set( const char *field, double value );
void meta_set( const char *field, const char *value );
#ifndef SWIG
// we don't wrap callbacks yet, so we can't wrap these for now
void meta_set( const char *field, VCallback free_fn, void *value );
void meta_set( const char *field,
VCallback free_fn, void *value, size_t length );
#endif /*SWIG*/
// Set header fields
void initdesc( int, int, int, TBandFmt, TCoding, TType,
float = 1.0, float = 1.0, int = 0, int = 0 );
/* Insert automatically generated headers.
*/
#include "vipsc++.h"
/* No point getting SWIG to wrap these ... we do this by hand later so we can
* handle things like "a + 12" correctly.
*/
#ifndef SWIG
// And some in-line operator equivalences done by hand
friend VImage operator+( VImage a, VImage b )
{ return( a.add( b ) ); }
friend VImage operator+( double a, VImage b )
{ return( b.lin( 1.0, a ) ); }
friend VImage operator+( VImage a, double b )
{ return( a.lin( 1.0, b ) ); }
friend VImage operator-( VImage a, VImage b )
{ return( a.subtract( b ) ); }
friend VImage operator-( double a, VImage b )
{ return( b.lin( -1.0, a ) ); }
friend VImage operator-( VImage a, double b )
{ return( a.lin( 1.0, -b ) ); }
friend VImage operator*( VImage a, VImage b )
{ return( a.multiply( b ) ); }
friend VImage operator*( double a, VImage b )
{ return( b.lin( a, 0.0 ) ); }
friend VImage operator*( VImage a, double b )
{ return( a.lin( b, 0.0 ) ); }
friend VImage operator/( VImage a, VImage b )
{ return( a.divide( b ) ); }
friend VImage operator/( double a, VImage b )
{ return( b.pow( -1.0 ).lin( a, 0.0 ) ); }
friend VImage operator/( VImage a, double b )
{ return( a.lin( 1.0/b, 0.0 ) ); }
friend VImage operator%( VImage a, VImage b )
{ return( a.remainder( b ) ); }
friend VImage operator%( VImage a, double b )
{ return( a.remainder( b ) ); }
friend VImage operator<( VImage a, VImage b )
{ return( a.less( b ) ); }
friend VImage operator<( double a, VImage b )
{ return( b.more( a ) ); }
friend VImage operator<( VImage a, double b )
{ return( a.less( b ) ); }
friend VImage operator<=( VImage a, VImage b )
{ return( a.lesseq( b ) ); }
friend VImage operator<=( double a, VImage b )
{ return( b.moreeq( a ) ); }
friend VImage operator<=( VImage a, double b )
{ return( a.lesseq( b ) ); }
friend VImage operator>( VImage a, VImage b )
{ return( a.more( b ) ); }
friend VImage operator>( double a, VImage b )
{ return( b.less( a ) ); }
friend VImage operator>( VImage a, double b )
{ return( a.more( b ) ); }
friend VImage operator>=( VImage a, VImage b )
{ return( a.moreeq( b ) ); }
friend VImage operator>=( double a, VImage b )
{ return( b.lesseq( a ) ); }
friend VImage operator>=( VImage a, double b )
{ return( a.moreeq( b ) ); }
friend VImage operator==( VImage a, VImage b )
{ return( a.equal( b ) ); }
friend VImage operator==( double a, VImage b )
{ return( b.equal( a ) ); }
friend VImage operator==( VImage a, double b )
{ return( a.equal( b ) ); }
friend VImage operator!=( VImage a, VImage b )
{ return( a.notequal( b ) ); }
friend VImage operator!=( double a, VImage b )
{ return( b.notequal( a ) ); }
friend VImage operator!=( VImage a, double b )
{ return( a.notequal( b ) ); }
friend VImage operator&( VImage a, VImage b )
{ return( a.andimage( b ) ); }
friend VImage operator&( int a, VImage b )
{ return( b.andimage( a ) ); }
friend VImage operator&( VImage a, int b )
{ return( a.andimage( b ) ); }
friend VImage operator|( VImage a, VImage b )
{ return( a.orimage( b ) ); }
friend VImage operator|( int a, VImage b )
{ return( b.orimage( a ) ); }
friend VImage operator|( VImage a, int b )
{ return( a.orimage( b ) ); }
friend VImage operator^( VImage a, VImage b )
{ return( a.eorimage( b ) ); }
friend VImage operator^( int a, VImage b )
{ return( b.eorimage( a ) ); }
friend VImage operator^( VImage a, int b )
{ return( a.eorimage( b ) ); }
friend VImage operator<<( VImage a, int b )
{ return( a.shiftleft( b ) ); }
friend VImage operator>>( VImage a, int b )
{ return( a.shiftright( b ) ); }
friend VImage operator-( VImage a )
{ return( a * -1 ); }
// Type conversion: VImage to VDMask and VIMask
operator VDMask() { return( this->vips2mask() ); }
operator VIMask() { return( VIMask( VDMask( *this ) ) ); }
#endif /*!SWIG*/
};
/* Don't include these when parsing for SWIG.
*/
#ifndef SWIG
/* Class wrapping up a vargv. Member function wrappers need this. It needs to
* be part of the public API in case people subclass VImage and add their own
* members.
*/
class VIPS_CC_API Vargv {
// Function we are args to
im__function *fn;
// Base of object vector
im__object *base;
public:
Vargv( const char *name );
~Vargv();
// Reference to element of base
im__object &data( int i = 0 ) { return( base[i] ); };
// Invoke function
void call();
};
#endif /*!SWIG*/
VIPS_NAMESPACE_END
// Other VIPS protos we need
extern "C" {
extern int im_init_world( const char *argv0 );
extern int im_init_world( const char *argv0 );
extern void vips_thread_shutdown( void );
extern void im__print_all();
extern void im_col_Lab2XYZ(
float, float, float,
float *, float *, float * );
}
#endif /*IM_VIMAGE_H*/

View File

@ -1,407 +0,0 @@
/* VIPS mask class.
*
* Just like VImage, but we don't need dependency stuff. Instead, have a base
* wrapper over *MASK, derive VMaskD and VMaskI from that, and then put
* refcounting over all of them.
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_VMASK_H
#define IM_VMASK_H
/* SWIG includes this file directly rather than going through vipscpp.h ... so
* we have to define these macros here as well.
*/
#ifdef SWIG
# define VIPS_NAMESPACE_START namespace vips {
# define VIPS_NAMESPACE_END }
#endif /*SWIG*/
/* Don't include these when parsing for SWIG.
*/
#ifndef SWIG
# include <cstdarg>
# include <iosfwd>
# include <vector>
#endif /*!SWIG*/
/* Wrap pointers to these, but we don't want to import all the old C API. Just
* declare them.
*/
extern "C" {
struct im__INTMASK;
struct im__DOUBLEMASK;
}
VIPS_NAMESPACE_START
/* This first section is private. Only expose the non-P versions of these
* classes later on. Don't need to wrap then in SWIG either.
*/
#ifndef SWIG
namespace _private_detail {
union MASKUNION {
im__INTMASK *iptr;
im__DOUBLEMASK *dptr;
};
// Private wrapper over *MASK - user does not see this
class VIPS_CC_API VPMask {
friend class VMask;
public:
// Track type of mask with this
enum VMaskType {
UNASSIGNED, // Not yet set
INT, // mask points to INTMASK
DOUBLE // mask points to DOUBLEMASK
};
MASKUNION data; // Mask pointer - INT or DOUBLE
VMaskType type; // Track type too, for safety
virtual ~VPMask() {};
// Duplicate
virtual VPMask *dup() const = 0;
// Projection functions to get MASK fields
virtual int xsize() const = 0;
virtual int ysize() const = 0;
virtual const char *filename() const = 0;
// Output
virtual void ostream_print( std::ostream & ) const = 0;
};
// Specialise for INTMASK
class VIPS_CC_API VPIMask : public VPMask {
public:
VPIMask( int xsize, int ysize );
VPIMask( int xsize, int ysize, int scale, int offset,
std::vector<int> coeff );
VPIMask( const char * );
VPIMask( im__INTMASK * );
VPIMask();
virtual ~VPIMask();
VPMask *dup() const;
void embed( im__INTMASK * );
int xsize() const;
int ysize() const;
int scale() const;
int offset() const;
const char *filename() const;
// Output
virtual void ostream_print( std::ostream & ) const;
// Extract start of array of ints
int *array() const;
};
// Specialise for DOUBLEMASK
class VIPS_CC_API VPDMask : public VPMask {
public:
VPDMask( int xsize, int ysize );
VPDMask( int xsize, int ysize,
double scale, double offset, std::vector<double> coeff );
VPDMask( const char * );
VPDMask( im__DOUBLEMASK * );
VPDMask();
virtual ~VPDMask();
VPMask *dup() const;
void embed( im__DOUBLEMASK * );
int xsize() const;
int ysize() const;
double scale() const;
double offset() const;
const char *filename() const;
// Output
virtual void ostream_print( std::ostream & ) const;
// Extract start of array of doubles
double *array() const;
};
} // end of namespace _private_detail
inline std::ostream &operator<<( std::ostream &file,
const _private_detail::VPMask &msk )
{
msk.ostream_print( file );
return( file );
}
#endif /*!SWIG*/
// Wrapper over VP?Mask with ref counting
class VIPS_CC_API VMask {
protected:
struct refblock {
_private_detail::VPMask *pmask; // Mask: double or int
int nrefs; // Refs to us
refblock() : pmask(0), nrefs(1) {}
virtual ~refblock() { delete pmask; }
};
refblock *ref;
// Make sure this is a private copy of pmask --- dup if nrefs != 1
void make_private();
public:
// Constructor leaves msk uninitialised
VMask() { ref = new refblock; }
// Copy constructor
VMask( const VMask &a ) { ref = a.ref; ref->nrefs++; }
// Assignment
VMask &operator=( const VMask &a );
// Destructor
virtual ~VMask();
int xsize() const
{ return( ref->pmask->xsize() ); }
int ysize() const
{ return( ref->pmask->ysize() ); }
int size() const
{ return( xsize() * ysize() ); }
const char *filename() const
{ return( ref->pmask->filename() ); }
// Extract underlying type
_private_detail::VPMask::VMaskType type() const
{ return( ref->pmask->type ); }
// Extract underlying VIPS pointer
_private_detail::MASKUNION mask() const { return( ref->pmask->data ); }
void ostream_print( std::ostream & ) const;
};
inline std::ostream &operator<<( std::ostream &file, const VMask &msk )
{
msk.ostream_print( file );
return( file );
}
// Need to forward ref these
class VIPS_CC_API VDMask;
class VIPS_CC_API VImage;
// Wrapper over _private_detail::VPIMask with ref counting
class VIPS_CC_API VIMask : public VMask {
public:
VIMask( int xsize, int ysize )
{
ref->pmask = new _private_detail::VPIMask( xsize, ysize );
}
/* Don't wrap the varargs constructor. We want Python to use the vector one.
*/
#ifndef SWIG
VIMask( int xsize, int ysize, int scale, int offset, ... )
{
va_list ap;
int i;
std::vector<int> coeff( xsize * ysize );
va_start( ap, offset );
for( i = 0; i < xsize * ysize; i++ )
coeff[i] = va_arg( ap, int );
va_end( ap );
ref->pmask = new _private_detail::VPIMask( xsize, ysize,
scale, offset, coeff );
}
#endif /*!SWIG*/
VIMask( int xsize, int ysize, int scale, int offset,
std::vector<int> coeff )
{
ref->pmask = new _private_detail::VPIMask( xsize, ysize,
scale, offset, coeff );
}
VIMask( const char *name )
{
ref->pmask = new _private_detail::VPIMask( name );
}
// No mask there yet
VIMask() {}
int scale()
{
return( ((_private_detail::VPIMask *)ref->pmask)->scale() );
}
int offset()
{
return( ((_private_detail::VPIMask *)ref->pmask)->offset() );
}
// Embed INTMASK in VIMask
void embed( im__INTMASK * );
// Overload [] to get linear array subscript.
int &operator[]( int );
// Overload () to get matrix subscript.
int &operator()( int x, int y ) { return( (*this)[x + y*xsize()] ); }
// and as a function call that SWIG can wrap
int get( int i )
{ return( (*this)[i] ); }
// Type conversion: INTMASK->DOUBLEMASK
operator VDMask();
// Type conversion: INTMASK->image
operator VImage();
// VIMask build functions
static VIMask gauss( double, double );
static VIMask gauss_sep( double, double );
static VIMask log( double, double );
// VIMask manipulation
VIMask rotate45();
VIMask rotate90();
// Arithmetic ... cast to double, and use VDMask funcs. For some
// reason, the compiler won't let us do casts to VDImage yet, so no
// inlines.
VDMask trn();
VDMask inv();
VDMask cat( VDMask );
VDMask mul( VDMask );
};
// Wrapper over _private_detail::VPDMask with ref counting
class VIPS_CC_API VDMask : public VMask {
public:
VDMask( int xsize, int ysize )
{
ref->pmask = new _private_detail::VPDMask( xsize, ysize );
}
/* Don't wrap the varargs constructor. We want Python to use the vector one.
*/
#ifndef SWIG
VDMask( int xsize, int ysize, double scale, double offset, ... )
{
va_list ap;
int i;
std::vector<double> coeff( xsize * ysize );
va_start( ap, offset );
for( i = 0; i < xsize * ysize; i++ )
coeff[i] = va_arg( ap, double );
va_end( ap );
ref->pmask = new _private_detail::VPDMask( xsize, ysize,
scale, offset, coeff );
}
#endif /*!SWIG*/
VDMask( int xsize, int ysize, double scale, double offset,
std::vector<double> coeff )
{
ref->pmask = new _private_detail::VPDMask( xsize, ysize,
scale, offset, coeff );
}
VDMask( const char *name )
{
ref->pmask = new _private_detail::VPDMask( name );
}
// No mask yet
VDMask() { }
// Embed DOUBLEMASK in VDMask
void embed( im__DOUBLEMASK * );
double scale()
{
return( ((_private_detail::VPDMask *)ref->pmask)->scale() );
}
double offset()
{
return( ((_private_detail::VPDMask *)ref->pmask)->offset() );
}
// Overload [] to get linear array subscript.
double &operator[]( int );
// Overload () to get matrix subscript.
double &operator()( int x, int y )
{ return( (*this)[x + y*xsize()] ); }
// and as a function call that SWIG can wrap
double get( int i ) { return( (*this)[i] ); }
// Type conversion: double->int
operator VIMask();
// Type conversion: DOUBLEMASK->image
operator VImage();
// VDMask build functions
static VDMask gauss( double, double );
static VDMask log( double, double );
// VDMask manipulation
VDMask rotate45();
VDMask rotate90();
// Scale to intmask
VIMask scalei();
// Simple arithmetic
VDMask trn();
VDMask inv();
VDMask cat( VDMask );
VDMask mul( VDMask );
};
VIPS_NAMESPACE_END
#endif /*IM_VMASK_H*/

View File

@ -1,122 +0,0 @@
// Include file to get all VIPS C++ bindings
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef IM_VIPS
#define IM_VIPS
#include <vips/version.h>
// VImage.h uses GValue for metadata
#include <glib-object.h>
/* Define VIPS_CC_EXPORTS to build a DLL using MSVC.
*/
#ifdef _MSC_VER
# ifdef VIPS_CC_EXPORTS
# define VIPS_CC_API __declspec(dllexport)
# else
# define VIPS_CC_API __declspec(dllimport)
# endif
#else
# define VIPS_CC_API
#endif
// If we have already #included the C vips headers, we have to undef a load of
// stuff to stop vips's stupid macros messing up our enums
#ifdef IM_VIPS_H
#ifdef IM_ENABLE_DEPRECATED
#undef MULTIBAND
#undef B_W
#undef LUMINACE
#undef XRAY
#undef IR
#undef YUV
#undef RED_ONLY
#undef GREEN_ONLY
#undef BLUE_ONLY
#undef POWER_SPECTRUM
#undef HISTOGRAM
#undef LUT
#undef XYZ
#undef LAB
#undef CMC
#undef CMYK
#undef LABQ
#undef RGB
#undef UCS
#undef LCH
#undef LABS
#undef sRGB
#undef FMTNOTSET
#undef FMTUCHAR
#undef FMTCHAR
#undef FMTUSHORT
#undef FMTSHORT
#undef FMTUINT
#undef FMTINT
#undef FMTFLOAT
#undef FMTCOMPLEX
#undef FMTDOUBLE
#undef FMTDPCOMPLEX
#undef NOCODING
#undef COLQUANT
#undef LABPACK
#undef LABPACK_COMPRESSED
#undef RGB_COMPRESSED
#undef LUM_COMPRESSED
#undef NO_COMPRESSION
#undef TCSF_COMPRESSION
#undef JPEG_COMPRESSION
#endif /*IM_ENABLE_DEPRECATED*/
#endif /*IM_VIPS_H*/
#ifdef IM_RECT_H
#ifdef IM_ENABLE_DEPRECATED
#undef right
#undef bottom
#endif /*IM_ENABLE_DEPRECATED*/
#endif /*IM_RECT_H*/
#define VIPS_NAMESPACE_START namespace vips {
#define VIPS_NAMESPACE_END }
#include <vips/VError.h>
#include <vips/VDisplay.h>
#include <vips/VMask.h>
#include <vips/VImage.h>
#endif /*IM_VIPS*/

View File

@ -1,419 +0,0 @@
// headers for package arithmetic
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
VImage abs();
VImage acos();
VImage add( VImage add_in2 );
VImage asin();
VImage atan();
double avg();
double point( char* point_interpolate, double point_x, double point_y, int point_band );
double point_bilinear( double point_bilinear_x, double point_bilinear_y, int point_bilinear_band );
VImage bandmean();
VImage ceil();
VImage cos();
VImage cross_phase( VImage cross_phase_in2 );
double deviate();
VImage divide( VImage divide_in2 );
VImage exp10();
VImage expn( double expn_x );
VImage expn( std::vector<double> expn_v );
VImage exp();
VImage floor();
VImage invert();
VImage lin( double lin_a, double lin_b );
static VImage linreg( std::vector<VImage> linreg_ins, std::vector<double> linreg_xs );
VImage lin( std::vector<double> lin_a, std::vector<double> lin_b );
VImage log10();
VImage log();
double max();
std::complex<double> maxpos();
double maxpos_avg( double& maxpos_avg_y, double& maxpos_avg_out );
VDMask measure( int measure_x, int measure_y, int measure_w, int measure_h, int measure_h_patches, int measure_v_patches );
double min();
std::complex<double> minpos();
VImage multiply( VImage multiply_in2 );
VImage pow( double pow_x );
VImage pow( std::vector<double> pow_v );
VImage recomb( VDMask recomb_matrix );
VImage remainder( VImage remainder_in2 );
VImage remainder( double remainder_x );
VImage remainder( std::vector<double> remainder_x );
VImage rint();
VImage sign();
VImage sin();
VDMask stats();
VImage subtract( VImage subtract_in2 );
VImage tan();
// headers for package cimg
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
VImage greyc( int greyc_iterations, double greyc_amplitude, double greyc_sharpness, double greyc_anisotropy, double greyc_alpha, double greyc_sigma, double greyc_dl, double greyc_da, double greyc_gauss_prec, int greyc_interpolation, int greyc_fast_approx );
VImage greyc_mask( VImage greyc_mask_mask, int greyc_mask_iterations, double greyc_mask_amplitude, double greyc_mask_sharpness, double greyc_mask_anisotropy, double greyc_mask_alpha, double greyc_mask_sigma, double greyc_mask_dl, double greyc_mask_da, double greyc_mask_gauss_prec, int greyc_mask_interpolation, int greyc_mask_fast_approx );
// headers for package colour
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
VImage LCh2Lab();
VImage LCh2UCS();
VImage Lab2LCh();
VImage Lab2LabQ();
VImage Lab2LabS();
VImage Lab2UCS();
VImage Lab2XYZ();
VImage Lab2XYZ_temp( double Lab2XYZ_temp_X0, double Lab2XYZ_temp_Y0, double Lab2XYZ_temp_Z0 );
VImage Lab2disp( VDisplay Lab2disp_disp );
VImage LabQ2LabS();
VImage LabQ2Lab();
VImage LabQ2XYZ();
VImage LabQ2disp( VDisplay LabQ2disp_disp );
VImage LabS2LabQ();
VImage LabS2Lab();
VImage UCS2LCh();
VImage UCS2Lab();
VImage UCS2XYZ();
VImage XYZ2Lab();
VImage XYZ2Lab_temp( double XYZ2Lab_temp_X0, double XYZ2Lab_temp_Y0, double XYZ2Lab_temp_Z0 );
VImage XYZ2UCS();
VImage XYZ2Yxy();
VImage XYZ2disp( VDisplay XYZ2disp_disp );
VImage XYZ2sRGB();
VImage Yxy2XYZ();
VImage dE00_fromLab( VImage dE00_fromLab_in2 );
VImage dECMC_fromLab( VImage dECMC_fromLab_in2 );
VImage dECMC_fromdisp( VImage dECMC_fromdisp_in2, VDisplay dECMC_fromdisp_disp );
VImage dE_fromLab( VImage dE_fromLab_in2 );
VImage dE_fromXYZ( VImage dE_fromXYZ_in2 );
VImage dE_fromdisp( VImage dE_fromdisp_in2, VDisplay dE_fromdisp_disp );
VImage disp2Lab( VDisplay disp2Lab_disp );
VImage disp2XYZ( VDisplay disp2XYZ_disp );
VImage float2rad();
VImage icc_ac2rc( char* icc_ac2rc_profile );
VImage icc_export_depth( int icc_export_depth_depth, char* icc_export_depth_output_profile, int icc_export_depth_intent );
VImage icc_import( char* icc_import_input_profile, int icc_import_intent );
VImage icc_import_embedded( int icc_import_embedded_intent );
VImage icc_transform( char* icc_transform_input_profile, char* icc_transform_output_profile, int icc_transform_intent );
VImage lab_morph( VDMask lab_morph_greyscale, double lab_morph_L_offset, double lab_morph_L_scale, double lab_morph_a_scale, double lab_morph_b_scale );
VImage rad2float();
VImage sRGB2XYZ();
// headers for package conversion
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
static VImage gaussnoise( int gaussnoise_xsize, int gaussnoise_ysize, double gaussnoise_mean, double gaussnoise_sigma );
VImage bandjoin( VImage bandjoin_in2 );
static VImage black( int black_x_size, int black_y_size, int black_bands );
VImage c2amph();
VImage c2imag();
VImage c2real();
VImage c2rect();
VImage clip2fmt( int clip2fmt_ofmt );
VImage copy();
VImage copy_file();
VImage copy_morph( int copy_morph_Bands, int copy_morph_BandFmt, int copy_morph_Coding );
VImage copy_swap();
VImage copy_set( int copy_set_Type, double copy_set_Xres, double copy_set_Yres, int copy_set_Xoffset, int copy_set_Yoffset );
VImage extract_area( int extract_area_left, int extract_area_top, int extract_area_width, int extract_area_height );
VImage extract_areabands( int extract_areabands_left, int extract_areabands_top, int extract_areabands_width, int extract_areabands_height, int extract_areabands_band, int extract_areabands_nbands );
VImage extract_band( int extract_band_band );
VImage extract_bands( int extract_bands_band, int extract_bands_nbands );
VImage extract( int extract_left, int extract_top, int extract_width, int extract_height, int extract_band );
VImage falsecolour();
VImage fliphor();
VImage flipver();
static VImage gbandjoin( std::vector<VImage> gbandjoin_in );
VImage grid( int grid_tile_height, int grid_across, int grid_down );
VImage insert( VImage insert_sub, int insert_x, int insert_y );
VImage insert( VImage insert_sub, std::vector<int> insert_x, std::vector<int> insert_y );
VImage insert_noexpand( VImage insert_noexpand_sub, int insert_noexpand_x, int insert_noexpand_y );
VImage embed( int embed_type, int embed_x, int embed_y, int embed_width, int embed_height );
VImage lrjoin( VImage lrjoin_in2 );
VImage msb();
VImage msb_band( int msb_band_band );
VImage replicate( int replicate_across, int replicate_down );
VImage ri2c( VImage ri2c_in2 );
VImage rot180();
VImage rot270();
VImage rot90();
VImage scale();
VImage scaleps();
VImage subsample( int subsample_xshrink, int subsample_yshrink );
char* system( char* system_command );
VImage system_image( char* system_image_in_format, char* system_image_out_format, char* system_image_command, char*& system_image_log );
VImage tbjoin( VImage tbjoin_in2 );
static VImage text( char* text_text, char* text_font, int text_width, int text_alignment, int text_dpi );
VImage wrap( int wrap_x, int wrap_y );
VImage zoom( int zoom_xfac, int zoom_yfac );
// headers for package convolution
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
VImage aconvsep( VDMask aconvsep_matrix, int aconvsep_n_layers );
VImage aconv( VDMask aconv_matrix, int aconv_n_layers, int aconv_cluster );
VImage addgnoise( double addgnoise_sigma );
VImage compass( VIMask compass_matrix );
VImage contrast_surface( int contrast_surface_half_win_size, int contrast_surface_spacing );
VImage conv( VIMask conv_matrix );
VImage conv( VDMask conv_matrix );
VImage convsep( VIMask convsep_matrix );
VImage convsep( VDMask convsep_matrix );
VImage fastcor( VImage fastcor_in2 );
VImage gradcor( VImage gradcor_in2 );
VImage gradient( VIMask gradient_matrix );
VImage grad_x();
VImage grad_y();
VImage lindetect( VIMask lindetect_matrix );
VImage sharpen( int sharpen_mask_size, double sharpen_x1, double sharpen_y2, double sharpen_y3, double sharpen_m1, double sharpen_m2 );
VImage spcor( VImage spcor_in2 );
// headers for package deprecated
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
VImage argb2rgba();
VImage flood_copy( int flood_copy_start_x, int flood_copy_start_y, std::vector<double> flood_copy_ink );
VImage flood_blob_copy( int flood_blob_copy_start_x, int flood_blob_copy_start_y, std::vector<double> flood_blob_copy_ink );
VImage flood_other_copy( VImage flood_other_copy_mark, int flood_other_copy_start_x, int flood_other_copy_start_y, int flood_other_copy_serial );
VImage clip();
VImage c2ps();
VImage resize_linear( int resize_linear_X, int resize_linear_Y );
VImage cmulnorm( VImage cmulnorm_in2 );
VImage fav4( VImage fav4_in2, VImage fav4_in3, VImage fav4_in4 );
VImage gadd( double gadd_a, double gadd_b, VImage gadd_in2, double gadd_c );
VImage icc_export( char* icc_export_output_profile, int icc_export_intent );
VImage litecor( VImage litecor_white, int litecor_clip, double litecor_factor );
VImage affine( double affine_a, double affine_b, double affine_c, double affine_d, double affine_dx, double affine_dy, int affine_x, int affine_y, int affine_w, int affine_h );
VImage clip2c();
VImage clip2cm();
VImage clip2d();
VImage clip2dcm();
VImage clip2f();
VImage clip2i();
VImage convsub( VIMask convsub_matrix, int convsub_xskip, int convsub_yskip );
VImage convf( VDMask convf_matrix );
VImage convsepf( VDMask convsepf_matrix );
VImage clip2s();
VImage clip2ui();
VImage insertplace( VImage insertplace_sub, std::vector<int> insertplace_x, std::vector<int> insertplace_y );
VImage clip2us();
VImage slice( double slice_thresh1, double slice_thresh2 );
VImage segment( int& segment_segments );
void line( int line_x1, int line_y1, int line_x2, int line_y2, int line_pelval );
VImage thresh( double thresh_threshold );
VImage convf_raw( VDMask convf_raw_matrix );
VImage conv_raw( VIMask conv_raw_matrix );
VImage contrast_surface_raw( int contrast_surface_raw_half_win_size, int contrast_surface_raw_spacing );
VImage convsepf_raw( VDMask convsepf_raw_matrix );
VImage convsep_raw( VIMask convsep_raw_matrix );
VImage fastcor_raw( VImage fastcor_raw_in2 );
VImage gradcor_raw( VImage gradcor_raw_in2 );
VImage spcor_raw( VImage spcor_raw_in2 );
VImage lhisteq_raw( int lhisteq_raw_width, int lhisteq_raw_height );
VImage stdif_raw( double stdif_raw_a, double stdif_raw_m0, double stdif_raw_b, double stdif_raw_s0, int stdif_raw_xw, int stdif_raw_yw );
VImage rank_raw( int rank_raw_xsize, int rank_raw_ysize, int rank_raw_n );
VImage dilate_raw( VIMask dilate_raw_mask );
VImage erode_raw( VIMask erode_raw_mask );
VImage similarity_area( double similarity_area_a, double similarity_area_b, double similarity_area_dx, double similarity_area_dy, int similarity_area_x, int similarity_area_y, int similarity_area_w, int similarity_area_h );
VImage similarity( double similarity_a, double similarity_b, double similarity_dx, double similarity_dy );
static VImage mask2vips( VDMask mask2vips_input );
VDMask vips2mask();
void insertplace( VImage insertplace_sub, int insertplace_x, int insertplace_y );
void circle( int circle_cx, int circle_cy, int circle_radius, int circle_intensity );
VImage andimage( VImage andimage_in2 );
VImage andimage( int andimage_c );
VImage andimage( std::vector<double> andimage_vec );
VImage orimage( VImage orimage_in2 );
VImage orimage( int orimage_c );
VImage orimage( std::vector<double> orimage_vec );
VImage eorimage( VImage eorimage_in2 );
VImage eorimage( int eorimage_c );
VImage eorimage( std::vector<double> eorimage_vec );
VImage shiftleft( std::vector<double> shiftleft_vec );
VImage shiftleft( int shiftleft_c );
VImage shiftright( std::vector<double> shiftright_vec );
VImage shiftright( int shiftright_c );
VImage blend( VImage blend_in1, VImage blend_in2 );
VImage equal( VImage equal_in2 );
VImage equal( std::vector<double> equal_vec );
VImage equal( double equal_c );
VImage ifthenelse( VImage ifthenelse_in1, VImage ifthenelse_in2 );
VImage less( VImage less_in2 );
VImage less( std::vector<double> less_vec );
VImage less( double less_c );
VImage lesseq( VImage lesseq_in2 );
VImage lesseq( std::vector<double> lesseq_vec );
VImage lesseq( double lesseq_c );
VImage more( VImage more_in2 );
VImage more( std::vector<double> more_vec );
VImage more( double more_c );
VImage moreeq( VImage moreeq_in2 );
VImage moreeq( std::vector<double> moreeq_vec );
VImage moreeq( double moreeq_c );
VImage notequal( VImage notequal_in2 );
VImage notequal( std::vector<double> notequal_vec );
VImage notequal( double notequal_c );
VImage quadratic( VImage quadratic_coeff );
// headers for package format
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
static VImage csv2vips( char* csv2vips_filename );
static VImage fits2vips( char* fits2vips_in );
static VImage jpeg2vips( char* jpeg2vips_in );
static VImage magick2vips( char* magick2vips_in );
static VImage png2vips( char* png2vips_in );
static VImage exr2vips( char* exr2vips_in );
static VImage ppm2vips( char* ppm2vips_filename );
static VImage analyze2vips( char* analyze2vips_filename );
static VImage tiff2vips( char* tiff2vips_in );
void vips2csv( char* vips2csv_filename );
void vips2dz( char* vips2dz_out );
void vips2jpeg( char* vips2jpeg_out );
void vips2mimejpeg( int vips2mimejpeg_qfac );
void vips2png( char* vips2png_out );
void vips2ppm( char* vips2ppm_filename );
void vips2tiff( char* vips2tiff_out );
// headers for package freq_filt
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
static VImage create_fmask( int create_fmask_width, int create_fmask_height, int create_fmask_type, double create_fmask_p1, double create_fmask_p2, double create_fmask_p3, double create_fmask_p4, double create_fmask_p5 );
VImage disp_ps();
VImage flt_image_freq( int flt_image_freq_type, double flt_image_freq_p1, double flt_image_freq_p2, double flt_image_freq_p3, double flt_image_freq_p4, double flt_image_freq_p5 );
static VImage fractsurf( int fractsurf_size, double fractsurf_dimension );
VImage freqflt( VImage freqflt_mask );
VImage fwfft();
VImage rotquad();
VImage invfft();
VImage phasecor_fft( VImage phasecor_fft_in2 );
VImage invfftr();
// headers for package histograms_lut
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
VImage gammacorrect( double gammacorrect_exponent );
VImage heq( int heq_band_number );
VImage hist( int hist_band_number );
VImage histcum();
VImage histeq();
VImage hist_indexed( VImage hist_indexed_value );
VImage histgr( int histgr_band_number );
VImage histnD( int histnD_bins );
VImage histnorm();
VImage histplot();
VImage histspec( VImage histspec_ref );
VImage hsp( VImage hsp_ref );
static VImage identity( int identity_nbands );
static VImage identity_ushort( int identity_ushort_nbands, int identity_ushort_size );
int ismonotonic();
VImage lhisteq( int lhisteq_width, int lhisteq_height );
int mpercent( double mpercent_percent );
static VImage invertlut( VDMask invertlut_measures, int invertlut_lut_size );
static VImage buildlut( VDMask buildlut_xyes );
VImage maplut( VImage maplut_lut );
VImage project( VImage& project_vout );
VImage stdif( double stdif_a, double stdif_m0, double stdif_b, double stdif_s0, int stdif_xw, int stdif_yw );
VImage tone_analyse( double tone_analyse_Ps, double tone_analyse_Pm, double tone_analyse_Ph, double tone_analyse_S, double tone_analyse_M, double tone_analyse_H );
static VImage tone_build( double tone_build_Lb, double tone_build_Lw, double tone_build_Ps, double tone_build_Pm, double tone_build_Ph, double tone_build_S, double tone_build_M, double tone_build_H );
static VImage tone_build_range( int tone_build_range_in_max, int tone_build_range_out_max, double tone_build_range_Lb, double tone_build_range_Lw, double tone_build_range_Ps, double tone_build_range_Pm, double tone_build_range_Ph, double tone_build_range_S, double tone_build_range_M, double tone_build_range_H );
VImage tone_map( VImage tone_map_lut );
// headers for package inplace
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
void draw_circle( int draw_circle_cx, int draw_circle_cy, int draw_circle_radius, int draw_circle_fill, std::vector<double> draw_circle_ink );
void draw_rect( int draw_rect_left, int draw_rect_top, int draw_rect_width, int draw_rect_height, int draw_rect_fill, std::vector<double> draw_rect_ink );
void draw_line( int draw_line_x1, int draw_line_y1, int draw_line_x2, int draw_line_y2, std::vector<double> draw_line_ink );
void draw_point( int draw_point_x, int draw_point_y, std::vector<double> draw_point_ink );
void draw_smudge( int draw_smudge_left, int draw_smudge_top, int draw_smudge_width, int draw_smudge_height );
void draw_flood( int draw_flood_x, int draw_flood_y, std::vector<double> draw_flood_ink );
void draw_flood_blob( int draw_flood_blob_x, int draw_flood_blob_y, std::vector<double> draw_flood_blob_ink );
void draw_flood_other( VImage draw_flood_other_test, int draw_flood_other_x, int draw_flood_other_y, int draw_flood_other_serial );
void draw_image( VImage draw_image_sub, int draw_image_x, int draw_image_y );
void draw_mask( VImage draw_mask_mask, int draw_mask_x, int draw_mask_y, std::vector<double> draw_mask_ink );
VImage line( VImage line_mask, VImage line_ink, std::vector<int> line_x1, std::vector<int> line_y1, std::vector<int> line_x2, std::vector<int> line_y2 );
// headers for package iofuncs
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
static VImage binfile( char* binfile_filename, int binfile_width, int binfile_height, int binfile_bands, int binfile_offset );
VImage cache( int cache_tile_width, int cache_tile_height, int cache_max_tiles );
VImage tile_cache_random( int tile_cache_random_tile_width, int tile_cache_random_tile_height, int tile_cache_random_max_tiles );
char* getext();
int header_get_typeof( char* header_get_typeof_field );
int header_int( char* header_int_field );
double header_double( char* header_double_field );
char* header_string( char* header_string_field );
char* history_get();
void printdesc();
// headers for package mask
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
// headers for package morphology
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
double cntlines( int cntlines_direction );
VImage dilate( VIMask dilate_mask );
VImage rank( int rank_xsize, int rank_ysize, int rank_n );
static VImage rank_image( std::vector<VImage> rank_image_in, int rank_image_index );
static VImage maxvalue( std::vector<VImage> maxvalue_in );
VImage label_regions( int& label_regions_segments );
VImage zerox( int zerox_flag );
VImage erode( VIMask erode_mask );
VImage profile( int profile_direction );
// headers for package mosaicing
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
VImage align_bands();
double correl( VImage correl_sec, int correl_xref, int correl_yref, int correl_xsec, int correl_ysec, int correl_hwindowsize, int correl_hsearchsize, int& correl_x, int& correl_y );
int _find_lroverlap( VImage _find_lroverlap_sec, int _find_lroverlap_bandno, int _find_lroverlap_xr, int _find_lroverlap_yr, int _find_lroverlap_xs, int _find_lroverlap_ys, int _find_lroverlap_halfcorrelation, int _find_lroverlap_halfarea, int& _find_lroverlap_dy0, double& _find_lroverlap_scale1, double& _find_lroverlap_angle1, double& _find_lroverlap_dx1, double& _find_lroverlap_dy1 );
int _find_tboverlap( VImage _find_tboverlap_sec, int _find_tboverlap_bandno, int _find_tboverlap_xr, int _find_tboverlap_yr, int _find_tboverlap_xs, int _find_tboverlap_ys, int _find_tboverlap_halfcorrelation, int _find_tboverlap_halfarea, int& _find_tboverlap_dy0, double& _find_tboverlap_scale1, double& _find_tboverlap_angle1, double& _find_tboverlap_dx1, double& _find_tboverlap_dy1 );
VImage global_balance( double global_balance_gamma );
VImage global_balancef( double global_balancef_gamma );
VImage lrmerge( VImage lrmerge_sec, int lrmerge_dx, int lrmerge_dy, int lrmerge_mwidth );
VImage lrmerge1( VImage lrmerge1_sec, int lrmerge1_xr1, int lrmerge1_yr1, int lrmerge1_xs1, int lrmerge1_ys1, int lrmerge1_xr2, int lrmerge1_yr2, int lrmerge1_xs2, int lrmerge1_ys2, int lrmerge1_mwidth );
VImage lrmosaic( VImage lrmosaic_sec, int lrmosaic_bandno, int lrmosaic_xr, int lrmosaic_yr, int lrmosaic_xs, int lrmosaic_ys, int lrmosaic_halfcorrelation, int lrmosaic_halfarea, int lrmosaic_balancetype, int lrmosaic_mwidth );
VImage lrmosaic1( VImage lrmosaic1_sec, int lrmosaic1_bandno, int lrmosaic1_xr1, int lrmosaic1_yr1, int lrmosaic1_xs1, int lrmosaic1_ys1, int lrmosaic1_xr2, int lrmosaic1_yr2, int lrmosaic1_xs2, int lrmosaic1_ys2, int lrmosaic1_halfcorrelation, int lrmosaic1_halfarea, int lrmosaic1_balancetype, int lrmosaic1_mwidth );
VImage match_linear( VImage match_linear_sec, int match_linear_xref1, int match_linear_yref1, int match_linear_xsec1, int match_linear_ysec1, int match_linear_xref2, int match_linear_yref2, int match_linear_xsec2, int match_linear_ysec2 );
VImage match_linear_search( VImage match_linear_search_sec, int match_linear_search_xref1, int match_linear_search_yref1, int match_linear_search_xsec1, int match_linear_search_ysec1, int match_linear_search_xref2, int match_linear_search_yref2, int match_linear_search_xsec2, int match_linear_search_ysec2, int match_linear_search_hwindowsize, int match_linear_search_hsearchsize );
double maxpos_subpel( double& maxpos_subpel_y );
VImage remosaic( char* remosaic_old_str, char* remosaic_new_str );
VImage tbmerge( VImage tbmerge_sec, int tbmerge_dx, int tbmerge_dy, int tbmerge_mwidth );
VImage tbmerge1( VImage tbmerge1_sec, int tbmerge1_xr1, int tbmerge1_yr1, int tbmerge1_xs1, int tbmerge1_ys1, int tbmerge1_xr2, int tbmerge1_yr2, int tbmerge1_xs2, int tbmerge1_ys2, int tbmerge1_mwidth );
VImage tbmosaic( VImage tbmosaic_sec, int tbmosaic_bandno, int tbmosaic_xr, int tbmosaic_yr, int tbmosaic_xs, int tbmosaic_ys, int tbmosaic_halfcorrelation, int tbmosaic_halfarea, int tbmosaic_balancetype, int tbmosaic_mwidth );
VImage tbmosaic1( VImage tbmosaic1_sec, int tbmosaic1_bandno, int tbmosaic1_xr1, int tbmosaic1_yr1, int tbmosaic1_xs1, int tbmosaic1_ys1, int tbmosaic1_xr2, int tbmosaic1_yr2, int tbmosaic1_xs2, int tbmosaic1_ys2, int tbmosaic1_halfcorrelation, int tbmosaic1_halfarea, int tbmosaic1_balancetype, int tbmosaic1_mwidth );
// headers for package other
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
VImage benchmark();
double benchmark2();
VImage benchmarkn( int benchmarkn_n );
static VImage eye( int eye_xsize, int eye_ysize, double eye_factor );
static VImage grey( int grey_xsize, int grey_ysize );
static VImage feye( int feye_xsize, int feye_ysize, double feye_factor );
static VImage fgrey( int fgrey_xsize, int fgrey_ysize );
static VImage fzone( int fzone_size );
static VImage make_xy( int make_xy_xsize, int make_xy_ysize );
static VImage sines( int sines_xsize, int sines_ysize, double sines_horfreq, double sines_verfreq );
static VImage zone( int zone_size );
// headers for package resample
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
VImage rightshift_size( int rightshift_size_xshift, int rightshift_size_yshift, int rightshift_size_band_fmt );
VImage shrink( double shrink_xfac, double shrink_yfac );
VImage stretch3( double stretch3_xdisp, double stretch3_ydisp );
VImage affinei( char* affinei_interpolate, double affinei_a, double affinei_b, double affinei_c, double affinei_d, double affinei_dx, double affinei_dy, int affinei_x, int affinei_y, int affinei_w, int affinei_h );
VImage affinei_all( char* affinei_all_interpolate, double affinei_all_a, double affinei_all_b, double affinei_all_c, double affinei_all_d, double affinei_all_dx, double affinei_all_dy );
// headers for package video
// this file automatically generated from
// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017
static VImage video_test( int video_test_brightness, int video_test_error );
static VImage video_v4l1( char* video_v4l1_device, int video_v4l1_channel, int video_v4l1_brightness, int video_v4l1_colour, int video_v4l1_contrast, int video_v4l1_hue, int video_v4l1_ngrabs );

View File

@ -1,40 +0,0 @@
// Include file to get all VIPS C++ bindings
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
/* This header is just for compatibility with the pre-namespace C++ bindings.
*/
#ifndef IM_VIPSCPP_H
#define IM_VIPSCPP_H
#include <vips/vips>
using namespace vips;
#endif /*IM_VIPSCPP_H*/

File diff suppressed because it is too large Load Diff

View File

@ -267,7 +267,6 @@ libvips/iofuncs/sinkscreen.c
libvips/iofuncs/object.c
libvips/iofuncs/buf.c
libvips/iofuncs/vipsmarshal.c
libvips/iofuncs/base64.c
libvips/morphology/morph.c
libvips/morphology/rank.c
libvips/morphology/countlines.c
@ -321,12 +320,6 @@ libvips/arithmetic/binary.h
libvips/arithmetic/parithmetic.h
libvips/arithmetic/statistic.h
libvips/arithmetic/hough.h
libvipsCC/include/vips/VMask.h
libvipsCC/include/vips/VImage.h
libvipsCC/include/vips/VError.h
libvipsCC/include/vips/vipscpp.h
libvipsCC/include/vips/vipsc++.h
libvipsCC/include/vips/VDisplay.h
libvips/colour/pcolour.h
libvips/conversion/pconversion.h
libvips/conversion/bandary.h
@ -396,7 +389,6 @@ libvips/include/vips/foreign.h
libvips/include/vips/transform.h
libvips/include/vips/memory.h
libvips/iofuncs/sink.h
libvips/iofuncs/base64.h
libvips/iofuncs/vipsmarshal.h
libvips/morphology/pmorphology.h
libvips/mosaicing/pmosaicing.h

View File

@ -1,5 +0,0 @@
SUBDIRS = packages
EXTRA_DIST = \
README.md

View File

@ -1,35 +0,0 @@
# vips8 binding for Python
This overrides file adds a few small helper functions to the
gobject-introspection binding for libvips. It has been tested with python2.7
and python3.4 and may work for other versions.
## Documentation
There's a chapter in the libvips API docs on these overrides, see "Using
libvips from Python".
vips-x.y.z/test has a test suite. Again, the test suite works with python2.7
and python3.4.
## Install
`libvips` need to be built and installed.
The libvips typelib, `Vips-8.0.typelib`, needs to be on your `GI_TYPELIB_PATH`. It is typically installed somewhere like `/usr/local/lib/girepository-1.0`
You need `pygobject-3.0`. To confirm that it's installed, check that your
Python `dist-packages` area has a directory called `gi`. For example:
ls /usr/lib/python2.7/dist-packages/gi
`Vips.py` needs to be in the overrides directory of your gobject-introspection
pygobject area, for example:
sudo cp Vips.py /usr/lib/python2.7/dist-packages/gi/overrides
or
sudo cp Vips.py /usr/lib/python3/dist-packages/gi/overrides
You can optionally pre-compile this file for a small speedup.

View File

@ -1,59 +0,0 @@
#!/usr/bin/python
import sys
import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
#Vips.cache_set_trace(True)
def to_polar(image):
"""Transform image coordinates to polar.
The image is transformed so that it is wrapped around a point in the
centre. Vertical straight lines become circles or segments of circles,
horizontal straight lines become radial spokes.
"""
# xy image, origin in the centre, scaled to fit image to a circle
xy = Vips.Image.xyz(image.width, image.height)
xy -= [image.width / 2.0, image.height / 2.0]
scale = min(image.width, image.height) / float(image.width)
xy *= 2.0 / scale
index = xy.polar()
# scale vertical axis to 360 degrees
index *= [1, image.height / 360.0]
return image.mapim(index)
def to_rectangular(image):
"""Transform image coordinates to rectangular.
The image is transformed so that it is unwrapped from a point in the
centre. Circles or segments of circles become vertical straight lines,
radial lines become horizontal lines.
"""
# xy image, vertical scaled to 360 degrees
xy = Vips.Image.xyz(image.width, image.height)
xy *= [1, 360.0 / image.height]
index = xy.rect()
# scale to image rect
scale = min(image.width, image.height) / float(image.width)
index *= scale / 2.0
index += [image.width / 2.0, image.height / 2.0]
return image.mapim(index)
a = Vips.Image.new_from_file(sys.argv[1])
a = to_polar(a)
a = to_rectangular(a)
a.write_to_file(sys.argv[2])

View File

@ -1,21 +0,0 @@
#!/usr/bin/python
import sys
#import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
#Vips.cache_set_trace(True)
a = Vips.Image.new_from_file(sys.argv[1])
profile = a.get_value("icc-profile-data")
with open('x.icm', 'w') as f:
f.write(profile)

View File

@ -1,205 +0,0 @@
#!/usr/bin/python
import sys
# you might need this in your .bashrc
# export GI_TYPELIB_PATH=$VIPSHOME/lib/girepository-1.0
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
print 'long way around:'
a = Vips.Image()
a.props.filename = sys.argv[1]
a.props.mode = 'r'
if a.build() != 0:
print Vips.error_buffer()
sys.exit(-1)
print 'a.get_width() =', a.get_width()
print 'a.props.width =', a.props.width
print 'via foreign load system:'
loader = Vips.Foreign.find_load(sys.argv[1])
if loader == None:
print Vips.error_buffer()
sys.exit(-1)
op = Vips.Operation.new(loader)
for prop in op.props:
print 'prop.name =', prop.name
flags = op.get_argument_flags(prop.name)
if flags & Vips.ArgumentFlags.OUTPUT:
print '\toutput'
if flags & Vips.ArgumentFlags.INPUT:
print '\tinput'
if flags & Vips.ArgumentFlags.REQUIRED:
print '\trequired'
print '\tisset', op.argument_isset(prop.name)
op.props.filename = sys.argv[1]
op2 = Vips.cache_operation_build(op)
if op2 == None:
print Vips.error_buffer()
sys.exit(-1)
b = op2.props.out
op2.unref_outputs()
print 'b.get_width() =', b.get_width()
print 'b.props.width =', b.props.width
print 'call operation:'
op = Vips.Operation.new("add")
for prop in op.props:
print 'prop.name =', prop.name
flags = op.get_argument_flags(prop.name)
if flags & Vips.ArgumentFlags.OUTPUT:
print '\toutput'
if flags & Vips.ArgumentFlags.INPUT:
print '\tinput'
if flags & Vips.ArgumentFlags.REQUIRED:
print '\trequired'
print '\tisset', op.argument_isset(prop.name)
op.props.left = a
op.props.right = b
op2 = Vips.cache_operation_build(op)
if op2 == None:
print Vips.error_buffer()
sys.exit(-1)
out = op2.props.out
op2.unref_outputs()
print 'out.get_format() =', out.get_format()
print 'out.props.format =', out.props.format
print 'save via foreign save system:'
saver = Vips.Foreign.find_save("x.v")
if saver == None:
print Vips.error_buffer()
sys.exit(-1)
op = Vips.Operation.new(saver)
for prop in op.props:
print 'prop.name =', prop.name
flags = op.get_argument_flags(prop.name)
if flags & Vips.ArgumentFlags.OUTPUT:
print '\toutput'
if flags & Vips.ArgumentFlags.INPUT:
print '\tinput'
if flags & Vips.ArgumentFlags.REQUIRED:
print '\trequired'
print '\tisset', op.argument_isset(prop.name)
setattr(op.props, "in", out)
op.props.filename = "x.v"
op2 = Vips.cache_operation_build(op)
if op2 == None:
print Vips.error_buffer()
sys.exit(-1)
op2.unref_outputs()
print 'generic call:'
def required_input(flags):
enm = Vips.ArgumentFlags
return flags & enm.INPUT and flags & enm.REQUIRED
def optional_input(flags):
enm = Vips.ArgumentFlags
return flags & enm.INPUT and not flags & enm.REQUIRED
def required_output(flags):
enm = Vips.ArgumentFlags
return flags & enm.OUTPUT and flags & enm.REQUIRED
def optional_output(flags):
enm = Vips.ArgumentFlags
return flags & enm.OUTPUT and not flags & enm.REQUIRED
def vips_call(name, *required, **optional):
op = Vips.Operation.new(name)
# set required input args
i = 0
for prop in op.props:
flags = op.get_argument_flags(prop.name)
if required_input(flags):
if i >= len(required):
print 'too few required args!'
op.props.__setattr__(prop.name, required[i])
i += 1
if i < len(required):
print 'too many required args!'
# set optional input args
for i in optional.keys():
flags = op.get_argument_flags(i)
if optional_input(flags):
op.props.__setattr__(i, optional[i])
# call
op2 = Vips.cache_operation_build(op)
if op2 == None:
print Vips.error_buffer()
# gather output args
out = []
for prop in op2.props:
flags = op2.get_argument_flags(prop.name)
if required_output(flags):
out.append(op2.props.__getattribute__(prop.name))
for i in optional.keys():
flags = op2.get_argument_flags(i)
if optional_output(flags):
out.append(op2.props.__getattribute__(i))
if len(out) == 1:
out = out[0]
# unref everything now we have refs to all outputs we want
op2.unref_outputs()
return out
im = vips_call("add", a, b)
print 'save via foreign save system:'
saver = Vips.Foreign.find_save("x2.v")
if saver == None:
print Vips.error_buffer()
sys.exit(-1)
op = Vips.Operation.new(saver)
for prop in op.props:
print 'prop.name =', prop.name
flags = op.get_argument_flags(prop.name)
if flags & Vips.ArgumentFlags.OUTPUT:
print '\toutput'
if flags & Vips.ArgumentFlags.INPUT:
print '\tinput'
if flags & Vips.ArgumentFlags.REQUIRED:
print '\trequired'
print '\tisset', op.argument_isset(prop.name)
setattr(op.props, "in", im)
op.props.filename = "x2.v"
op2 = Vips.cache_operation_build(op)
if op2 == None:
print Vips.error_buffer()
sys.exit(-1)
op2.unref_outputs()

View File

@ -1,18 +0,0 @@
#!/usr/bin/python
import sys
import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
a = Vips.Image.black(100, 100)
a = a.draw_circle(128, 50, 50, 20)
b = a.hough_circle(scale = 1, min_radius = 15, max_radius = 25)
b.write_to_file("x.v")

View File

@ -1,20 +0,0 @@
#!/usr/bin/python
import sys
#import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
a = Vips.Image.new_from_file(sys.argv[1])
ipct = a.get("ipct-data")
print "ipct = ", ipct.get()
a.remove("ipct-data")
a.write_to_file("x.jpg")

View File

@ -1,20 +0,0 @@
#!/usr/bin/python
import sys
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
im = Vips.Image.new_from_file(sys.argv[1], access = Vips.Access.SEQUENTIAL)
footer = Vips.Image.black(im.width, 150)
left_text = Vips.Image.text("left corner", dpi = 300)
right_text = Vips.Image.text("right corner", dpi = 300)
footer = footer.insert(left_text, 50, 50)
footer = footer.insert(right_text, im.width - right_text.width - 50, 50)
footer = footer.ifthenelse(0, [255, 0, 0], blend = True)
im = im.insert(footer, 0, im.height, expand = True)
im.write_to_file(sys.argv[2])

View File

@ -1,10 +0,0 @@
#!/usr/bin/python
import sys
import logging
logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips

View File

@ -1,21 +0,0 @@
#!/usr/bin/python
import sys
import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
a = Vips.Image.black(100, 100)
b = a.bandjoin(2)
b.write_to_file("x.v")
txt = Vips.Image.text("left corner", dpi = 300)
c = txt.ifthenelse(2, [0, 255, 0], blend = True)
c.write_to_file("x2.v")

View File

@ -1,17 +0,0 @@
#!/usr/bin/python
import sys
import gi
gi.require_version('Vips', '8.0')
from gi.repository import GLib, Vips
context = GLib.OptionContext(" - test python 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)

View File

@ -1,22 +0,0 @@
#!/usr/bin/python3
import sys
import logging
logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
#Vips.cache_set_trace(True)
a = Vips.Image.new_from_file(sys.argv[1])
x = a.erode([[128, 255, 128],
[255, 255, 255],
[128, 255, 128]])
x.write_to_file(sys.argv[2])

View File

@ -1,20 +0,0 @@
#!/usr/bin/python3
import sys
import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
#Vips.cache_set_trace(True)
a = Vips.Image.new_from_file(sys.argv[1])
a = a[1:]
a.write_to_file(sys.argv[2])

View File

@ -1,35 +0,0 @@
#!/usr/bin/python
import logging
logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
Vips.cache_set_trace(True)
try:
a = Vips.Image.new_from_file("/home/john/pics/babe.poop")
except Vips.Error, e:
print e
a = Vips.Image.new_from_file("/home/john/pics/babe.jpg")
b = Vips.Image.new_from_file("/home/john/pics/k2.jpg")
print 'a =', a
print 'b =', b
out = Vips.call("add", a, b)
print 'out =', out
out = a.add(b)
print 'out =', out
ones = Vips.ArrayDouble.new([1])
twos = Vips.ArrayDouble.new([2])
out = out.linear(ones, twos)
out.write_to_file("x.v")

View File

@ -1,17 +0,0 @@
#!/usr/bin/python
import sys
#import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
Vips.cache_set_trace(True)
a = Vips.Image.new_from_file(sys.argv[1])
print a.max()
print a.max()

View File

@ -1,22 +0,0 @@
#!/usr/bin/python
import sys
#import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
a = Vips.Image.new_from_file(sys.argv[1])
b = Vips.Image.new_from_file(sys.argv[2])
c = a.join(b, Vips.Direction.HORIZONTAL,
expand = True,
shim = 100,
align = Vips.Align.CENTRE,
background = [128, 255, 128])
c.write_to_file(sys.argv[3])

View File

@ -1,104 +0,0 @@
#!/usr/bin/python
import sys
#import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
a = Vips.Image.new_from_file(sys.argv[1])
def should_equal(test, a, b):
if abs(a - b) > 0.01:
print '%s: seen %g and %g' % (test, a, b)
sys.exit(1)
def bandsplit(a):
return [a.extract_band(i) for i in range(0, a.bands)]
# test operator overloads
# addition
b = a + 12
should_equal('add constant', a.avg() + 12, b.avg())
b = a + [12, 0, 0]
x = map (lambda x: x.avg()) bandsplit(a)
y = map (lambda x: x.avg()) bandsplit(b)
x[0] += 12
should_equal('add multiband constant', sum(x), sum(y))
b = a + [12, 0, 0]
b = a + b
b = 12 + a
b = [12, 0, 0] + a
b = a - 12
b = a - [12, 0, 0]
b = a - b
b = 12 - a
b = [12, 0, 0] - a
b = a * 12
b = a * [12, 1, 1]
b = a * b
b = 12 * a
b = [12, 1, 1] * a
b = a / 12
b = a / [12, 1, 1]
b = 12 / a
b = [12, 1, 1] / a
b = a / b
b = a // 12
b = a // [12, 1, 1]
b = 12 // a
b = [12, 1, 1] // a
b = a // b
b = a % 12
b = a % [12, 1, 1]
b = a % b
b = a ** 12
b = a ** [12, 1, 1]
b = 12 ** a
b = [12, 1, 1] ** a
b = a ** b
b = a << 12
b = a << [12, 1, 1]
b = a << b
b = a >> 12
b = a >> [12, 1, 1]
b = a >> b
b = a & 12
b = a & [12, 1, 1]
b = 12 & a
b = [12, 1, 1] & a
b = a & b
b = a | 12
b = a | [12, 1, 1]
b = 12 | a
b = [12, 1, 1] | a
b = a | b
b = a ^ 12
b = a ^ [12, 1, 1]
b = 12 ^ a
b = [12, 1, 1] ^ a
b = a ^ b
b = -a
b = +a
b = abs(a)
b = ~a

View File

@ -1,16 +0,0 @@
#!/usr/bin/python
import sys
#import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
a = Vips.Image.new_from_file(sys.argv[1])
b = a.write_to_buffer(".jpg")
c = Vips.Image.new_from_buffer(b, "")

View File

@ -1,18 +0,0 @@
#!/usr/bin/python
import sys
#import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
a = Vips.Image.new_from_file(sys.argv[1])
b = a.write_to_memory()
c = Vips.Image.new_from_memory(b, a.width, a.height, a.bands, a.bandfmt)
c.write_to_file("x.v")

View File

@ -1,17 +0,0 @@
#!/usr/bin/python
import sys
#import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
a = Vips.Image.new_from_array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 8, 128)
print 'scale =', a.get('scale')
print 'offset =', a.get('offset')
a.write_to_file("x.v")

View File

@ -1,14 +0,0 @@
#!/usr/bin/python
import sys
import logging
logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
a = Vips.Image.black(100, 100)
a.write_to_file("x.v")

View File

@ -1,59 +0,0 @@
#!/usr/bin/python
import sys
import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips, GObject
# Search for all VipsOperation which don't have an input image object ... these
# should be class methods and need to have their names pasted into Vips.py
# This is slow :-( so we don't do this dynamically
vips_type_image = GObject.GType.from_name("VipsImage")
vips_type_operation = GObject.GType.from_name("VipsOperation")
def find_class_methods(cls):
names = set()
if not cls.is_abstract():
op = Vips.Operation.new(cls.name)
found = False
for prop in op.props:
flags = op.get_argument_flags(prop.name)
if not flags & Vips.ArgumentFlags.INPUT:
continue
if not flags & Vips.ArgumentFlags.REQUIRED:
continue
if GObject.type_is_a(vips_type_image, prop.value_type):
found = True
break
if not found:
gtype = Vips.type_find("VipsOperation", cls.name)
names.add(Vips.nickname_find(gtype))
if len(cls.children) > 0:
for child in cls.children:
# not easy to get at the deprecated flag in an abtract type?
if cls.name != 'VipsWrap7':
names.update(find_class_methods(child))
return names
print 'found class methods:'
names = find_class_methods(vips_type_operation)
# filter out things we know we should not wrap
names -= set(["bandjoin", "bandrank"])
names = list(names)
names.sort()
for name in names:
print ' "%s",' % name

View File

@ -1 +0,0 @@
SUBDIRS = gi

View File

@ -1,5 +0,0 @@
SUBDIRS = overrides
EXTRA_DIST = \
__init__.py

View File

@ -1,3 +0,0 @@
# support overrides in different directories than our gi module
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,5 +0,0 @@
vips_overridesdir = $(pyexecdir)/gi/overrides
vips_overrides_PYTHON = Vips.py
EXTRA_DIST = \
__init__.py

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
# support overrides in different directories than our gi module
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,5 +0,0 @@
SUBDIRS = \
vipsCC
EXTRA_DIST = \
README.txt

View File

@ -1,3 +0,0 @@
This is the old vips7 Python binding. Use the vips8 one in preference for new
projects.

View File

@ -1,58 +0,0 @@
# Let make substitute the value of PYTHON_INCLUDES rather than auto*
# this makes it easier to support multiple python installs
AM_CPPFLAGS = \
-I${top_srcdir}/libvips/include \
-I${top_srcdir}/libvipsCC/include \
@VIPS_CFLAGS@ \
@VIPS_INCLUDES@ \
$(PYTHON_INCLUDES)
# we install to a directory inside the python area, since we are a module
vipsccdir = $(pyexecdir)/vipsCC
vipscc_PYTHON = VImage.py VDisplay.py VError.py VMask.py __init__.py
# I tried making a suffix rule for this (and defining SUFFIXES) but I couldn't
# get it to work, how annoying
# FIXME at some point
#
# need an expanded VImage.h ... SWIG's preprocessor b0rks on includes inside
# class definitions
vimagemodule.cxx: VImage.i
cpp -DSWIG -E $(top_srcdir)/libvipsCC/include/vips/VImage.h > VImage.h
swig -python -c++ -interface $(@:.cxx=) -I$(top_srcdir)/libvipsCC/include -o $@ $<
vdisplaymodule.cxx: VDisplay.i
swig -python -c++ -interface $(@:.cxx=) -I$(top_srcdir)/libvipsCC/include -o $@ $<
verrormodule.cxx: VError.i
swig -python -c++ -interface $(@:.cxx=) -I$(top_srcdir)/libvipsCC/include -o $@ $<
vmaskmodule.cxx: VMask.i
swig -python -c++ -interface $(@:.cxx=) -I$(top_srcdir)/libvipsCC/include -o $@ $<
vipscc_LTLIBRARIES = vimagemodule.la vdisplaymodule.la verrormodule.la vmaskmodule.la
# maybe there's a clever way to avoid repeating the link stuff 4 times
# vimagemodule uses the C API as well, so it needs libvips too
vimagemodule_la_LDFLAGS = -module -avoid-version
vimagemodule_la_LIBADD = ../../libvipsCC/libvipsCC.la ../../libvips/libvips.la $(VIPS_LIBS)
nodist_vimagemodule_la_SOURCES = vimagemodule.cxx
vdisplaymodule_la_LDFLAGS = -module -avoid-version
vdisplaymodule_la_LIBADD = ../../libvipsCC/libvipsCC.la $(VIPS_LIBS)
nodist_vdisplaymodule_la_SOURCES = vdisplaymodule.cxx
verrormodule_la_LDFLAGS = -module -avoid-version
verrormodule_la_LIBADD = ../../libvipsCC/libvipsCC.la $(VIPS_LIBS)
nodist_verrormodule_la_SOURCES = verrormodule.cxx
vmaskmodule_la_LDFLAGS = -module -avoid-version
vmaskmodule_la_LIBADD = ../../libvipsCC/libvipsCC.la $(VIPS_LIBS)
nodist_vmaskmodule_la_SOURCES = vmaskmodule.cxx
CLEANFILES = VImage.h
EXTRA_DIST = \
VImage.i VDisplay.i VError.i VMask.i __init__.py \
vimagemodule.cxx \
verrormodule.cxx vdisplaymodule.cxx vmaskmodule.cxx \
VImage.py VDisplay.py VError.py VMask.py

View File

@ -1,15 +0,0 @@
/* SWIG interface file for VDisplay.
*/
%module VDisplay
%{
#include <vips/vipscpp.h>
%}
%import "VError.i"
/* Need to override assignment to get refcounting working.
*/
%rename(__assign__) *::operator=;
%include vips/VDisplay.h

View File

@ -1,19 +0,0 @@
/* SWIG interface file for VError.
*/
%module VError
%{
#include <vips/vipscpp.h>
%}
%include "std_except.i"
%include "std_string.i"
%include vips/VError.h
%extend vips::VError {
const char *__str__ () {
return $self->what ();
}
}

View File

@ -1,381 +0,0 @@
/* SWIG interface file for vipsCC7
*
* 5/9/07
* - use g_option_context_set_ignore_unknown_options() so we don't fail
* on unrecognied -args (thanks Simon)
* 3/8/08
* - add .tobuffer() / .frombuffer (), .tostring (), .fromstring ()
* methods
* - add PIL_mode_from_vips () and vips_from_PIL_mode () utility
* functions
* 6/11/09
* - arg, std::vector<vips::VImage> was missing the "vips::"
*/
%module VImage
%{
#include <vips/vipscpp.h>
/* We need the C API too for the args init and some of the
* frombuffer/tobuffer stuff.
*/
#include <vips/vips.h>
#include <vips/vips7compat.h>
%}
/* Need to override assignment to get refcounting working.
*/
%rename(__assign__) vips::VImage::operator=;
%include "std_list.i"
%include "std_complex.i"
%include "std_vector.i"
%include "std_except.i"
%include "std_string.i"
%include "cstring.i"
%include "typemaps.i"
%import "VError.i"
%import "VMask.i"
%import "VDisplay.i"
namespace std {
%template(IntVector) vector<int>;
%template(DoubleVector) vector<double>;
%template(ImageVector) vector<vips::VImage>;
}
/* To get image data to and from VImage (eg. when interfacing with PIL) we
* need to be able to import and export Python buffer() objects. Add new
* methods to construct from and return pointer/length pairs, then wrap them
* ourselves with a couple of typemaps.
*/
%{
struct VBuffer {
void *data;
size_t size;
};
%}
%typemap (out) VBuffer {
$result = PyBuffer_FromMemory ($1.data, $1.size);
}
%typemap (in) VBuffer {
const char *buffer;
Py_ssize_t buffer_len;
if (PyObject_AsCharBuffer ($input, &buffer, &buffer_len) == -1) {
PyErr_SetString (PyExc_TypeError,"Type error. Unable to get char pointer from buffer");
return NULL;
}
$1.data = (void *) buffer;
$1.size = buffer_len;
}
/* Functions which return extra values though their parameters need special
* typemaps.
*/
// double maxpos_avg( double& maxpos_avg_y, double& maxpos_avg_out )
%apply double *OUTPUT { double & maxpos_avg_y };
%apply double *OUTPUT { double & maxpos_avg_out };
// VImage system_image( char* system_image_in_format, char* system_image_out_format, char* system_image_command, char*& system_image_log )
%cstring_output_allocate(char **system_image_log, g_free(*$1));
// VImage segment( int& segment_segments )
%apply int *OUTPUT { int & segment_segments };
// VImage project( VImage& project_vout ) throw( VError );
// nope ... not sure how to handle this one
//%apply VImage *OUTPUT { VImage & project_vout };
// VImage label_regions( int& label_regions_segments )
%apply int *OUTPUT { int & label_regions_segments };
// double correl( VImage correl_sec, int correl_xref, int correl_yref, int correl_xsec, int correl_ysec, int correl_hwindowsize, int correl_hsearchsize, int& correl_x, int& correl_y )
%apply int *OUTPUT { int & correl_x };
%apply int *OUTPUT { int & correl_y };
// int _find_lroverlap( VImage _find_lroverlap_sec, int _find_lroverlap_bandno, int _find_lroverlap_xr, int _find_lroverlap_yr, int _find_lroverlap_xs, int _find_lroverlap_ys, int _find_lroverlap_halfcorrelation, int _find_lroverlap_halfarea, int& _find_lroverlap_dy0, double& _find_lroverlap_scale1, double& _find_lroverlap_angle1, double& _find_lroverlap_dx1, double& _find_lroverlap_dy1 )
%apply int *OUTPUT { int & _find_lroverlap_dy0 };
%apply double *OUTPUT { double & _find_lroverlap_scale1 };
%apply double *OUTPUT { double & _find_lroverlap_angle1 };
%apply double *OUTPUT { double & _find_lroverlap_dx1 };
%apply double *OUTPUT { double & _find_lroverlap_dy1 };
// int _find_tboverlap( VImage _find_tboverlap_sec, int _find_tboverlap_bandno, int _find_tboverlap_xr, int _find_tboverlap_yr, int _find_tboverlap_xs, int _find_tboverlap_ys, int _find_tboverlap_halfcorrelation, int _find_tboverlap_halfarea, int& _find_tboverlap_dy0, double& _find_tboverlap_scale1, double& _find_tboverlap_angle1, double& _find_tboverlap_dx1, double& _find_tboverlap_dy1 )
%apply int *OUTPUT { int & _find_tboverlap_dy0 };
%apply double *OUTPUT { double & _find_tboverlap_scale1 };
%apply double *OUTPUT { double & _find_tboverlap_angle1 };
%apply double *OUTPUT { double & _find_tboverlap_dx1 };
%apply double *OUTPUT { double & _find_tboverlap_dy1 };
// double maxpos_subpel( double& maxpos_subpel_y )
%apply double *OUTPUT { double & maxpos_subpel_y };
/* Need the expanded VImage.h in this directory, rather than the usual
* vips/VImage.h. SWIG b0rks on #include inside class definitions.
*/
%include VImage.h
%extend vips::VImage {
public:
VBuffer tobuffer () throw (VError)
{
VBuffer buffer;
buffer.data = $self->data ();
buffer.size = (size_t) $self->Xsize () * $self->Ysize () *
IM_IMAGE_SIZEOF_PEL ($self->image ());
return buffer;
}
static VImage frombuffer (VBuffer buffer, int width, int height,
int bands, TBandFmt format) throw (VError)
{
return VImage (buffer.data, width, height, bands, format);
}
%cstring_output_allocate_size (char **buffer, int *buffer_len, im_free (*$1))
void tostring (char **buffer, int *buffer_len) throw (VError)
{
void *vips_memory;
/* Eval the vips image first. This may throw an exception and we want to
* make sure we do this before we try to malloc() space for the copy.
*/
vips_memory = $self->data ();
/* We have to copy the image data to make a string that Python can
* manage. Use frombuffer() / tobuffer () if you want to avoid the copy
* and manage memory lifetime yourself.
*/
*buffer_len = (size_t) $self->Xsize () * $self->Ysize () *
IM_IMAGE_SIZEOF_PEL ($self->image ());
if (!(*buffer = (char *) im_malloc (NULL, *buffer_len)))
verror ("Unable to allocate memory for image copy.");
memcpy (*buffer, vips_memory, *buffer_len);
}
static VImage fromstring (std::string buffer, int width, int height,
int bands, TBandFmt format) throw (VError)
{
void *vips_memory;
VImage result;
/* We have to copy the string, then add a callback to the VImage to free
* it when we free the VImage. Use frombuffer() / tobuffer () if you want
* to avoid the copy and manage memory lifetime yourself.
*/
if (!(vips_memory = im_malloc (NULL, buffer.length ())))
verror ("Unable to allocate memory for image copy.");
/* We have to use .c_str () since the string may not be contiguous.
*/
memcpy (vips_memory, buffer.c_str (), buffer.length ());
result = VImage (vips_memory, width, height, bands, format);
if (im_add_close_callback (result.image (),
(im_callback_fn) im_free, vips_memory, NULL))
verror ();
return result;
}
}
%pythoncode %{
# try to guess a PIL mode string from a VIPS image
def PIL_mode_from_vips (vim):
if vim.Bands () == 3 and vim.BandFmt () == VImage.FMTUCHAR:
return 'RGB'
elif vim.Bands () == 4 and vim.BandFmt () == VImage.FMTUCHAR and vim.Type () == VImage.RGB:
return 'RGBA'
elif vim.Bands () == 4 and vim.BandFmt () == VImage.FMTUCHAR and vim.Type () == VImage.CMYK:
return 'CMYK'
elif vim.Bands () == 1 and vim.BandFmt () == VImage.FMTUCHAR:
return 'L'
elif vim.Bands () == 1 and vim.BandFmt () == VImage.FMTINT:
return 'I'
elif vim.Bands () == 1 and vim.BandFmt () == VImage.FMTFLOAT:
return 'F'
elif vim.Bands () == 2 and vim.BandFmt () == VImage.FMTUCHAR:
return 'LA'
else:
raise ValueError ('unsupported vips -> pil image')
# return vips (bands, format, type) for a PIL mode
def vips_from_PIL_mode (mode):
if mode == 'RGB':
return (3, VImage.FMTUCHAR, VImage.RGB)
elif mode == 'RGBA':
return (4, VImage.FMTUCHAR, VImage.RGB)
elif mode == 'CMYK':
return (4, VImage.FMTUCHAR, VImage.CMYK)
elif mode == 'L':
return (1, VImage.FMTUCHAR, VImage.B_W)
elif mode == 'I':
return (1, VImage.FMTINT, VImage.B_W)
elif mode == 'F':
return (1, VImage.FMTFLOAT, VImage.B_W)
elif mode == 'LA':
return (2, VImage.FMTUCHAR, VImage.B_W)
else:
raise ValueError ('unsupported pil -> vips image')
%}
/* Helper code for vips_init().
*/
%{
/* Turn on to print args.
#define DEBUG
*/
/* Command-line args during parse.
*/
typedef struct _Args {
/* The n strings we alloc when we get from Python.
*/
int n;
char **str;
/* argc/argv as processed by us.
*/
int argc;
char **argv;
} Args;
#ifdef DEBUG
static void
args_print (Args *args)
{
int i;
printf ("args_print: argc = %d\n", args->argc);
// +1 so we print the trailing NULL too
for (i = 0; i < args->argc + 1; i++)
printf ("\t%2d)\t%s\n", i, args->argv[i]);
}
#endif /*DEBUG*/
static void
args_free (Args *args)
{
int i;
for (i = 0; i < args->n; i++)
IM_FREE (args->str[i]);
args->n = 0;
args->argc = 0;
IM_FREE (args->str);
IM_FREE (args->argv);
IM_FREE (args);
}
/* Get argv/argc from python.
*/
static Args *
args_new (void)
{
Args *args;
PyObject *av;
int i;
int n;
args = g_new (Args, 1);
args->n = 0;
args->str = NULL;
args->argc = 0;
args->argv = NULL;
if (!(av = PySys_GetObject ((char *) "argv")))
return (args);
if (!PyList_Check (av)) {
PyErr_Warn (PyExc_Warning, "ignoring sys.argv: "
"it must be a list of strings");
return args;
}
n = PyList_Size (av);
args->str = g_new (char *, n);
for (i = 0; i < n; i++)
args->str[i] = g_strdup (PyString_AsString (PyList_GetItem (av, i)));
args->n = n;
/* +1 for NULL termination.
*/
args->argc = n;
args->argv = g_new (char *, n + 1);
for (i = 0; i < n; i++)
args->argv[i] = args->str[i];
args->argv[i] = NULL;
return args;
}
static void
vips_fatal (const char *msg)
{
char buf[256];
im_snprintf (buf, 256, "%s\n%s", msg, im_error_buffer());
im_error_clear ();
Py_FatalError (buf);
}
%}
%init %{
{
Args *args;
args = args_new ();
#ifdef DEBUG
printf ("on startup:\n");
args_print (args);
#endif /*DEBUG*/
if (im_init_world (args->argv[0])) {
args_free (args);
vips_fatal ("can't initialise module vips");
}
/* Now parse any GOptions.
*/
GError *error = NULL;
GOptionContext *context;
context = g_option_context_new ("- vips");
g_option_context_add_group (context, im_get_option_group());
g_option_context_set_ignore_unknown_options (context, TRUE);
if (!g_option_context_parse (context,
&args->argc, &args->argv, &error)) {
g_option_context_free (context);
args_free (args);
im_error ("vipsmodule", "%s", error->message);
g_error_free (error);
vips_fatal ("can't initialise module vips");
}
g_option_context_free (context);
#ifdef DEBUG
printf ("after parse:\n");
args_print (args);
#endif /*DEBUG*/
// Write (possibly) modified argc/argv back again.
if (args->argv)
PySys_SetArgv (args->argc, args->argv);
args_free (args);
}
%}

View File

@ -1,35 +0,0 @@
/* SWIG interface file for VMask.
*/
%module VMask
%{
#include <stdexcept>
#include <vips/vipscpp.h>
%}
%import "VError.i"
%import "VImage.i"
/* Need to override assignment to get refcounting working.
*/
%rename(__assign__) *::operator=;
/* [] is array subscript, as you'd expect.
*/
%rename(__index__) vips::VIMask::operator[];
%rename(__index__) vips::VDMask::operator[];
/* () is 2d array subscript, how odd!
*/
%rename(__call__) vips::VIMask::operator();
%rename(__call__) vips::VDMask::operator();
/* Type conversion operators renamed as functions.
*/
%rename(convert_VImage) vips::VIMask::operator vips::VImage;
%rename(convert_VImage) vips::VDMask::operator vips::VImage;
%rename(convert_VIMask) vips::VDMask::operator vips::VIMask;
%rename(convert_VDMask) vips::VIMask::operator vips::VDMask;
%include vips/VMask.h

View File

@ -1 +0,0 @@
__all__=["VImage","VMask","VError","VDisplay"]