diff --git a/cplusplus/Makefile.am b/cplusplus/Makefile.am index cdaf8921..6afa3d35 100644 --- a/cplusplus/Makefile.am +++ b/cplusplus/Makefile.am @@ -11,6 +11,7 @@ lib_LTLIBRARIES = libvips-cpp.la libvips_cpp_la_SOURCES = \ VImage.cpp \ VInterpolate.cpp \ + VStream.cpp \ VError.cpp libvips_cpp_la_LDFLAGS = \ diff --git a/cplusplus/VImage.cpp b/cplusplus/VImage.cpp index 205b46cb..ca5107de 100644 --- a/cplusplus/VImage.cpp +++ b/cplusplus/VImage.cpp @@ -169,7 +169,7 @@ VOption::set( const char *name, const char *value ) // input image VOption * -VOption::set( const char *name, VImage value ) +VOption::set( const char *name, const VImage &value ) { Pair *pair = new Pair( name ); @@ -595,6 +595,28 @@ VImage::new_from_buffer( const std::string &buf, const char *option_string, return( new_from_buffer( buf.c_str(), buf.size(), option_string, options ) ); } +VImage +VImage::new_from_stream( const VStreamI &input, const char *option_string, + VOption *options ) +{ + const char *operation_name; + VImage out; + + if( !(operation_name = vips_foreign_find_load_stream( + input.get_stream() )) ) { + delete options; + throw( VError() ); + } + + options = (options ? options : VImage::option())-> + set( "input", input )-> + set( "out", &out ); + + call_option_string( operation_name, option_string, options ); + + return( out ); +} + VImage VImage::new_matrix( int width, int height ) { @@ -679,6 +701,27 @@ VImage::write_to_buffer( const char *suffix, void **buf, size_t *size, } } +void +VImage::write_to_stream( const char *suffix, const VStreamO &output, + VOption *options ) const +{ + char filename[VIPS_PATH_MAX]; + char option_string[VIPS_PATH_MAX]; + const char *operation_name; + VipsBlob *blob; + + vips__filename_split8( suffix, filename, option_string ); + if( !(operation_name = vips_foreign_find_save_stream( filename )) ) { + delete options; + throw VError(); + } + + call_option_string( operation_name, option_string, + (options ? options : VImage::option())-> + set( "in", *this )-> + set( "output", output ) ); +} + #include "vips-operators.cpp" std::vector diff --git a/cplusplus/VInterpolate.cpp b/cplusplus/VInterpolate.cpp index 265bf66e..fb7ce3a5 100644 --- a/cplusplus/VInterpolate.cpp +++ b/cplusplus/VInterpolate.cpp @@ -45,15 +45,13 @@ VIPS_NAMESPACE_START VInterpolate -VInterpolate::new_from_name( const char *name, VOption *options ) +VInterpolate::new_from_name( const char *name ) { VipsInterpolate *interp; if( !(interp = vips_interpolate_new( name )) ) { - delete options; throw VError(); } - delete options; VInterpolate out( interp ); @@ -61,7 +59,7 @@ VInterpolate::new_from_name( const char *name, VOption *options ) } VOption * -VOption::set( const char *name, VInterpolate value ) +VOption::set( const char *name, const VInterpolate &value ) { Pair *pair = new Pair( name ); diff --git a/cplusplus/VStream.cpp b/cplusplus/VStream.cpp new file mode 100644 index 00000000..58f4a9d6 --- /dev/null +++ b/cplusplus/VStream.cpp @@ -0,0 +1,178 @@ +/* Object part of the VStreamI and VStreamO 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 + +/* +#define VIPS_DEBUG +#define VIPS_DEBUG_VERBOSE + */ + +VIPS_NAMESPACE_START + +VStreamI +VStreamI::new_from_descriptor( int descriptor ) +{ + VipsStreami *input; + + if( !(input = vips_streami_new_from_descriptor( descriptor )) ) + throw VError(); + + VStreamI out( input ); + + return( out ); +} + +VStreamI +VStreamI::new_from_filename( const char *filename ) +{ + VipsStreami *input; + + if( !(input = vips_streami_new_from_filename( filename )) ) + throw VError(); + + VStreamI out( input ); + + return( out ); +} + +VStreamI +VStreamI::new_from_blob( VipsBlob *blob ) +{ + VipsStreami *input; + + if( !(input = vips_streami_new_from_blob( blob )) ) + throw VError(); + + VStreamI out( input ); + + return( out ); +} + +VStreamI +VStreamI::new_from_memory( const void *data, + size_t size ) +{ + VipsStreami *input; + + if( !(input = vips_streami_new_from_memory( data, size )) ) + throw VError(); + + VStreamI out( input ); + + return( out ); +} + +VStreamI +VStreamI::new_from_options( const char *options ) +{ + VipsStreami *input; + + if( !(input = vips_streami_new_from_options( options )) ) + throw VError(); + + VStreamI out( input ); + + return( out ); +} + +VOption * +VOption::set( const char *name, const VStreamI &value ) +{ + Pair *pair = new Pair( name ); + + pair->input = true; + g_value_init( &pair->value, VIPS_TYPE_STREAMI ); + g_value_set_object( &pair->value, value.get_stream() ); + options.push_back( pair ); + + return( this ); +} + +VStreamO +VStreamO::new_to_descriptor( int descriptor ) +{ + VipsStreamo *output; + + if( !(output = vips_streamo_new_to_descriptor( descriptor )) ) + throw VError(); + + VStreamO out( output ); + + return( out ); +} + +VStreamO +VStreamO::new_to_filename( const char *filename ) +{ + VipsStreamo *output; + + if( !(output = vips_streamo_new_to_filename( filename )) ) + throw VError(); + + VStreamO out( output ); + + return( out ); +} + +VStreamO +VStreamO::new_to_memory() +{ + VipsStreamo *output; + + if( !(output = vips_streamo_new_to_memory()) ) + throw VError(); + + VStreamO out( output ); + + return( out ); +} + +VOption * +VOption::set( const char *name, const VStreamO &value ) +{ + Pair *pair = new Pair( name ); + + pair->input = true; + g_value_init( &pair->value, VIPS_TYPE_STREAMO ); + g_value_set_object( &pair->value, value.get_stream() ); + options.push_back( pair ); + + return( this ); +} + +VIPS_NAMESPACE_END diff --git a/cplusplus/gen-operators.py b/cplusplus/gen-operators.py index 03a63f63..97c9f5e1 100755 --- a/cplusplus/gen-operators.py +++ b/cplusplus/gen-operators.py @@ -28,6 +28,10 @@ import argparse from pyvips import Operation, GValue, Error, \ ffi, gobject_lib, type_map, type_from_name, nickname_find, type_name +# TODO Move to pyvips.GValue +stream_input_type = type_from_name('VipsStreami') +stream_output_type = type_from_name('VipsStreamo') + # turn a GType into a C++ type gtype_to_cpp = { GValue.gbool_type: 'bool', @@ -37,12 +41,17 @@ gtype_to_cpp = { GValue.refstr_type: 'char *', GValue.gflags_type: 'int', GValue.image_type: 'VImage', + stream_input_type: 'const VStreamI &', + stream_output_type: 'const VStreamO &', GValue.array_int_type: 'std::vector', GValue.array_double_type: 'std::vector', GValue.array_image_type: 'std::vector', GValue.blob_type: 'VipsBlob *' } +cplusplus_suffixes = ('*', '&') +cplusplus_keywords = ('case', 'switch') + # values for VipsArgumentFlags _REQUIRED = 1 _INPUT = 16 @@ -138,7 +147,7 @@ def generate_operation(operation_name, declaration_only=False): if has_output: # the first output arg will be used as the result cpp_type = get_cpp_type(op.get_typeof(required_output[0])) - spacing = '' if cpp_type.endswith('*') else ' ' + spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' ' result += '{0}{1}'.format(cpp_type, spacing) else: result += 'void ' @@ -146,11 +155,15 @@ def generate_operation(operation_name, declaration_only=False): if not declaration_only: result += 'VImage::' - result += '{0}( '.format(operation_name) + cplusplus_operation = operation_name + if operation_name in cplusplus_keywords: + cplusplus_operation += '_image' + + result += '{0}( '.format(cplusplus_operation) for name in required_input: gtype = op.get_typeof(name) cpp_type = get_cpp_type(gtype) - spacing = '' if cpp_type.endswith('*') else ' ' + spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' ' result += '{0}{1}{2}, '.format(cpp_type, spacing, cppize(name)) # output params are passed by reference @@ -159,7 +172,7 @@ def generate_operation(operation_name, declaration_only=False): for name in required_output[1:]: gtype = op.get_typeof(name) cpp_type = get_cpp_type(gtype) - spacing = '' if cpp_type.endswith('*') else ' ' + spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' ' result += '{0}{1}*{2}, '.format(cpp_type, spacing, cppize(name)) result += 'VOption *options {0})'.format('= 0 ' if declaration_only else '') @@ -179,7 +192,7 @@ def generate_operation(operation_name, declaration_only=False): # the first output arg will be used as the result name = required_output[0] cpp_type = get_cpp_type(op.get_typeof(name)) - spacing = '' if cpp_type.endswith('*') else ' ' + spacing = '' if cpp_type.endswith(cplusplus_suffixes) else ' ' result += ' {0}{1}{2};\n\n'.format(cpp_type, spacing, cppize(name)) result += ' call( "{0}",\n'.format(operation_name) diff --git a/cplusplus/include/vips/Makefile.am b/cplusplus/include/vips/Makefile.am index 36ea1eb3..813734ca 100644 --- a/cplusplus/include/vips/Makefile.am +++ b/cplusplus/include/vips/Makefile.am @@ -2,6 +2,7 @@ pkginclude_HEADERS = \ VError8.h \ VImage8.h \ VInterpolate8.h \ + VStream8.h \ vips8 \ vips-operators.h diff --git a/cplusplus/include/vips/VImage8.h b/cplusplus/include/vips/VImage8.h index 3e67896b..12b74dfa 100644 --- a/cplusplus/include/vips/VImage8.h +++ b/cplusplus/include/vips/VImage8.h @@ -169,6 +169,8 @@ public: class VIPS_CPLUSPLUS_API VImage; class VIPS_CPLUSPLUS_API VInterpolate; +class VIPS_CPLUSPLUS_API VStreamI; +class VIPS_CPLUSPLUS_API VStreamO; class VIPS_CPLUSPLUS_API VOption; class VOption @@ -220,8 +222,10 @@ public: VOption *set( const char *name, int value ); VOption *set( const char *name, double value ); VOption *set( const char *name, const char *value ); - VOption *set( const char *name, VImage value ); - VOption *set( const char *name, VInterpolate value ); + VOption *set( const char *name, const VImage &value ); + VOption *set( const char *name, const VInterpolate &value ); + VOption *set( const char *name, const VStreamI &value ); + VOption *set( const char *name, const VStreamO &value ); VOption *set( const char *name, std::vector value ); VOption *set( const char *name, std::vector value ); VOption *set( const char *name, std::vector value ); @@ -510,6 +514,9 @@ public: static VImage new_from_buffer( const std::string &buf, const char *option_string, VOption *options = 0 ); + static VImage new_from_stream( const VStreamI &input, + const char *option_string, VOption *options = 0 ); + static VImage new_matrix( int width, int height ); static VImage @@ -562,6 +569,9 @@ public: void write_to_buffer( const char *suffix, void **buf, size_t *size, VOption *options = 0 ) const; + void write_to_stream( const char *suffix, + const VStreamO &output, VOption *options = 0 ) const; + void * write_to_memory( size_t *size ) const { diff --git a/cplusplus/include/vips/VInterpolate8.h b/cplusplus/include/vips/VInterpolate8.h index 8ef6f99e..14ec43f7 100644 --- a/cplusplus/include/vips/VInterpolate8.h +++ b/cplusplus/include/vips/VInterpolate8.h @@ -30,12 +30,6 @@ #ifndef VIPS_VINTERPOLATE_H #define VIPS_VINTERPOLATE_H -#include -#include -#include - -#include - #include VIPS_NAMESPACE_START @@ -49,7 +43,7 @@ public: } static - VInterpolate new_from_name( const char *name, VOption *options = 0 ); + VInterpolate new_from_name( const char *name ); VipsInterpolate * get_interpolate() const @@ -61,4 +55,4 @@ public: VIPS_NAMESPACE_END -#endif /*VIPS_VIMAGE_H*/ +#endif /*VIPS_VINTERPOLATE_H*/ diff --git a/cplusplus/include/vips/VStream8.h b/cplusplus/include/vips/VStream8.h new file mode 100644 index 00000000..37a983ee --- /dev/null +++ b/cplusplus/include/vips/VStream8.h @@ -0,0 +1,96 @@ +// VIPS stream input/output 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 VIPS_VSTREAM_H +#define VIPS_VSTREAM_H + +#include + +VIPS_NAMESPACE_START + +class VStreamI : VObject +{ +public: + VStreamI( VipsStreami *input, VSteal steal = STEAL ) : + VObject( (VipsObject *) input, steal ) + { + } + + static + VStreamI new_from_descriptor( int descriptor ); + + static + VStreamI new_from_filename( const char *filename ); + + static + VStreamI new_from_blob( VipsBlob *blob ); + + static + VStreamI new_from_memory( const void *data, + size_t size ); + + static + VStreamI new_from_options( const char *options ); + + VipsStreami * + get_stream() const + { + return( (VipsStreami *) VObject::get_object() ); + } + +}; + +class VStreamO : VObject +{ +public: + VStreamO( VipsStreamo *output, VSteal steal = STEAL ) : + VObject( (VipsObject *) output, steal ) + { + } + + static + VStreamO new_to_descriptor( int descriptor ); + + static + VStreamO new_to_filename( const char *filename ); + + static + VStreamO new_to_memory(); + + VipsStreamo * + get_stream() const + { + return( (VipsStreamo *) VObject::get_object() ); + } + +}; + +VIPS_NAMESPACE_END + +#endif /*VIPS_VSTREAM_H*/ diff --git a/cplusplus/include/vips/vips-operators.h b/cplusplus/include/vips/vips-operators.h index f59ce970..d473745a 100644 --- a/cplusplus/include/vips/vips-operators.h +++ b/cplusplus/include/vips/vips-operators.h @@ -1,5 +1,5 @@ // headers for vips operations -// Wed Apr 24 15:50:21 CEST 2019 +// Sun 10 Nov 2019 01:44:17 PM CET // this file is generated automatically, do not edit! /** @@ -296,6 +296,14 @@ VImage cache( VOption *options = 0 ) const; */ VImage canny( VOption *options = 0 ) const; +/** + * Use pixel values to pick cases from an array of images. + * @param cases Array of case images. + * @param options Optional options. + * @return Output image. + */ +VImage case_image( std::vector cases, VOption *options = 0 ) const; + /** * Cast an image. * @param format Format to cast to. @@ -1029,6 +1037,14 @@ static VImage jpegload( const char *filename, VOption *options = 0 ); */ static VImage jpegload_buffer( VipsBlob *buffer, VOption *options = 0 ); +/** + * Load image from jpeg stream. + * @param input Stream to load from. + * @param options Optional options. + * @return Output image. + */ +static VImage jpegload_stream( const VStreamI &input, VOption *options = 0 ); + /** * Save image to jpeg file. * @param filename Filename to save to. @@ -1049,6 +1065,13 @@ VipsBlob *jpegsave_buffer( VOption *options = 0 ) const; */ void jpegsave_mime( VOption *options = 0 ) const; +/** + * Save image to jpeg stream. + * @param output Stream to save to. + * @param options Optional options. + */ +void jpegsave_stream( const VStreamO &output, VOption *options = 0 ) const; + /** * Label regions in an image. * @param options Optional options. @@ -1112,7 +1135,7 @@ void magicksave( const char *filename, VOption *options = 0 ) const; VipsBlob *magicksave_buffer( VOption *options = 0 ) const; /** - * Resample with an mapim image. + * Resample with a map image. * @param index Index pixels with this. * @param options Optional options. * @return Output image. @@ -1492,6 +1515,14 @@ static VImage pngload( const char *filename, VOption *options = 0 ); */ static VImage pngload_buffer( VipsBlob *buffer, VOption *options = 0 ); +/** + * Load png from stream. + * @param input Stream to load from. + * @param options Optional options. + * @return Output image. + */ +static VImage pngload_stream( const VStreamI &input, VOption *options = 0 ); + /** * Save image to png file. * @param filename Filename to save to. @@ -1506,6 +1537,13 @@ void pngsave( const char *filename, VOption *options = 0 ) const; */ VipsBlob *pngsave_buffer( VOption *options = 0 ) const; +/** + * Save image to png stream. + * @param output Stream to save to. + * @param options Optional options. + */ +void pngsave_stream( const VStreamO &output, VOption *options = 0 ) const; + /** * Load ppm from file. * @param filename Filename to load from. @@ -1575,6 +1613,22 @@ VImage rad2float( VOption *options = 0 ) const; */ static VImage radload( const char *filename, VOption *options = 0 ); +/** + * Load rad from buffer. + * @param buffer Buffer to load from. + * @param options Optional options. + * @return Output image. + */ +static VImage radload_buffer( VipsBlob *buffer, VOption *options = 0 ); + +/** + * Load rad from stream. + * @param input Stream to load from. + * @param options Optional options. + * @return Output image. + */ +static VImage radload_stream( const VStreamI &input, VOption *options = 0 ); + /** * Save image to radiance file. * @param filename Filename to save to. @@ -1589,6 +1643,13 @@ void radsave( const char *filename, VOption *options = 0 ) const; */ VipsBlob *radsave_buffer( VOption *options = 0 ) const; +/** + * Save image to radiance stream. + * @param output Stream to save to. + * @param options Optional options. + */ +void radsave_stream( const VStreamO &output, VOption *options = 0 ) const; + /** * Rank filter. * @param width Window width in pixels. @@ -1931,6 +1992,22 @@ static VImage svgload( const char *filename, VOption *options = 0 ); */ static VImage svgload_buffer( VipsBlob *buffer, VOption *options = 0 ); +/** + * Load svg from stream. + * @param input Stream to load from. + * @param options Optional options. + * @return Output image. + */ +static VImage svgload_stream( const VStreamI &input, VOption *options = 0 ); + +/** + * Find the index of the first non-zero pixel in tests. + * @param tests Table of images to test. + * @param options Optional options. + * @return Output image. + */ +static VImage switch_image( std::vector tests, VOption *options = 0 ); + /** * Run an external command. * @param cmd_format Command to run. @@ -1972,6 +2049,15 @@ static VImage thumbnail_buffer( VipsBlob *buffer, int width, VOption *options = */ VImage thumbnail_image( int width, VOption *options = 0 ) const; +/** + * Generate thumbnail from stream. + * @param input Stream to load from. + * @param width Size to this width. + * @param options Optional options. + * @return Output image. + */ +static VImage thumbnail_stream( const VStreamI &input, int width, VOption *options = 0 ); + /** * Load tiff from file. * @param filename Filename to load from. @@ -1988,6 +2074,14 @@ static VImage tiffload( const char *filename, VOption *options = 0 ); */ static VImage tiffload_buffer( VipsBlob *buffer, VOption *options = 0 ); +/** + * Load tiff from stream. + * @param input Stream to load from. + * @param options Optional options. + * @return Output image. + */ +static VImage tiffload_stream( const VStreamI &input, VOption *options = 0 ); + /** * Save image to tiff file. * @param filename Filename to save to. @@ -2061,6 +2155,14 @@ static VImage webpload( const char *filename, VOption *options = 0 ); */ static VImage webpload_buffer( VipsBlob *buffer, VOption *options = 0 ); +/** + * Load webp from stream. + * @param input Stream to load from. + * @param options Optional options. + * @return Output image. + */ +static VImage webpload_stream( const VStreamI &input, VOption *options = 0 ); + /** * Save image to webp file. * @param filename Filename to save to. @@ -2075,6 +2177,13 @@ void webpsave( const char *filename, VOption *options = 0 ) const; */ VipsBlob *webpsave_buffer( VOption *options = 0 ) const; +/** + * Save image to webp stream. + * @param output Stream to save to. + * @param options Optional options. + */ +void webpsave_stream( const VStreamO &output, VOption *options = 0 ) const; + /** * Make a worley noise image. * @param width Image width in pixels. diff --git a/cplusplus/include/vips/vips8 b/cplusplus/include/vips/vips8 index 98f67926..5213c6eb 100644 --- a/cplusplus/include/vips/vips8 +++ b/cplusplus/include/vips/vips8 @@ -52,5 +52,6 @@ #include "VError8.h" #include "VImage8.h" #include "VInterpolate8.h" +#include "VStream8.h" #endif /*VIPS_CPLUSPLUS*/ diff --git a/cplusplus/vips-operators.cpp b/cplusplus/vips-operators.cpp index beae5057..f530fcbb 100644 --- a/cplusplus/vips-operators.cpp +++ b/cplusplus/vips-operators.cpp @@ -1,5 +1,5 @@ // bodies for vips operations -// Wed Apr 24 15:50:21 CEST 2019 +// Sun 10 Nov 2019 01:44:18 PM CET // this file is generated automatically, do not edit! VImage VImage::CMC2LCh( VOption *options ) const @@ -491,6 +491,19 @@ VImage VImage::canny( VOption *options ) const return( out ); } +VImage VImage::case_image( std::vector cases, VOption *options ) const +{ + VImage out; + + call( "case", + (options ? options : VImage::option())-> + set( "index", *this )-> + set( "out", &out )-> + set( "cases", cases ) ); + + return( out ); +} + VImage VImage::cast( VipsBandFormat format, VOption *options ) const { VImage out; @@ -1615,6 +1628,18 @@ VImage VImage::jpegload_buffer( VipsBlob *buffer, VOption *options ) return( out ); } +VImage VImage::jpegload_stream( const VStreamI &input, VOption *options ) +{ + VImage out; + + call( "jpegload_stream", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "input", input ) ); + + return( out ); +} + void VImage::jpegsave( const char *filename, VOption *options ) const { call( "jpegsave", @@ -1642,6 +1667,14 @@ void VImage::jpegsave_mime( VOption *options ) const set( "in", *this ) ); } +void VImage::jpegsave_stream( const VStreamO &output, VOption *options ) const +{ + call( "jpegsave_stream", + (options ? options : VImage::option())-> + set( "in", *this )-> + set( "output", output ) ); +} + VImage VImage::labelregions( VOption *options ) const { VImage mask; @@ -2286,6 +2319,18 @@ VImage VImage::pngload_buffer( VipsBlob *buffer, VOption *options ) return( out ); } +VImage VImage::pngload_stream( const VStreamI &input, VOption *options ) +{ + VImage out; + + call( "pngload_stream", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "input", input ) ); + + return( out ); +} + void VImage::pngsave( const char *filename, VOption *options ) const { call( "pngsave", @@ -2306,6 +2351,14 @@ VipsBlob *VImage::pngsave_buffer( VOption *options ) const return( buffer ); } +void VImage::pngsave_stream( const VStreamO &output, VOption *options ) const +{ + call( "pngsave_stream", + (options ? options : VImage::option())-> + set( "in", *this )-> + set( "output", output ) ); +} + VImage VImage::ppmload( const char *filename, VOption *options ) { VImage out; @@ -2413,6 +2466,30 @@ VImage VImage::radload( const char *filename, VOption *options ) return( out ); } +VImage VImage::radload_buffer( VipsBlob *buffer, VOption *options ) +{ + VImage out; + + call( "radload_buffer", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "buffer", buffer ) ); + + return( out ); +} + +VImage VImage::radload_stream( const VStreamI &input, VOption *options ) +{ + VImage out; + + call( "radload_stream", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "input", input ) ); + + return( out ); +} + void VImage::radsave( const char *filename, VOption *options ) const { call( "radsave", @@ -2433,6 +2510,14 @@ VipsBlob *VImage::radsave_buffer( VOption *options ) const return( buffer ); } +void VImage::radsave_stream( const VStreamO &output, VOption *options ) const +{ + call( "radsave_stream", + (options ? options : VImage::option())-> + set( "in", *this )-> + set( "output", output ) ); +} + VImage VImage::rank( int width, int height, int index, VOption *options ) const { VImage out; @@ -2977,6 +3062,30 @@ VImage VImage::svgload_buffer( VipsBlob *buffer, VOption *options ) return( out ); } +VImage VImage::svgload_stream( const VStreamI &input, VOption *options ) +{ + VImage out; + + call( "svgload_stream", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "input", input ) ); + + return( out ); +} + +VImage VImage::switch_image( std::vector tests, VOption *options ) +{ + VImage out; + + call( "switch", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "tests", tests ) ); + + return( out ); +} + void VImage::system( const char *cmd_format, VOption *options ) { call( "system", @@ -3035,6 +3144,19 @@ VImage VImage::thumbnail_image( int width, VOption *options ) const return( out ); } +VImage VImage::thumbnail_stream( const VStreamI &input, int width, VOption *options ) +{ + VImage out; + + call( "thumbnail_stream", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "input", input )-> + set( "width", width ) ); + + return( out ); +} + VImage VImage::tiffload( const char *filename, VOption *options ) { VImage out; @@ -3059,6 +3181,18 @@ VImage VImage::tiffload_buffer( VipsBlob *buffer, VOption *options ) return( out ); } +VImage VImage::tiffload_stream( const VStreamI &input, VOption *options ) +{ + VImage out; + + call( "tiffload_stream", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "input", input ) ); + + return( out ); +} + void VImage::tiffsave( const char *filename, VOption *options ) const { call( "tiffsave", @@ -3170,6 +3304,18 @@ VImage VImage::webpload_buffer( VipsBlob *buffer, VOption *options ) return( out ); } +VImage VImage::webpload_stream( const VStreamI &input, VOption *options ) +{ + VImage out; + + call( "webpload_stream", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "input", input ) ); + + return( out ); +} + void VImage::webpsave( const char *filename, VOption *options ) const { call( "webpsave", @@ -3190,6 +3336,14 @@ VipsBlob *VImage::webpsave_buffer( VOption *options ) const return( buffer ); } +void VImage::webpsave_stream( const VStreamO &output, VOption *options ) const +{ + call( "webpsave_stream", + (options ? options : VImage::option())-> + set( "in", *this )-> + set( "output", output ) ); +} + VImage VImage::worley( int width, int height, VOption *options ) { VImage out;