Thu, 26 Aug 2004

Fading Memories

Under the covers

I like refactoring. It gives a person the warm, fuzzy feeling he's accomplished something, without actually having had to do some hard creative thinking. And it can lead to nice results -- if most of the work remains under the covers. I've just spent three days refactoring Krita's painting code. We used to have a big class, KisPainter, which had a different method for each kind of painting: brush, pencil, airbrush, erasing and some very cool things Cyrille Berger is doing, with painting with filters (something that, as far as I know, is only done by Photogenics. But KisPainter was getting too big for XEmacs to comfortably fontify, and that's always a warning sign. So I started refactoring...


Now, we want Krita to become a painting application, so it wasn't just the obesity of KisPainter that made me want to rip bits out, it was also a problem that we couldn't easily extend Krita with new paint operations -- image hose, oil paints, whatever. So I extracted all paint methods, put them in their own class and, presto, KisPainter is a whole lot lighter.

This means not only that plugin-authors can add new and interesting paint operations to Krita without so much as peeking inside Krita's intestinal system, but also that existing tools like 'freehand', 'line', 'rectangle' or 'ellipse' can make use of any paint method, instead of being limited to brushes. Of course, that's something I still have to code.

And I need to do the selection tools -- in Krita selecting is as simple as painting -- base them on the painting tools only working on the selection layer instead of the parent layer. Need to code that, too.

And select-by-color, make sure selections are taken into account when filtering, painting and adjusting. And so on. But not now. Tomorrow.

/hacking/krita | permanent link | |


Your Comment


Name:
URL/Email: [http://... or mailto:you@wherever] (optional)
Title: (optional)
Comment:
Save my Name and URL/Email for next time
Captcha: To prevent comment spam, please retype the characters in this image:

Enter the text here: