[Haskell-cafe] Pixel plotter

Tim Docker twd_gg at dockerz.net
Sun Oct 14 20:30:24 EDT 2007

Andrew Coppin:

> As far as I know, all of this is *possible* with Gtk2hs
> right now - it's just vastly more complex than making
> a single function call. So what I'd like to do is write
> a small library which will enable me to do each of the
> above tasks in 1 function call. However, I'm getting
> nowhere fast with this. Anybody have any suggestions?

Despite having a large API gtk2hs is pretty easy to use for these kind of
tasks. You can look at this library [1] (for plotting charts) to see
simple examples of opening windows, saving images etc. It uses
the (nice) 2D cairo API for drawing, though it's not too hard to work with
raw pixels via the functions in Graphics.UI.Gtk.Gdk.Pixbuf.

You'll need to restrict your drawing calls to a single thread - most GUI
toolkits will require this. Haskell makes this easy through its
ability to pass drawing actions from thread to thread.


[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Chart-2007.8.8

More information about the Haskell-Cafe mailing list