Archive for the ‘cairo’ Category

The potential of pratical Haskell, 2nd edition

Wednesday, August 31st, 2005

First of all, I couldn’t imagine have done all of this in another language. You do really get caught by the beautifulness and the expressiveness of Haskell code. I passed many (every? ;-)) night of this last month in long and exceptionally fun hacking sessions. Now I can show off some “physical” bounties, and be glad to have actually understood many very interesting concepts and tips.

I announced some days ago, on the gtk2hs-devel mailing list, that the bindings were complete and in the Gtk2Hs cvs. I don’t know who had tried it yet, but I decided to write a sample application to show off Haskell and Cairo - and it looks so nice!

Thanks to Boegel’s work HaskLS, Duncan initial tries while I was translating the documentation, and the simplicity of Gtk+Haskell brought by Gtk2Hs itself, I’m proud to show you this screenshot of the demo application rendering Lindenmayer Systems (which, as now, counts 118 lines of code, including comments!):

[img] [img]

I want to thank everybody involved in the project again, this was a great learning experience for me. Also many many thanks to Galois Connections, which donated the space for the darcs repositories used during the hard developing, and

It’s not just about techincal information, working with other people, writing OpenSource projects, is a superb personal experience. Quoting shapr again, when you start a cool project, people around you will help you make it real. The community’s feedback is also one of the most important part - it compels yourself to try to do as best as you can. Furthermore, thanks in particular to the Haskell community, this process has a excellent rhythm - yes, they are smart ;-). I hope my work will be as useful as I imagined it two months ago. I’m very proud to have actually released a project - my first real OpenSource project.

OTOH, Haskell is having a big momentum these days, read for example the latest Haskell Weekly Newsletter, or the last issue of The Monad.Reader, and what about the growing number of little cool Haskell projects starting everywhere? I’m looking forward to see some Haskell Ph.D making good use of the binding ;-)

I’m planning to release the program I used to make those screenshot these days, for now, stay tuned: more Haskell+Cairo porn is on the way :-D

Cool news

Thursday, August 18th, 2005

The binding is complete.

Gtk integration is working. Some porn: demo/graphics/Drawer.hs before and after moving to cairo ;-)

The repository of the bindings theirself has moved to:

darcs get

You’ll be able find the higher-level API there soon. The gtk2hs darcs repository nearby will be updated too, I’ll blogpost about it when the bindings will completely become a package of the Gtk2Hs source tree (p.s. Gour: at that time you’ll be able to actually compile the whole thing and try it out, along with the monadic API. The IO direct API will not be exposed and nor it’s meant for the final user.

I’m keeping “darcspushing” every little change, any feedback is welcome, enjoy! :-)


Wednesday, August 17th, 2005

I’m finally happy with the code and it’s really time to share it, I expect feedback, don’t be too cruel! :-)

You’ll need GHC, c2hs (I used the latest 0.14.3, but it prolly works with previous versions), and cairo (>= 0.6.0), to try compiling the code. Some instructions:

  1. darcs get
  2. cd cairobindings && make this in fact does translate the .chs files to .hs modules.
  3. ghci -fffi -lcairo -i$(pwd) demo/StarAndRing.hs and then try “main” at the prompt, it will create the starAndRing.png in the current directory

Some notes: the Makefiles are mainly thought for developing purposes locally. The base hierarchy of the modules is Graphics.Rendering.Cairo: Cairo.{chs,hs} will be the higher-level monadic interface inspired by Abraham Egnor’s one. I’m not fond on revision control systems, I’ll do my best to keep the public repository up-to-date and avoid to mess up everything (I’m a bit afraid of that :-)) - but in fact darcs is pretty nice and easy to use.

Have fun!


Saturday, August 6th, 2005

I hacked the code all day (and night, it’s 2:30 am) long, and now, yeah, it’s working :-) (at least the PNG backend)

Output of the Haskell port of the star_and_ring.c snippet:

Snippet output

P.S. the 3rd of August was my birthday ;-) I’ll upload the code to the public repo soon