Sunday, September 02, 2007

Cairo/GNUstep

I was at AlpenStep this weekend (photos will follow..) which was quite cool. I teamed with Fred Kiefer (the GNUstep gui maintainer) to try to iron out some of the quirks of the Cairo backend. The main problem (recopy of surfaces is not always done well, which impact scrolling) is still here, although we improved some things, and it looks now like it should be solvable with a bit more work. We also added 32 bit surface support when choosing x11 visuals : a cool side-effect is that you can then use directly the alpha channel on the window :) and thus draw semi-transparent windows.





David will like that ;-) -- he's working at the moment on Etoile's compositing manager...

In the above screenshot, I simply fill the view with NSCompositeClear (so it's just transparent), and then composite an image on it, with 0.8 transparency. You can then see that parts of the window are fully solid, while some are completely transparent, and others partially transparent.

5 comments:

Jesse Ross said...

Yay! It's great to see some good hacking was done at AlpenStep! Congrats on a successful meetup, guys!

Anonymous said...

Congrats indeed! Please keep up the good work and know that many people are watching -- and praying. :)

I'd love to hack again some day...

Oh, Cairo is the future, please do what you can to push that as a key instrument in GNUstep. I'd even say we could use Cairo as a cross-platform rendering model -- a 'la Mozilla -- and clear out more code from -back. Maybe not, just an idea.

Cheers!

A long lost friend,

Michael

Nicolas said...

Michael: I entirely agree with you, Cairo is our best option for the future. We could even use it everywhere; at the very least I do hope it will (in time) become the default backend on X11.. You just have to see how small the backend is to be convainced !

Anonymous said...

Hi there,

sorry for a reply almost two years after this has been posted... however, I am working on some software in GNUstep right now, I am trying to figure out how exactly to implement this. I have Cairo and GNUstep is set to use Cairo as the backend... I am looking for an example as to how to composite translucent areas like in the screenshot.

Thanks,
Marcus
mstr@me.com

Nicolas said...

Hi Marcus,

Simply do something like this:

NSRectFillUsingOperation([self bounds], NSCompositeClear);

then draw something over it..

btw, if you have programming questions, you will probably have people answering you faster on the gnustep mailing lists :)