A little while ago I added basic support for gradients in Kiva (and thus Enable). Its been slowly improving, and I think its at a point where it should be shared with a greater audience. Kiva now supports linear and radial gradients as path fills. My goal is to support the majority of what the SVG spec requires, currently we pass about 1/2 to 2/3 of the compliance tests.
I have added a couple of full examples in Enable/examples/kiva, here is an excerpt:
# colors are 5 doubles: offset, red, green, blue, alpha
starting_color = numpy.array([0.0, 1.0, 1.0, 1.0, 1.0])
ending_color = numpy.array([1.0, 0.0, 0.0, 0.0, 1.0])
That is all the code required to draw a rectangle with a diagonal gradient. And here is a screenshot of the example I took this from:
Last October I added a toolbar for Chaco plots. It was functional, but it wasn’t very pretty. I decided to rewrite it from scratch, with emphasis on improving the appearance and improving the auto-hide feature.
The new toolbar also employs a new feature to Enable: gradients! Gradient support is still a work in progress, but improving daily.
A few months ago Bryan Cole added the start of a Cairo based backend for Kiva. I’ve been fighting with Agg for several SVG related features and thought Cairo might be a good subsitute for rendering SVG’s. For most of our rendering needs, Cairo is about 4x slower than Agg, so its not a good general replacement, but for the SVG editor it might be okay. I took the initial work done, which only rendered to images, hacked it a bit, and go it into an Enable canvas. There is still a lot of work to be done, and this is the first time I’ve looked at Cairo at all, so if anyone wants to help out, please do. Anyway, without further ado, here is the SVG lion image:
If anyone knows how to get rid of the background rendering artifacts, please let me know.
During the “State of SciPy” presentation that Jarrod Millman and I gave this year at the SciPy 2008 Conference, we showed a “code swarm” video that was put together by David Martin and Chris Galvan. It’s a first-of-it’s-kind, because it combines repositories from several projects; namely NumPy, SciPy, Mayavi, Chaco, Traits, and Matplotlib.
Among other things, you can see how the number of people involved and the level of code production has really accelerated over time.
Ive just uploaded a video from Peters presentation about the multitouch prototype that he and Dave Kammeyer and Robert Kern have developed over the past few months. It not only showcases what a few brilliant guys can pull off in their spare time, it shows the power of the open source tool stack that they used to get it done (Numpy, Scipy, Kiva, Enable, Chaco, Mayavi, Traits, Pyglet, to name a few).
The full version is here:There’s a shorter version of a portion of the demo here:
In the past I’ve put off writing documentation for Chaco and Enable because every time I had faced the task, it seemed so daunting: there are over a hundred classes, a dozen different patterns and conventions, and so many areas for improvement and exploration. It frequently felt much easier just to work on code.
But I recognize that the situation is pretty dire, and something needs to be done about it. The reality of the situation is that the only way this documentation will materialize is if someone actually sits down and writes it, and this someone is basically going to have to be me, along with much-appreciated help from Janet. I’m going to take a slightly different approach, though. In the past, I’ve been stumped by the question of organization and structure; this time, I will just talk about all the pieces that comprise Enable and Chaco and essentially narrate a tour of the packages, without trying to outline a detailed structure beforehand.
Doing this as a series of blog posts makes the task seem somewhat less daunting, and it also allows for reader feedback as I’m writing things up.