from_bytes
Description:
[ CCode ( cname = "gdk_texture_new_from_bytes" ) ]
[ Version ( since = "4.6" ) ]
public static Texture from_bytes (Bytes bytes) throws Error
[ Version ( since = "4.6" ) ]
public static Texture from_bytes (Bytes bytes) throws Error
Creates a new texture by loading an image from memory,
The file format is detected automatically. The supported formats are PNG, JPEG and TIFF, though more formats might be available.
If `NULL` is returned, then throws will be set.
This function is threadsafe, so that you can e.g. use GTask and [method@Gio.Task.run_in_thread] to avoid blocking the main thread while loading a big image.
::: warning Note that this function should not be used with untrusted data. Use a proper image loading framework such as libglycin, which can load many image formats into a `GdkTexture`.
Parameters:
| bytes |
a `GBytes` containing the data to load |
Returns:
|
A newly-created `GdkTexture` |