Selections

Boudewijn Rempt boud at valdyas.org
Thu Aug 19 18:07:19 CEST 2004


I've just committed some code that shows more or less where I want to go with 
selections. You can load an image and start painting selections with the 
select brush, and the unselected area is shown as a kind of milky-white 
transparent painted mask. I believe, actually, that this is how the Gimp and 
Photoshop do masks, but I've never understood those.

Anyway, there is still a little todo to do:

* selections are now complete layers of the same type as the layer they're a 
selection of. I'd prefer if they're just one byte wide per pixel, no matter 
which colour type their layer is. But if I want to do that, I'll have to 
implement heterogenous layer compositing, which is a bit hard at the moment 
since the colour strategy of the receiving layer knows nothing about the 
bytes it's going to composite with and has to assume it's the only thing it 
knows, its own type.

* I want the mask colour and the opacity of the mask composition to be 
user-definable. The .ui for that is done, but the colour is waiting for the 
previous point, and I haven't yet made it possible to propagate the opacity.

* All the infrastracture: cutting, copying, saving & loading, pasting 
enabling, disabling, dragging, moving of selections isn't done.

* All the other selection tools need to be done.

* Some way to discover whether a layer's pixel is selected or not, and how 
much, needs to be done.

* Using selections in paint operations. This can be implemented in two ways: 

 - either everything that reads a pixel and messes with it needs to also read 
the corresponding selections value and if it's not selected, shouldn't mess 
with it, or
 - the selections mask for the corresponding rect is passed in the bitBlt 
methods and used to determine which pixels are to be written.

Both ideas have their advantages and disadvantages, but the second seems 
easier to implement.

Oh, and messing with selections (and reading Adrian's gradient code) made it 
once more very clear how bad Krita currently is at setting and getting pixels 
in whichever way.

That's it for now, hope to make some more progress tonight.


More information about the kimageshop mailing list