Sunday, January 3, 2010

Hooray for goocanvas, tadavinci reborn?


Yesterday I posted about my first little foray into image editing on Ubuntu. I started a little program called "photobomb". I received a comment on that post, suggesting that thought bubbles, and the ability to size and place them, would be a nice feature to add.

I was interested in discovering what it would be like to code that up, so I investigated a bit. It was immidiately apparent that while PIL is great for manipulating images as data, it was not designed to support manipulating images as objects on a screen. As I investigated, I discovered goocanvas. Goocanvas provides a widget like abstraction over SVG, and it is quite well integrated with Gtk, so I was fairly easily able to port photobomb to use goocanvas. It includes classes for images and paths.

I haven't been able to figure out how to write out an image file from the goocanvas, so actually saving the edited file is currently broken. But you can type in a thought and have it appear within a thought balloon, but I you can't size or place it yet.

Goovanvas has support built in for figuring out what item was clicked on, rotating it, scaling it, etc... It's really quite well suited for a photobomb app

While working with the goocanvas API, I realized that I've been here before. About three years ago, when Silverlight was new, and I cared about it, I created "TadaVinci" in Silverlight.

TadaVinci could:
  • Search for images and add them to a canvas
  • Resize, rotate, and place those images
  • "Scalpel" the images, which meant you could kind of carve them up
  • Allow users to draw in different colors and pen thickness
  • Adjust the translucency of any object on the surface
Since I wrote all this functionality once, I think I could write it again with goocanvas. I could also make it a bit more groovy and social:
  • automatically import pictures from Picture directory
  • automatically import pictures for friends via Gwibber
  • automatically import pictures from a web cam
  • publish to facebook, etc... via Gwibber
  • Lots of lolzy stuff, like a "breaking news" frame, etc..., stamps, etc...
I feel very motivated to work on Photobomb, I think it could really add a neat social element to Ubuntu, especially UNR. Mostly, though really fun to write and use. Ah, but alas, vacation time is over.

Tomorrow morning I need to wake up and do my "real job" of managing the Ubuntu Desktop team. I've also got three other projects in the works Bughugger (which is a real work project), Quickly which is like 50% work and 50% person, and Quidets (all personal, but it really helps with Bughugger).

So I don't see myself resurrecting TadaVinci using goocanvas in the near future, but boy would it be cool.

2 comments:

  1. To save the image to disk, you can render the goocanvas contents to a Cairo context with an ImageSurface and then write the context to a file as a png. You can see an example in the GrabberSnap source code here: http://u.nu/8adf4

    ReplyDelete
  2. Hello,

    About Canvas libraries like GooCanvas, there is an analysis of different Canvas replacements for GTK+ environments here: http://live.gnome.org/ProjectRidley/CanvasOverview

    Regards

    ReplyDelete