gnome-shell r67 - trunk/src



Author: marinaz
Date: Fri Nov 21 00:39:14 2008
New Revision: 67
URL: http://svn.gnome.org/viewvc/gnome-shell?rev=67&view=rev

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


Modified:
   trunk/src/shell-global.c
   trunk/src/shell-global.h

Modified: trunk/src/shell-global.c
==============================================================================
--- trunk/src/shell-global.c	(original)
+++ trunk/src/shell-global.c	Fri Nov 21 00:39:14 2008
@@ -169,6 +169,31 @@
 }
 
 /**
+ * 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:
  *
  * Gets the singleton global object that represents the desktop.

Modified: trunk/src/shell-global.h
==============================================================================
--- trunk/src/shell-global.h	(original)
+++ trunk/src/shell-global.h	Fri Nov 21 00:39:14 2008
@@ -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 @@
 
 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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]