colorstrategy independence

Casper Boemann cbr at boemann.dk
Sun Mar 13 16:02:10 CET 2005


At the moment we are darting out a wrong path regarding colorstrategy
independence.

Almost every filter and tool,, as well as some other places, assume RGB. We
have colorstrategy class in place, but we don't use it as much as we should.

Colorstrategy independence consists of:
- number of color channel independence (we are halfway there)
- per channel type independence (nowhere near ready)
- per channel size independence (nowhere near ready)
- per channel interpretation independence (not even begun)

What this means is that CMYK,LAB,HSV,XYZ hasn't got a chance of working
before we do some serious work.

Take plugins as an example. In one place we compute the brightness as:
.17*ch[0]+0.35*ch[1]+ 0.5*ch[2]

This is true for RGB, but not for any other colorstrategy. If we allow a lot
of new plugins to be developed in the same way, we'd never be colorstrategy
independent.

Even if we use KisQuantum this would never be right. Sure we would overcome
the problem of per channel size and type independence, but the
interpretation would be all wrong.

In HSV the brighness would actually be the 3'rd channel and in XYZ it would
be the 2.nd channel. Oh and even then the brigthness wouldn't be
perceptually the same.

In my view the only way to be independent is for every colorstrategy to
provide a toolkit of pixel mangling functions, that the filter and tools can
use to do their work. Say a brightness_halfer_filter:

bright = colorstrategy->brightness(pixel);
pixel = colorspace->setBrightness(pixel, bright/2);

That way it wouldn't matter what the colorstrategy is. The filter would
always work.

best regards / venlig hilsen
Casper Boemann



More information about the kimageshop mailing list