diff options
author | Jonathan Blandford <jrb@redhat.com> | 1999-10-28 19:00:02 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 1999-10-28 19:00:02 +0000 |
commit | 9a1c50c961e6313f2f3ef23807b13f8e346b0da5 (patch) | |
tree | cf9c7cb13aac316ccea58c1ba369c74d90e34470 /gdk-pixbuf/gdk-pixbuf.c | |
parent | 0a810f950f062980a6f761e4355443ba2777bb61 (diff) | |
download | gtk+-9a1c50c961e6313f2f3ef23807b13f8e346b0da5.tar.gz |
turned convenience macros into convenience
1999-10-28 Jonathan Blandford <jrb@redhat.com>
* src/gdk-pixbuf.h: turned convenience macros into convenience
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf.c')
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c index 4aacd3b171..cc0d841291 100644 --- a/gdk-pixbuf/gdk-pixbuf.c +++ b/gdk-pixbuf/gdk-pixbuf.c @@ -147,3 +147,78 @@ gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample, return gdk_pixbuf_new_from_data (buf, format, has_alpha, width, height, rowstride, free_buffer, NULL); } + + +/* Convenience functions */ +ArtPixFormat +gdk_pixbuf_get_format (GdkPixbuf *pixbuf) +{ + /* Unfortunately, there's nothing else to return */ + g_return_val_if_fail (pixbuf != NULL, ART_PIX_RGB); + g_assert (pixbuf->art_pixbuf != NULL); + + return (pixbuf->art_pixbuf->format); +} + +int +gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf) +{ + g_return_val_if_fail (pixbuf != NULL, -1); + g_assert (pixbuf->art_pixbuf != NULL); + + return (pixbuf->art_pixbuf->n_channels); +} + +int +gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf) +{ + g_return_val_if_fail (pixbuf != NULL, -1); + g_assert (pixbuf->art_pixbuf != NULL); + + return (pixbuf->art_pixbuf->has_alpha); +} + +int +gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf) +{ + g_return_val_if_fail (pixbuf != NULL, -1); + g_assert (pixbuf->art_pixbuf != NULL); + + return (pixbuf->art_pixbuf->bits_per_sample); +} + +guchar * +gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf) +{ + g_return_val_if_fail (pixbuf != NULL, NULL); + g_assert (pixbuf->art_pixbuf != NULL); + + return (pixbuf->art_pixbuf->pixels); +} + +int +gdk_pixbuf_get_width (GdkPixbuf *pixbuf) +{ + g_return_val_if_fail (pixbuf != NULL, -1); + g_assert (pixbuf->art_pixbuf != NULL); + + return (pixbuf->art_pixbuf->width); +} + +int +gdk_pixbuf_get_height (GdkPixbuf *pixbuf) +{ + g_return_val_if_fail (pixbuf != NULL, -1); + g_assert (pixbuf->art_pixbuf != NULL); + + return (pixbuf->art_pixbuf->height); +} + +int +gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf) +{ + g_return_val_if_fail (pixbuf != NULL, -1); + g_assert (pixbuf->art_pixbuf != NULL); + + return (pixbuf->art_pixbuf->rowstride); +} |