Commit 9a1c50c9 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford
Browse files

turned convenience macros into convenience


1999-10-28  Jonathan Blandford  <jrb@redhat.com>

	* src/gdk-pixbuf.h: turned convenience macros into convenience
parent 0a810f95
1999-10-28 Jonathan Blandford <jrb@redhat.com>
* src/gdk-pixbuf.h: turned convenience macros into convenience
functions so some error checking could be added.
* src/io-tiff.c (image_load_increment): started work on the tiff
non-incremental loader.
(image_begin_load): Finished the incremental loader.
......
......@@ -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);
}
......@@ -50,22 +50,23 @@ struct _GdkPixbuf {
/* Convenience macros */
/* Convenience functions */
#define gdk_pixbuf_get_format(pixbuf) ((pixbuf)->art_pixbuf->format)
#define gdk_pixbuf_get_n_channels(pixbuf) ((pixbuf)->art_pixbuf->n_channels)
#define gdk_pixbuf_get_has_alpha(pixbuf) ((pixbuf)->art_pixbuf->has_alpha)
#define gdk_pixbuf_get_bits_per_sample(pixbuf) ((pixbuf)->art_pixbuf->bits_per_sample)
#define gdk_pixbuf_get_pixels(pixbuf) ((pixbuf)->art_pixbuf->pixels)
#define gdk_pixbuf_get_width(pixbuf) ((pixbuf)->art_pixbuf->width)
#define gdk_pixbuf_get_height(pixbuf) ((pixbuf)->art_pixbuf->height)
#define gdk_pixbuf_get_rowstride(pixbuf) ((pixbuf)->art_pixbuf->rowstride)
ArtPixFormat gdk_pixbuf_get_format (GdkPixbuf *pixbuf);
int gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf);
int gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf);
int gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf);
guchar *gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf);
int gdk_pixbuf_get_width (GdkPixbuf *pixbuf);
int gdk_pixbuf_get_height (GdkPixbuf *pixbuf);
int gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf);
/* Reference counting */
void gdk_pixbuf_ref (GdkPixbuf *pixbuf);
void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
/* Constructors */
/* Wrap a libart pixbuf */
GdkPixbuf *gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment