Support std::vector within the image_get/set_array_int functions

This commit is contained in:
Kleis Auke Wolthuizen 2019-07-15 15:29:19 +02:00
parent 2da56b918d
commit 42bb8f51b9
1 changed files with 21 additions and 0 deletions

View File

@ -357,6 +357,13 @@ public:
vips_image_set_array_int( this->get_image(), field, value, n );
}
void
set( const char *field, std::vector<int> value )
{
vips_image_set_array_int( this->get_image(), field, &value[0],
static_cast<int>( value.size() ) );
}
void
set( const char *field, double value )
{
@ -401,6 +408,20 @@ public:
throw( VError() );
}
std::vector<int>
get_array_int( const char *field ) const
{
int length;
int *array;
if( vips_image_get_array_int( this->get_image(), field, &array, &length ) )
throw( VError() );
std::vector<int> vector( array, array + length );
return( vector );
}
double
get_double( const char *field ) const
{