The API docs outline why quite well.
This should make it possible to do saving of textures to image files
without any private API with the same featureset that GTK uses.
Also remove the gsktextureprivate.h include where
gdk_texture_get_format() was the only reason for it.
#include "gdkglcontextprivate.h"
#include "gdkmemoryformatprivate.h"
#include "gdkmemorytextureprivate.h"
-#include "gdktextureprivate.h"
#include <epoxy/gl.h>
#include "gdkmemoryformatprivate.h"
#include "gdkmemorytextureprivate.h"
#include "gdksurface.h"
-#include "gdktextureprivate.h"
#include "gdktexturedownloaderprivate.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
stride);
}
+/**
+ * gdk_texture_get_format:
+ * @self: a GdkTexture
+ *
+ * Gets the memory format most closely associated with the data of
+ * the texture.
+ *
+ * Note that it may not be an exact match for texture data
+ * stored on the GPU or with compression.
+ *
+ * The format can give an indication about the bit depth and opacity
+ * of the texture and is useful to determine the best format for
+ * downloading the texture.
+ *
+ * Returns: the preferred format for the texture's data
+ *
+ * Since: 4.10
+ **/
GdkMemoryFormat
gdk_texture_get_format (GdkTexture *self)
{
+ g_return_val_if_fail (GDK_IS_TEXTURE (self), GDK_MEMORY_DEFAULT);
+
return self->format;
}
#endif
#include <gdk/gdkversionmacros.h>
+#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
int gdk_texture_get_width (GdkTexture *texture) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
int gdk_texture_get_height (GdkTexture *texture) G_GNUC_PURE;
+GDK_AVAILABLE_IN_4_10
+GdkMemoryFormat gdk_texture_get_format (GdkTexture *self) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
void gdk_texture_download (GdkTexture *texture,
GdkMemoryFormat format,
guchar *data,
gsize stride);
-GdkMemoryFormat gdk_texture_get_format (GdkTexture *self);
gboolean gdk_texture_set_render_data (GdkTexture *self,
gpointer key,
gpointer data,
#include "gdkmemorytexture.h"
#include "gdkprofilerprivate.h"
#include "gdktexturedownloaderprivate.h"
-#include "gdktextureprivate.h"
#include "gsk/gl/fp16private.h"
#include <png.h>
#include <stdio.h>
#include "gdkmemorytexture.h"
#include "gdkprofilerprivate.h"
#include "gdktexturedownloaderprivate.h"
-#include "gdktextureprivate.h"
#include <tiffio.h>
#include "gskgliconlibraryprivate.h"
#include "gskglprogramprivate.h"
#include "gskglshadowlibraryprivate.h"
-#include "gskgltextureprivate.h"
#include "fp16private.h"
#include <gdk/gdkglcontextprivate.h>