use gdk_sys;
use glib::translate::*;
// Remove once there's a new gdk-rs release

pub trait PixbufExt {
    fn create_surface(&self, scale: i32, for_window: Option<&gdk::Window>) -> Option<cairo::ImageSurface>;
}

impl PixbufExt for gdk_pixbuf::Pixbuf {
    fn create_surface(&self, scale: i32, for_window: Option<&gdk::Window>) -> Option<cairo::ImageSurface> {
        unsafe { from_glib_full(gdk_sys::gdk_cairo_surface_create_from_pixbuf(self.to_glib_none().0, scale, for_window.to_glib_none().0)) }
    }
}
