note VImage::new_from_memory_steal() in ChangeLog

plus doxy commnets etc., see https://github.com/libvips/libvips/pull/1758/
This commit is contained in:
John Cupitt 2020-09-24 10:44:49 +01:00
parent 62e1cb4862
commit fd0a0905ff
4 changed files with 31 additions and 18 deletions

View File

@ -3,6 +3,7 @@
- integrate doxygen in build system to generate C++ API docs
- improve C++ API doc comments
- add VipsInterpolate and guint64 support to C++ API
- add VImage::new_from_memory_steal [Zeranoe]
6/9/20 started 8.10.2
- update magicksave/load profile handling [kelilevi]

View File

@ -641,6 +641,22 @@ VImage::new_from_source( VSource source, const char *option_string,
return( out );
}
VImage
VImage::new_from_memory_steal( void *data, size_t size,
int width, int height, int bands, VipsBandFormat format )
{
VipsImage *image;
if( !(image = vips_image_new_from_memory( data, size,
width, height, bands, format )) )
throw( VError() );
g_signal_connect( image, "postclose",
G_CALLBACK( vips_image_free_buffer ), data);
return( VImage( image ) );
}
VImage
VImage::new_matrix( int width, int height )
{

View File

@ -862,11 +862,23 @@ public:
return( VImage( image ) );
}
/**
* Create a new VImage object from an area of memory containing a
* C-style array.
*
* The VImage steals ownership of @data and will free() it when it
* goes out of scope.
*/
static VImage
new_from_memory_steal( void *data, size_t size,
int width, int height, int bands, VipsBandFormat format );
/**
* Create a matrix image of a specified size. All elements will be
* zero.
*/
static VImage new_matrix( int width, int height );
static VImage
new_matrix( int width, int height );
/**
* Create a matrix image of a specified size, initialized from the
@ -917,22 +929,6 @@ public:
return( new_from_image( to_vectorv( 1, pixel ) ) );
}
static VImage
new_from_memory_steal( void *data, size_t size,
int width, int height, int bands, VipsBandFormat format )
{
VipsImage *image;
if( !(image = vips_image_new_from_memory( data, size,
width, height, bands, format )) )
throw( VError() );
g_signal_connect( image, "postclose",
G_CALLBACK(vips_image_free_buffer), data);
return( VImage( image ) );
}
/**
* Make a new image by rendering self to a large memory area,
* wrapping a VImage around it, and copying all metadata over from

View File

@ -3878,7 +3878,7 @@ vips_band_format_iscomplex( VipsBandFormat format )
* @buffer: the orignal buffer that was stolen
*
* Free the externally allocated buffer found in the input image. This function
* is intened to be used with g_signal_connect.
* is intended to be used with g_signal_connect.
*/
void
vips_image_free_buffer( VipsImage *image, void *buffer )