From 1be424cd47161228ba54ff5804215581fd27be4a Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 27 Nov 2017 19:35:08 +0000 Subject: [PATCH] Add missing file from commit fc233ed --- src/libvips/cplusplus/VImage.cpp | 38 ++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/libvips/cplusplus/VImage.cpp b/src/libvips/cplusplus/VImage.cpp index 93b2e56e..da1eef17 100644 --- a/src/libvips/cplusplus/VImage.cpp +++ b/src/libvips/cplusplus/VImage.cpp @@ -205,6 +205,30 @@ VOption::set( const char *name, std::vector value ) return( this ); } +// input int array +VOption * +VOption::set( const char *name, std::vector value ) +{ + Pair *pair = new Pair( name ); + + int *array; + unsigned int i; + + pair->input = true; + + g_value_init( &pair->value, VIPS_TYPE_ARRAY_INT ); + vips_value_set_array_int( &pair->value, NULL, + static_cast< int >( value.size() ) ); + array = vips_value_get_array_int( &pair->value, NULL ); + + for( i = 0; i < value.size(); i++ ) + array[i] = value[i]; + + options.push_back( pair ); + + return( this ); +} + // input image array VOption * VOption::set( const char *name, std::vector value ) @@ -465,8 +489,7 @@ VImage::call_option_string( const char *operation_name, operation_name ); if( !(operation = vips_operation_new( operation_name )) ) { - if( options ) - delete options; + delete options; throw( VError() ); } @@ -671,6 +694,17 @@ VImage::bandjoin( VImage other, VOption *options ) return( bandjoin( vec, options ) ); } +VImage +VImage::composite( VImage other, VipsBlendMode mode, VOption *options ) +{ + VImage v[2] = { *this, other }; + std::vector ivec( v, v + VIPS_NUMBER( v ) ); + int m[1] = { static_cast( mode ) }; + std::vector mvec( m, m + VIPS_NUMBER( m ) ); + + return( composite( ivec, mvec, options ) ); +} + std::complex VImage::minpos( VOption *options ) {