I was on the wrong track...
I started a year ago or so with a Krita plugin that closely mimicked the select/colorrange dialog in Photoshop. Of course, before I could start to actually implement the stuff behind that dialog I needed to implement selections. At that point in time, Krita's selections were limited to a rectangle defined by a QRect. In more modern paint apps, selections are bit masks, or even byte masks -- giving you a range of "selectedness". I implemented the byte mask variant (note to self: use Vigra to implement a plugin that can crack an image into selections that correspond to each object on the image and add a possibility to have more than one selection per layer -- one layer for each object.)
However, that particular dialog is not an example of good design. It is modal to start with, it combines a tool -- a selection colour picker -- with a few simple selection algorithms -- select by red, green, blue, yellow, magenta, cyan or shadow. highlight, mid-tone in a dialog which also includes a fuzziness slider, an inversion checkbox and a preview panel.
In Krita, I'll add the select color/tone options to the application menu, and make a color picker selection tool just like we have a selection brush and eraser, with a fuzziness slider and a plus/minus/replace choice in the tool option pane. The hoops I'm jumping through now to use a tool from a dialog box won't be necessary. What a relief -- a good, Krita like way to add useful functionality, getting rid of a semi-modal dialog box and simplifying the code in one fell swoop. Now I only have to do it...
It's a bit of a pity of my nice selection preview code, though. But no doubt that'll get in handy somewhere else.
/hacking/krita | permanent link | |