Alpha fixed to float (0-1), was: is alpha fixed to 8bit unsigned

Adrian Page adrian at pagenet.plus.com
Thu Jun 16 14:47:03 CEST 2005


Boudewijn Rempt wrote:
> What I propose as a solution is to define alpha in Krita outside 
> colorstrategies as a float with a range from 0 to 1, with 0 transparent and 1 
> opaque. The colorstrategies can then convert the float value to whatever 
> floats their own boat.

I like the idea of using a float, especially when we have colour depths 
greater than 8-bit. We should be able to specify opacity with higher 
resolution when working with 16-bit, and greater, colour spaces. If 
performance is too much of an issue, perhaps we could at least use a 16- 
or 32-bit int. Sticking with 8-bit feels too restrictive and shifting an 
int is negligible.

> Oh, and by the way: what about premultiplied alpha?

In that case, the setAlpha function will have to modify the colour 
channels too. It does mean that things like KisPixel's direct access 
alpha() function will not work. In fact, direct access to a colour 
channel will also be wrong, since they will contain an alpha component. 
I think OpenEXR's channels are stored as pre-multiplied alpha, although 
you can always divide it out on loading and put it back on saving.

Adrian


More information about the kimageshop mailing list