I've been tinkering away with Cairo in my copious spare time. I've had this pipe dream. Big pipe. I was hoping that it would be possible to do some bridge interface objects and make something like this work:
builder := Workspace open.
window := builder window.
surface := ImageSurface format: #FormatAlphaColor extent: window bounds extent.
context := surface context.
[window component renderOn: context] ensure: [window controller closeAndUnschedule].
surface saveAsPng: 'cairoworkspace.png'
Well, it does work:
At least, kinda. That's a .png file that I generated from the above code. It wasn't a screen capture. It was an interesting experiment to get to that point. The approach I chose was to simply add a parallel API to the classlcal displayOn: family of methods. One called renderOn:. I had to duplicate a bunch of methods to get this to work. It was mundane and straightforward. And definitely not the way to pursue such a goal.
I really like Cairo though. That it can do arbitrary shaped clipping, and manages it all for you is great. And I really like the save/restore stack model it has. The thing that this attempt made clear too though, is the text thing just isn't there by itself. You can see some of the artifacts in the graphic above. So I'll have a look at Pango. And see how that fairs. I'll try to publish a new version of cairo this evening. And I think I'll let go of my pipe dream of transparently having all the display code in VW just automagically render using Cairo, concentrate instead on supporting the creation of new drawing things that use Cairo.
I do believe that Cairo could be used quite easily at this point to generate graphics for web content.