Archive for the 'Announcements' Category

Getting started with Cairo

Thursday, November 10th, 2005

Using ghci is a great way of experimenting with Cairo. You might experience problems due to the way ghci and Gtk2Hs both require to be run concurrently. I’ve created a little code snippet that opens a dialog box, displays the given Cairo action and waits for you to click the Close button.

The run function will execute the given Cairo statements and will then continue to run the Gtk main loop until the dialog is actually removed from screen. This function can conveniently be used to test various Cairo commands. For example, try:

run (moveTo 200 200 >> lineTo 0 0 >> stroke)

If straight lines are too boring, you can do this:

run (moveTo 200 200 >> setLineWidth 20 >> curveTo 200 0 100 200 0 0 >> stroke)

To render text, you need to create a layout first:

run (moveTo 20 20 >> rotate (pi/4) >> createLayout "Haskell and Cairo is cool." >>= showLayout)

Note that the return value of createLayout is passed to showLayout.

Gtk2Hs 0.9.10 released

Saturday, November 5th, 2005

Gtk2Hs version 0.9.10 is now available from:

http://haskell.org/gtk2hs/download/

An installer for Windows is available. A package is available for Gentoo. Packages for other platforms should become available soon (hopefully including Fedora Core, Debian, Darwin, FreeBSD and OpenBSD).

Changes since version 0.9.9:

  • New bindings for the cairo vector graphics library. This provides a easy-to-use vector graphics API (using a PDF-style drawing model) with high quality output for multiple backends (screen, print and image files).
  • Completion of Pango, the text layout and rendering engine of Gtk+. We now provide all functions that end users should ever need for rendering text, ranging from type-setting whole paragraphs down to breaking up attributed text into several runs. All offsets into Haskell strings are transparently translated into UTF-8 offsets used in Pango, thereby alleviating much of the grief of dealing with Unicode.
  • new Gtk+ 2.8 APIs are bound
  • many bugs fixed
  • various minor documentation improvements
  • an installer for Windows is available again
  • the mozembed HTML rendering component can now be built against the FireFox libraries if the appropriate developer files are present.

Read the rest of this entry »

University courses using Gtk2Hs for teaching

Tuesday, November 1st, 2005

Starting this academic term, Gtk2Hs is being used as part of teaching functional programming on two different University courses, one at the University of Oxford in the UK and one at the University of Jyväskylä in Finland.
Read the rest of this entry »

Pivotal GUI code available

Monday, October 31st, 2005

Keith Hanna has put up the code that creates the GUI for his Pivotal project. The code is a good tutorial on how to set up a standard application window. A preliminary release of Pivotal is due shortly.