Add a convenience function for setting an image for ClutterTexture based on GdkPixbuf.

svn path=/trunk/; revision=67
This commit is contained in:
Marina Zhurakhinskaya 2008-11-21 00:39:14 +00:00
parent 4840b813ca
commit 7cad9a7ca0
2 changed files with 30 additions and 0 deletions

View File

@ -168,6 +168,31 @@ shell_global_class_init (ShellGlobalClass *klass)
G_PARAM_READABLE));
}
/**
* shell_clutter_texture_set_from_pixbuf:
* texture: #ClutterTexture to be modified
* pixbuf: #GdkPixbuf to set as an image for #ClutterTexture
*
* Convenience function for setting an image for #ClutterTexture based on #GdkPixbuf.
* Copied from an example posted by hp in this thread http://mail.gnome.org/archives/gtk-devel-list/2008-September/msg00218.html
*
* Return value: %TRUE on success, %FALSE on failure
*/
gboolean
shell_clutter_texture_set_from_pixbuf (ClutterTexture *texture,
GdkPixbuf *pixbuf)
{
return clutter_texture_set_from_rgb_data (texture,
gdk_pixbuf_get_pixels (pixbuf),
gdk_pixbuf_get_has_alpha (pixbuf),
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
gdk_pixbuf_get_rowstride (pixbuf),
gdk_pixbuf_get_has_alpha (pixbuf)
? 4 : 3,
0, NULL);
}
/**
* shell_global_get:
*

View File

@ -4,6 +4,7 @@
#include "mutter-plugin.h"
#include <clutter/clutter.h>
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
@ -29,6 +30,10 @@ struct _ShellGlobalClass
GType shell_global_get_type (void) G_GNUC_CONST;
gboolean
shell_clutter_texture_set_from_pixbuf (ClutterTexture *texture,
GdkPixbuf *pixbuf);
ShellGlobal *shell_global_get (void);
void shell_global_set_stage_input_area (ShellGlobal *global,