[gtkmm] gdkmm: Pixbuf: Add constructor (and create) that takes a Cairo::Surface.



commit 58efc478b52d9e8507e1439b19a581dc8e020a4e
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Sep 2 12:49:47 2010 +0200

    gdkmm: Pixbuf: Add constructor (and create) that takes a Cairo::Surface.
    
    * gdk/src/pixbuf.hg: Wrap gdk_pixbuf_get_from_surface() as a constructor
      and add a create() method for it.
    * tools/m4/convert_gdk.m4: Add necessary conversion.

 ChangeLog               |    8 ++++++++
 gdk/src/pixbuf.ccg      |    8 +++++++-
 gdk/src/pixbuf.hg       |   19 +++++++++++++++++--
 tools/m4/convert_gdk.m4 |    1 +
 4 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d3fc976..52e1dc0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-09-02  Murray Cumming  <murrayc murrayc-desktop>
+
+	gdkmm: Pixbuf: Add constructor (and create) that takes a Cairo::Surface.
+
+	* gdk/src/pixbuf.hg: Wrao gdk_pixbuf_get_from_surface() as a constructor
+  and add a create() method for it.
+	* tools/m4/convert_gdk.m4: Add necessary conversion.
+
 2010-09-01  Murray Cumming  <murrayc murrayc com>
 
 	Regenerated GTK+ XML for documetntation.
diff --git a/gdk/src/pixbuf.ccg b/gdk/src/pixbuf.ccg
index 719cd16..d222432 100644
--- a/gdk/src/pixbuf.ccg
+++ b/gdk/src/pixbuf.ccg
@@ -65,6 +65,13 @@ Pixbuf::Pixbuf(const Glib::RefPtr<Drawable>& src,
       0, src->gobj(), 0, src_x, src_y, 0, 0, width, height))
 {}
 
+Pixbuf::Pixbuf(const Cairo::RefPtr<Cairo::Surface>& src,
+         int src_x, int src_y, int width, int height)
+:
+  Object((GObject*) gdk_pixbuf_get_from_surface(
+      0, src->cobj(), src_x, src_y, 0, 0, width, height))
+{}
+
 Glib::RefPtr<Pixbuf> Pixbuf::create_from_data(const guint8* data, Colorspace colorspace,
                                               bool has_alpha, int bits_per_sample,
                                               int width, int height, int rowstride)
@@ -202,4 +209,3 @@ Pixbuf::SListHandle_PixbufFormat Pixbuf::get_formats()
 }
 
 } // namespace Gdk
-
diff --git a/gdk/src/pixbuf.hg b/gdk/src/pixbuf.hg
index 53015a0..668101a 100644
--- a/gdk/src/pixbuf.hg
+++ b/gdk/src/pixbuf.hg
@@ -62,7 +62,7 @@ class Pixbuf : public Glib::Object
   _CLASS_GOBJECT(Pixbuf, GdkPixbuf, GDK_PIXBUF, Glib::Object, GObject)
   _IGNORE(gdk_pixbuf_ref, gdk_pixbuf_unref, gdk_pixbuf_render_pixmap_and_mask,
       gdk_pixbuf_render_pixmap_and_mask_for_colormap,
-      gdk_pixbuf_get_from_image, gdk_pixbuf_get_from_drawable,
+      gdk_pixbuf_get_from_image,
       gdk_pixbuf_set_option, gdk_pixbuf_get_option, gdk_pixbuf_non_anim_new)
 
 protected:
@@ -130,6 +130,15 @@ protected:
    */
    Pixbuf(const Glib::RefPtr<Drawable>& src,
          int src_x, int src_y, int width, int height);
+   _IGNORE(gdk_pixbuf_get_from_drawable)
+
+   //TODO: Documentation:
+   /** @newin{2,30}
+    */
+   Pixbuf(const Cairo::RefPtr<Cairo::Surface>& src,
+         int src_x, int src_y, int width, int height);
+   _IGNORE(gdk_pixbuf_get_from_surface)
+
 
 public:
   typedef sigc::slot<void, const guint8*> SlotDestroyData;
@@ -198,6 +207,13 @@ public:
   _WRAP_CREATE(const Glib::RefPtr<Drawable>& src,
                int src_x, int src_y, int width, int height)
 
+   //TODO: Documentation
+   /**
+    * @newin{2,30}
+    */
+  _WRAP_CREATE(const Cairo::RefPtr<Cairo::Surface>& src,
+               int src_x, int src_y, int width, int height)
+
   _WRAP_METHOD(Glib::RefPtr<Pixbuf> copy() const, gdk_pixbuf_copy)
 
   _WRAP_METHOD(static Glib::RefPtr<Pixbuf> create(
@@ -504,4 +520,3 @@ gboolean gdk_pixbuf_save_to_callbackv   (GdkPixbuf  *pixbuf,
 };
 
 } // namespace Gdk
-
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index fa57050..90bae3f 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -162,6 +162,7 @@ _CONVERSION(`GdkRectangle*',`const Gdk::Rectangle&',`Glib::wrap($3)')
 #_CONVERSION(const Glib::RefPtr<const Gdk::Image>&,GdkImage*,__CONVERT_CONST_REFPTR_TO_P)
 #_CONVERSION(const Glib::RefPtr<const Gdk::GC>&,GdkGC*,__CONVERT_CONST_REFPTR_TO_P)
 
+_CONVERSION(`const Glib::RefPtr<const Gdk::Device>&', `GdkDevice*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Device))
 _CONVERSION(`const Glib::RefPtr<const Gdk::Pixmap>&', `GdkPixmap*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Pixmap))
 _CONVERSION(`const Glib::RefPtr<const Gdk::Window>&', `GdkWindow*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Window))
 _CONVERSION(`const Glib::RefPtr<const Window>&', `GdkWindow*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Window))



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