module Graphics.Rendering.Cairo.Internal (
Render(..), bracketR
, module Graphics.Rendering.Cairo.Types
, module Graphics.Rendering.Cairo.Internal.Drawing.Cairo
, module Graphics.Rendering.Cairo.Internal.Drawing.Paths
, module Graphics.Rendering.Cairo.Internal.Drawing.Patterns
, module Graphics.Rendering.Cairo.Internal.Drawing.Text
, module Graphics.Rendering.Cairo.Internal.Drawing.Transformations
, module Graphics.Rendering.Cairo.Internal.Fonts.FontOptions
, module Graphics.Rendering.Cairo.Internal.Surfaces.Image
, module Graphics.Rendering.Cairo.Internal.Surfaces.PDF
, module Graphics.Rendering.Cairo.Internal.Surfaces.PNG
, module Graphics.Rendering.Cairo.Internal.Surfaces.PS
, module Graphics.Rendering.Cairo.Internal.Surfaces.SVG
, module Graphics.Rendering.Cairo.Internal.Surfaces.Surface
, module Graphics.Rendering.Cairo.Internal.Region
, module Graphics.Rendering.Cairo.Internal.Utilities
) where
import Graphics.Rendering.Cairo.Types
import Graphics.Rendering.Cairo.Internal.Drawing.Cairo
import Graphics.Rendering.Cairo.Internal.Drawing.Paths
import Graphics.Rendering.Cairo.Internal.Drawing.Patterns
import Graphics.Rendering.Cairo.Internal.Drawing.Text
import Graphics.Rendering.Cairo.Internal.Drawing.Transformations
import Graphics.Rendering.Cairo.Internal.Fonts.FontOptions
import Graphics.Rendering.Cairo.Internal.Surfaces.Image
import Graphics.Rendering.Cairo.Internal.Surfaces.PDF
import Graphics.Rendering.Cairo.Internal.Surfaces.PNG
import Graphics.Rendering.Cairo.Internal.Surfaces.PS
import Graphics.Rendering.Cairo.Internal.Surfaces.SVG
import Graphics.Rendering.Cairo.Internal.Surfaces.Surface
import Graphics.Rendering.Cairo.Internal.Region
import Graphics.Rendering.Cairo.Internal.Utilities
import Control.Monad.Reader
import Control.Applicative
import Control.Exception (bracket)
newtype Render m = Render { runRender :: ReaderT Cairo IO m }
deriving (Functor, Applicative, Monad, MonadIO, MonadReader Cairo)
bracketR :: IO a -> (a -> IO b) -> (a -> Render c) -> Render c
bracketR begin end action =
Render $
ReaderT $ \r ->
bracket begin end
(\s -> runReaderT (runRender $ action s) r)