From ff59e8585670b58dcde26d72dcf123e566569930 Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Thu, 30 Dec 2010 21:25:50 -0600 Subject: Wrap cairo_surface_get_device() --- cairomm/surface.cc | 10 ++++++++++ cairomm/surface.h | 5 +++++ 2 files changed, 15 insertions(+) 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 Surface::get_device() +{ + cairo_device_t *d = cairo_surface_get_device (m_cobject); + + if (!d) + return RefPtr(); + + return RefPtr(new Device(d, true)); +} + void Surface::reference() const { cairo_surface_reference(const_cast(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 #include #include +#include #include #include @@ -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 get_device(); /** The underlying C cairo surface type */ -- cgit v1.2.3