Merge pull request #1366 from kleisauke/vector-array-int
Support std::vector within the image_get/set_array_int functions
This commit is contained in:
commit
db5671ecbb
@ -357,6 +357,13 @@ public:
|
|||||||
vips_image_set_array_int( this->get_image(), field, value, n );
|
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
|
void
|
||||||
set( const char *field, double value )
|
set( const char *field, double value )
|
||||||
{
|
{
|
||||||
@ -401,6 +408,20 @@ public:
|
|||||||
throw( VError() );
|
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
|
double
|
||||||
get_double( const char *field ) const
|
get_double( const char *field ) const
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user