[cairo] adding canvas/javascript backend

Geert Jansen geert at boskant.nl
Sat Jan 5 10:47:57 PST 2008


Hi,

what would it take to add a new backend to Cairo that outputs a HTML5
<canvas> with Javascript drawing instructions? I have looked into
<canvas> a little bit and the imaging model looks very similar to
Cairo's (maybe this is not coincidental). Documentation on <canvas> as
implemented in Firefox can be found here:
http://developer.mozilla.org/en/docs/Canvas_tutorial

Why add a canvas backend you may ask? Well, I thought it would be cool
to see if it is possible to port GTK+ to the web browser. With this I
mean that you'd be able to run a GTK+ app on a Linux system and instead
of displaying on X11 you'd display to a (possibly remote) web browser.
GTK uses Cairo for rendering. You'd need some Ajax/Comet infrastructure
to incrementally send the Javascript drawing commands to the browser,
and send events such as mouse events and key presses back. Unless I'm
overseeing something big this should be sufficient to display a
conventional desktop application on the web..

What do you think?

Regards,
Geert


More information about the cairo mailing list