From c2948352006ea4185abb966868e88b741c7737a8 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Wed, 21 Apr 2021 18:09:34 +0200 Subject: [PATCH] Update C++ binding and function list --- cplusplus/include/vips/VImage8.h | 225 ++++++++++++++++++++++++++++--- cplusplus/vips-operators.cpp | 122 ++++++++++++++++- doc/function-list.xml | 75 ++++++++++- libvips/foreign/niftiload.c | 2 +- 4 files changed, 401 insertions(+), 23 deletions(-) diff --git a/cplusplus/include/vips/VImage8.h b/cplusplus/include/vips/VImage8.h index a0f52fa3..3a96ab8e 100644 --- a/cplusplus/include/vips/VImage8.h +++ b/cplusplus/include/vips/VImage8.h @@ -1724,7 +1724,7 @@ public: * * Rebuild with: * - * make vips-operators.h + * make vips-operators * * Then delete from here to the end of the class and paste in * vips-operators.h. We could just #include vips-operators.h, but @@ -1732,7 +1732,7 @@ public: */ // headers for vips operations -// Wed 19 Aug 14:34:56 BST 2020 +// Wed Apr 21 06:00:31 PM CEST 2021 // this file is generated automatically, do not edit! /** @@ -2679,6 +2679,22 @@ int find_trim( int *top, int *width, int *height, VOption *options = 0 ) const; */ static VImage fitsload( const char *filename, VOption *options = 0 ); +/** + * Load fits from a source. + * + * **Optional parameters** + * - **memory** -- Force open via memory, bool. + * - **access** -- Required access pattern for this file, VipsAccess. + * - **sequential** -- Sequential read only, bool. + * - **fail** -- Fail on first error, bool. + * - **disc** -- Open to disc, bool. + * + * @param source Source to load from. + * @param options Set of options. + * @return Output image. + */ +static VImage fitsload_source( VSource source, VOption *options = 0 ); + /** * Save image to fits file. * @@ -2789,6 +2805,7 @@ static VImage gaussmat( double sigma, double min_ampl, VOption *options = 0 ); * **Optional parameters** * - **sigma** -- Standard deviation of pixels in generated image, double. * - **mean** -- Mean of pixels in generated image, double. + * - **seed** -- Random number seed, int. * * @param width Image width in pixels. * @param height Image height in pixels. @@ -2807,11 +2824,11 @@ static VImage gaussnoise( int width, int height, VOption *options = 0 ); std::vector getpoint( int x, int y, VOption *options = 0 ) const; /** - * Load gif with giflib. + * Load gif with libnsgif. * * **Optional parameters** - * - **page** -- Load this page from the file, int. * - **n** -- Load this many pages, int. + * - **page** -- Load this page from the file, int. * - **memory** -- Force open via memory, bool. * - **access** -- Required access pattern for this file, VipsAccess. * - **sequential** -- Sequential read only, bool. @@ -2825,11 +2842,11 @@ std::vector getpoint( int x, int y, VOption *options = 0 ) const; static VImage gifload( const char *filename, VOption *options = 0 ); /** - * Load gif with giflib. + * Load gif with libnsgif. * * **Optional parameters** - * - **page** -- Load this page from the file, int. * - **n** -- Load this many pages, int. + * - **page** -- Load this page from the file, int. * - **memory** -- Force open via memory, bool. * - **access** -- Required access pattern for this file, VipsAccess. * - **sequential** -- Sequential read only, bool. @@ -2843,11 +2860,11 @@ static VImage gifload( const char *filename, VOption *options = 0 ); static VImage gifload_buffer( VipsBlob *buffer, VOption *options = 0 ); /** - * Load gif with giflib. + * Load gif from source. * * **Optional parameters** - * - **page** -- Load this page from the file, int. * - **n** -- Load this many pages, int. + * - **page** -- Load this page from the file, int. * - **memory** -- Force open via memory, bool. * - **access** -- Required access pattern for this file, VipsAccess. * - **sequential** -- Sequential read only, bool. @@ -2977,7 +2994,7 @@ static VImage heifload_source( VSource source, VOption *options = 0 ); * - **Q** -- Q factor, int. * - **lossless** -- Enable lossless compression, bool. * - **compression** -- Compression format, VipsForeignHeifCompression. - * - **speed**: -- CPU effort, 0 slowest - 8 fastest, AV1 compression only, int. + * - **speed** -- CPU effort, int. * - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample. * - **strip** -- Strip all metadata from image, bool. * - **background** -- Background value, std::vector. @@ -2995,7 +3012,7 @@ void heifsave( const char *filename, VOption *options = 0 ) const; * - **Q** -- Q factor, int. * - **lossless** -- Enable lossless compression, bool. * - **compression** -- Compression format, VipsForeignHeifCompression. - * - **speed**: -- CPU effort, 0 slowest - 8 fastest, AV1 compression only, int. + * - **speed** -- CPU effort, int. * - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample. * - **strip** -- Strip all metadata from image, bool. * - **background** -- Background value, std::vector. @@ -3013,7 +3030,7 @@ VipsBlob *heifsave_buffer( VOption *options = 0 ) const; * - **Q** -- Q factor, int. * - **lossless** -- Enable lossless compression, bool. * - **compression** -- Compression format, VipsForeignHeifCompression. - * - **speed**: -- CPU effort, 0 slowest - 8 fastest, AV1 compression only, int. + * - **speed** -- CPU effort, int. * - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample. * - **strip** -- Strip all metadata from image, bool. * - **background** -- Background value, std::vector. @@ -3156,6 +3173,7 @@ VImage hough_line( VOption *options = 0 ) const; * **Optional parameters** * - **pcs** -- Set Profile Connection Space, VipsPCS. * - **intent** -- Rendering intent, VipsIntent. + * - **black_point_compensation** -- Enable black point compensation, bool. * - **output_profile** -- Filename to load output profile from, const char *. * - **depth** -- Output device space depth in bits, int. * @@ -3170,6 +3188,7 @@ VImage icc_export( VOption *options = 0 ) const; * **Optional parameters** * - **pcs** -- Set Profile Connection Space, VipsPCS. * - **intent** -- Rendering intent, VipsIntent. + * - **black_point_compensation** -- Enable black point compensation, bool. * - **embedded** -- Use embedded input profile, if available, bool. * - **input_profile** -- Filename to load input profile from, const char *. * @@ -3184,6 +3203,7 @@ VImage icc_import( VOption *options = 0 ) const; * **Optional parameters** * - **pcs** -- Set Profile Connection Space, VipsPCS. * - **intent** -- Rendering intent, VipsIntent. + * - **black_point_compensation** -- Enable black point compensation, bool. * - **embedded** -- Use embedded input profile, if available, bool. * - **input_profile** -- Filename to load input profile from, const char *. * - **depth** -- Output device space depth in bits, int. @@ -3280,6 +3300,111 @@ VImage invfft( VOption *options = 0 ) const; */ VImage join( VImage in2, VipsDirection direction, VOption *options = 0 ) const; +/** + * Load jpeg2000 image. + * + * **Optional parameters** + * - **page** -- Load this page from the image, int. + * - **memory** -- Force open via memory, bool. + * - **access** -- Required access pattern for this file, VipsAccess. + * - **sequential** -- Sequential read only, bool. + * - **fail** -- Fail on first error, bool. + * - **disc** -- Open to disc, bool. + * + * @param filename Filename to load from. + * @param options Set of options. + * @return Output image. + */ +static VImage jp2kload( const char *filename, VOption *options = 0 ); + +/** + * Load jpeg2000 image. + * + * **Optional parameters** + * - **page** -- Load this page from the image, int. + * - **memory** -- Force open via memory, bool. + * - **access** -- Required access pattern for this file, VipsAccess. + * - **sequential** -- Sequential read only, bool. + * - **fail** -- Fail on first error, bool. + * - **disc** -- Open to disc, bool. + * + * @param buffer Buffer to load from. + * @param options Set of options. + * @return Output image. + */ +static VImage jp2kload_buffer( VipsBlob *buffer, VOption *options = 0 ); + +/** + * Load jpeg2000 image. + * + * **Optional parameters** + * - **page** -- Load this page from the image, int. + * - **memory** -- Force open via memory, bool. + * - **access** -- Required access pattern for this file, VipsAccess. + * - **sequential** -- Sequential read only, bool. + * - **fail** -- Fail on first error, bool. + * - **disc** -- Open to disc, bool. + * + * @param source Source to load from. + * @param options Set of options. + * @return Output image. + */ +static VImage jp2kload_source( VSource source, VOption *options = 0 ); + +/** + * Save image in heif format. + * + * **Optional parameters** + * - **tile_width** -- Tile width in pixels, int. + * - **tile_height** -- Tile height in pixels, int. + * - **lossless** -- Enable lossless compression, bool. + * - **Q** -- Q factor, int. + * - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample. + * - **strip** -- Strip all metadata from image, bool. + * - **background** -- Background value, std::vector. + * - **page_height** -- Set page height for multipage save, int. + * + * @param filename Filename to load from. + * @param options Set of options. + */ +void jp2ksave( const char *filename, VOption *options = 0 ) const; + +/** + * Save image in heif format. + * + * **Optional parameters** + * - **tile_width** -- Tile width in pixels, int. + * - **tile_height** -- Tile height in pixels, int. + * - **lossless** -- Enable lossless compression, bool. + * - **Q** -- Q factor, int. + * - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample. + * - **strip** -- Strip all metadata from image, bool. + * - **background** -- Background value, std::vector. + * - **page_height** -- Set page height for multipage save, int. + * + * @param options Set of options. + * @return Buffer to save to. + */ +VipsBlob *jp2ksave_buffer( VOption *options = 0 ) const; + +/** + * Save image in heif format. + * + * **Optional parameters** + * - **tile_width** -- Tile width in pixels, int. + * - **tile_height** -- Tile height in pixels, int. + * - **lossless** -- Enable lossless compression, bool. + * - **Q** -- Q factor, int. + * - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample. + * - **strip** -- Strip all metadata from image, bool. + * - **background** -- Background value, std::vector. + * - **page_height** -- Set page height for multipage save, int. + * + * @param target Target to save to. + * @param options Set of options. + */ +void jp2ksave_target( VTarget target, VOption *options = 0 ) const; + /** * Load jpeg from file. * @@ -4030,7 +4155,7 @@ VImage msb( VOption *options = 0 ) const; VImage multiply( VImage right, VOption *options = 0 ) const; /** - * Load a nifti image. + * Load nifti volume. * * **Optional parameters** * - **memory** -- Force open via memory, bool. @@ -4045,6 +4170,22 @@ VImage multiply( VImage right, VOption *options = 0 ) const; */ static VImage niftiload( const char *filename, VOption *options = 0 ); +/** + * Load nifti volumes. + * + * **Optional parameters** + * - **memory** -- Force open via memory, bool. + * - **access** -- Required access pattern for this file, VipsAccess. + * - **sequential** -- Sequential read only, bool. + * - **fail** -- Fail on first error, bool. + * - **disc** -- Open to disc, bool. + * + * @param source Source to load from. + * @param options Set of options. + * @return Output image. + */ +static VImage niftiload_source( VSource source, VOption *options = 0 ); + /** * Save image to nifti file. * @@ -4078,7 +4219,7 @@ static VImage openexrload( const char *filename, VOption *options = 0 ); * Load file with openslide. * * **Optional parameters** - * - **attach_associated** -- Attach all asssociated images, bool. + * - **attach_associated** -- Attach all associated images, bool. * - **level** -- Load this level from the file, int. * - **autocrop** -- Crop to image bounds, bool. * - **associated** -- Load this associated image, const char *. @@ -4094,6 +4235,26 @@ static VImage openexrload( const char *filename, VOption *options = 0 ); */ static VImage openslideload( const char *filename, VOption *options = 0 ); +/** + * Load source with openslide. + * + * **Optional parameters** + * - **attach_associated** -- Attach all associated images, bool. + * - **level** -- Load this level from the file, int. + * - **autocrop** -- Crop to image bounds, bool. + * - **associated** -- Load this associated image, const char *. + * - **memory** -- Force open via memory, bool. + * - **access** -- Required access pattern for this file, VipsAccess. + * - **sequential** -- Sequential read only, bool. + * - **fail** -- Fail on first error, bool. + * - **disc** -- Open to disc, bool. + * + * @param source Source to load from. + * @param options Set of options. + * @return Output image. + */ +static VImage openslideload_source( VSource source, VOption *options = 0 ); + /** * Load pdf from file. * @@ -4171,6 +4332,7 @@ int percent( double percent, VOption *options = 0 ) const; * **Optional parameters** * - **cell_size** -- Size of Perlin cells, int. * - **uchar** -- Output an unsigned char image, bool. + * - **seed** -- Random number seed, int. * * @param width Image width in pixels. * @param height Image height in pixels. @@ -4339,7 +4501,7 @@ static VImage ppmload_source( VSource source, VOption *options = 0 ); * **Optional parameters** * - **ascii** -- save as ascii, bool. * - **squash** -- save as one bit, bool. - * - **bitdepth** -- Write as a 1 bit image, int. + * - **bitdepth** -- set to 1 to write as a 1 bit image, int. * - **strip** -- Strip all metadata from image, bool. * - **background** -- Background value, std::vector. * - **page_height** -- Set page height for multipage save, int. @@ -4355,7 +4517,7 @@ void ppmsave( const char *filename, VOption *options = 0 ) const; * **Optional parameters** * - **ascii** -- save as ascii, bool. * - **squash** -- save as one bit, bool. - * - **bitdepth** -- Write as a 1 bit image, int. + * - **bitdepth** -- set to 1 to write as a 1 bit image, int. * - **strip** -- Strip all metadata from image, bool. * - **background** -- Background value, std::vector. * - **page_height** -- Set page height for multipage save, int. @@ -5039,6 +5201,7 @@ static void system( const char *cmd_format, VOption *options = 0 ); * - **width** -- Maximum image width in pixels, int. * - **height** -- Maximum image height in pixels, int. * - **align** -- Align on the low, centre or high edge, VipsAlign. + * - **rgba** -- Enable RGBA output, bool. * - **dpi** -- DPI to render at, int. * - **justify** -- Justify lines, bool. * - **spacing** -- Line spacing, int. @@ -5341,7 +5504,23 @@ VImage unpremultiply( VOption *options = 0 ) const; static VImage vipsload( const char *filename, VOption *options = 0 ); /** - * Save image to vips file. + * Load vips from source. + * + * **Optional parameters** + * - **memory** -- Force open via memory, bool. + * - **access** -- Required access pattern for this file, VipsAccess. + * - **sequential** -- Sequential read only, bool. + * - **fail** -- Fail on first error, bool. + * - **disc** -- Open to disc, bool. + * + * @param source Source to load from. + * @param options Set of options. + * @return Output image. + */ +static VImage vipsload_source( VSource source, VOption *options = 0 ); + +/** + * Save image to file in vips format. * * **Optional parameters** * - **strip** -- Strip all metadata from image, bool. @@ -5353,6 +5532,19 @@ static VImage vipsload( const char *filename, VOption *options = 0 ); */ void vipssave( const char *filename, VOption *options = 0 ) const; +/** + * Save image to target in vips format. + * + * **Optional parameters** + * - **strip** -- Strip all metadata from image, bool. + * - **background** -- Background value, std::vector. + * - **page_height** -- Set page height for multipage save, int. + * + * @param target Target to save to. + * @param options Set of options. + */ +void vipssave_target( VTarget target, VOption *options = 0 ) const; + /** * Load webp from file. * @@ -5490,6 +5682,7 @@ void webpsave_target( VTarget target, VOption *options = 0 ) const; * * **Optional parameters** * - **cell_size** -- Size of Worley cells, int. + * - **seed** -- Random number seed, int. * * @param width Image width in pixels. * @param height Image height in pixels. diff --git a/cplusplus/vips-operators.cpp b/cplusplus/vips-operators.cpp index d910d40d..88095d1e 100644 --- a/cplusplus/vips-operators.cpp +++ b/cplusplus/vips-operators.cpp @@ -1,5 +1,5 @@ // bodies for vips operations -// Mon 17 Aug 18:04:15 BST 2020 +// Wed Apr 21 06:00:31 PM CEST 2021 // this file is generated automatically, do not edit! VImage VImage::CMC2LCh( VOption *options ) const @@ -1065,6 +1065,18 @@ VImage VImage::fitsload( const char *filename, VOption *options ) return( out ); } +VImage VImage::fitsload_source( VSource source, VOption *options ) +{ + VImage out; + + call( "fitsload_source", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "source", source ) ); + + return( out ); +} + void VImage::fitssave( const char *filename, VOption *options ) const { call( "fitssave", @@ -1656,6 +1668,70 @@ VImage VImage::join( VImage in2, VipsDirection direction, VOption *options ) con return( out ); } +VImage VImage::jp2kload( const char *filename, VOption *options ) +{ + VImage out; + + call( "jp2kload", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "filename", filename ) ); + + return( out ); +} + +VImage VImage::jp2kload_buffer( VipsBlob *buffer, VOption *options ) +{ + VImage out; + + call( "jp2kload_buffer", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "buffer", buffer ) ); + + return( out ); +} + +VImage VImage::jp2kload_source( VSource source, VOption *options ) +{ + VImage out; + + call( "jp2kload_source", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "source", source ) ); + + return( out ); +} + +void VImage::jp2ksave( const char *filename, VOption *options ) const +{ + call( "jp2ksave", + (options ? options : VImage::option())-> + set( "in", *this )-> + set( "filename", filename ) ); +} + +VipsBlob *VImage::jp2ksave_buffer( VOption *options ) const +{ + VipsBlob *buffer; + + call( "jp2ksave_buffer", + (options ? options : VImage::option())-> + set( "in", *this )-> + set( "buffer", &buffer ) ); + + return( buffer ); +} + +void VImage::jp2ksave_target( VTarget target, VOption *options ) const +{ + call( "jp2ksave_target", + (options ? options : VImage::option())-> + set( "in", *this )-> + set( "target", target ) ); +} + VImage VImage::jpegload( const char *filename, VOption *options ) { VImage out; @@ -2284,6 +2360,18 @@ VImage VImage::niftiload( const char *filename, VOption *options ) return( out ); } +VImage VImage::niftiload_source( VSource source, VOption *options ) +{ + VImage out; + + call( "niftiload_source", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "source", source ) ); + + return( out ); +} + void VImage::niftisave( const char *filename, VOption *options ) const { call( "niftisave", @@ -2316,6 +2404,18 @@ VImage VImage::openslideload( const char *filename, VOption *options ) return( out ); } +VImage VImage::openslideload_source( VSource source, VOption *options ) +{ + VImage out; + + call( "openslideload_source", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "source", source ) ); + + return( out ); +} + VImage VImage::pdfload( const char *filename, VOption *options ) { VImage out; @@ -3388,6 +3488,18 @@ VImage VImage::vipsload( const char *filename, VOption *options ) return( out ); } +VImage VImage::vipsload_source( VSource source, VOption *options ) +{ + VImage out; + + call( "vipsload_source", + (options ? options : VImage::option())-> + set( "out", &out )-> + set( "source", source ) ); + + return( out ); +} + void VImage::vipssave( const char *filename, VOption *options ) const { call( "vipssave", @@ -3396,6 +3508,14 @@ void VImage::vipssave( const char *filename, VOption *options ) const set( "filename", filename ) ); } +void VImage::vipssave_target( VTarget target, VOption *options ) const +{ + call( "vipssave_target", + (options ? options : VImage::option())-> + set( "in", *this )-> + set( "target", target ) ); +} + VImage VImage::webpload( const char *filename, VOption *options ) { VImage out; diff --git a/doc/function-list.xml b/doc/function-list.xml index 4c14b3cc..6b4526ad 100644 --- a/doc/function-list.xml +++ b/doc/function-list.xml @@ -496,6 +496,11 @@ Load a fits image vips_fitsload() + + fitsload_source + Load fits from a source + vips_fitsload_source() + fitssave Save image to fits file @@ -558,17 +563,17 @@ gifload - Load gif with giflib + Load gif with libnsgif vips_gifload() gifload_buffer - Load gif with giflib + Load gif with libnsgif vips_gifload_buffer() gifload_source - Load gif with giflib + Load gif from source vips_gifload_source() @@ -736,6 +741,36 @@ Join a pair of images vips_join() + + jp2kload + Load jpeg2000 image + vips_jp2kload() + + + jp2kload_buffer + Load jpeg2000 image + vips_jp2kload_buffer() + + + jp2kload_source + Load jpeg2000 image + vips_jp2kload_source() + + + jp2ksave + Save image in heif format + vips_jp2ksave() + + + jp2ksave_buffer + Save image in heif format + vips_jp2ksave_buffer() + + + jp2ksave_target + Save image in heif format + vips_jp2ksave_target() + jpegload Load jpeg from file @@ -973,9 +1008,14 @@ niftiload - Load a nifti image + Load nifti volume vips_niftiload() + + niftiload_source + Load nifti volumes + vips_niftiload_source() + niftisave Save image to nifti file @@ -991,6 +1031,11 @@ Load file with openslide vips_openslideload() + + openslideload_source + Load source with openslide + vips_openslideload_source() + pdfload Load pdf from file @@ -1056,11 +1101,21 @@ Load ppm from file vips_ppmload() + + ppmload_source + Load ppm base class + vips_ppmload_source() + ppmsave Save image to ppm file vips_ppmsave() + + ppmsave_target + Save to ppm + vips_ppmsave_target() + premultiply Premultiply image alpha @@ -1426,11 +1481,21 @@ Load vips from file vips_vipsload() + + vipsload_source + Load vips from source + vips_vipsload_source() + vipssave - Save image to vips file + Save image to file in vips format vips_vipssave() + + vipssave_target + Save image to target in vips format + vips_vipssave_target() + webpload Load webp from file diff --git a/libvips/foreign/niftiload.c b/libvips/foreign/niftiload.c index 4427a99f..a68725ce 100644 --- a/libvips/foreign/niftiload.c +++ b/libvips/foreign/niftiload.c @@ -95,7 +95,7 @@ typedef struct _VipsForeignLoadNifti { typedef VipsForeignLoadClass VipsForeignLoadNiftiClass; -G_DEFINE_TYPE( VipsForeignLoadNifti, vips_foreign_load_nifti, +G_DEFINE_ABSTRACT_TYPE( VipsForeignLoadNifti, vips_foreign_load_nifti, VIPS_TYPE_FOREIGN_LOAD ); static void