gi-cairo-connector-0.1.1: GI friendly Binding to the Cairo library.

Copyright | (c) Kilian Kilger Iñaki García Etxebarria 2018
License | LGPL-2.1
Maintainer | kkilger@gmail.com
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

GI.Cairo.Render.Connector

Description

This library contains glue code to interconnect Haskell GI, i.e. the gi-cairo library and gi-cairo-render, i.e. the hand written cairo bindings for Haskell.

Synopsis

- renderWithContext :: MonadIO m => Render a -> Context -> m a
- getContext :: Render Context
- toRender :: (Context -> IO a) -> Render a

# Documentation

renderWithContext Source #

Arguments

:: MonadIO m |
=> Render a | Render action
-> Context | Context from gi-cairo
-> m a | Result of the action

This function is used to call a function in the `Render` monad from the draw function of GTK+. It takes a `Context` (as it appears in gi-cairo) and a `Render` action (as it appears in gi-cairo-render) and renders the `Render` context inside the given context.

getContext Source #

Arguments

:: Render Context | Underlying GI.Cairo.Context

This function is used to call back to functions of GI.Pango or GI.PangoCairo or other Haskell GI libraries from inside the `Render` action. Example:

    draw :: Cairo.Render ()
    draw = do ...
              context <- getContext
              somePangoFunction context

toRender :: (Context -> IO a) -> Render a Source #

This function is used to "lift" functions of GI.Pango or GI.PangoCairo to the Render monad. Example:

    draw :: Cairo.Render ()
    draw = do ...
              toRender somePangoFunction