Selections

Adrian Page adrian at pagenet.plus.com
Tue Aug 24 00:09:01 CEST 2004


On Monday 23 August 2004 9:22 pm, Boudewijn Rempt wrote:
> Fills are easiest implemented by creating a filled paint device for
> the rect covered by the selection, and then, while composting the fill
> with the target layer, pass the mask to the compositing loop, and skip
> un-selected pixels.

Another option is to 'apply' the selection to the filled paint device by 
multiplying its alpha values by the selection's 'alpha' values. Unselected 
pixels will be set to zero alpha, fully selected will retain their full 
alpha, and partially selected will have their alpha decreased proportionally. 
Then you can just composite as normal without the compositing code needing to 
know anything about selections.

> XXX: What about convolving, which takes a matrix of pixels. If only
> the middle pixel of a matrix is selected, should we take the input of
> the surrounding unselected pixels, or should the operation then assume
> edge conditions? Or should this be an option?

If the selection is only being used to restrict the pixels that will be 
changed by the filter operation, then you would still want the unselected 
pixels to be taken into account when calculating the output pixels. It's a 
bit of an unusual situation to think about though, so it all depends on the 
specific details.

Adrian


More information about the kimageshop mailing list