[gtk/image-loading: 17/18] texture: Add gdk_texture_save_to_tiff_bytes()




commit d4316c807f74fcf6e10c41092b2aa386ea0365fa
Author: Benjamin Otte <otte redhat com>
Date:   Tue Sep 14 02:36:56 2021 +0200

    texture: Add gdk_texture_save_to_tiff_bytes()

 gdk/gdktexture.c | 29 +++++++++++++++++++++++++++++
 gdk/gdktexture.h |  2 ++
 2 files changed, 31 insertions(+)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index 0654d7a867..a2415da114 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -757,3 +757,32 @@ gdk_texture_save_to_tiff (GdkTexture  *texture,
 
   return result;
 }
+
+/**
+ * gdk_texture_save_to_tiff_bytes:
+ * @texture: a `GdkTexture`
+ *
+ * Store the given @texture in memory as a TIFF file.
+ * Use gdk_texture_new_from_bytes() to read it back.
+ *
+ * This function is intended to store a representation of the
+ * texture's data that is as accurate as possible. This is
+ * particularly relevant when working with high dynamic range
+ * images and floating-point texture data.
+ *
+ * If that is not your concern and you are interested in a
+ * smaller size and a more portable format, you might want to
+ * use gdk_texture_save_to_png_bytes().
+ *
+ * Returns: a newly allocated `GBytes` containing TIFF data
+ *
+ * Since: 4.6
+ */
+GBytes *
+gdk_texture_save_to_tiff_bytes (GdkTexture *texture)
+{
+  g_return_val_if_fail (GDK_IS_TEXTURE (texture), NULL);
+
+  return gdk_save_tiff (texture);
+}
+
diff --git a/gdk/gdktexture.h b/gdk/gdktexture.h
index ce1ccf2642..59ba657607 100644
--- a/gdk/gdktexture.h
+++ b/gdk/gdktexture.h
@@ -93,6 +93,8 @@ GBytes *                gdk_texture_save_to_png_bytes          (GdkTexture
 GDK_AVAILABLE_IN_4_6
 gboolean                gdk_texture_save_to_tiff               (GdkTexture      *texture,
                                                                 const char      *filename);
+GDK_AVAILABLE_IN_4_6
+GBytes *                gdk_texture_save_to_tiff_bytes         (GdkTexture      *texture);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]