How to replace deprecated Picture::new_for_pixbuf method?

Since: 4.12 Picture::new_for_pixbuf marked as deprecated, but not sure I understand how to replace it with Picture::new_for_paintable.

I’m dependent of Pixbuf, because reading the image from stream by Pixbuf::new_from_stream_async to memory, not as the tmp file on disk.

Accumulate the stream contents inside a GBytes and then use GdkMemoryTextureBuilder to create a GdkTexture, which implements the GdkPaintable interface.

1 Like

Thanks for a tip,
just implemented by following way in Rust:

Pixbuf::from_stream_async(
    &memory_input_stream,
    Some(&cancellable),
    move |result| {
        match result {
            Ok(buffer) => {
                Picture::for_paintable(
                    &Texture::for_pixbuf(&buffer)
                );

Some related solution

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.