Merge pull request #1758 from Zeranoe/master
Add C++ bindings for new_from_memory_steal()
This commit is contained in:
commit
62e1cb4862
@ -917,6 +917,22 @@ public:
|
|||||||
return( new_from_image( to_vectorv( 1, pixel ) ) );
|
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,
|
* Make a new image by rendering self to a large memory area,
|
||||||
* wrapping a VImage around it, and copying all metadata over from
|
* wrapping a VImage around it, and copying all metadata over from
|
||||||
|
@ -524,6 +524,8 @@ int vips_reorder_prepare_many( VipsImage *image,
|
|||||||
VipsRegion **regions, VipsRect *r );
|
VipsRegion **regions, VipsRect *r );
|
||||||
void vips_reorder_margin_hint( VipsImage *image, int margin );
|
void vips_reorder_margin_hint( VipsImage *image, int margin );
|
||||||
|
|
||||||
|
void vips_image_free_buffer( VipsImage *image, void *buffer );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
@ -3872,6 +3872,20 @@ vips_band_format_iscomplex( VipsBandFormat format )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vips_image_free_buffer:
|
||||||
|
* @image: the image that contains the buffer
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
vips_image_free_buffer( VipsImage *image, void *buffer )
|
||||||
|
{
|
||||||
|
free( buffer );
|
||||||
|
}
|
||||||
|
|
||||||
/* Handy for debugging: view an image in nip2.
|
/* Handy for debugging: view an image in nip2.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user