Skip to content

Commit

Permalink
cplusplus: add VImage::new_from_memory_steal compat function (libvi…
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke authored Oct 11, 2024
1 parent 6efc71d commit 1a21cba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cplusplus/VImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ VImage::new_from_memory_steal(const void *data, size_t size,
throw(VError());

g_signal_connect(image, "postclose",
G_CALLBACK(vips_image_free_buffer), (void *) data);
G_CALLBACK(vips_image_free_buffer), const_cast<void *>(data));

return VImage(image);
}
Expand Down Expand Up @@ -1594,6 +1594,14 @@ operator>>=(VImage &a, const std::vector<double> b)

// Compat operations

VImage
VImage::new_from_memory_steal(void *data, size_t size,
int width, int height, int bands, VipsBandFormat format)
{
return new_from_memory_steal(static_cast<const void *>(data), size,
width, height, bands, format);
}

void
VImage::rawsave_fd(int fd, VOption *options) const
{
Expand Down
4 changes: 4 additions & 0 deletions cplusplus/include/vips/VImage8.h
Original file line number Diff line number Diff line change
Expand Up @@ -2050,6 +2050,10 @@ class VImage : public VObject {

// Compat operations

static VImage
new_from_memory_steal(void *data, size_t size,
int width, int height, int bands, VipsBandFormat format);

/**
* Write raw image to file descriptor.
*
Expand Down

0 comments on commit 1a21cba

Please sign in to comment.