Skip to main content

webp_memory_write

Function webp_memory_write 

Source
#[unsafe(export_name = "WebPMemoryWrite")]
pub unsafe extern "C" fn webp_memory_write( data: *const u8, data_size: usize, picture: *const WebPPicture, ) -> c_int
Expand description

The writer of WebPMemoryWriter as picture->custom_ptr: appends the data to the buffer, which grows by doubling, with a minimum of 8192 bytes. Returns 0 when the buffer cannot grow.

The translation works on a copy of the written bytes; the grown buffer is a new block of the platform malloc of the translation’s max_size.

§Safety

picture points to a valid picture whose custom_ptr is null or a valid WebPMemoryWriter; data points to data_size readable bytes when data_size is not 0.