Skip to content
A simpler drawing API for Cairo. Inspired by the Processing language.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
src/Graphics/Rendering/Cairo
.ghci
.gitignore fixed for new SDL2-binding version Jul 26, 2017
.travis.yml
LICENSE
README.md
Setup.hs
cairo-canvas.cabal
hackage-docs.sh
stack.yaml
travis-install-sdl2.sh

README.md

cairo-canvas Hackage version Build Status

Haskell library providing an alternative drawing API for Cairo which is heavily inspired by Processing.

Install

This library depends on the cairo bindings.

You also need the SDL2 bindings, if you want to build the demo.

Just clone and install this repository:

git clone git@github.com:apirogov/cairo-canvas.git
cd cairo-canvas
stack install

It should work with recent GHC versions (>= 7.8.4) without problems under Linux und OS X.

Documentation

Generate the haddock documentation for reference.

import SDL.Cairo
import Graphics.Rendering.Cairo.Canvas
...
  texture <- createCairoTexture renderer (V2 800 600)
  withCairoTexture' texture $ runCanvas $ do
    background $ gray 100
    stroke $ red 255
    fill $ blue 255 !@ 128
    rect $ D 0 0 100 100
    rect $ toD (V2 50 50) (V2 150 150)

  copy renderer texture Nothing Nothing
  present renderer

See the source of Main.hs for more examples. You start that demo with:

stack install --flag cairo-canvas:builddemo
stack exec cairo-canvas-test
You can’t perform that action at this time.