module CairoExts where import Graphics.UI.Gtk.Cairo import Graphics.Rendering.Cairo as Cairo import Graphics.UI.Gtk.Gdk.Drawable {- This is really awkward because we don't have longer lived Surfaces. Perhaps just using ForeignPtrs would be a better way to go, though GHC's garbage collection is rather broken when it comes to ForeignPtrs to large data. -} renderWithSurfaceFromDrawable :: (DrawableClass source, DrawableClass dest) => source -> dest -> (Surface -> Render a) -> IO a renderWithSurfaceFromDrawable src dst f = renderWithDrawable src $ withTargetSurface $ \s -> liftIO $ renderWithDrawable dst (f s)