From ad56c57830601f197e84f8469e8ec166f5840aa6 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 10 Jun 2016 14:22:08 +0100 Subject: [PATCH] add implementation for VImage::write() oops, it was missing also, change the return type from void to VImage. This makes chaining possible, eg.: VImage memory = im.write( Viameg::new_memory() ); --- ChangeLog | 2 ++ cplusplus/VImage.cpp | 11 +++++++++++ cplusplus/include/vips/VImage8.h | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e82cc29f..6cee415f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,8 @@ - dzsave can write compressed zips [Felix Bünemann] - vips_image_write() only refs the input when it has to ... makes it easier to combine many images in bounded memory +- VImage::write() implementation was missing +- VImage::write() return value changed from void to VImage to help chaining 18/5/16 started 8.3.2 - more robust vips image reading diff --git a/cplusplus/VImage.cpp b/cplusplus/VImage.cpp index a2d8101f..7f9d8187 100644 --- a/cplusplus/VImage.cpp +++ b/cplusplus/VImage.cpp @@ -2,6 +2,8 @@ * * 30/12/14 * - allow set enum value from string + * 10/6/16 + * - missing implementation of VImage::write() */ /* @@ -612,6 +614,15 @@ VImage::new_matrixv( int width, int height, ... ) return( matrix ); } +VImage +VImage::write( VImage out ) +{ + if( vips_image_write( this->get_image(), out.get_image() ) ) + throw VError(); + + return( out ); +} + void VImage::write_to_file( const char *name, VOption *options ) { diff --git a/cplusplus/include/vips/VImage8.h b/cplusplus/include/vips/VImage8.h index ca5116fc..c7f2ea3c 100644 --- a/cplusplus/include/vips/VImage8.h +++ b/cplusplus/include/vips/VImage8.h @@ -471,7 +471,7 @@ public: VImage new_from_image( std::vector pixel ); VImage new_from_image( double pixel ); - void write( VImage out ); + VImage write( VImage out ); void write_to_file( const char *name, VOption *options = 0 );