summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@gnome.org>2010-12-30 21:25:50 -0600
committerJonathon Jongsma <jjongsma@gnome.org>2010-12-30 21:25:50 -0600
commitff59e8585670b58dcde26d72dcf123e566569930 (patch)
treeb87bc3be32617729109c891cf2c1cb1dc8a42dae
parentaf2b2805ed7dc326194fceeed4127adb3d92153f (diff)
Wrap cairo_surface_get_device()
-rw-r--r--cairomm/surface.cc10
-rw-r--r--cairomm/surface.h5
2 files changed, 15 insertions, 0 deletions
diff --git a/cairomm/surface.cc b/cairomm/surface.cc
index c801ec5..802ce00 100644
--- a/cairomm/surface.cc
+++ b/cairomm/surface.cc
@@ -239,6 +239,16 @@ void Surface::write_to_png(cairo_write_func_t write_func, void *closure)
}
#endif
+RefPtr<Device> Surface::get_device()
+{
+ cairo_device_t *d = cairo_surface_get_device (m_cobject);
+
+ if (!d)
+ return RefPtr<Device>();
+
+ return RefPtr<Device>(new Device(d, true));
+}
+
void Surface::reference() const
{
cairo_surface_reference(const_cast<cobject*>(cobj()));
diff --git a/cairomm/surface.h b/cairomm/surface.h
index 3ec1a1a..9d1cfdf 100644
--- a/cairomm/surface.h
+++ b/cairomm/surface.h
@@ -33,6 +33,7 @@
#include <sigc++/slot.h>
#include <cairomm/enums.h>
#include <cairomm/exception.h>
+#include <cairomm/device.h>
#include <cairomm/fontoptions.h>
#include <cairomm/refptr.h>
@@ -306,6 +307,10 @@ public:
#endif // CAIRO_HAS_PNG_FUNCTIONS
+ /** This function returns the device for a surface
+ * @return The device for this surface, or an empty RefPtr if the surface has
+ * no associated device */
+ RefPtr<Device> get_device();
/** The underlying C cairo surface type
*/