Selections

Adrian Page adrian at pagenet.plus.com
Tue Aug 24 14:15:45 CEST 2004


On Tuesday 24 August 2004 7:50 am, Boudewijn Rempt wrote:
> Wouldn't it be more efficient to loop through the selection parallel to the
> creation of the fill instead of first looping to create the fill, then
> looping to apply the selection, then looping to compose?

Possibly, although that could be thought of as an optimisation so it would be 
good to profile the different approaches to see how much difference it really 
makes.

The main advantage of keeping the loops separate is that the code is a lot 
simpler, which is always a good thing. And since every paint operation 
(brush, airbrush, line, fill, gradient, etc) will need to respect the 
selection, the simplest method would be to write to a temporary paint device, 
apply the selection to that, then composite, rather than putting selection 
handling into each inner loop. Of course, if it is too slow, the more 
efficient route would be the one to take. Perhaps we should experiment and 
see what works best.

Adrian


More information about the kimageshop mailing list