diff options
Diffstat (limited to 'gdk/gdkimage.c')
-rw-r--r-- | gdk/gdkimage.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c index 7438c51c6c..2606f48a10 100644 --- a/gdk/gdkimage.c +++ b/gdk/gdkimage.c @@ -44,6 +44,21 @@ gdk_image_unref (GdkImage *image) g_object_unref (G_OBJECT (image)); } +/** + * gdk_image_get: + * @window: a #GdkWindow + * @x: x coordinate in @window + * @y: y coordinate in @window + * @width: width of area in @window + * @height: height of area in @window + * + * This is a deprecated wrapper for gdk_drawable_get_image(); + * gdk_drawable_get_image() should be used instead. Or even better: in + * most cases gdk_pixbuf_get_from_drawable() is the most convenient + * choice. + * + * Return value: a new #GdkImage or %NULL + **/ GdkImage* gdk_image_get (GdkWindow *window, gint x, @@ -59,3 +74,51 @@ gdk_image_get (GdkWindow *window, return gdk_drawable_get_image (window, x, y, width, height); } + +/** + * gdk_image_set_colormap: + * @image: a #GdkImage + * @colormap: a #GdkColormap + * + * Sets the colormap for the image to the given colormap. Normally + * there's no need to use this function, images are created with the + * correct colormap if you get the image from a drawable. If you + * create the image from scratch, use the colormap of the drawable you + * intend to render the image to. + **/ +void +gdk_image_set_colormap (GdkImage *image, + GdkColormap *colormap) +{ + g_return_if_fail (GDK_IS_IMAGE (image)); + g_return_if_fail (GDK_IS_COLORMAP (colormap)); + + if (image->colormap != colormap) + { + if (image->colormap) + g_object_unref (G_OBJECT (image->colormap)); + + image->colormap = colormap; + g_object_ref (G_OBJECT (image->colormap)); + } + +} + +/** + * gdk_image_get_colormap: + * @image: a #GdkImage + * + * Retrieves the colormap for a given image, if it exists. An image + * will have a colormap if the drawable from which it was created has + * a colormap, or if a colormap was set explicitely with + * gdk_image_set_colormap(). + * + * Return value: colormap for the image + **/ +GdkColormap * +gdk_image_get_colormap (GdkImage *image) +{ + g_return_val_if_fail (GDK_IS_IMAGE (image), NULL); + + return image->colormap; +} |