Two more functions for the colorstrategy?
8 answers - 672 bytes -

KisPaintDevice has two function, clearSelection and applySelection that do
some maths with the alpha value. Both functions use KisPixel with its
hard-coded 8-bit alpha value, although clearSelection puts the value in a
short
clearSelection does: MAX_SELECTED - selection alpha * device alpha
applySelection does: selection alpa * device alpha / MAX_SELECTED
I think we should push these computations back into the color strategy -- but
I'm not sure of a good name for them.
, and in the selection manager there's another routine to apply a selection
mask, and this one does:
p.alpha() = UINT8_MULT(p_alpha, s_alpha);
No.1 | | 692 bytes |
| 
Tuesday 09 August 2005 09:26, Boudewijn Rempt wrote:
KisPaintDevice has two function, clearSelection and applySelection that do
some maths with the alpha value. Both functions use KisPixel with its
hard-coded 8-bit alpha value, although clearSelection puts the value in a
short
clearSelection does: MAX_SELECTED - selection alpha * device alpha
applySelection does: selection alpa * device alpha / MAX_SELECTED
I think we should push these computations back into the color strategy --
but I'm not sure of a good name for them.
how about:
screenWithSelect()
screenWithInverseSelect()
anyway I need them in the transform tool as well
No.2 | | 814 bytes |
| 
Wednesday 10 August 2005 13:51, Casper Boemann wrote:
clearSelection does: MAX_SELECTED - selection alpha * device alpha
applySelection does: selection alpa * device alpha / MAX_SELECTED
how about:
screenWithSelect()
screenWithInverseSelect()
Well -- it's not about the selection per se here, right?. It's about computing
with alpha, so wouldn't something like
inverseAverageAlpha(Q_UINT8 * pixel, Q_UINT8 * alph2)
averageAlpha(Q_UINT8 * pixel, Q_UINT8 * alph2)
be better?
maybe:
mask (Q_UINT8 * pixels, Q_UINT8 * mask, Q_UINT32 nPixels)
inverseMask (Q_UINT8 * pixels, Q_UINT8 * mask, Q_UINT32 nPixels)
?
anyway I need them in the transform tool as well
Give me some time to complete the !@#$% renaming
No.3 | | 1368 bytes |
| 
Wednesday 10 August 2005 13:59, Boudewijn Rempt wrote:
Wednesday 10 August 2005 13:51, Casper Boemann wrote:
clearSelection does: MAX_SELECTED - selection alpha * device alpha
applySelection does: selection alpa * device alpha / MAX_SELECTED
how about:
screenWithSelect()
screenWithInverseSelect()
Well -- it's not about the selection per se here, right?.
I think it is about selection.
so we have
-the alpha of the colorspace which is why we need to put it inside the
colorspace
-and we have an external alpha coming from the selection
If the external selection could come from anywhere we wouldn't know the
format. And do we ever need external alphas from somewhere else. (and not
needing to convert colorspace anyway)
It's about
computing with alpha, so wouldn't something like
inverseAverageAlpha(Q_UINT8 * pixel, Q_UINT8 * alph2)
averageAlpha(Q_UINT8 * pixel, Q_UINT8 * alph2)
be better?
maybe:
mask (Q_UINT8 * pixels, Q_UINT8 * mask, Q_UINT32 nPixels)
inverseMask (Q_UINT8 * pixels, Q_UINT8 * mask, Q_UINT32 nPixels)
I think Average would be a very wrong word. Mask is ok so:
maskWithSelect(Q_UINT8 * pixels, Q_UINT8 * mask, Q_UINT32 nPixels)
maskWithInverseSelect(Q_UINT8 * pixels, Q_UINT8 * mask, Q_UINT32 nPixels)
No.4 | | 745 bytes |
| 
Wednesday 10 August 2005 14:18, Casper Boemann wrote:
If the external selection could come from anywhere we wouldn't know the
format. And do we ever need external alphas from somewhere else. (and not
needing to convert colorspace anyway)
Not sure -- but there is nothing in the actual function which would prevent
it. If it's named blaSelect or blaSelection that gives the impression that we
can only feed selections into it, while it is an 8-bit alphamask and nothing
more.
maskWithSelect(Q_UINT8 * pixels, Q_UINT8 * mask, Q_UINT32 nPixels)
maskWithInverseSelect(Q_UINT8 * pixels, Q_UINT8 * mask, Q_UINT32 nPixels)
I still want to amend that to
maskAlpha8()
maskInverseAlpha8()
No.5 | | 160 bytes |
| 
Wednesday 10 August 2005 14:22, Boudewijn Rempt wrote:
maskAlpha8()
maskInverseAlpha8()
or
applyApha8Mask()
applyInverseAlpha8Mask()
No.6 | | 186 bytes |
| 
Wednesday 10 August 2005 14:24, Boudewijn Rempt wrote:
applyApha8Mask()
applyInverseAlpha8Mask()
but uint8 not just 8
or whatever abbriviation you use in the colorspaces
No.7 | | 288 bytes |
| 
Wednesday 10 August 2005 14:33, Casper Boemann wrote:
Wednesday 10 August 2005 14:24, Boudewijn Rempt wrote:
applyApha8Mask()
applyInverseAlpha8Mask()
but uint8 not just 8
or whatever abbriviation you use in the colorspaces
u8 -- analogous to Adrian's u16.
No.8 | | 436 bytes |
| 
Wednesday 10 August 2005 14:34, Boudewijn Rempt wrote:
Wednesday 10 August 2005 14:33, Casper Boemann wrote:
Wednesday 10 August 2005 14:24, Boudewijn Rempt wrote:
applyApha8Mask()
applyInverseAlpha8Mask()
but uint8 not just 8
or whatever abbriviation you use in the colorspaces
u8 -- analogous to Adrian's u16.
I've added them -- only waiting for the compile to succeed before committing.