To mark the end of Paolo Martini’s project to add support for the cairo vector graphics library we are pleased to announce a special “tech preview” release of Gtk2Hs including Paolo’s contributions.
Here’s a screenshot from a demo program Paolo and others wrote to show off the combination of Haskell, cairo and Gtk+.
You can see more of his latest screenshots in his blog.
As of version 2.8, Gtk+ now depends on cairo and uses it for much of it’s drawing. It is a great advance over Gtk’s previous drawing API. The cairo website describes it thusly:
Cairo is a 2D graphics library with support for multiple output devices. Currently supported output targets include the X Window System, win32, and image buffers. Experimental backends include OpenGL (through glitz), Quartz, XCB, PostScript and PDF file output.
Cairo is designed to produce consistent output on all output media while taking advantage of display hardware acceleration when available (for example, through the X Render Extension).
The cairo API provides operations similar to the drawing operators of PostScript and PDF. Operations in cairo including stroking and filling cubic Bézier splines, transforming and compositing translucent images, and antialiased text rendering. All drawing operations can be transformed by any affine transformation (scale, rotation, shear, etc.).
We encourage anyone who has Gtk+ 2.8 installed to give this Gtk2Hs release a try and to experiment with using the cairo drawing API. Bug reports and cool screenshots will be gratefully accepted.
The release includes some demos showing how to use cairo in a stand alone fashion to produce PNG image files and also demos showing how to use the cairo api for drawing in a Gtk+ GUI (both real-time and non-real-time). There is also some preliminary reference documentation available.
This release is not intended for packaging for distros. The next ordinary release will of course retain the cairo support. It is intended that the cairo package will eventually be distributed separately since it is useful in non-GUI programs too.
This project was undertaken by Paolo as part of Google’s Summer of Code programme. In our opinion his project has been a success and so we would like to recommend to Paolo’s official mentor at Google and the judges that he be counted amongst the successful SoC programme participants and awarded the full project grant.