Sunday, February 3, 2008

Current Progress + PyGTK Threads

My current goal is to make the drawing system more responsive. I originally tried to use Cairo surfaces and draw on them and redraw screen every once in a while (10 times per second or so). The problem with my implementation was that it was simply too slow. Drawing a dab (individual part of a stroke) on surface in the background and then drawing the surface takes more time than I can afford to.

So I had to devise a new plan. I implemented a simple path based drawing model. It is still extremely rudimentary but it works to some extent. The biggest factor making it considerably faster than the old implementation is that I draw directly on drawing area (ie. I use it as Cairo context). Next I have to make it fit the architecture and add facilities that make sure the drawn stroke gets stored.

Before I figured out the current solution, I looked into threading options offered by PyGTK and Python. I found a couple of pages that summarize different options well. They work as a good reference material. So here you go:
http://wiki.laptop.org/go/PyGTK/Smooth_Animation_with_PyGTK
http://www.pardon-sleeuwaegen.be/antoon/python/page0.html
http://www.daa.com.au/pipermail/pygtk/2000-October/000442.html
http://cairographics.org/threaded_animation_with_cairo/

I also found a nice page about using OpenGL with Cairo.