diff --git a/ChangeLog b/ChangeLog index 077a40f9..fbd6b7a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/Makefile.am b/Makefile.am index 90f7e96e..bc579da4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/README.md b/README.md index 1d83be7f..565374fb 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/configure.ac b/configure.ac index e8316158..bdc86b64 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/cplusplus/include/vips/Makefile.am b/cplusplus/include/vips/Makefile.am index dcb3d8fd..36ea1eb3 100644 --- a/cplusplus/include/vips/Makefile.am +++ b/cplusplus/include/vips/Makefile.am @@ -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 diff --git a/libvipsCC/Makefile.am b/libvipsCC/Makefile.am deleted file mode 100644 index 0051f1f0..00000000 --- a/libvipsCC/Makefile.am +++ /dev/null @@ -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 diff --git a/libvipsCC/README.txt b/libvipsCC/README.txt deleted file mode 100644 index a596bba4..00000000 --- a/libvipsCC/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -This is the old vips7 C++ API. Use the vips8 one in preference for new -projects. - diff --git a/libvipsCC/VDisplay.cc b/libvipsCC/VDisplay.cc deleted file mode 100644 index c414e778..00000000 --- a/libvipsCC/VDisplay.cc +++ /dev/null @@ -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 -#endif /*HAVE_CONFIG_H*/ -#include - -#include -#include - -#include -#include -#include - -#include - -#ifdef WITH_DMALLOC -#include -#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 - diff --git a/libvipsCC/VError.cc b/libvipsCC/VError.cc deleted file mode 100644 index 5081f672..00000000 --- a/libvipsCC/VError.cc +++ /dev/null @@ -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 -#endif /*HAVE_CONFIG_H*/ -#include - -#include -#include - -#include - -#include -#include - -#include - -#ifdef WITH_DMALLOC -#include -#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 diff --git a/libvipsCC/VImage.cc b/libvipsCC/VImage.cc deleted file mode 100644 index 0eaa61ea..00000000 --- a/libvipsCC/VImage.cc +++ /dev/null @@ -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 -#endif /*HAVE_CONFIG_H*/ -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include - -#ifdef WITH_DMALLOC -#include -#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::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::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::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 diff --git a/libvipsCC/VMask.cc b/libvipsCC/VMask.cc deleted file mode 100644 index 573776d2..00000000 --- a/libvipsCC/VMask.cc +++ /dev/null @@ -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 -#endif /*HAVE_CONFIG_H*/ -#include - -#include -#include - -#include -#include - -#include - -#ifdef WITH_DMALLOC -#include -#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 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 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 diff --git a/libvipsCC/include/Makefile.am b/libvipsCC/include/Makefile.am deleted file mode 100644 index 227a7696..00000000 --- a/libvipsCC/include/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ - -SUBDIRS = vips diff --git a/libvipsCC/include/vips/Makefile.am b/libvipsCC/include/vips/Makefile.am deleted file mode 100644 index a37601e9..00000000 --- a/libvipsCC/include/vips/Makefile.am +++ /dev/null @@ -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 diff --git a/libvipsCC/include/vips/VDisplay.h b/libvipsCC/include/vips/VDisplay.h deleted file mode 100644 index 9beeba77..00000000 --- a/libvipsCC/include/vips/VDisplay.h +++ /dev/null @@ -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*/ diff --git a/libvipsCC/include/vips/VError.h b/libvipsCC/include/vips/VError.h deleted file mode 100644 index c062c335..00000000 --- a/libvipsCC/include/vips/VError.h +++ /dev/null @@ -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 -# include -# include -#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*/ diff --git a/libvipsCC/include/vips/VImage.h b/libvipsCC/include/vips/VImage.h deleted file mode 100644 index b1a1ed02..00000000 --- a/libvipsCC/include/vips/VImage.h +++ /dev/null @@ -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 -# include -# include -#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 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 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*/ diff --git a/libvipsCC/include/vips/VMask.h b/libvipsCC/include/vips/VMask.h deleted file mode 100644 index c60a9644..00000000 --- a/libvipsCC/include/vips/VMask.h +++ /dev/null @@ -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 -# include -# include -#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 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 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 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 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 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 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*/ diff --git a/libvipsCC/include/vips/vips b/libvipsCC/include/vips/vips deleted file mode 100644 index 3ded4f9a..00000000 --- a/libvipsCC/include/vips/vips +++ /dev/null @@ -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 - -// VImage.h uses GValue for metadata -#include - -/* 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 -#include -#include -#include - -#endif /*IM_VIPS*/ diff --git a/libvipsCC/include/vips/vipsc++.h b/libvipsCC/include/vips/vipsc++.h deleted file mode 100644 index aa9fc70e..00000000 --- a/libvipsCC/include/vips/vipsc++.h +++ /dev/null @@ -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 expn_v ); -VImage exp(); -VImage floor(); -VImage invert(); -VImage lin( double lin_a, double lin_b ); -static VImage linreg( std::vector linreg_ins, std::vector linreg_xs ); -VImage lin( std::vector lin_a, std::vector lin_b ); -VImage log10(); -VImage log(); -double max(); -std::complex 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 minpos(); -VImage multiply( VImage multiply_in2 ); -VImage pow( double pow_x ); -VImage pow( std::vector pow_v ); -VImage recomb( VDMask recomb_matrix ); -VImage remainder( VImage remainder_in2 ); -VImage remainder( double remainder_x ); -VImage remainder( std::vector 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 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 insert_x, std::vector 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 flood_copy_ink ); -VImage flood_blob_copy( int flood_blob_copy_start_x, int flood_blob_copy_start_y, std::vector 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 insertplace_x, std::vector 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 andimage_vec ); -VImage orimage( VImage orimage_in2 ); -VImage orimage( int orimage_c ); -VImage orimage( std::vector orimage_vec ); -VImage eorimage( VImage eorimage_in2 ); -VImage eorimage( int eorimage_c ); -VImage eorimage( std::vector eorimage_vec ); -VImage shiftleft( std::vector shiftleft_vec ); -VImage shiftleft( int shiftleft_c ); -VImage shiftright( std::vector shiftright_vec ); -VImage shiftright( int shiftright_c ); -VImage blend( VImage blend_in1, VImage blend_in2 ); -VImage equal( VImage equal_in2 ); -VImage equal( std::vector equal_vec ); -VImage equal( double equal_c ); -VImage ifthenelse( VImage ifthenelse_in1, VImage ifthenelse_in2 ); -VImage less( VImage less_in2 ); -VImage less( std::vector less_vec ); -VImage less( double less_c ); -VImage lesseq( VImage lesseq_in2 ); -VImage lesseq( std::vector lesseq_vec ); -VImage lesseq( double lesseq_c ); -VImage more( VImage more_in2 ); -VImage more( std::vector more_vec ); -VImage more( double more_c ); -VImage moreeq( VImage moreeq_in2 ); -VImage moreeq( std::vector moreeq_vec ); -VImage moreeq( double moreeq_c ); -VImage notequal( VImage notequal_in2 ); -VImage notequal( std::vector 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 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 draw_rect_ink ); -void draw_line( int draw_line_x1, int draw_line_y1, int draw_line_x2, int draw_line_y2, std::vector draw_line_ink ); -void draw_point( int draw_point_x, int draw_point_y, std::vector 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 draw_flood_ink ); -void draw_flood_blob( int draw_flood_blob_x, int draw_flood_blob_y, std::vector 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 draw_mask_ink ); -VImage line( VImage line_mask, VImage line_ink, std::vector line_x1, std::vector line_y1, std::vector line_x2, std::vector 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 rank_image_in, int rank_image_index ); -static VImage maxvalue( std::vector 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 ); - diff --git a/libvipsCC/include/vips/vipscpp.h b/libvipsCC/include/vips/vipscpp.h deleted file mode 100644 index faff9231..00000000 --- a/libvipsCC/include/vips/vipscpp.h +++ /dev/null @@ -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 - -using namespace vips; - -#endif /*IM_VIPSCPP_H*/ diff --git a/libvipsCC/vipsc++.cc b/libvipsCC/vipsc++.cc deleted file mode 100644 index 73e81c84..00000000 --- a/libvipsCC/vipsc++.cc +++ /dev/null @@ -1,6220 +0,0 @@ - -// bodies for package arithmetic -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_abs: absolute value -VImage VImage::abs() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_abs" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_acostra: acos of image (result in degrees) -VImage VImage::acos() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_acostra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_add: add two images -VImage VImage::add( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_add" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_asintra: asin of image (result in degrees) -VImage VImage::asin() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_asintra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_atantra: atan of image (result in degrees) -VImage VImage::atan() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_atantra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_avg: average value of image -double VImage::avg() -{ - VImage in = *this; - double value; - - Vargv _vec( "im_avg" ); - - _vec.data(0) = in.image(); - _vec.call(); - value = *((double*)_vec.data(1)); - - return( value ); -} - -// im_point: interpolate value at single point -double VImage::point( char* interpolate, double x, double y, int band ) -{ - VImage in = *this; - double out; - - Vargv _vec( "im_point" ); - - _vec.data(0) = in.image(); - if( vips__input_interpolate_init( &_vec.data(1), interpolate ) ) - verror(); - *((double*) _vec.data(2)) = x; - *((double*) _vec.data(3)) = y; - *((int*) _vec.data(4)) = band; - _vec.call(); - out = *((double*)_vec.data(5)); - - return( out ); -} - -// im_point_bilinear: interpolate value at single point, linearly -double VImage::point_bilinear( double x, double y, int band ) -{ - VImage in = *this; - double val; - - Vargv _vec( "im_point_bilinear" ); - - _vec.data(0) = in.image(); - *((double*) _vec.data(1)) = x; - *((double*) _vec.data(2)) = y; - *((int*) _vec.data(3)) = band; - _vec.call(); - val = *((double*)_vec.data(4)); - - return( val ); -} - -// im_bandmean: average image bands -VImage VImage::bandmean() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_bandmean" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_ceil: round to smallest integer value not less than -VImage VImage::ceil() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_ceil" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_costra: cos of image (angles in degrees) -VImage VImage::cos() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_costra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_cross_phase: phase of cross power spectrum of two complex images -VImage VImage::cross_phase( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_cross_phase" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_deviate: standard deviation of image -double VImage::deviate() -{ - VImage in = *this; - double value; - - Vargv _vec( "im_deviate" ); - - _vec.data(0) = in.image(); - _vec.call(); - value = *((double*)_vec.data(1)); - - return( value ); -} - -// im_divide: divide two images -VImage VImage::divide( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_divide" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_exp10tra: 10^pel of image -VImage VImage::exp10() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_exp10tra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_expntra: x^pel of image -VImage VImage::expn( double x ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_expntra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = x; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_expntra_vec: [x,y,z]^pel of image -VImage VImage::expn( std::vector v ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_expntra_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = v.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[v.size()]; - for( unsigned int i = 0; i < v.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = v[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_exptra: e^pel of image -VImage VImage::exp() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_exptra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_floor: round to largest integer value not greater than -VImage VImage::floor() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_floor" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_invert: photographic negative -VImage VImage::invert() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_invert" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_lintra: calculate a*in + b = outfile -VImage VImage::lin( double a, double b ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_lintra" ); - - *((double*) _vec.data(0)) = a; - _vec.data(1) = in.image(); - *((double*) _vec.data(2)) = b; - _vec.data(3) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_linreg: pixelwise linear regression -VImage VImage::linreg( std::vector ins, std::vector xs ) -{ - VImage out; - - Vargv _vec( "im_linreg" ); - - ((im_imagevec_object*) _vec.data(0))->n = ins.size(); - ((im_imagevec_object*) _vec.data(0))->vec = new IMAGE *[ins.size()]; - for( unsigned int i = 0; i < ins.size(); i++ ) - ((im_imagevec_object*) _vec.data(0))->vec[i] = ins[i].image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = xs.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[xs.size()]; - for( unsigned int i = 0; i < xs.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = xs[i]; - _vec.call(); - for( unsigned int i = 0; i < ins.size(); i++ ) - out._ref->addref( ins[i]._ref ); - - return( out ); -} - -// im_lintra_vec: calculate a*in + b -> out, a and b vectors -VImage VImage::lin( std::vector a, std::vector b ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_lintra_vec" ); - - ((im_doublevec_object*) _vec.data(0))->n = a.size(); - ((im_doublevec_object*) _vec.data(0))->vec = new double[a.size()]; - for( unsigned int i = 0; i < a.size(); i++ ) - ((im_doublevec_object*) _vec.data(0))->vec[i] = a[i]; - _vec.data(1) = in.image(); - ((im_doublevec_object*) _vec.data(2))->n = b.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[b.size()]; - for( unsigned int i = 0; i < b.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = b[i]; - _vec.data(3) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_log10tra: log10 of image -VImage VImage::log10() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_log10tra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_logtra: ln of image -VImage VImage::log() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_logtra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_max: maximum value of image -double VImage::max() -{ - VImage in = *this; - double value; - - Vargv _vec( "im_max" ); - - _vec.data(0) = in.image(); - _vec.call(); - value = *((double*)_vec.data(1)); - - return( value ); -} - -// im_maxpos: position of maximum value of image -std::complex VImage::maxpos() -{ - VImage in = *this; - std::complex position; - - Vargv _vec( "im_maxpos" ); - - _vec.data(0) = in.image(); - _vec.call(); - position = *((std::complex*)_vec.data(1)); - - return( position ); -} - -// im_maxpos_avg: position of maximum value of image, averaging in case of draw -double VImage::maxpos_avg( double& y, double& out ) -{ - VImage in = *this; - double x; - - Vargv _vec( "im_maxpos_avg" ); - - _vec.data(0) = in.image(); - _vec.call(); - x = *((double*)_vec.data(1)); - y = *((double*)_vec.data(2)); - out = *((double*)_vec.data(3)); - - return( x ); -} - -// im_measure: measure averages of a grid of patches -VDMask VImage::measure( int x, int y, int w, int h, int h_patches, int v_patches ) -{ - VImage in = *this; - VDMask mask; - - Vargv _vec( "im_measure" ); - - _vec.data(0) = in.image(); - ((im_mask_object*) _vec.data(1))->name = (char*)"noname"; - *((int*) _vec.data(2)) = x; - *((int*) _vec.data(3)) = y; - *((int*) _vec.data(4)) = w; - *((int*) _vec.data(5)) = h; - *((int*) _vec.data(6)) = h_patches; - *((int*) _vec.data(7)) = v_patches; - _vec.call(); - mask.embed( (DOUBLEMASK *)((im_mask_object*)_vec.data(1))->mask ); - - return( mask ); -} - -// im_min: minimum value of image -double VImage::min() -{ - VImage in = *this; - double value; - - Vargv _vec( "im_min" ); - - _vec.data(0) = in.image(); - _vec.call(); - value = *((double*)_vec.data(1)); - - return( value ); -} - -// im_minpos: position of minimum value of image -std::complex VImage::minpos() -{ - VImage in = *this; - std::complex position; - - Vargv _vec( "im_minpos" ); - - _vec.data(0) = in.image(); - _vec.call(); - position = *((std::complex*)_vec.data(1)); - - return( position ); -} - -// im_multiply: multiply two images -VImage VImage::multiply( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_multiply" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_powtra: pel^x of image -VImage VImage::pow( double x ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_powtra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = x; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_powtra_vec: pel^[x,y,z] of image -VImage VImage::pow( std::vector v ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_powtra_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = v.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[v.size()]; - for( unsigned int i = 0; i < v.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = v[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_recomb: linear recombination with mask -VImage VImage::recomb( VDMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_recomb" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_remainder: remainder after integer division -VImage VImage::remainder( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_remainder" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_remainderconst: remainder after integer division by a constant -VImage VImage::remainder( double x ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_remainderconst" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = x; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_remainder_vec: remainder after integer division by a vector of constants -VImage VImage::remainder( std::vector x ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_remainder_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = x.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[x.size()]; - for( unsigned int i = 0; i < x.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = x[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_rint: round to nearest integer value -VImage VImage::rint() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rint" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_sign: unit vector in direction of value -VImage VImage::sign() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_sign" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_sintra: sin of image (angles in degrees) -VImage VImage::sin() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_sintra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_stats: many image statistics in one pass -VDMask VImage::stats() -{ - VImage in = *this; - VDMask statistics; - - Vargv _vec( "im_stats" ); - - _vec.data(0) = in.image(); - ((im_mask_object*) _vec.data(1))->name = (char*) "noname"; - _vec.call(); - statistics.embed( (DOUBLEMASK *)((im_mask_object*)_vec.data(1))->mask ); - - return( statistics ); -} - -// im_subtract: subtract two images -VImage VImage::subtract( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_subtract" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_tantra: tan of image (angles in degrees) -VImage VImage::tan() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_tantra" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - - -// bodies for package cimg -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_greyc: noise-removing filter -VImage VImage::greyc( int iterations, double amplitude, double sharpness, double anisotropy, double alpha, double sigma, double dl, double da, double gauss_prec, int interpolation, int fast_approx ) -{ - VImage src = *this; - VImage dst; - - Vargv _vec( "im_greyc" ); - - _vec.data(0) = src.image(); - _vec.data(1) = dst.image(); - *((int*) _vec.data(2)) = iterations; - *((double*) _vec.data(3)) = amplitude; - *((double*) _vec.data(4)) = sharpness; - *((double*) _vec.data(5)) = anisotropy; - *((double*) _vec.data(6)) = alpha; - *((double*) _vec.data(7)) = sigma; - *((double*) _vec.data(8)) = dl; - *((double*) _vec.data(9)) = da; - *((double*) _vec.data(10)) = gauss_prec; - *((int*) _vec.data(11)) = interpolation; - *((int*) _vec.data(12)) = fast_approx; - _vec.call(); - dst._ref->addref( src._ref ); - - return( dst ); -} - -// im_greyc_mask: noise-removing filter, with a mask -VImage VImage::greyc_mask( VImage mask, int iterations, double amplitude, double sharpness, double anisotropy, double alpha, double sigma, double dl, double da, double gauss_prec, int interpolation, int fast_approx ) -{ - VImage src = *this; - VImage dst; - - Vargv _vec( "im_greyc_mask" ); - - _vec.data(0) = src.image(); - _vec.data(1) = dst.image(); - _vec.data(2) = mask.image(); - *((int*) _vec.data(3)) = iterations; - *((double*) _vec.data(4)) = amplitude; - *((double*) _vec.data(5)) = sharpness; - *((double*) _vec.data(6)) = anisotropy; - *((double*) _vec.data(7)) = alpha; - *((double*) _vec.data(8)) = sigma; - *((double*) _vec.data(9)) = dl; - *((double*) _vec.data(10)) = da; - *((double*) _vec.data(11)) = gauss_prec; - *((int*) _vec.data(12)) = interpolation; - *((int*) _vec.data(13)) = fast_approx; - _vec.call(); - dst._ref->addref( src._ref ); - dst._ref->addref( mask._ref ); - - return( dst ); -} - - -// bodies for package colour -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_LCh2Lab: convert LCh to Lab -VImage VImage::LCh2Lab() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_LCh2Lab" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_LCh2UCS: convert LCh to UCS -VImage VImage::LCh2UCS() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_LCh2UCS" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_Lab2LCh: convert Lab to LCh -VImage VImage::Lab2LCh() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_Lab2LCh" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_Lab2LabQ: convert Lab to LabQ -VImage VImage::Lab2LabQ() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_Lab2LabQ" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_Lab2LabS: convert Lab to LabS -VImage VImage::Lab2LabS() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_Lab2LabS" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_Lab2UCS: convert Lab to UCS -VImage VImage::Lab2UCS() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_Lab2UCS" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_Lab2XYZ: convert D65 Lab to XYZ -VImage VImage::Lab2XYZ() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_Lab2XYZ" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_Lab2XYZ_temp: convert Lab to XYZ, with a specified colour temperature -VImage VImage::Lab2XYZ_temp( double X0, double Y0, double Z0 ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_Lab2XYZ_temp" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = X0; - *((double*) _vec.data(3)) = Y0; - *((double*) _vec.data(4)) = Z0; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_Lab2disp: convert Lab to displayable -VImage VImage::Lab2disp( VDisplay disp ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_Lab2disp" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = disp.disp(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_LabQ2LabS: convert LabQ to LabS -VImage VImage::LabQ2LabS() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_LabQ2LabS" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_LabQ2Lab: convert LabQ to Lab -VImage VImage::LabQ2Lab() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_LabQ2Lab" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_LabQ2XYZ: convert LabQ to XYZ -VImage VImage::LabQ2XYZ() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_LabQ2XYZ" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_LabQ2disp: convert LabQ to displayable -VImage VImage::LabQ2disp( VDisplay disp ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_LabQ2disp" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = disp.disp(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_LabS2LabQ: convert LabS to LabQ -VImage VImage::LabS2LabQ() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_LabS2LabQ" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_LabS2Lab: convert LabS to Lab -VImage VImage::LabS2Lab() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_LabS2Lab" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_UCS2LCh: convert UCS to LCh -VImage VImage::UCS2LCh() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_UCS2LCh" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_UCS2Lab: convert UCS to Lab -VImage VImage::UCS2Lab() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_UCS2Lab" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_UCS2XYZ: convert UCS to XYZ -VImage VImage::UCS2XYZ() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_UCS2XYZ" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_XYZ2Lab: convert D65 XYZ to Lab -VImage VImage::XYZ2Lab() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_XYZ2Lab" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_XYZ2Lab_temp: convert XYZ to Lab, with a specified colour temperature -VImage VImage::XYZ2Lab_temp( double X0, double Y0, double Z0 ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_XYZ2Lab_temp" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = X0; - *((double*) _vec.data(3)) = Y0; - *((double*) _vec.data(4)) = Z0; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_XYZ2UCS: convert XYZ to UCS -VImage VImage::XYZ2UCS() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_XYZ2UCS" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_XYZ2Yxy: convert XYZ to Yxy -VImage VImage::XYZ2Yxy() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_XYZ2Yxy" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_XYZ2disp: convert XYZ to displayble -VImage VImage::XYZ2disp( VDisplay disp ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_XYZ2disp" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = disp.disp(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_XYZ2sRGB: convert XYZ to sRGB -VImage VImage::XYZ2sRGB() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_XYZ2sRGB" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_Yxy2XYZ: convert Yxy to XYZ -VImage VImage::Yxy2XYZ() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_Yxy2XYZ" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_dE00_fromLab: calculate delta-E CIE2000 for two Lab images -VImage VImage::dE00_fromLab( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_dE00_fromLab" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_dECMC_fromLab: calculate delta-E CMC(1:1) for two Lab images -VImage VImage::dECMC_fromLab( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_dECMC_fromLab" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_dECMC_fromdisp: calculate delta-E CMC(1:1) for two displayable images -VImage VImage::dECMC_fromdisp( VImage in2, VDisplay disp ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_dECMC_fromdisp" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.data(3) = disp.disp(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_dE_fromLab: calculate delta-E for two Lab images -VImage VImage::dE_fromLab( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_dE_fromLab" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_dE_fromXYZ: calculate delta-E for two XYZ images -VImage VImage::dE_fromXYZ( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_dE_fromXYZ" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_dE_fromdisp: calculate delta-E for two displayable images -VImage VImage::dE_fromdisp( VImage in2, VDisplay disp ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_dE_fromdisp" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.data(3) = disp.disp(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_disp2Lab: convert displayable to Lab -VImage VImage::disp2Lab( VDisplay disp ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_disp2Lab" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = disp.disp(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_disp2XYZ: convert displayable to XYZ -VImage VImage::disp2XYZ( VDisplay disp ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_disp2XYZ" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = disp.disp(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_float2rad: convert float to Radiance packed -VImage VImage::float2rad() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_float2rad" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_icc_ac2rc: convert LAB from AC to RC using an ICC profile -VImage VImage::icc_ac2rc( char* profile ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_icc_ac2rc" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = (im_object) profile; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_icc_export_depth: convert a float LAB to device space with an ICC profile -VImage VImage::icc_export_depth( int depth, char* output_profile, int intent ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_icc_export_depth" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = depth; - _vec.data(3) = (im_object) output_profile; - *((int*) _vec.data(4)) = intent; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_icc_import: convert a device image to float LAB with an ICC profile -VImage VImage::icc_import( char* input_profile, int intent ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_icc_import" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = (im_object) input_profile; - *((int*) _vec.data(3)) = intent; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_icc_import_embedded: convert a device image to float LAB using the embedded profile -VImage VImage::icc_import_embedded( int intent ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_icc_import_embedded" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = intent; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_icc_transform: convert between two device images with a pair of ICC profiles -VImage VImage::icc_transform( char* input_profile, char* output_profile, int intent ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_icc_transform" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = (im_object) input_profile; - _vec.data(3) = (im_object) output_profile; - *((int*) _vec.data(4)) = intent; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_lab_morph: morph colourspace of a LAB image -VImage VImage::lab_morph( VDMask greyscale, double L_offset, double L_scale, double a_scale, double b_scale ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_lab_morph" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = greyscale.mask().dptr; - *((double*) _vec.data(3)) = L_offset; - *((double*) _vec.data(4)) = L_scale; - *((double*) _vec.data(5)) = a_scale; - *((double*) _vec.data(6)) = b_scale; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_rad2float: convert Radiance packed to float -VImage VImage::rad2float() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rad2float" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_sRGB2XYZ: convert sRGB to XYZ -VImage VImage::sRGB2XYZ() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_sRGB2XYZ" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - - -// bodies for package conversion -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_gaussnoise: generate image of gaussian noise with specified statistics -VImage VImage::gaussnoise( int xsize, int ysize, double mean, double sigma ) -{ - VImage out; - - Vargv _vec( "im_gaussnoise" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = xsize; - *((int*) _vec.data(2)) = ysize; - *((double*) _vec.data(3)) = mean; - *((double*) _vec.data(4)) = sigma; - _vec.call(); - - return( out ); -} - -// im_bandjoin: bandwise join of two images -VImage VImage::bandjoin( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_bandjoin" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_black: generate black image -VImage VImage::black( int x_size, int y_size, int bands ) -{ - VImage output; - - Vargv _vec( "im_black" ); - - _vec.data(0) = output.image(); - *((int*) _vec.data(1)) = x_size; - *((int*) _vec.data(2)) = y_size; - *((int*) _vec.data(3)) = bands; - _vec.call(); - - return( output ); -} - -// im_c2amph: convert real and imaginary to phase and amplitude -VImage VImage::c2amph() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_c2amph" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_c2imag: extract imaginary part of complex image -VImage VImage::c2imag() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_c2imag" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_c2real: extract real part of complex image -VImage VImage::c2real() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_c2real" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_c2rect: convert phase and amplitude to real and imaginary -VImage VImage::c2rect() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_c2rect" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2fmt: convert image format to ofmt -VImage VImage::clip2fmt( int ofmt ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2fmt" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = ofmt; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_copy: copy image -VImage VImage::copy() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_copy" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_copy_file: copy image to a file and return that -VImage VImage::copy_file() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_copy_file" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_copy_morph: copy image, setting pixel layout -VImage VImage::copy_morph( int Bands, int BandFmt, int Coding ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_copy_morph" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = Bands; - *((int*) _vec.data(3)) = BandFmt; - *((int*) _vec.data(4)) = Coding; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - -// im_copy_swap: copy image, swapping byte order -VImage VImage::copy_swap() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_copy_swap" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_copy_set: copy image, setting informational fields -VImage VImage::copy_set( int Type, double Xres, double Yres, int Xoffset, int Yoffset ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_copy_set" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = Type; - *((double*) _vec.data(3)) = Xres; - *((double*) _vec.data(4)) = Yres; - *((int*) _vec.data(5)) = Xoffset; - *((int*) _vec.data(6)) = Yoffset; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - -// im_extract_area: extract area -VImage VImage::extract_area( int left, int top, int width, int height ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_extract_area" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = left; - *((int*) _vec.data(3)) = top; - *((int*) _vec.data(4)) = width; - *((int*) _vec.data(5)) = height; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - -// im_extract_areabands: extract area and bands -VImage VImage::extract_areabands( int left, int top, int width, int height, int band, int nbands ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_extract_areabands" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = left; - *((int*) _vec.data(3)) = top; - *((int*) _vec.data(4)) = width; - *((int*) _vec.data(5)) = height; - *((int*) _vec.data(6)) = band; - *((int*) _vec.data(7)) = nbands; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - -// im_extract_band: extract band -VImage VImage::extract_band( int band ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_extract_band" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = band; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - -// im_extract_bands: extract several bands -VImage VImage::extract_bands( int band, int nbands ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_extract_bands" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = band; - *((int*) _vec.data(3)) = nbands; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - -// im_extract: extract area/band -VImage VImage::extract( int left, int top, int width, int height, int band ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_extract" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = left; - *((int*) _vec.data(3)) = top; - *((int*) _vec.data(4)) = width; - *((int*) _vec.data(5)) = height; - *((int*) _vec.data(6)) = band; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - -// im_falsecolour: turn luminance changes into chrominance changes -VImage VImage::falsecolour() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_falsecolour" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_fliphor: flip image left-right -VImage VImage::fliphor() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_fliphor" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_flipver: flip image top-bottom -VImage VImage::flipver() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_flipver" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_gbandjoin: bandwise join of many images -VImage VImage::gbandjoin( std::vector in ) -{ - VImage out; - - Vargv _vec( "im_gbandjoin" ); - - ((im_imagevec_object*) _vec.data(0))->n = in.size(); - ((im_imagevec_object*) _vec.data(0))->vec = new IMAGE *[in.size()]; - for( unsigned int i = 0; i < in.size(); i++ ) - ((im_imagevec_object*) _vec.data(0))->vec[i] = in[i].image(); - _vec.data(1) = out.image(); - _vec.call(); - for( unsigned int i = 0; i < in.size(); i++ ) - out._ref->addref( in[i]._ref ); - - return( out ); -} - -// im_grid: chop a tall thin image into a grid of images -VImage VImage::grid( int tile_height, int across, int down ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_grid" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = tile_height; - *((int*) _vec.data(3)) = across; - *((int*) _vec.data(4)) = down; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - -// im_insert: insert sub-image into main image at position -VImage VImage::insert( VImage sub, int x, int y ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_insert" ); - - _vec.data(0) = in.image(); - _vec.data(1) = sub.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = x; - *((int*) _vec.data(4)) = y; - _vec.call(); - out._ref->addref( in._ref ); - out._ref->addref( sub._ref ); - - return( out ); -} - -// im_insertset: insert sub into main at every position in x, y -VImage VImage::insert( VImage sub, std::vector x, std::vector y ) -{ - VImage main = *this; - VImage out; - - Vargv _vec( "im_insertset" ); - - _vec.data(0) = main.image(); - _vec.data(1) = sub.image(); - _vec.data(2) = out.image(); - ((im_intvec_object*) _vec.data(3))->n = x.size(); - ((im_intvec_object*) _vec.data(3))->vec = new int[x.size()]; - for( unsigned int i = 0; i < x.size(); i++ ) - ((im_intvec_object*) _vec.data(3))->vec[i] = x[i]; - ((im_intvec_object*) _vec.data(4))->n = y.size(); - ((im_intvec_object*) _vec.data(4))->vec = new int[y.size()]; - for( unsigned int i = 0; i < y.size(); i++ ) - ((im_intvec_object*) _vec.data(4))->vec[i] = y[i]; - _vec.call(); - - return( out ); -} - -// im_insert_noexpand: insert sub-image into main image at position, no expansion -VImage VImage::insert_noexpand( VImage sub, int x, int y ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_insert_noexpand" ); - - _vec.data(0) = in.image(); - _vec.data(1) = sub.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = x; - *((int*) _vec.data(4)) = y; - _vec.call(); - out._ref->addref( in._ref ); - out._ref->addref( sub._ref ); - - return( out ); -} - -// im_embed: embed in within a set of borders -VImage VImage::embed( int type, int x, int y, int width, int height ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_embed" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = type; - *((int*) _vec.data(3)) = x; - *((int*) _vec.data(4)) = y; - *((int*) _vec.data(5)) = width; - *((int*) _vec.data(6)) = height; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_lrjoin: join two images left-right -VImage VImage::lrjoin( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_lrjoin" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_msb: convert to uchar by discarding bits -VImage VImage::msb() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_msb" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_msb_band: convert to single band uchar by discarding bits -VImage VImage::msb_band( int band ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_msb_band" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = band; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_replicate: replicate an image horizontally and vertically -VImage VImage::replicate( int across, int down ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_replicate" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = across; - *((int*) _vec.data(3)) = down; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - -// im_ri2c: join two non-complex images to form complex -VImage VImage::ri2c( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_ri2c" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_rot180: rotate image 180 degrees -VImage VImage::rot180() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rot180" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_rot270: rotate image 270 degrees clockwise -VImage VImage::rot270() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rot270" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_rot90: rotate image 90 degrees clockwise -VImage VImage::rot90() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rot90" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_scale: scale image linearly to fit range 0-255 -VImage VImage::scale() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_scale" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_scaleps: logarithmic scale of image to fit range 0-255 -VImage VImage::scaleps() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_scaleps" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_subsample: subsample image by integer factors -VImage VImage::subsample( int xshrink, int yshrink ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_subsample" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = xshrink; - *((int*) _vec.data(3)) = yshrink; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_system: run command on image -char* VImage::system( char* command ) -{ - VImage im = *this; - char* output; - - Vargv _vec( "im_system" ); - - _vec.data(0) = im.image(); - _vec.data(1) = (im_object) command; - _vec.call(); - output = (char*) _vec.data(2); - - return( output ); -} - -// im_system_image: run command on image, with image output -VImage VImage::system_image( char* in_format, char* out_format, char* command, char*& log ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_system_image" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = (im_object) in_format; - _vec.data(3) = (im_object) out_format; - _vec.data(4) = (im_object) command; - _vec.call(); - log = (char*) _vec.data(5); - - return( out ); -} - -// im_tbjoin: join two images top-bottom -VImage VImage::tbjoin( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_tbjoin" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_text: generate text image -VImage VImage::text( char* text, char* font, int width, int alignment, int dpi ) -{ - VImage out; - - Vargv _vec( "im_text" ); - - _vec.data(0) = out.image(); - _vec.data(1) = (im_object) text; - _vec.data(2) = (im_object) font; - *((int*) _vec.data(3)) = width; - *((int*) _vec.data(4)) = alignment; - *((int*) _vec.data(5)) = dpi; - _vec.call(); - - return( out ); -} - -// im_wrap: shift image origin, wrapping at sides -VImage VImage::wrap( int x, int y ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_wrap" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = x; - *((int*) _vec.data(3)) = y; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_zoom: simple zoom of an image by integer factors -VImage VImage::zoom( int xfac, int yfac ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_zoom" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((int*) _vec.data(2)) = xfac; - *((int*) _vec.data(3)) = yfac; - _vec.call(); - output._ref->addref( input._ref ); - - return( output ); -} - - -// bodies for package convolution -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_aconvsep: approximate separable convolution -VImage VImage::aconvsep( VDMask matrix, int n_layers ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_aconvsep" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - *((int*) _vec.data(3)) = n_layers; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_aconv: approximate convolution -VImage VImage::aconv( VDMask matrix, int n_layers, int cluster ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_aconv" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - *((int*) _vec.data(3)) = n_layers; - *((int*) _vec.data(4)) = cluster; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_addgnoise: add gaussian noise with mean 0 and std. dev. sigma -VImage VImage::addgnoise( double sigma ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_addgnoise" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = sigma; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_compass: convolve with 8-way rotating integer mask -VImage VImage::compass( VIMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_compass" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_contrast_surface: find high-contrast points in an image -VImage VImage::contrast_surface( int half_win_size, int spacing ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_contrast_surface" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = half_win_size; - *((int*) _vec.data(3)) = spacing; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_conv: convolve -VImage VImage::conv( VIMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_conv" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_conv_f: convolve, with DOUBLEMASK -VImage VImage::conv( VDMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_conv_f" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convsep: seperable convolution -VImage VImage::convsep( VIMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convsep" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convsep_f: seperable convolution, with DOUBLEMASK -VImage VImage::convsep( VDMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convsep_f" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_fastcor: fast correlate in2 within in1 -VImage VImage::fastcor( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_fastcor" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_gradcor: non-normalised correlation of gradient of in2 within in1 -VImage VImage::gradcor( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_gradcor" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_gradient: convolve with 2-way rotating mask -VImage VImage::gradient( VIMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_gradient" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_grad_x: horizontal difference image -VImage VImage::grad_x() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_grad_x" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_grad_y: vertical difference image -VImage VImage::grad_y() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_grad_y" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_lindetect: convolve with 4-way rotating mask -VImage VImage::lindetect( VIMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_lindetect" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_sharpen: sharpen high frequencies of L channel of LabQ -VImage VImage::sharpen( int mask_size, double x1, double y2, double y3, double m1, double m2 ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_sharpen" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = mask_size; - *((double*) _vec.data(3)) = x1; - *((double*) _vec.data(4)) = y2; - *((double*) _vec.data(5)) = y3; - *((double*) _vec.data(6)) = m1; - *((double*) _vec.data(7)) = m2; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_spcor: normalised correlation of in2 within in1 -VImage VImage::spcor( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_spcor" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - - -// bodies for package deprecated -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_argb2rgba: convert pre-multipled argb to png-style rgba -VImage VImage::argb2rgba() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_argb2rgba" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_flood_copy: flood with ink from start_x, start_y while pixel == start pixel -VImage VImage::flood_copy( int start_x, int start_y, std::vector ink ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_flood_copy" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = start_x; - *((int*) _vec.data(3)) = start_y; - ((im_doublevec_object*) _vec.data(4))->n = ink.size(); - ((im_doublevec_object*) _vec.data(4))->vec = new double[ink.size()]; - for( unsigned int i = 0; i < ink.size(); i++ ) - ((im_doublevec_object*) _vec.data(4))->vec[i] = ink[i]; - _vec.call(); - - return( out ); -} - -// im_flood_blob_copy: flood with ink from start_x, start_y while pixel == start pixel -VImage VImage::flood_blob_copy( int start_x, int start_y, std::vector ink ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_flood_blob_copy" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = start_x; - *((int*) _vec.data(3)) = start_y; - ((im_doublevec_object*) _vec.data(4))->n = ink.size(); - ((im_doublevec_object*) _vec.data(4))->vec = new double[ink.size()]; - for( unsigned int i = 0; i < ink.size(); i++ ) - ((im_doublevec_object*) _vec.data(4))->vec[i] = ink[i]; - _vec.call(); - - return( out ); -} - -// im_flood_other_copy: flood mark with serial from start_x, start_y while pixel == start pixel -VImage VImage::flood_other_copy( VImage mark, int start_x, int start_y, int serial ) -{ - VImage test = *this; - VImage out; - - Vargv _vec( "im_flood_other_copy" ); - - _vec.data(0) = test.image(); - _vec.data(1) = mark.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = start_x; - *((int*) _vec.data(4)) = start_y; - *((int*) _vec.data(5)) = serial; - _vec.call(); - - return( out ); -} - -// im_clip: convert to unsigned 8-bit integer -VImage VImage::clip() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_c2ps: find power spectrum of complex image -VImage VImage::c2ps() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_c2ps" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_resize_linear: resize to X by Y pixels with linear interpolation -VImage VImage::resize_linear( int X, int Y ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_resize_linear" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = X; - *((int*) _vec.data(3)) = Y; - _vec.call(); - - return( out ); -} - -// im_cmulnorm: multiply two complex images, normalising output -VImage VImage::cmulnorm( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_cmulnorm" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_fav4: average of 4 images -VImage VImage::fav4( VImage in2, VImage in3, VImage in4 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_fav4" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = in3.image(); - _vec.data(3) = in4.image(); - _vec.data(4) = out.image(); - _vec.call(); - - return( out ); -} - -// im_gadd: calculate a*in1 + b*in2 + c = outfile -VImage VImage::gadd( double a, double b, VImage in2, double c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_gadd" ); - - *((double*) _vec.data(0)) = a; - _vec.data(1) = in1.image(); - *((double*) _vec.data(2)) = b; - _vec.data(3) = in2.image(); - *((double*) _vec.data(4)) = c; - _vec.data(5) = out.image(); - _vec.call(); - - return( out ); -} - -// im_icc_export: convert a float LAB to an 8-bit device image with an ICC profile -VImage VImage::icc_export( char* output_profile, int intent ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_icc_export" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = (im_object) output_profile; - *((int*) _vec.data(3)) = intent; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_litecor: calculate max(white)*factor*(in/white), if clip == 1 -VImage VImage::litecor( VImage white, int clip, double factor ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_litecor" ); - - _vec.data(0) = in.image(); - _vec.data(1) = white.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = clip; - *((double*) _vec.data(4)) = factor; - _vec.call(); - - return( out ); -} - -// im_affine: affine transform -VImage VImage::affine( double a, double b, double c, double d, double dx, double dy, int x, int y, int w, int h ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_affine" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = a; - *((double*) _vec.data(3)) = b; - *((double*) _vec.data(4)) = c; - *((double*) _vec.data(5)) = d; - *((double*) _vec.data(6)) = dx; - *((double*) _vec.data(7)) = dy; - *((int*) _vec.data(8)) = x; - *((int*) _vec.data(9)) = y; - *((int*) _vec.data(10)) = w; - *((int*) _vec.data(11)) = h; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2c: convert to signed 8-bit integer -VImage VImage::clip2c() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2c" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2cm: convert to complex -VImage VImage::clip2cm() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2cm" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2d: convert to double-precision float -VImage VImage::clip2d() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2d" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2dcm: convert to double complex -VImage VImage::clip2dcm() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2dcm" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2f: convert to single-precision float -VImage VImage::clip2f() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2f" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2i: convert to signed 32-bit integer -VImage VImage::clip2i() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2i" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convsub: convolve uchar to uchar, sub-sampling by xskip, yskip -VImage VImage::convsub( VIMask matrix, int xskip, int yskip ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convsub" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - *((int*) _vec.data(3)) = xskip; - *((int*) _vec.data(4)) = yskip; - _vec.call(); - - return( out ); -} - -// im_convf: convolve, with DOUBLEMASK -VImage VImage::convf( VDMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convf" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convsepf: seperable convolution, with DOUBLEMASK -VImage VImage::convsepf( VDMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convsepf" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2s: convert to signed 16-bit integer -VImage VImage::clip2s() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2s" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2ui: convert to unsigned 32-bit integer -VImage VImage::clip2ui() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2ui" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_insertplaceset: insert sub into main at every position in x, y -VImage VImage::insertplace( VImage sub, std::vector x, std::vector y ) -{ - VImage main = *this; - VImage out; - - Vargv _vec( "im_insertplaceset" ); - - _vec.data(0) = main.image(); - _vec.data(1) = sub.image(); - _vec.data(2) = out.image(); - ((im_intvec_object*) _vec.data(3))->n = x.size(); - ((im_intvec_object*) _vec.data(3))->vec = new int[x.size()]; - for( unsigned int i = 0; i < x.size(); i++ ) - ((im_intvec_object*) _vec.data(3))->vec[i] = x[i]; - ((im_intvec_object*) _vec.data(4))->n = y.size(); - ((im_intvec_object*) _vec.data(4))->vec = new int[y.size()]; - for( unsigned int i = 0; i < y.size(); i++ ) - ((im_intvec_object*) _vec.data(4))->vec[i] = y[i]; - _vec.call(); - - return( out ); -} - -// im_clip2us: convert to unsigned 16-bit integer -VImage VImage::clip2us() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2us" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_slice: slice an image using two thresholds -VImage VImage::slice( double thresh1, double thresh2 ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_slice" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((double*) _vec.data(2)) = thresh1; - *((double*) _vec.data(3)) = thresh2; - _vec.call(); - - return( output ); -} - -// im_segment: number continuous regions in an image -VImage VImage::segment( int& segments ) -{ - VImage test = *this; - VImage mask; - - Vargv _vec( "im_segment" ); - - _vec.data(0) = test.image(); - _vec.data(1) = mask.image(); - _vec.call(); - segments = *((int*)_vec.data(2)); - - return( mask ); -} - -// im_line: draw line between points (x1,y1) and (x2,y2) -void VImage::line( int x1, int y1, int x2, int y2, int pelval ) -{ - VImage im = *this; - Vargv _vec( "im_line" ); - - _vec.data(0) = im.image(); - *((int*) _vec.data(1)) = x1; - *((int*) _vec.data(2)) = y1; - *((int*) _vec.data(3)) = x2; - *((int*) _vec.data(4)) = y2; - *((int*) _vec.data(5)) = pelval; - _vec.call(); -} - -// im_thresh: slice an image at a threshold -VImage VImage::thresh( double threshold ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_thresh" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((double*) _vec.data(2)) = threshold; - _vec.call(); - - return( output ); -} - -// im_convf_raw: convolve, with DOUBLEMASK, no border -VImage VImage::convf_raw( VDMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convf_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_conv_raw: convolve, no border -VImage VImage::conv_raw( VIMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_conv_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_contrast_surface_raw: find high-contrast points in an image -VImage VImage::contrast_surface_raw( int half_win_size, int spacing ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_contrast_surface_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = half_win_size; - *((int*) _vec.data(3)) = spacing; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convsepf_raw: seperable convolution, with DOUBLEMASK, no border -VImage VImage::convsepf_raw( VDMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convsepf_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convsep_raw: seperable convolution, no border -VImage VImage::convsep_raw( VIMask matrix ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convsep_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_fastcor_raw: fast correlate in2 within in1, no border -VImage VImage::fastcor_raw( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_fastcor_raw" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_gradcor_raw: non-normalised correlation of gradient of in2 within in1, no padding -VImage VImage::gradcor_raw( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_gradcor_raw" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_spcor_raw: normalised correlation of in2 within in1, no black padding -VImage VImage::spcor_raw( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_spcor_raw" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_lhisteq_raw: local histogram equalisation, no border -VImage VImage::lhisteq_raw( int width, int height ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_lhisteq_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = width; - *((int*) _vec.data(3)) = height; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_stdif_raw: statistical differencing, no border -VImage VImage::stdif_raw( double a, double m0, double b, double s0, int xw, int yw ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_stdif_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = a; - *((double*) _vec.data(3)) = m0; - *((double*) _vec.data(4)) = b; - *((double*) _vec.data(5)) = s0; - *((int*) _vec.data(6)) = xw; - *((int*) _vec.data(7)) = yw; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_rank_raw: rank filter nth element of xsize/ysize window, no border -VImage VImage::rank_raw( int xsize, int ysize, int n ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rank_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = xsize; - *((int*) _vec.data(3)) = ysize; - *((int*) _vec.data(4)) = n; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_dilate_raw: dilate image with mask -VImage VImage::dilate_raw( VIMask mask ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_dilate_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = mask.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_erode_raw: erode image with mask -VImage VImage::erode_raw( VIMask mask ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_erode_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = mask.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_similarity_area: output area xywh of similarity transformation -VImage VImage::similarity_area( double a, double b, double dx, double dy, int x, int y, int w, int h ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_similarity_area" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = a; - *((double*) _vec.data(3)) = b; - *((double*) _vec.data(4)) = dx; - *((double*) _vec.data(5)) = dy; - *((int*) _vec.data(6)) = x; - *((int*) _vec.data(7)) = y; - *((int*) _vec.data(8)) = w; - *((int*) _vec.data(9)) = h; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_similarity: similarity transformation -VImage VImage::similarity( double a, double b, double dx, double dy ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_similarity" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = a; - *((double*) _vec.data(3)) = b; - *((double*) _vec.data(4)) = dx; - *((double*) _vec.data(5)) = dy; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_mask2vips: convert DOUBLEMASK to VIPS image -VImage VImage::mask2vips( VDMask input ) -{ - VImage output; - - Vargv _vec( "im_mask2vips" ); - - ((im_mask_object*) _vec.data(0))->mask = input.mask().dptr; - _vec.data(1) = output.image(); - _vec.call(); - - return( output ); -} - -// im_vips2mask: convert VIPS image to DOUBLEMASK -VDMask VImage::vips2mask() -{ - VImage input = *this; - VDMask output; - - Vargv _vec( "im_vips2mask" ); - - _vec.data(0) = input.image(); - ((im_mask_object*) _vec.data(1))->name = (char*)"noname"; - _vec.call(); - output.embed( (DOUBLEMASK *)((im_mask_object*)_vec.data(1))->mask ); - - return( output ); -} - -// im_insertplace: draw image sub inside image main at position (x,y) -void VImage::insertplace( VImage sub, int x, int y ) -{ - VImage main = *this; - Vargv _vec( "im_insertplace" ); - - _vec.data(0) = main.image(); - _vec.data(1) = sub.image(); - *((int*) _vec.data(2)) = x; - *((int*) _vec.data(3)) = y; - _vec.call(); -} - -// im_circle: plot circle on image -void VImage::circle( int cx, int cy, int radius, int intensity ) -{ - VImage image = *this; - Vargv _vec( "im_circle" ); - - _vec.data(0) = image.image(); - *((int*) _vec.data(1)) = cx; - *((int*) _vec.data(2)) = cy; - *((int*) _vec.data(3)) = radius; - *((int*) _vec.data(4)) = intensity; - _vec.call(); -} - -// im_andimage: bitwise and of two images -VImage VImage::andimage( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_andimage" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_andimageconst: bitwise and of an image with a constant -VImage VImage::andimage( int c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_andimageconst" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_andimage_vec: bitwise and of an image with a vector constant -VImage VImage::andimage( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_andimage_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_orimage: bitwise or of two images -VImage VImage::orimage( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_orimage" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_orimageconst: bitwise or of an image with a constant -VImage VImage::orimage( int c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_orimageconst" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_orimage_vec: bitwise or of an image with a vector constant -VImage VImage::orimage( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_orimage_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_eorimage: bitwise eor of two images -VImage VImage::eorimage( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_eorimage" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_eorimageconst: bitwise eor of an image with a constant -VImage VImage::eorimage( int c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_eorimageconst" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_eorimage_vec: bitwise eor of an image with a vector constant -VImage VImage::eorimage( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_eorimage_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_shiftleft_vec: shift image array bits to left -VImage VImage::shiftleft( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_shiftleft_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_shiftleft: shift image n bits to left -VImage VImage::shiftleft( int c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_shiftleft" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_shiftright_vec: shift image array bits to right -VImage VImage::shiftright( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_shiftright_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_shiftright: shift integer image n bits to right -VImage VImage::shiftright( int c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_shiftright" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_blend: use cond image to blend between images in1 and in2 -VImage VImage::blend( VImage in1, VImage in2 ) -{ - VImage cond = *this; - VImage out; - - Vargv _vec( "im_blend" ); - - _vec.data(0) = cond.image(); - _vec.data(1) = in1.image(); - _vec.data(2) = in2.image(); - _vec.data(3) = out.image(); - _vec.call(); - out._ref->addref( cond._ref ); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_equal: two images equal in value -VImage VImage::equal( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_equal" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_equal_vec: image equals doublevec -VImage VImage::equal( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_equal_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_equalconst: image equals const -VImage VImage::equal( double c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_equalconst" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_ifthenelse: use cond image to choose pels from image in1 or in2 -VImage VImage::ifthenelse( VImage in1, VImage in2 ) -{ - VImage cond = *this; - VImage out; - - Vargv _vec( "im_ifthenelse" ); - - _vec.data(0) = cond.image(); - _vec.data(1) = in1.image(); - _vec.data(2) = in2.image(); - _vec.data(3) = out.image(); - _vec.call(); - out._ref->addref( cond._ref ); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_less: in1 less than in2 in value -VImage VImage::less( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_less" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_less_vec: in less than doublevec -VImage VImage::less( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_less_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_lessconst: in less than const -VImage VImage::less( double c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_lessconst" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_lesseq: in1 less than or equal to in2 in value -VImage VImage::lesseq( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_lesseq" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_lesseq_vec: in less than or equal to doublevec -VImage VImage::lesseq( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_lesseq_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_lesseqconst: in less than or equal to const -VImage VImage::lesseq( double c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_lesseqconst" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_more: in1 more than in2 in value -VImage VImage::more( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_more" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_more_vec: in more than doublevec -VImage VImage::more( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_more_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_moreconst: in more than const -VImage VImage::more( double c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_moreconst" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_moreeq: in1 more than or equal to in2 in value -VImage VImage::moreeq( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_moreeq" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_moreeq_vec: in more than or equal to doublevec -VImage VImage::moreeq( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_moreeq_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_moreeqconst: in more than or equal to const -VImage VImage::moreeq( double c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_moreeqconst" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_notequal: two images not equal in value -VImage VImage::notequal( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_notequal" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_notequal_vec: image does not equal doublevec -VImage VImage::notequal( std::vector vec ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_notequal_vec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_doublevec_object*) _vec.data(2))->n = vec.size(); - ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; - for( unsigned int i = 0; i < vec.size(); i++ ) - ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_notequalconst: image does not equal const -VImage VImage::notequal( double c ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_notequalconst" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = c; - _vec.call(); - out._ref->addref( in1._ref ); - - return( out ); -} - -// im_quadratic: transform via quadratic -VImage VImage::quadratic( VImage coeff ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_quadratic" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = coeff.image(); - _vec.call(); - out._ref->addref( in._ref ); - out._ref->addref( coeff._ref ); - - return( out ); -} - - -// bodies for package format -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_csv2vips: read a file in csv format -VImage VImage::csv2vips( char* filename ) -{ - VImage im; - - Vargv _vec( "im_csv2vips" ); - - _vec.data(0) = (im_object) filename; - _vec.data(1) = im.image(); - _vec.call(); - - return( im ); -} - -// im_fits2vips: convert from fits -VImage VImage::fits2vips( char* in ) -{ - VImage out; - - Vargv _vec( "im_fits2vips" ); - - _vec.data(0) = (im_object) in; - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_jpeg2vips: convert from jpeg -VImage VImage::jpeg2vips( char* in ) -{ - VImage out; - - Vargv _vec( "im_jpeg2vips" ); - - _vec.data(0) = (im_object) in; - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_magick2vips: load file with libMagick -VImage VImage::magick2vips( char* in ) -{ - VImage out; - - Vargv _vec( "im_magick2vips" ); - - _vec.data(0) = (im_object) in; - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_png2vips: convert PNG file to VIPS image -VImage VImage::png2vips( char* in ) -{ - VImage out; - - Vargv _vec( "im_png2vips" ); - - _vec.data(0) = (im_object) in; - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_exr2vips: convert an OpenEXR file to VIPS -VImage VImage::exr2vips( char* in ) -{ - VImage out; - - Vargv _vec( "im_exr2vips" ); - - _vec.data(0) = (im_object) in; - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_ppm2vips: read a file in pbm/pgm/ppm format -VImage VImage::ppm2vips( char* filename ) -{ - VImage im; - - Vargv _vec( "im_ppm2vips" ); - - _vec.data(0) = (im_object) filename; - _vec.data(1) = im.image(); - _vec.call(); - - return( im ); -} - -// im_analyze2vips: read a file in analyze format -VImage VImage::analyze2vips( char* filename ) -{ - VImage im; - - Vargv _vec( "im_analyze2vips" ); - - _vec.data(0) = (im_object) filename; - _vec.data(1) = im.image(); - _vec.call(); - - return( im ); -} - -// im_tiff2vips: convert TIFF file to VIPS image -VImage VImage::tiff2vips( char* in ) -{ - VImage out; - - Vargv _vec( "im_tiff2vips" ); - - _vec.data(0) = (im_object) in; - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_vips2csv: write an image in csv format -void VImage::vips2csv( char* filename ) -{ - VImage in = *this; - Vargv _vec( "im_vips2csv" ); - - _vec.data(0) = in.image(); - _vec.data(1) = (im_object) filename; - _vec.call(); -} - -// im_vips2dz: save as deepzoom -void VImage::vips2dz( char* out ) -{ - VImage in = *this; - Vargv _vec( "im_vips2dz" ); - - _vec.data(0) = in.image(); - _vec.data(1) = (im_object) out; - _vec.call(); -} - -// im_vips2jpeg: convert to jpeg -void VImage::vips2jpeg( char* out ) -{ - VImage in = *this; - Vargv _vec( "im_vips2jpeg" ); - - _vec.data(0) = in.image(); - _vec.data(1) = (im_object) out; - _vec.call(); -} - -// im_vips2mimejpeg: convert to jpeg as mime type on stdout -void VImage::vips2mimejpeg( int qfac ) -{ - VImage in = *this; - Vargv _vec( "im_vips2mimejpeg" ); - - _vec.data(0) = in.image(); - *((int*) _vec.data(1)) = qfac; - _vec.call(); -} - -// im_vips2png: convert VIPS image to PNG file -void VImage::vips2png( char* out ) -{ - VImage in = *this; - Vargv _vec( "im_vips2png" ); - - _vec.data(0) = in.image(); - _vec.data(1) = (im_object) out; - _vec.call(); -} - -// im_vips2ppm: write a file in pbm/pgm/ppm format -void VImage::vips2ppm( char* filename ) -{ - VImage im = *this; - Vargv _vec( "im_vips2ppm" ); - - _vec.data(0) = im.image(); - _vec.data(1) = (im_object) filename; - _vec.call(); -} - -// im_vips2tiff: convert VIPS image to TIFF file -void VImage::vips2tiff( char* out ) -{ - VImage in = *this; - Vargv _vec( "im_vips2tiff" ); - - _vec.data(0) = in.image(); - _vec.data(1) = (im_object) out; - _vec.call(); -} - - -// bodies for package freq_filt -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_create_fmask: create frequency domain filter mask -VImage VImage::create_fmask( int width, int height, int type, double p1, double p2, double p3, double p4, double p5 ) -{ - VImage out; - - Vargv _vec( "im_create_fmask" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = width; - *((int*) _vec.data(2)) = height; - *((int*) _vec.data(3)) = type; - *((double*) _vec.data(4)) = p1; - *((double*) _vec.data(5)) = p2; - *((double*) _vec.data(6)) = p3; - *((double*) _vec.data(7)) = p4; - *((double*) _vec.data(8)) = p5; - _vec.call(); - - return( out ); -} - -// im_disp_ps: make displayable power spectrum -VImage VImage::disp_ps() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_disp_ps" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_flt_image_freq: frequency domain filter image -VImage VImage::flt_image_freq( int type, double p1, double p2, double p3, double p4, double p5 ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_flt_image_freq" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = type; - *((double*) _vec.data(3)) = p1; - *((double*) _vec.data(4)) = p2; - *((double*) _vec.data(5)) = p3; - *((double*) _vec.data(6)) = p4; - *((double*) _vec.data(7)) = p5; - _vec.call(); - - return( out ); -} - -// im_fractsurf: generate a fractal surface of given dimension -VImage VImage::fractsurf( int size, double dimension ) -{ - VImage out; - - Vargv _vec( "im_fractsurf" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = size; - *((double*) _vec.data(2)) = dimension; - _vec.call(); - - return( out ); -} - -// im_freqflt: frequency-domain filter of in with mask -VImage VImage::freqflt( VImage mask ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_freqflt" ); - - _vec.data(0) = in.image(); - _vec.data(1) = mask.image(); - _vec.data(2) = out.image(); - _vec.call(); - - return( out ); -} - -// im_fwfft: forward fast-fourier transform -VImage VImage::fwfft() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_fwfft" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_rotquad: rotate image quadrants to move origin to centre -VImage VImage::rotquad() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rotquad" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_invfft: inverse fast-fourier transform -VImage VImage::invfft() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_invfft" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_phasecor_fft: non-normalised correlation of gradient of in2 within in1 -VImage VImage::phasecor_fft( VImage in2 ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_phasecor_fft" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - - return( out ); -} - -// im_invfftr: real part of inverse fast-fourier transform -VImage VImage::invfftr() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_invfftr" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - - -// bodies for package histograms_lut -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_gammacorrect: gamma-correct image -VImage VImage::gammacorrect( double exponent ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_gammacorrect" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = exponent; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_heq: histogram-equalise image -VImage VImage::heq( int band_number ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_heq" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = band_number; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_hist: find and graph histogram of image -VImage VImage::hist( int band_number ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_hist" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = band_number; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_histcum: turn histogram to cumulative histogram -VImage VImage::histcum() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_histcum" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_histeq: form histogram equalistion LUT -VImage VImage::histeq() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_histeq" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_hist_indexed: make a histogram with an index image -VImage VImage::hist_indexed( VImage value ) -{ - VImage index = *this; - VImage out; - - Vargv _vec( "im_hist_indexed" ); - - _vec.data(0) = index.image(); - _vec.data(1) = value.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( index._ref ); - out._ref->addref( value._ref ); - - return( out ); -} - -// im_histgr: find histogram of image -VImage VImage::histgr( int band_number ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_histgr" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = band_number; - _vec.call(); - - return( out ); -} - -// im_histnD: find 1D, 2D or 3D histogram of image -VImage VImage::histnD( int bins ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_histnD" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = bins; - _vec.call(); - - return( out ); -} - -// im_histnorm: form normalised histogram -VImage VImage::histnorm() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_histnorm" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_histplot: plot graph of histogram -VImage VImage::histplot() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_histplot" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_histspec: find histogram which will make pdf of in match ref -VImage VImage::histspec( VImage ref ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_histspec" ); - - _vec.data(0) = in.image(); - _vec.data(1) = ref.image(); - _vec.data(2) = out.image(); - _vec.call(); - - return( out ); -} - -// im_hsp: match stats of in to stats of ref -VImage VImage::hsp( VImage ref ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_hsp" ); - - _vec.data(0) = in.image(); - _vec.data(1) = ref.image(); - _vec.data(2) = out.image(); - _vec.call(); - - return( out ); -} - -// im_identity: generate identity histogram -VImage VImage::identity( int nbands ) -{ - VImage out; - - Vargv _vec( "im_identity" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = nbands; - _vec.call(); - - return( out ); -} - -// im_identity_ushort: generate ushort identity histogram -VImage VImage::identity_ushort( int nbands, int size ) -{ - VImage out; - - Vargv _vec( "im_identity_ushort" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = nbands; - *((int*) _vec.data(2)) = size; - _vec.call(); - - return( out ); -} - -// im_ismonotonic: test LUT for monotonicity -int VImage::ismonotonic() -{ - VImage lut = *this; - int mono; - - Vargv _vec( "im_ismonotonic" ); - - _vec.data(0) = lut.image(); - _vec.call(); - mono = *((int*)_vec.data(1)); - - return( mono ); -} - -// im_lhisteq: local histogram equalisation -VImage VImage::lhisteq( int width, int height ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_lhisteq" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = width; - *((int*) _vec.data(3)) = height; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_mpercent: find threshold above which there are percent values -int VImage::mpercent( double percent ) -{ - VImage in = *this; - int thresh; - - Vargv _vec( "im_mpercent" ); - - _vec.data(0) = in.image(); - *((double*) _vec.data(1)) = percent; - _vec.call(); - thresh = *((int*)_vec.data(2)); - - return( thresh ); -} - -// im_invertlut: generate correction table from set of measures -VImage VImage::invertlut( VDMask measures, int lut_size ) -{ - VImage lut; - - Vargv _vec( "im_invertlut" ); - - ((im_mask_object*) _vec.data(0))->mask = measures.mask().dptr; - _vec.data(1) = lut.image(); - *((int*) _vec.data(2)) = lut_size; - _vec.call(); - - return( lut ); -} - -// im_buildlut: generate LUT table from set of x/y positions -VImage VImage::buildlut( VDMask xyes ) -{ - VImage lut; - - Vargv _vec( "im_buildlut" ); - - ((im_mask_object*) _vec.data(0))->mask = xyes.mask().dptr; - _vec.data(1) = lut.image(); - _vec.call(); - - return( lut ); -} - -// im_maplut: map image through LUT -VImage VImage::maplut( VImage lut ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_maplut" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = lut.image(); - _vec.call(); - out._ref->addref( in._ref ); - out._ref->addref( lut._ref ); - - return( out ); -} - -// im_project: find horizontal and vertical projections of an image -VImage VImage::project( VImage& vout ) -{ - VImage in = *this; - VImage hout; - - Vargv _vec( "im_project" ); - - _vec.data(0) = in.image(); - _vec.data(1) = hout.image(); - _vec.data(2) = vout.image(); - _vec.call(); - - return( hout ); -} - -// im_stdif: statistical differencing -VImage VImage::stdif( double a, double m0, double b, double s0, int xw, int yw ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_stdif" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = a; - *((double*) _vec.data(3)) = m0; - *((double*) _vec.data(4)) = b; - *((double*) _vec.data(5)) = s0; - *((int*) _vec.data(6)) = xw; - *((int*) _vec.data(7)) = yw; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_tone_analyse: analyse in and create LUT for tone adjustment -VImage VImage::tone_analyse( double Ps, double Pm, double Ph, double S, double M, double H ) -{ - VImage in = *this; - VImage hist; - - Vargv _vec( "im_tone_analyse" ); - - _vec.data(0) = in.image(); - _vec.data(1) = hist.image(); - *((double*) _vec.data(2)) = Ps; - *((double*) _vec.data(3)) = Pm; - *((double*) _vec.data(4)) = Ph; - *((double*) _vec.data(5)) = S; - *((double*) _vec.data(6)) = M; - *((double*) _vec.data(7)) = H; - _vec.call(); - - return( hist ); -} - -// im_tone_build: create LUT for tone adjustment of LabS images -VImage VImage::tone_build( double Lb, double Lw, double Ps, double Pm, double Ph, double S, double M, double H ) -{ - VImage hist; - - Vargv _vec( "im_tone_build" ); - - _vec.data(0) = hist.image(); - *((double*) _vec.data(1)) = Lb; - *((double*) _vec.data(2)) = Lw; - *((double*) _vec.data(3)) = Ps; - *((double*) _vec.data(4)) = Pm; - *((double*) _vec.data(5)) = Ph; - *((double*) _vec.data(6)) = S; - *((double*) _vec.data(7)) = M; - *((double*) _vec.data(8)) = H; - _vec.call(); - - return( hist ); -} - -// im_tone_build_range: create LUT for tone adjustment -VImage VImage::tone_build_range( int in_max, int out_max, double Lb, double Lw, double Ps, double Pm, double Ph, double S, double M, double H ) -{ - VImage hist; - - Vargv _vec( "im_tone_build_range" ); - - _vec.data(0) = hist.image(); - *((int*) _vec.data(1)) = in_max; - *((int*) _vec.data(2)) = out_max; - *((double*) _vec.data(3)) = Lb; - *((double*) _vec.data(4)) = Lw; - *((double*) _vec.data(5)) = Ps; - *((double*) _vec.data(6)) = Pm; - *((double*) _vec.data(7)) = Ph; - *((double*) _vec.data(8)) = S; - *((double*) _vec.data(9)) = M; - *((double*) _vec.data(10)) = H; - _vec.call(); - - return( hist ); -} - -// im_tone_map: map L channel of LabS or LabQ image through LUT -VImage VImage::tone_map( VImage lut ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_tone_map" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = lut.image(); - _vec.call(); - out._ref->addref( in._ref ); - out._ref->addref( lut._ref ); - - return( out ); -} - - -// bodies for package inplace -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_draw_circle: draw circle on image -void VImage::draw_circle( int cx, int cy, int radius, int fill, std::vector ink ) -{ - VImage image = *this; - Vargv _vec( "im_draw_circle" ); - - _vec.data(0) = image.image(); - *((int*) _vec.data(1)) = cx; - *((int*) _vec.data(2)) = cy; - *((int*) _vec.data(3)) = radius; - *((int*) _vec.data(4)) = fill; - ((im_doublevec_object*) _vec.data(5))->n = ink.size(); - ((im_doublevec_object*) _vec.data(5))->vec = new double[ink.size()]; - for( unsigned int i = 0; i < ink.size(); i++ ) - ((im_doublevec_object*) _vec.data(5))->vec[i] = ink[i]; - _vec.call(); -} - -// im_draw_rect: draw rect on image -void VImage::draw_rect( int left, int top, int width, int height, int fill, std::vector ink ) -{ - VImage image = *this; - Vargv _vec( "im_draw_rect" ); - - _vec.data(0) = image.image(); - *((int*) _vec.data(1)) = left; - *((int*) _vec.data(2)) = top; - *((int*) _vec.data(3)) = width; - *((int*) _vec.data(4)) = height; - *((int*) _vec.data(5)) = fill; - ((im_doublevec_object*) _vec.data(6))->n = ink.size(); - ((im_doublevec_object*) _vec.data(6))->vec = new double[ink.size()]; - for( unsigned int i = 0; i < ink.size(); i++ ) - ((im_doublevec_object*) _vec.data(6))->vec[i] = ink[i]; - _vec.call(); -} - -// im_draw_line: draw line on image -void VImage::draw_line( int x1, int y1, int x2, int y2, std::vector ink ) -{ - VImage image = *this; - Vargv _vec( "im_draw_line" ); - - _vec.data(0) = image.image(); - *((int*) _vec.data(1)) = x1; - *((int*) _vec.data(2)) = y1; - *((int*) _vec.data(3)) = x2; - *((int*) _vec.data(4)) = y2; - ((im_doublevec_object*) _vec.data(5))->n = ink.size(); - ((im_doublevec_object*) _vec.data(5))->vec = new double[ink.size()]; - for( unsigned int i = 0; i < ink.size(); i++ ) - ((im_doublevec_object*) _vec.data(5))->vec[i] = ink[i]; - _vec.call(); -} - -// im_draw_point: draw point on image -void VImage::draw_point( int x, int y, std::vector ink ) -{ - VImage image = *this; - Vargv _vec( "im_draw_point" ); - - _vec.data(0) = image.image(); - *((int*) _vec.data(1)) = x; - *((int*) _vec.data(2)) = y; - ((im_doublevec_object*) _vec.data(3))->n = ink.size(); - ((im_doublevec_object*) _vec.data(3))->vec = new double[ink.size()]; - for( unsigned int i = 0; i < ink.size(); i++ ) - ((im_doublevec_object*) _vec.data(3))->vec[i] = ink[i]; - _vec.call(); -} - -// im_draw_smudge: smudge part of an image -void VImage::draw_smudge( int left, int top, int width, int height ) -{ - VImage image = *this; - Vargv _vec( "im_draw_smudge" ); - - _vec.data(0) = image.image(); - *((int*) _vec.data(1)) = left; - *((int*) _vec.data(2)) = top; - *((int*) _vec.data(3)) = width; - *((int*) _vec.data(4)) = height; - _vec.call(); -} - -// im_draw_flood: flood with ink from x, y while pixel != ink -void VImage::draw_flood( int x, int y, std::vector ink ) -{ - VImage image = *this; - Vargv _vec( "im_draw_flood" ); - - _vec.data(0) = image.image(); - *((int*) _vec.data(1)) = x; - *((int*) _vec.data(2)) = y; - ((im_doublevec_object*) _vec.data(3))->n = ink.size(); - ((im_doublevec_object*) _vec.data(3))->vec = new double[ink.size()]; - for( unsigned int i = 0; i < ink.size(); i++ ) - ((im_doublevec_object*) _vec.data(3))->vec[i] = ink[i]; - _vec.call(); -} - -// im_draw_flood_blob: flood with ink from x, y while pixel == start -void VImage::draw_flood_blob( int x, int y, std::vector ink ) -{ - VImage image = *this; - Vargv _vec( "im_draw_flood_blob" ); - - _vec.data(0) = image.image(); - *((int*) _vec.data(1)) = x; - *((int*) _vec.data(2)) = y; - ((im_doublevec_object*) _vec.data(3))->n = ink.size(); - ((im_doublevec_object*) _vec.data(3))->vec = new double[ink.size()]; - for( unsigned int i = 0; i < ink.size(); i++ ) - ((im_doublevec_object*) _vec.data(3))->vec[i] = ink[i]; - _vec.call(); -} - -// im_draw_flood_other: flood image with serial from x, y while pixel == start -void VImage::draw_flood_other( VImage test, int x, int y, int serial ) -{ - VImage image = *this; - Vargv _vec( "im_draw_flood_other" ); - - _vec.data(0) = image.image(); - _vec.data(1) = test.image(); - *((int*) _vec.data(2)) = x; - *((int*) _vec.data(3)) = y; - *((int*) _vec.data(4)) = serial; - _vec.call(); -} - -// im_draw_image: draw image sub inside image main at position (x,y) -void VImage::draw_image( VImage sub, int x, int y ) -{ - VImage image = *this; - Vargv _vec( "im_draw_image" ); - - _vec.data(0) = image.image(); - _vec.data(1) = sub.image(); - *((int*) _vec.data(2)) = x; - *((int*) _vec.data(3)) = y; - _vec.call(); -} - -// im_draw_mask: draw mask sub inside image main at position (x,y) -void VImage::draw_mask( VImage mask, int x, int y, std::vector ink ) -{ - VImage image = *this; - Vargv _vec( "im_draw_mask" ); - - _vec.data(0) = image.image(); - _vec.data(1) = mask.image(); - *((int*) _vec.data(2)) = x; - *((int*) _vec.data(3)) = y; - ((im_doublevec_object*) _vec.data(4))->n = ink.size(); - ((im_doublevec_object*) _vec.data(4))->vec = new double[ink.size()]; - for( unsigned int i = 0; i < ink.size(); i++ ) - ((im_doublevec_object*) _vec.data(4))->vec[i] = ink[i]; - _vec.call(); -} - -// im_lineset: draw line between points (x1,y1) and (x2,y2) -VImage VImage::line( VImage mask, VImage ink, std::vector x1, std::vector y1, std::vector x2, std::vector y2 ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_lineset" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = mask.image(); - _vec.data(3) = ink.image(); - ((im_intvec_object*) _vec.data(4))->n = x1.size(); - ((im_intvec_object*) _vec.data(4))->vec = new int[x1.size()]; - for( unsigned int i = 0; i < x1.size(); i++ ) - ((im_intvec_object*) _vec.data(4))->vec[i] = x1[i]; - ((im_intvec_object*) _vec.data(5))->n = y1.size(); - ((im_intvec_object*) _vec.data(5))->vec = new int[y1.size()]; - for( unsigned int i = 0; i < y1.size(); i++ ) - ((im_intvec_object*) _vec.data(5))->vec[i] = y1[i]; - ((im_intvec_object*) _vec.data(6))->n = x2.size(); - ((im_intvec_object*) _vec.data(6))->vec = new int[x2.size()]; - for( unsigned int i = 0; i < x2.size(); i++ ) - ((im_intvec_object*) _vec.data(6))->vec[i] = x2[i]; - ((im_intvec_object*) _vec.data(7))->n = y2.size(); - ((im_intvec_object*) _vec.data(7))->vec = new int[y2.size()]; - for( unsigned int i = 0; i < y2.size(); i++ ) - ((im_intvec_object*) _vec.data(7))->vec[i] = y2[i]; - _vec.call(); - - return( out ); -} - - -// bodies for package iofuncs -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_binfile: open a headerless binary file -VImage VImage::binfile( char* filename, int width, int height, int bands, int offset ) -{ - VImage out; - - Vargv _vec( "im_binfile" ); - - _vec.data(0) = (im_object) filename; - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = width; - *((int*) _vec.data(3)) = height; - *((int*) _vec.data(4)) = bands; - *((int*) _vec.data(5)) = offset; - _vec.call(); - - return( out ); -} - -// im_cache: cache results of an operation -VImage VImage::cache( int tile_width, int tile_height, int max_tiles ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_cache" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = tile_width; - *((int*) _vec.data(3)) = tile_height; - *((int*) _vec.data(4)) = max_tiles; - _vec.call(); - - return( out ); -} - -// im_tile_cache_random: cache results of an operation -VImage VImage::tile_cache_random( int tile_width, int tile_height, int max_tiles ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_tile_cache_random" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = tile_width; - *((int*) _vec.data(3)) = tile_height; - *((int*) _vec.data(4)) = max_tiles; - _vec.call(); - - return( out ); -} - -// im_getext: return the image metadata XML as a string -char* VImage::getext() -{ - VImage image = *this; - char* history; - - Vargv _vec( "im_getext" ); - - _vec.data(0) = image.image(); - _vec.call(); - history = (char*) _vec.data(1); - - return( history ); -} - -// im_header_get_typeof: return field type -int VImage::header_get_typeof( char* field ) -{ - VImage image = *this; - int gtype; - - Vargv _vec( "im_header_get_typeof" ); - - _vec.data(0) = (im_object) field; - _vec.data(1) = image.image(); - _vec.call(); - gtype = *((int*)_vec.data(2)); - - return( gtype ); -} - -// im_header_int: extract int fields from header -int VImage::header_int( char* field ) -{ - VImage image = *this; - int value; - - Vargv _vec( "im_header_int" ); - - _vec.data(0) = (im_object) field; - _vec.data(1) = image.image(); - _vec.call(); - value = *((int*)_vec.data(2)); - - return( value ); -} - -// im_header_double: extract double fields from header -double VImage::header_double( char* field ) -{ - VImage image = *this; - double value; - - Vargv _vec( "im_header_double" ); - - _vec.data(0) = (im_object) field; - _vec.data(1) = image.image(); - _vec.call(); - value = *((double*)_vec.data(2)); - - return( value ); -} - -// im_header_string: extract fields from headers as strings -char* VImage::header_string( char* field ) -{ - VImage image = *this; - char* value; - - Vargv _vec( "im_header_string" ); - - _vec.data(0) = (im_object) field; - _vec.data(1) = image.image(); - _vec.call(); - value = (char*) _vec.data(2); - - return( value ); -} - -// im_history_get: return the image history as a string -char* VImage::history_get() -{ - VImage image = *this; - char* history; - - Vargv _vec( "im_history_get" ); - - _vec.data(0) = image.image(); - _vec.call(); - history = (char*) _vec.data(1); - - return( history ); -} - -// im_printdesc: print an image header to stdout -void VImage::printdesc() -{ - VImage image = *this; - Vargv _vec( "im_printdesc" ); - - _vec.data(0) = image.image(); - _vec.call(); -} - - -// bodies for package mask -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 - -// bodies for package morphology -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_cntlines: count horizontal or vertical lines -double VImage::cntlines( int direction ) -{ - VImage in = *this; - double nlines; - - Vargv _vec( "im_cntlines" ); - - _vec.data(0) = in.image(); - *((int*) _vec.data(2)) = direction; - _vec.call(); - nlines = *((double*)_vec.data(1)); - - return( nlines ); -} - -// im_dilate: dilate image with mask, adding a black border -VImage VImage::dilate( VIMask mask ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_dilate" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = mask.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_rank: rank filter nth element of xsize/ysize window -VImage VImage::rank( int xsize, int ysize, int n ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rank" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = xsize; - *((int*) _vec.data(3)) = ysize; - *((int*) _vec.data(4)) = n; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_rank_image: point-wise pixel rank -VImage VImage::rank_image( std::vector in, int index ) -{ - VImage out; - - Vargv _vec( "im_rank_image" ); - - ((im_imagevec_object*) _vec.data(0))->n = in.size(); - ((im_imagevec_object*) _vec.data(0))->vec = new IMAGE *[in.size()]; - for( unsigned int i = 0; i < in.size(); i++ ) - ((im_imagevec_object*) _vec.data(0))->vec[i] = in[i].image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = index; - _vec.call(); - for( unsigned int i = 0; i < in.size(); i++ ) - out._ref->addref( in[i]._ref ); - - return( out ); -} - -// im_maxvalue: point-wise maximum value -VImage VImage::maxvalue( std::vector in ) -{ - VImage out; - - Vargv _vec( "im_maxvalue" ); - - ((im_imagevec_object*) _vec.data(0))->n = in.size(); - ((im_imagevec_object*) _vec.data(0))->vec = new IMAGE *[in.size()]; - for( unsigned int i = 0; i < in.size(); i++ ) - ((im_imagevec_object*) _vec.data(0))->vec[i] = in[i].image(); - _vec.data(1) = out.image(); - _vec.call(); - for( unsigned int i = 0; i < in.size(); i++ ) - out._ref->addref( in[i]._ref ); - - return( out ); -} - -// im_label_regions: number continuous regions in an image -VImage VImage::label_regions( int& segments ) -{ - VImage test = *this; - VImage mask; - - Vargv _vec( "im_label_regions" ); - - _vec.data(0) = test.image(); - _vec.data(1) = mask.image(); - _vec.call(); - segments = *((int*)_vec.data(2)); - - return( mask ); -} - -// im_zerox: find +ve or -ve zero crossings in image -VImage VImage::zerox( int flag ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_zerox" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = flag; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_erode: erode image with mask, adding a black border -VImage VImage::erode( VIMask mask ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_erode" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = mask.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_profile: find first horizontal/vertical edge -VImage VImage::profile( int direction ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_profile" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = direction; - _vec.call(); - - return( out ); -} - - -// bodies for package mosaicing -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_align_bands: align the bands of an image -VImage VImage::align_bands() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_align_bands" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - - return( out ); -} - -// im_correl: search area around sec for match for area around ref -double VImage::correl( VImage sec, int xref, int yref, int xsec, int ysec, int hwindowsize, int hsearchsize, int& x, int& y ) -{ - VImage ref = *this; - double correlation; - - Vargv _vec( "im_correl" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - *((int*) _vec.data(2)) = xref; - *((int*) _vec.data(3)) = yref; - *((int*) _vec.data(4)) = xsec; - *((int*) _vec.data(5)) = ysec; - *((int*) _vec.data(6)) = hwindowsize; - *((int*) _vec.data(7)) = hsearchsize; - _vec.call(); - correlation = *((double*)_vec.data(8)); - x = *((int*)_vec.data(9)); - y = *((int*)_vec.data(10)); - - return( correlation ); -} - -// im__find_lroverlap: search for left-right overlap of ref and sec -int VImage::_find_lroverlap( VImage sec, int bandno, int xr, int yr, int xs, int ys, int halfcorrelation, int halfarea, int& dy0, double& scale1, double& angle1, double& dx1, double& dy1 ) -{ - VImage ref = *this; - int dx0; - - Vargv _vec( "im__find_lroverlap" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - *((int*) _vec.data(2)) = bandno; - *((int*) _vec.data(3)) = xr; - *((int*) _vec.data(4)) = yr; - *((int*) _vec.data(5)) = xs; - *((int*) _vec.data(6)) = ys; - *((int*) _vec.data(7)) = halfcorrelation; - *((int*) _vec.data(8)) = halfarea; - _vec.call(); - dx0 = *((int*)_vec.data(9)); - dy0 = *((int*)_vec.data(10)); - scale1 = *((double*)_vec.data(11)); - angle1 = *((double*)_vec.data(12)); - dx1 = *((double*)_vec.data(13)); - dy1 = *((double*)_vec.data(14)); - - return( dx0 ); -} - -// im__find_tboverlap: search for top-bottom overlap of ref and sec -int VImage::_find_tboverlap( VImage sec, int bandno, int xr, int yr, int xs, int ys, int halfcorrelation, int halfarea, int& dy0, double& scale1, double& angle1, double& dx1, double& dy1 ) -{ - VImage ref = *this; - int dx0; - - Vargv _vec( "im__find_tboverlap" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - *((int*) _vec.data(2)) = bandno; - *((int*) _vec.data(3)) = xr; - *((int*) _vec.data(4)) = yr; - *((int*) _vec.data(5)) = xs; - *((int*) _vec.data(6)) = ys; - *((int*) _vec.data(7)) = halfcorrelation; - *((int*) _vec.data(8)) = halfarea; - _vec.call(); - dx0 = *((int*)_vec.data(9)); - dy0 = *((int*)_vec.data(10)); - scale1 = *((double*)_vec.data(11)); - angle1 = *((double*)_vec.data(12)); - dx1 = *((double*)_vec.data(13)); - dy1 = *((double*)_vec.data(14)); - - return( dx0 ); -} - -// im_global_balance: automatically rebuild mosaic with balancing -VImage VImage::global_balance( double gamma ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_global_balance" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = gamma; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_global_balancef: automatically rebuild mosaic with balancing, float output -VImage VImage::global_balancef( double gamma ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_global_balancef" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = gamma; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_lrmerge: left-right merge of in1 and in2 -VImage VImage::lrmerge( VImage sec, int dx, int dy, int mwidth ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_lrmerge" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = dx; - *((int*) _vec.data(4)) = dy; - *((int*) _vec.data(5)) = mwidth; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - -// im_lrmerge1: first-order left-right merge of ref and sec -VImage VImage::lrmerge1( VImage sec, int xr1, int yr1, int xs1, int ys1, int xr2, int yr2, int xs2, int ys2, int mwidth ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_lrmerge1" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = xr1; - *((int*) _vec.data(4)) = yr1; - *((int*) _vec.data(5)) = xs1; - *((int*) _vec.data(6)) = ys1; - *((int*) _vec.data(7)) = xr2; - *((int*) _vec.data(8)) = yr2; - *((int*) _vec.data(9)) = xs2; - *((int*) _vec.data(10)) = ys2; - *((int*) _vec.data(11)) = mwidth; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - -// im_lrmosaic: left-right mosaic of ref and sec -VImage VImage::lrmosaic( VImage sec, int bandno, int xr, int yr, int xs, int ys, int halfcorrelation, int halfarea, int balancetype, int mwidth ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_lrmosaic" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = bandno; - *((int*) _vec.data(4)) = xr; - *((int*) _vec.data(5)) = yr; - *((int*) _vec.data(6)) = xs; - *((int*) _vec.data(7)) = ys; - *((int*) _vec.data(8)) = halfcorrelation; - *((int*) _vec.data(9)) = halfarea; - *((int*) _vec.data(10)) = balancetype; - *((int*) _vec.data(11)) = mwidth; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - -// im_lrmosaic1: first-order left-right mosaic of ref and sec -VImage VImage::lrmosaic1( VImage sec, int bandno, int xr1, int yr1, int xs1, int ys1, int xr2, int yr2, int xs2, int ys2, int halfcorrelation, int halfarea, int balancetype, int mwidth ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_lrmosaic1" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = bandno; - *((int*) _vec.data(4)) = xr1; - *((int*) _vec.data(5)) = yr1; - *((int*) _vec.data(6)) = xs1; - *((int*) _vec.data(7)) = ys1; - *((int*) _vec.data(8)) = xr2; - *((int*) _vec.data(9)) = yr2; - *((int*) _vec.data(10)) = xs2; - *((int*) _vec.data(11)) = ys2; - *((int*) _vec.data(12)) = halfcorrelation; - *((int*) _vec.data(13)) = halfarea; - *((int*) _vec.data(14)) = balancetype; - *((int*) _vec.data(15)) = mwidth; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - -// im_match_linear: resample ref so that tie-points match -VImage VImage::match_linear( VImage sec, int xref1, int yref1, int xsec1, int ysec1, int xref2, int yref2, int xsec2, int ysec2 ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_match_linear" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = xref1; - *((int*) _vec.data(4)) = yref1; - *((int*) _vec.data(5)) = xsec1; - *((int*) _vec.data(6)) = ysec1; - *((int*) _vec.data(7)) = xref2; - *((int*) _vec.data(8)) = yref2; - *((int*) _vec.data(9)) = xsec2; - *((int*) _vec.data(10)) = ysec2; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - -// im_match_linear_search: search sec, then resample so that tie-points match -VImage VImage::match_linear_search( VImage sec, int xref1, int yref1, int xsec1, int ysec1, int xref2, int yref2, int xsec2, int ysec2, int hwindowsize, int hsearchsize ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_match_linear_search" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = xref1; - *((int*) _vec.data(4)) = yref1; - *((int*) _vec.data(5)) = xsec1; - *((int*) _vec.data(6)) = ysec1; - *((int*) _vec.data(7)) = xref2; - *((int*) _vec.data(8)) = yref2; - *((int*) _vec.data(9)) = xsec2; - *((int*) _vec.data(10)) = ysec2; - *((int*) _vec.data(11)) = hwindowsize; - *((int*) _vec.data(12)) = hsearchsize; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - -// im_maxpos_subpel: subpixel position of maximum of (phase correlation) image -double VImage::maxpos_subpel( double& y ) -{ - VImage im = *this; - double x; - - Vargv _vec( "im_maxpos_subpel" ); - - _vec.data(0) = im.image(); - _vec.call(); - x = *((double*)_vec.data(1)); - y = *((double*)_vec.data(2)); - - return( x ); -} - -// im_remosaic: automatically rebuild mosaic with new files -VImage VImage::remosaic( char* old_str, char* new_str ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_remosaic" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = (im_object) old_str; - _vec.data(3) = (im_object) new_str; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_tbmerge: top-bottom merge of in1 and in2 -VImage VImage::tbmerge( VImage sec, int dx, int dy, int mwidth ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_tbmerge" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = dx; - *((int*) _vec.data(4)) = dy; - *((int*) _vec.data(5)) = mwidth; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - -// im_tbmerge1: first-order top-bottom merge of in1 and in2 -VImage VImage::tbmerge1( VImage sec, int xr1, int yr1, int xs1, int ys1, int xr2, int yr2, int xs2, int ys2, int mwidth ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_tbmerge1" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = xr1; - *((int*) _vec.data(4)) = yr1; - *((int*) _vec.data(5)) = xs1; - *((int*) _vec.data(6)) = ys1; - *((int*) _vec.data(7)) = xr2; - *((int*) _vec.data(8)) = yr2; - *((int*) _vec.data(9)) = xs2; - *((int*) _vec.data(10)) = ys2; - *((int*) _vec.data(11)) = mwidth; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - -// im_tbmosaic: top-bottom mosaic of in1 and in2 -VImage VImage::tbmosaic( VImage sec, int bandno, int xr, int yr, int xs, int ys, int halfcorrelation, int halfarea, int balancetype, int mwidth ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_tbmosaic" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = bandno; - *((int*) _vec.data(4)) = xr; - *((int*) _vec.data(5)) = yr; - *((int*) _vec.data(6)) = xs; - *((int*) _vec.data(7)) = ys; - *((int*) _vec.data(8)) = halfcorrelation; - *((int*) _vec.data(9)) = halfarea; - *((int*) _vec.data(10)) = balancetype; - *((int*) _vec.data(11)) = mwidth; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - -// im_tbmosaic1: first-order top-bottom mosaic of ref and sec -VImage VImage::tbmosaic1( VImage sec, int bandno, int xr1, int yr1, int xs1, int ys1, int xr2, int yr2, int xs2, int ys2, int halfcorrelation, int halfarea, int balancetype, int mwidth ) -{ - VImage ref = *this; - VImage out; - - Vargv _vec( "im_tbmosaic1" ); - - _vec.data(0) = ref.image(); - _vec.data(1) = sec.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = bandno; - *((int*) _vec.data(4)) = xr1; - *((int*) _vec.data(5)) = yr1; - *((int*) _vec.data(6)) = xs1; - *((int*) _vec.data(7)) = ys1; - *((int*) _vec.data(8)) = xr2; - *((int*) _vec.data(9)) = yr2; - *((int*) _vec.data(10)) = xs2; - *((int*) _vec.data(11)) = ys2; - *((int*) _vec.data(12)) = halfcorrelation; - *((int*) _vec.data(13)) = halfarea; - *((int*) _vec.data(14)) = balancetype; - *((int*) _vec.data(15)) = mwidth; - _vec.call(); - out._ref->addref( ref._ref ); - out._ref->addref( sec._ref ); - - return( out ); -} - - -// bodies for package other -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_benchmark: do something complicated for testing -VImage VImage::benchmark() -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_benchmark" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_benchmark2: do something complicated for testing -double VImage::benchmark2() -{ - VImage in = *this; - double value; - - Vargv _vec( "im_benchmark2" ); - - _vec.data(0) = in.image(); - _vec.call(); - value = *((double*)_vec.data(1)); - - return( value ); -} - -// im_benchmarkn: do something complicated for testing -VImage VImage::benchmarkn( int n ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_benchmarkn" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = n; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_eye: generate IM_BANDFMT_UCHAR [0,255] frequency/amplitude image -VImage VImage::eye( int xsize, int ysize, double factor ) -{ - VImage out; - - Vargv _vec( "im_eye" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = xsize; - *((int*) _vec.data(2)) = ysize; - *((double*) _vec.data(3)) = factor; - _vec.call(); - - return( out ); -} - -// im_grey: generate IM_BANDFMT_UCHAR [0,255] grey scale image -VImage VImage::grey( int xsize, int ysize ) -{ - VImage out; - - Vargv _vec( "im_grey" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = xsize; - *((int*) _vec.data(2)) = ysize; - _vec.call(); - - return( out ); -} - -// im_feye: generate IM_BANDFMT_FLOAT [-1,1] frequency/amplitude image -VImage VImage::feye( int xsize, int ysize, double factor ) -{ - VImage out; - - Vargv _vec( "im_feye" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = xsize; - *((int*) _vec.data(2)) = ysize; - *((double*) _vec.data(3)) = factor; - _vec.call(); - - return( out ); -} - -// im_fgrey: generate IM_BANDFMT_FLOAT [0,1] grey scale image -VImage VImage::fgrey( int xsize, int ysize ) -{ - VImage out; - - Vargv _vec( "im_fgrey" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = xsize; - *((int*) _vec.data(2)) = ysize; - _vec.call(); - - return( out ); -} - -// im_fzone: generate IM_BANDFMT_FLOAT [-1,1] zone plate image -VImage VImage::fzone( int size ) -{ - VImage out; - - Vargv _vec( "im_fzone" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = size; - _vec.call(); - - return( out ); -} - -// im_make_xy: generate image with pixel value equal to coordinate -VImage VImage::make_xy( int xsize, int ysize ) -{ - VImage out; - - Vargv _vec( "im_make_xy" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = xsize; - *((int*) _vec.data(2)) = ysize; - _vec.call(); - - return( out ); -} - -// im_sines: generate 2D sine image -VImage VImage::sines( int xsize, int ysize, double horfreq, double verfreq ) -{ - VImage out; - - Vargv _vec( "im_sines" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = xsize; - *((int*) _vec.data(2)) = ysize; - *((double*) _vec.data(3)) = horfreq; - *((double*) _vec.data(4)) = verfreq; - _vec.call(); - - return( out ); -} - -// im_zone: generate IM_BANDFMT_UCHAR [0,255] zone plate image -VImage VImage::zone( int size ) -{ - VImage out; - - Vargv _vec( "im_zone" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = size; - _vec.call(); - - return( out ); -} - - -// bodies for package resample -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_rightshift_size: decrease size by a power-of-two factor -VImage VImage::rightshift_size( int xshift, int yshift, int band_fmt ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rightshift_size" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = xshift; - *((int*) _vec.data(3)) = yshift; - *((int*) _vec.data(4)) = band_fmt; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_shrink: shrink image by xfac, yfac times -VImage VImage::shrink( double xfac, double yfac ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_shrink" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = xfac; - *((double*) _vec.data(3)) = yfac; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_stretch3: stretch 3%, sub-pixel displace by xdisp/ydisp -VImage VImage::stretch3( double xdisp, double ydisp ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_stretch3" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = xdisp; - *((double*) _vec.data(3)) = ydisp; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_affinei: affine transform -VImage VImage::affinei( char* interpolate, double a, double b, double c, double d, double dx, double dy, int x, int y, int w, int h ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_affinei" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - if( vips__input_interpolate_init( &_vec.data(2), interpolate ) ) - verror(); - *((double*) _vec.data(3)) = a; - *((double*) _vec.data(4)) = b; - *((double*) _vec.data(5)) = c; - *((double*) _vec.data(6)) = d; - *((double*) _vec.data(7)) = dx; - *((double*) _vec.data(8)) = dy; - *((int*) _vec.data(9)) = x; - *((int*) _vec.data(10)) = y; - *((int*) _vec.data(11)) = w; - *((int*) _vec.data(12)) = h; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_affinei_all: affine transform of whole image -VImage VImage::affinei_all( char* interpolate, double a, double b, double c, double d, double dx, double dy ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_affinei_all" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - if( vips__input_interpolate_init( &_vec.data(2), interpolate ) ) - verror(); - *((double*) _vec.data(3)) = a; - *((double*) _vec.data(4)) = b; - *((double*) _vec.data(5)) = c; - *((double*) _vec.data(6)) = d; - *((double*) _vec.data(7)) = dx; - *((double*) _vec.data(8)) = dy; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - - -// bodies for package video -// this file automatically generated from -// VIPS library 8.6.0-Sun Nov 26 17:45:39 GMT 2017 -// im_video_test: test video grabber -VImage VImage::video_test( int brightness, int error ) -{ - VImage out; - - Vargv _vec( "im_video_test" ); - - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = brightness; - *((int*) _vec.data(2)) = error; - _vec.call(); - - return( out ); -} - -// im_video_v4l1: grab a video frame with v4l1 -VImage VImage::video_v4l1( char* device, int channel, int brightness, int colour, int contrast, int hue, int ngrabs ) -{ - VImage out; - - Vargv _vec( "im_video_v4l1" ); - - _vec.data(0) = out.image(); - _vec.data(1) = (im_object) device; - *((int*) _vec.data(2)) = channel; - *((int*) _vec.data(3)) = brightness; - *((int*) _vec.data(4)) = colour; - *((int*) _vec.data(5)) = contrast; - *((int*) _vec.data(6)) = hue; - *((int*) _vec.data(7)) = ngrabs; - _vec.call(); - - return( out ); -} - - diff --git a/po/POTFILES.in b/po/POTFILES.in index 2843ea71..a6b3c871 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/python/Makefile.am b/python/Makefile.am deleted file mode 100644 index fadca9af..00000000 --- a/python/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = packages - -EXTRA_DIST = \ - README.md - diff --git a/python/README.md b/python/README.md deleted file mode 100644 index 51b5546e..00000000 --- a/python/README.md +++ /dev/null @@ -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. diff --git a/python/example/cod.py b/python/example/cod.py deleted file mode 100755 index bbe8771f..00000000 --- a/python/example/cod.py +++ /dev/null @@ -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]) - - diff --git a/python/example/read_profile.py b/python/example/read_profile.py deleted file mode 100755 index d7c859b8..00000000 --- a/python/example/read_profile.py +++ /dev/null @@ -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) - - diff --git a/python/example/try.py b/python/example/try.py deleted file mode 100755 index 4ccfe3f0..00000000 --- a/python/example/try.py +++ /dev/null @@ -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() diff --git a/python/example/try10.py b/python/example/try10.py deleted file mode 100755 index 1e0a9b8d..00000000 --- a/python/example/try10.py +++ /dev/null @@ -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") diff --git a/python/example/try11.py b/python/example/try11.py deleted file mode 100755 index 76ff609e..00000000 --- a/python/example/try11.py +++ /dev/null @@ -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") diff --git a/python/example/try12.py b/python/example/try12.py deleted file mode 100755 index 38bec857..00000000 --- a/python/example/try12.py +++ /dev/null @@ -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]) diff --git a/python/example/try13.py b/python/example/try13.py deleted file mode 100755 index 3349c966..00000000 --- a/python/example/try13.py +++ /dev/null @@ -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 diff --git a/python/example/try14.py b/python/example/try14.py deleted file mode 100755 index cd2b4ee4..00000000 --- a/python/example/try14.py +++ /dev/null @@ -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") diff --git a/python/example/try15.py b/python/example/try15.py deleted file mode 100755 index 62ae8df2..00000000 --- a/python/example/try15.py +++ /dev/null @@ -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) - - diff --git a/python/example/try16.py b/python/example/try16.py deleted file mode 100755 index 852fa091..00000000 --- a/python/example/try16.py +++ /dev/null @@ -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]) - - diff --git a/python/example/try17.py b/python/example/try17.py deleted file mode 100755 index d8078b4d..00000000 --- a/python/example/try17.py +++ /dev/null @@ -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]) - - diff --git a/python/example/try2.py b/python/example/try2.py deleted file mode 100755 index cb3b39c4..00000000 --- a/python/example/try2.py +++ /dev/null @@ -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") diff --git a/python/example/try3.py b/python/example/try3.py deleted file mode 100755 index b39e776d..00000000 --- a/python/example/try3.py +++ /dev/null @@ -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() - diff --git a/python/example/try4.py b/python/example/try4.py deleted file mode 100755 index bbe7db55..00000000 --- a/python/example/try4.py +++ /dev/null @@ -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]) diff --git a/python/example/try5.py b/python/example/try5.py deleted file mode 100755 index 104c98f1..00000000 --- a/python/example/try5.py +++ /dev/null @@ -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 - diff --git a/python/example/try6.py b/python/example/try6.py deleted file mode 100755 index f3201fa0..00000000 --- a/python/example/try6.py +++ /dev/null @@ -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, "") diff --git a/python/example/try7.py b/python/example/try7.py deleted file mode 100755 index e82219b1..00000000 --- a/python/example/try7.py +++ /dev/null @@ -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") diff --git a/python/example/try8.py b/python/example/try8.py deleted file mode 100755 index fc381565..00000000 --- a/python/example/try8.py +++ /dev/null @@ -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") diff --git a/python/example/try9.py b/python/example/try9.py deleted file mode 100755 index 56f0149d..00000000 --- a/python/example/try9.py +++ /dev/null @@ -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") diff --git a/python/find_class_methods.py b/python/find_class_methods.py deleted file mode 100755 index 93c55159..00000000 --- a/python/find_class_methods.py +++ /dev/null @@ -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 diff --git a/python/packages/Makefile.am b/python/packages/Makefile.am deleted file mode 100644 index 14602de3..00000000 --- a/python/packages/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = gi diff --git a/python/packages/gi/Makefile.am b/python/packages/gi/Makefile.am deleted file mode 100644 index dee3aef1..00000000 --- a/python/packages/gi/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = overrides - -EXTRA_DIST = \ - __init__.py - diff --git a/python/packages/gi/__init__.py b/python/packages/gi/__init__.py deleted file mode 100644 index e35e122f..00000000 --- a/python/packages/gi/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# support overrides in different directories than our gi module -from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) diff --git a/python/packages/gi/overrides/Makefile.am b/python/packages/gi/overrides/Makefile.am deleted file mode 100644 index 7a93b151..00000000 --- a/python/packages/gi/overrides/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -vips_overridesdir = $(pyexecdir)/gi/overrides -vips_overrides_PYTHON = Vips.py - -EXTRA_DIST = \ - __init__.py diff --git a/python/packages/gi/overrides/Vips.py b/python/packages/gi/overrides/Vips.py deleted file mode 100644 index c071d5e4..00000000 --- a/python/packages/gi/overrides/Vips.py +++ /dev/null @@ -1,1153 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -# vim: tabstop=4 shiftwidth=4 expandtab - -from __future__ import division - -# overrides for pygobject gobject-introspection binding for libvips, tested -# with python2.7 and python3.4 - -# copy this file to dist-packages/gi/overrides, eg. -# -# sudo cp Vips.py /usr/lib/python2.7/dist-packages/gi/overrides -# sudo cp Vips.py /usr/lib/python3/dist-packages/gi/overrides -# -# Alternatively, build vips to another prefix, then copy Vips.py and Vips.pyc -# from $prefix/lib/python2.7/dist-packages/gi/overrides to /usr - -# 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 - -import sys -import re -import logging -import numbers - -logger = logging.getLogger(__name__) - -from gi.repository import GObject -from ..overrides import override -from ..module import get_introspection_module - -Vips = get_introspection_module('Vips') - -__all__ = [] - -# start up vips! -# passing argv[0] helps vips find its data files on some platforms -Vips.init(sys.argv[0]) - -# need the gtypes for various vips types -vips_type_array_int = GObject.GType.from_name("VipsArrayInt") -vips_type_array_double = GObject.GType.from_name("VipsArrayDouble") -vips_type_array_image = GObject.GType.from_name("VipsArrayImage") -vips_type_blob = GObject.GType.from_name("VipsBlob") -vips_type_image = GObject.GType.from_name("VipsImage") -vips_type_operation = GObject.GType.from_name("VipsOperation") -vips_type_ref_string = GObject.GType.from_name("VipsRefString") - -# 8.4 and earlier had a bug which swapped the order of const args to enum -# operations -swap_const_args = Vips.version(0) < 8 or (Vips.version(0) == 8 and - Vips.version(1) <= 4) - -def is_2D(value): - if not isinstance(value, list): - return False - - for x in value: - if not isinstance(x, list): - return False - - if len(x) != len(value[0]): - return False - - return True - -def imageize(match_image, value): - logger.debug('imageize match_image=%s, value=%s' % (match_image, value)) - - # 2D arrays become array images - if is_2D(value): - return Vips.Image.new_from_array(value) - - # if there's nothing to match to, also make an array - if match_image is None: - return Vips.Image.new_from_array(value) - - # assume this is a pixel constant ... expand into an image using - # match as a template - return match_image.new_from_image(value) - -# we'd like to use memoryview to avoid copying things like ICC profiles, but -# unfortunately pygobject does not support this ... so for blobs we just use -# bytes(). - -unpack_types = [[Vips.Blob, lambda x: bytes(x.get())], - [Vips.RefString, lambda x: x.get()], - [Vips.ArrayDouble, lambda x: x.get()], - [Vips.ArrayImage, lambda x: x.get()], - [Vips.ArrayInt, lambda x: x.get()]] -def unpack(value): - for t, cast in unpack_types: - if isinstance(value, t): - return cast(value) - - return value - -def array_image_new(array): - match_image = next((x for x in array if isinstance(x, Vips.Image)), None) - if match_image is None: - raise Error('Unable to make image array argument.', - 'Array must contain at least one image.') - - for i in range(0, len(array)): - if not isinstance(array[i], Vips.Image): - array[i] = imageize(match_image, array[i]) - - return Vips.ArrayImage.new(array) - -arrayize_types = [[vips_type_array_int, Vips.ArrayInt.new], - [vips_type_array_double, Vips.ArrayDouble.new], - [vips_type_array_image, array_image_new]] -def arrayize(gtype, value): - for t, cast in arrayize_types: - if GObject.type_is_a(gtype, t): - if not isinstance(value, list): - value = [value] - return cast(value) - - return value - -def run_cmplx(fn, image): - """Run a complex function on a non-complex image. - - The image needs to be complex, or have an even number of bands. The input - can be int, the output is always float or double. - """ - original_format = image.format - - if not Vips.band_format_iscomplex(image.format): - if image.bands % 2 != 0: - raise "not an even number of bands" - - if not Vips.band_format_isfloat(image.format): - image = image.cast(Vips.BandFormat.FLOAT) - - if image.format == Vips.BandFormat.DOUBLE: - new_format = Vips.BandFormat.DPCOMPLEX - else: - new_format = Vips.BandFormat.COMPLEX - - image = image.copy(format = new_format, bands = image.bands / 2) - - image = fn(image) - - if not Vips.band_format_iscomplex(original_format): - if image.format == Vips.BandFormat.DPCOMPLEX: - new_format = Vips.BandFormat.DOUBLE - else: - new_format = Vips.BandFormat.FLOAT - - image = image.copy(format = new_format, bands = image.bands * 2) - - return image - -class Error(Exception): - """An error from vips. - - message -- a high-level description of the error - detail -- a string with some detailed diagnostics - """ - def __init__(self, message, detail = None): - self.message = message - if detail == None or detail == "": - detail = Vips.error_buffer() - Vips.error_clear() - self.detail = detail - - logger.debug('Error %s %s', self.message, self.detail) - - def __str__(self): - return '%s\n %s' % (self.message, self.detail) - -Vips.Error = Error - -class Argument(object): - def __init__(self, op, prop): - self.op = op - self.prop = prop - self.name = re.sub("-", "_", prop.name) - self.flags = op.get_argument_flags(self.name) - self.priority = op.get_argument_priority(self.name) - self.isset = op.argument_isset(self.name) - - def set_value(self, match_image, value): - logger.debug('assigning %s to %s' % (value, self.name)) - logger.debug('%s needs a %s' % (self.name, self.prop.value_type)) - - # blob-ize - if GObject.type_is_a(self.prop.value_type, vips_type_blob): - if not isinstance(value, Vips.Blob): - value = Vips.Blob.new(None, value) - - # image-ize - if GObject.type_is_a(self.prop.value_type, vips_type_image): - if not isinstance(value, Vips.Image): - value = imageize(match_image, value) - - # array-ize some types, if necessary - value = arrayize(self.prop.value_type, value) - - # MODIFY input images need to be copied before assigning them - if self.flags & Vips.ArgumentFlags.MODIFY: - # don't use .copy(): we want to make a new pipeline with no - # reference back to the old stuff ... this way we can free the - # previous image earlier - logger.debug('MODIFY argument: copying image') - new_image = Vips.Image.new_memory() - value.write(new_image) - value = new_image - - logger.debug('assigning %s' % value) - - self.op.props.__setattr__(self.name, value) - - def get_value(self): - value = self.op.props.__getattribute__(self.name) - - logger.debug('read out %s from %s' % (value, self.name)) - - return unpack(value) - - def description(self): - result = self.name - result += " " * (10 - len(self.name)) + " -- " + self.prop.blurb - result += ", " + self.prop.value_type.name - - return result - -Vips.Argument = Argument - -class Operation(Vips.Operation): - - # find all the args for this op, sort into priority order - # we leave deprecated args in this list: for compatibility, we want users - # to be able to set them - # if you are (for example) generating docs, you'll need to filter out the - # deprecated args yourself - def get_args(self): - args = [Argument(self, x) for x in self.props] - args.sort(key = lambda x: x.priority) - - return args - -Operation = override(Operation) -__all__.append('Operation') - -# search a list recursively for a Vips.Image object -def find_image(x): - if isinstance(x, Vips.Image): - return x - if isinstance(x, list): - for i in x: - y = find_image(i) - if y is not None: - return y - return None - -def _call_base(name, required, optional, self = None, option_string = None): - logger.debug('_call_base name=%s, required=%s optional=%s' % - (name, required, optional)) - if self: - logger.debug('_call_base self=%s' % self) - if option_string: - logger.debug('_call_base option_string = %s' % option_string) - - try: - op = Vips.Operation.new(name) - except TypeError as e: - raise Error('No such operator.') - if op.get_flags() & Vips.OperationFlags.DEPRECATED: - raise Error('No such operator.', 'operator "%s" is deprecated' % name) - - # set str options first so the user can't override things we set - # deliberately and break stuff - if option_string: - if op.set_from_string(option_string) != 0: - raise Error('Bad arguments.') - - args = op.get_args() - - enm = Vips.ArgumentFlags - - # find all required, unassigned, undeprecated input args - required_input = [x for x in args if x.flags & enm.INPUT and - x.flags & enm.REQUIRED and - not x.flags & enm.DEPRECATED and - not x.isset] - - # do we have a non-None self pointer? this is used to set the first - # compatible input arg - if self is not None: - found = False - for x in required_input: - if GObject.type_is_a(self, x.prop.value_type): - x.set_value(None, self) - required_input.remove(x) - found = True - break - - if not found: - raise Error('Bad arguments.', 'No %s argument to %s.' % - (str(self.__class__), name)) - - if len(required_input) != len(required): - raise Error('Wrong number of arguments.', - '%s needs %d arguments, you supplied %d.' % - (name, len(required_input), len(required))) - - # if we need an image arg but the user supplied a number or list of - # numbers, we expand it into an image automatically ... the number is - # expanded to match self, or if that's None, the first image we can find in - # the required or optional arguments - match_image = self - if match_image is None: - for arg in required: - match_image = find_image(arg) - if match_image is not None: - break - - if match_image is None: - for arg_name in optional: - match_image = find_image(optional[arg_name]) - if match_image is not None: - break - - for i in range(len(required_input)): - required_input[i].set_value(match_image, required[i]) - - # find all optional, unassigned input args ... make a hash from name to - # Argument - # we let deprecated ones through, we want to allow assigment to them for - # compat - optional_input = {x.name: x for x in args if x.flags & enm.INPUT and - not x.flags & enm.REQUIRED and - not x.isset} - - # find all optional output args ... we use "x = True" - # in args to mean add that to output - optional_output = {x.name: x for x in args if x.flags & enm.OUTPUT and - not x.flags & enm.REQUIRED} - - # set optional input args - for key in list(optional.keys()): - if key in optional_input: - optional_input[key].set_value(match_image, optional[key]) - elif key in optional_output: - # must be a literal True value - if optional[key] is not True: - raise Error('Optional output argument must be True.', - 'Argument %s should equal True.' % key) - else: - raise Error('Unknown argument.', - 'Operator %s has no argument %s.' % (name, key)) - - # call - logger.debug('_call_base checking cache for op %s' % op) - op2 = Vips.cache_operation_build(op) - logger.debug('_call_base got op2 %s' % op2) - if op2 == None: - raise Error('Error calling operator %s.' % name) - - # rescan args if op2 is different from op - if op2 != op: - logger.debug('_call_base rescanning args') - args = op2.get_args() - optional_output = {x.name: x for x in args if x.flags & enm.OUTPUT and - not x.flags & enm.REQUIRED} - - # gather output args - logger.debug('_call_base fetching required output args') - out = [] - - for x in args: - # required non-deprecated output arg - if x.flags & enm.OUTPUT and x.flags & enm.REQUIRED and not x.flags & enm.DEPRECATED: - out.append(x.get_value()) - - # modified input arg ... this will get the memory image we made above - if x.flags & enm.INPUT and x.flags & enm.MODIFY: - out.append(x.get_value()) - - logger.debug('_call_base fetching optional output args') - out_dict = {} - for x in list(optional.keys()): - if x in optional_output: - out_dict[x] = optional_output[x].get_value() - if out_dict != {}: - out.append(out_dict) - - if len(out) == 1: - out = out[0] - elif len(out) == 0: - out = None - - # unref everything now we have refs to all outputs we want - op2.unref_outputs() - - logger.debug('success') - - return out - -# handy for expanding enums -def _call_enum(self, name, enum, other): - if isinstance(other, Vips.Image): - return _call_base(name, [other, enum], {}, self) - elif swap_const_args: - return _call_base(name + "_const", [other, enum], {}, self) - else: - return _call_base(name + "_const", [enum, other], {}, self) - -# for equality style operations, we need to allow comparison with None -def _call_enum_eq(self, name, enum, other): - if isinstance(other, Vips.Image): - return _call_base(name, [other, enum], {}, self) - elif isinstance(other, list) or isinstance(other, numbers.Number): - if swap_const_args: - return _call_base(name + "_const", [other, enum], {}, self) - else: - return _call_base(name + "_const", [enum, other], {}, self) - else: - return False - -# general user entrypoint -def call(name, *args, **kwargs): - return _call_base(name, args, kwargs) - -Vips.call = call - -# here from getattr ... try to run the attr as a method -def _call_instance(self, name, args, kwargs): - return _call_base(name, args, kwargs, self) - -@classmethod -def vips_image_new_from_file(cls, vips_filename, **kwargs): - """Create a new Image from a filename. - - Extra optional arguments depend on the loader selected by libvips. See each - loader for details. - """ - filename = Vips.filename_get_filename(vips_filename) - option_string = Vips.filename_get_options(vips_filename) - loader = Vips.Foreign.find_load(filename) - if loader == None: - raise Error('No known loader for "%s".' % filename) - logger.debug('Image.new_from_file: loader = %s' % loader) - - return _call_base(loader, [filename], kwargs, None, option_string) - -setattr(Vips.Image, 'new_from_file', vips_image_new_from_file) - -@classmethod -def vips_image_new_from_buffer(cls, data, option_string, **kwargs): - """Create a new Image from binary data in a string. - - data -- binary image data - option_string -- optional arguments in string form - - option_string can be something like "page=10" to load the 10th page of a - tiff file. You can also give load options as keyword arguments. - """ - loader = Vips.Foreign.find_load_buffer(data) - if loader == None: - raise Error('No known loader for buffer.') - logger.debug('Image.new_from_buffer: loader = %s' % loader) - - return _call_base(loader, [data], kwargs, None, option_string) - -setattr(Vips.Image, 'new_from_buffer', vips_image_new_from_buffer) - -@classmethod -def vips_image_new_from_array(cls, array, scale = 1, offset = 0): - """Create a new image from an array. - - The array argument can be a 1D array to create a height == 1 image, or a 2D - array to make a 2D image. Use scale and offset to set the scale factor, - handy for integer convolutions. - """ - # we accept a 1D array and assume height == 1, or a 2D array and check all - # lines are the same length - if not isinstance(array, list): - raise TypeError('new_from_array() takes a list argument') - if not isinstance(array[0], list): - height = 1 - width = len(array) - else: - # must copy the first row, we don't want to modify the passed-in array - flat_array = list(array[0]) - height = len(array) - width = len(array[0]) - for i in range(1, height): - if len(array[i]) != width: - raise TypeError('new_from_array() array not rectangular') - flat_array += array[i] - array = flat_array - - image = cls.new_matrix_from_array(width, height, array) - - # be careful to set them as double - image.set('scale', float(scale)) - image.set('offset', float(offset)) - - return image - -setattr(Vips.Image, 'new_from_array', vips_image_new_from_array) - -def generate_docstring(name): - try: - op = Vips.Operation.new(name) - except TypeError as e: - raise Error('No such operator.') - if op.get_flags() & Vips.OperationFlags.DEPRECATED: - raise Error('No such operator.', 'operator "%s" is deprecated' % name) - - # find all the args for this op, sort into priority order - args = op.get_args() - - # we are only interested in non-deprecated args - args = [y for y in args - if not y.flags & Vips.ArgumentFlags.DEPRECATED] - - enm = Vips.ArgumentFlags - - # find all required, unassigned input args - required_input = [x for x in args if x.flags & enm.INPUT and - x.flags & enm.REQUIRED and - not x.isset] - - optional_input = [x for x in args if x.flags & enm.INPUT and - not x.flags & enm.REQUIRED and - not x.isset] - - required_output = [x for x in args if x.flags & enm.OUTPUT and - x.flags & enm.REQUIRED] - - optional_output = [x for x in args if x.flags & enm.OUTPUT and - not x.flags & enm.REQUIRED] - - # find the first required input image, if any ... we will be a member - # function of this instance - member_x = None - for i in range(0, len(required_input)): - x = required_input[i] - if GObject.type_is_a(vips_type_image, x.prop.value_type): - member_x = x - break - - description = op.get_description() - result = description[0].upper() + description[1:] + ".\n\n" - result += "Usage:\n" - - result += " " + ", ".join([x.name for x in required_output]) + " = " - if member_x: - result += member_x.name + "." + name + "(" - else: - result += "Vips.Image." + name + "(" - - required_input_args = [x.name for x in required_input if x != member_x] - result += ", ".join(required_input_args) - if len(optional_input) > 0 and len(required_input_args) > 0: - result += ", " - result += ", ".join([x.name + " = " + x.prop.value_type.name - for x in optional_input]) - result += ")\n" - - result += "Where:\n" - for x in required_output: - result += " " + x.description() + "\n" - - for x in required_input: - result += " " + x.description() + "\n" - - if len(optional_input) > 0: - result += "Keyword parameters:\n" - for x in optional_input: - result += " " + x.description() + "\n" - - if len(optional_output) > 0: - result += "Extra output options:\n" - for x in optional_output: - result += " " + x.description() + "\n" - - return result - -# apply a function to a thing, or map over a list -# we often need to do something like (1.0 / other) and need to work for lists -# as well as scalars -def smap(func, x): - if isinstance(x, list): - return list(map(func, x)) - else: - return func(x) - -# decorator to set docstring -def add_doc(value): - def _doc(func): - func.__doc__ = value - return func - return _doc - -class Image(Vips.Image): - # for constructors, see class methods above - - def new_from_image(self, value): - """Create a new image based on an existing one. - - A new image is created with the same width, height, format, - interpretation, resolution and offset as self, but with every pixel - having the value of value. - - You can pass an array to create a many-band image. - """ - - # we'd like to call the vips function vips_image_new_from_image() but we - # can't call __getattr__ methods from a subclass - pixel = (Vips.Image.black(1, 1) + value).cast(self.format) - image = pixel.embed(0, 0, self.width, self.height, - extend = Vips.Extend.COPY) - image = image.copy(interpretation = self.interpretation, - xres = self.xres, - yres = self.yres, - xoffset = self.xoffset, - yoffset = self.yoffset) - - return image - - # output - - def write_to_file(self, vips_filename, **kwargs): - """Write an Image to a file. - - The filename can contain save options, for example - "fred.tif[compression=jpeg]", or save options can be given as keyword - arguments. Save options depend on the selected saver. - """ - filename = Vips.filename_get_filename(vips_filename) - option_string = Vips.filename_get_options(vips_filename) - saver = Vips.Foreign.find_save(filename) - if saver == None: - raise Error('No known saver for "%s".' % filename) - logger.debug('Image.write_to_file: saver = %s' % saver) - - _call_base(saver, [filename], kwargs, self, option_string) - - def write_to_buffer(self, format_string, **kwargs): - """Write an Image to memory. - - Return the image as a binary string, encoded in the selected format. - Save options can be given in the format_string, for example - ".jpg[Q=90]". Save options depend on the selected saver. - """ - filename = Vips.filename_get_filename(format_string) - option_string = Vips.filename_get_options(format_string) - saver = Vips.Foreign.find_save_buffer(filename) - if saver == None: - raise Error('No known saver for "%s".' % filename) - logger.debug('Image.write_to_buffer: saver = %s' % saver) - - return _call_base(saver, [], kwargs, self, option_string) - - # we can use Vips.Image.write_to_memory() directly - - # support with in the most trivial way - def __enter__(self): - return self - def __exit__(self, type, value, traceback): - pass - - # operator overloads - - def __getattr__(self, name): - logger.debug('Image.__getattr__ %s' % name) - - # look up in props first, eg. x.props.width - if name in dir(self.props): - return getattr(self.props, name) - - @add_doc(generate_docstring(name)) - def call_function(*args, **kwargs): - return _call_instance(self, name, args, kwargs) - - return call_function - - def __add__(self, other): - if isinstance(other, Vips.Image): - return self.add(other) - else: - return self.linear(1, other) - - def __radd__(self, other): - return self.__add__(other) - - def __sub__(self, other): - if isinstance(other, Vips.Image): - return self.subtract(other) - else: - return self.linear(1, smap(lambda x: -1 * x, other)) - - def __rsub__(self, other): - return self.linear(-1, other) - - def __mul__(self, other): - if isinstance(other, Vips.Image): - return self.multiply(other) - else: - return self.linear(other, 0) - - def __rmul__(self, other): - return self.__mul__(other) - - # a / const has always been a float in vips, so div and truediv are the - # same - def __div__(self, other): - if isinstance(other, Vips.Image): - return self.divide(other) - else: - return self.linear(smap(lambda x: 1.0 / x, other), 0) - - def __rdiv__(self, other): - return (self ** -1) * other - - def __truediv__(self, other): - return self.__div__(other) - - def __rtruediv__(self, other): - return self.__rdiv__(other) - - def __floordiv__(self, other): - if isinstance(other, Vips.Image): - return self.divide(other).floor() - else: - return self.linear(smap(lambda x: 1.0 / x, other), 0).floor() - - def __rfloordiv__(self, other): - return ((self ** -1) * other).floor() - - def __mod__(self, other): - if isinstance(other, Vips.Image): - return self.remainder(other) - else: - return self.remainder_const(other) - - def __pow__(self, other): - return _call_enum(self, "math2", Vips.OperationMath2.POW, other) - - def __rpow__(self, other): - return _call_enum(self, "math2", Vips.OperationMath2.WOP, other) - - def __abs__(self): - return self.abs() - - def __lshift__(self, other): - return _call_enum(self, "boolean", Vips.OperationBoolean.LSHIFT, other) - - def __rshift__(self, other): - return _call_enum(self, "boolean", Vips.OperationBoolean.RSHIFT, other) - - def __and__(self, other): - return _call_enum(self, "boolean", Vips.OperationBoolean.AND, other) - - def __rand__(self, other): - return self.__and__(other) - - def __or__(self, other): - return _call_enum(self, "boolean", Vips.OperationBoolean.OR, other) - - def __ror__(self, other): - return self.__or__(other) - - def __xor__(self, other): - return _call_enum(self, "boolean", Vips.OperationBoolean.EOR, other) - - def __rxor__(self, other): - return self.__xor__(other) - - def __neg__(self): - return -1 * self - - def __pos__(self): - return self - - def __invert__(self): - return self ^ -1 - - def __gt__(self, other): - return _call_enum(self, - "relational", Vips.OperationRelational.MORE, other) - - def __ge__(self, other): - return _call_enum(self, - "relational", Vips.OperationRelational.MOREEQ, other) - - def __lt__(self, other): - return _call_enum(self, - "relational", Vips.OperationRelational.LESS, other) - - def __le__(self, other): - return _call_enum(self, - "relational", Vips.OperationRelational.LESSEQ, other) - - def __eq__(self, other): - # _eq version allows comparison to None - return _call_enum_eq(self, - "relational", Vips.OperationRelational.EQUAL, other) - - def __ne__(self, other): - # _eq version allows comparison to None - return _call_enum_eq(self, - "relational", Vips.OperationRelational.NOTEQ, other) - - def __getitem__(self, arg): - if isinstance(arg, slice): - i = 0 - if arg.start != None: - i = arg.start - - n = self.bands - i - if arg.stop != None: - if arg.stop < 0: - n = self.bands + arg.stop - i - else: - n = arg.stop - i - elif isinstance(arg, int): - i = arg - n = 1 - else: - raise TypeError - - if i < 0: - i = self.bands + i - - if i < 0 or i >= self.bands: - raise IndexError - - return self.extract_band(i, n = n) - - def __call__(self, x, y): - return self.getpoint(x, y) - - # the cast operators int(), long() and float() must return numeric types, - # so we can't define them for images - - # a few useful things - - def get_value(self, field): - """Get a named item from an Image. - - Fetch an item of metadata and convert it to a Python-friendly format. - For example, VipsBlob values will be converted to bytes(). - """ - value = self.get(field) - - logger.debug('read out %s from %s' % (value, self)) - - return unpack(value) - - def set_value(self, field, value): - """Set a named item on an Image. - - Values are converted from Python types to something libvips can swallow. - For example, bytes() can be used to set VipsBlob fields. - """ - gtype = self.get_typeof(field) - logger.debug('%s.%s = %s' % (self, field, value)) - logger.debug('%s.%s needs a %s' % (self, field, gtype)) - - # if there's a thing of this name already, convert to that type - if gtype != GObject.TYPE_INVALID: - # blob-ize - if GObject.type_is_a(gtype, vips_type_blob): - if not isinstance(value, Vips.Blob): - value = Vips.Blob.new(None, value) - - # image-ize - if GObject.type_is_a(gtype, vips_type_image): - if not isinstance(value, Vips.Image): - value = imageize(self, value) - - # array-ize some types, if necessary - value = arrayize(gtype, value) - - self.set(field, value) - - def floor(self): - """Return the largest integral value not greater than the argument.""" - return self.round(Vips.OperationRound.FLOOR) - - def ceil(self): - """Return the smallest integral value not less than the argument.""" - return self.round(Vips.OperationRound.CEIL) - - def rint(self): - """Return the nearest integral value.""" - return self.round(Vips.OperationRound.RINT) - - def bandand(self): - """AND image bands together.""" - return self.bandbool(Vips.OperationBoolean.AND) - - def bandor(self): - """OR image bands together.""" - return self.bandbool(Vips.OperationBoolean.OR) - - def bandeor(self): - """EOR image bands together.""" - return self.bandbool(Vips.OperationBoolean.EOR) - - def bandsplit(self): - """Split an n-band image into n separate images.""" - return [x for x in self] - - def bandjoin(self, other): - """Append a set of images or constants bandwise.""" - if not isinstance(other, list): - other = [other] - - # if [other] is all numbers, we can use bandjoin_const - non_number = next((x for x in other - if not isinstance(x, numbers.Number)), - None) - - if non_number == None: - return self.bandjoin_const(other) - else: - return _call_base("bandjoin", [[self] + other], {}) - - def bandrank(self, other, **kwargs): - """Band-wise rank filter a set of images.""" - if not isinstance(other, list): - other = [other] - - return _call_base("bandrank", [[self] + other], kwargs) - - def maxpos(self): - """Return the coordinates of the image maximum.""" - v, opts = self.max(x = True, y = True) - x = opts['x'] - y = opts['y'] - return v, x, y - - def minpos(self): - """Return the coordinates of the image minimum.""" - v, opts = self.min(x = True, y = True) - x = opts['x'] - y = opts['y'] - return v, x, y - - def real(self): - """Return the real part of a complex image.""" - return self.complexget(Vips.OperationComplexget.REAL) - - def imag(self): - """Return the imaginary part of a complex image.""" - return self.complexget(Vips.OperationComplexget.IMAG) - - def polar(self): - """Return an image converted to polar coordinates.""" - return run_cmplx(lambda x: x.complex(Vips.OperationComplex.POLAR), self) - - def rect(self): - """Return an image converted to rectangular coordinates.""" - return run_cmplx(lambda x: x.complex(Vips.OperationComplex.RECT), self) - - def conj(self): - """Return the complex conjugate of an image.""" - return self.complex(Vips.OperationComplex.CONJ) - - def sin(self): - """Return the sine of an image in degrees.""" - return self.math(Vips.OperationMath.SIN) - - def cos(self): - """Return the cosine of an image in degrees.""" - return self.math(Vips.OperationMath.COS) - - def tan(self): - """Return the tangent of an image in degrees.""" - return self.math(Vips.OperationMath.TAN) - - def asin(self): - """Return the inverse sine of an image in degrees.""" - return self.math(Vips.OperationMath.ASIN) - - def acos(self): - """Return the inverse cosine of an image in degrees.""" - return self.math(Vips.OperationMath.ACOS) - - def atan(self): - """Return the inverse tangent of an image in degrees.""" - return self.math(Vips.OperationMath.ATAN) - - def log(self): - """Return the natural log of an image.""" - return self.math(Vips.OperationMath.LOG) - - def log10(self): - """Return the log base 10 of an image.""" - return self.math(Vips.OperationMath.LOG10) - - def exp(self): - """Return e ** pixel.""" - return self.math(Vips.OperationMath.EXP) - - def exp10(self): - """Return 10 ** pixel.""" - return self.math(Vips.OperationMath.EXP10) - - def erode(self, mask): - """Erode with a structuring element.""" - return self.morph(mask, Vips.OperationMorphology.ERODE) - - def dilate(self, mask): - """Dilate with a structuring element.""" - return self.morph(mask, Vips.OperationMorphology.DILATE) - - def median(self, size): - """size x size median filter.""" - return self.rank(size, size, (size * size) / 2) - - def fliphor(self): - """Flip horizontally.""" - return self.flip(Vips.Direction.HORIZONTAL) - - def flipver(self): - """Flip vertically.""" - return self.flip(Vips.Direction.VERTICAL) - - def rot90(self): - """Rotate 90 degrees clockwise.""" - return self.rot(Vips.Angle.D90) - - def rot180(self): - """Rotate 180 degrees.""" - return self.rot(Vips.Angle.D180) - - def rot270(self): - """Rotate 270 degrees clockwise.""" - return self.rot(Vips.Angle.D270) - - # we need different imageize rules for this operator ... we need to - # imageize th and el to match each other first - @add_doc(generate_docstring("ifthenelse")) - def ifthenelse(self, th, el, **kwargs): - for match_image in [th, el, self]: - if isinstance(match_image, Vips.Image): - break - - if not isinstance(th, Vips.Image): - th = imageize(match_image, th) - if not isinstance(el, Vips.Image): - el = imageize(match_image, el) - - return _call_base("ifthenelse", [th, el], kwargs, self) - -# add operators which needs to be class methods - -# use find_class_methods.py to generate this list - -# don't include "bandjoin" or "bandrank", they need to be wrapped by hand, -# see above - -class_methods = [ - "analyzeload", - "arrayjoin", - "black", - "csvload", - "eye", - "fitsload", - "fractsurf", - "gaussmat", - "gaussnoise", - "gifload", - "gifload_buffer", - "grey", - "identity", - "jpegload", - "jpegload_buffer", - "logmat", - "magickload", - "magickload_buffer", - "mask_butterworth", - "mask_butterworth_band", - "mask_butterworth_ring", - "mask_fractal", - "mask_gaussian", - "mask_gaussian_band", - "mask_gaussian_ring", - "mask_ideal", - "mask_ideal_band", - "mask_ideal_ring", - "matload", - "matrixload", - "openexrload", - "openslideload", - "pdfload", - "pdfload_buffer", - "perlin", - "pngload", - "pngload_buffer", - "ppmload", - "radload", - "rawload", - "sines", - "sum", - "svgload", - "svgload_buffer", - "system", - "text", - "thumbnail", - "thumbnail_buffer", - "tiffload", - "tiffload_buffer", - "tonelut", - "vipsload", - "webpload", - "webpload_buffer", - "worley", - "xyz", - "zone"] - -def generate_class_method(name): - @classmethod - @add_doc(generate_docstring(name)) - def class_method(cls, *args, **kwargs): - return _call_base(name, args, kwargs) - - return class_method - -for nickname in class_methods: - logger.debug('adding %s as a class method' % nickname) - # some may be missing in this vips, eg. we might not have "webpload" - try: - method = generate_class_method(nickname) - setattr(Vips.Image, nickname, method) - except Error: - pass - -Image = override(Image) -__all__.append('Image') diff --git a/python/packages/gi/overrides/__init__.py b/python/packages/gi/overrides/__init__.py deleted file mode 100644 index e35e122f..00000000 --- a/python/packages/gi/overrides/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# support overrides in different directories than our gi module -from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) diff --git a/swig/Makefile.am b/swig/Makefile.am deleted file mode 100644 index a76c581e..00000000 --- a/swig/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = \ - vipsCC - -EXTRA_DIST = \ - README.txt diff --git a/swig/README.txt b/swig/README.txt deleted file mode 100644 index ec78dca2..00000000 --- a/swig/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -This is the old vips7 Python binding. Use the vips8 one in preference for new -projects. - diff --git a/swig/vipsCC/Makefile.am b/swig/vipsCC/Makefile.am deleted file mode 100644 index 95db03f1..00000000 --- a/swig/vipsCC/Makefile.am +++ /dev/null @@ -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 diff --git a/swig/vipsCC/VDisplay.i b/swig/vipsCC/VDisplay.i deleted file mode 100644 index 7c880761..00000000 --- a/swig/vipsCC/VDisplay.i +++ /dev/null @@ -1,15 +0,0 @@ -/* SWIG interface file for VDisplay. - */ - -%module VDisplay -%{ -#include -%} - -%import "VError.i" - -/* Need to override assignment to get refcounting working. - */ -%rename(__assign__) *::operator=; - -%include vips/VDisplay.h diff --git a/swig/vipsCC/VError.i b/swig/vipsCC/VError.i deleted file mode 100644 index 779c66d8..00000000 --- a/swig/vipsCC/VError.i +++ /dev/null @@ -1,19 +0,0 @@ -/* SWIG interface file for VError. - */ - -%module VError -%{ -#include -%} - -%include "std_except.i" -%include "std_string.i" - -%include vips/VError.h - -%extend vips::VError { - const char *__str__ () { - return $self->what (); - } -} - diff --git a/swig/vipsCC/VImage.i b/swig/vipsCC/VImage.i deleted file mode 100644 index 6f4f68ef..00000000 --- a/swig/vipsCC/VImage.i +++ /dev/null @@ -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 was missing the "vips::" - */ - -%module VImage - -%{ -#include - -/* We need the C API too for the args init and some of the - * frombuffer/tobuffer stuff. - */ -#include -#include -%} - -/* 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; - %template(DoubleVector) vector; - %template(ImageVector) vector; -} - -/* 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); -} -%} - diff --git a/swig/vipsCC/VMask.i b/swig/vipsCC/VMask.i deleted file mode 100644 index ce74b08c..00000000 --- a/swig/vipsCC/VMask.i +++ /dev/null @@ -1,35 +0,0 @@ -/* SWIG interface file for VMask. - */ - -%module VMask -%{ -#include -#include -%} - -%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 diff --git a/swig/vipsCC/__init__.py b/swig/vipsCC/__init__.py deleted file mode 100644 index 0b05d457..00000000 --- a/swig/vipsCC/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__=["VImage","VMask","VError","VDisplay"]