always an alpha channel

Casper Boemann cbr at boemann.dk
Wed Sep 15 15:30:37 CEST 2004


----- Original Message ----- 
From: "Cyrille Berger" <cyb at lepi.org>
> > And the function of the eraser becomes different... On the other hand,
with
> > the current code, it's hard to add an alpha channel to an image that
> > doesn't have one. Maybe always have one that's dormant.
>
> We might separate the alpha channel from the other data, and put it in an
> other layer that can have either one channel or the exact number of
channels.

hmm, perhabs

I think of two different cases of alpha

1) a channel in a colorstrategy for use in composite operations
2) a mask - which is in effect a layer with only a alphachannel and no color
(selections are a kind of mask)

Your suggestion might give problems with case 1, as the connection between
layers and colorstrategy is hopefully nonexistent. Case 2 is however easy
with your suggestion.

Case 1 problems might be overcome, if we think of a "normal layer" as a
"color layer" and an "alpha layer" always combined. The "normal layer" would
then have the responsibillity of combining the two. But what happens when we
use paintdevices that are not layers - wouldn't we still want alpha for
those?

My suggestion would be more in the like of a RGB colorstrategy, a RGBA
colorstrategy, a RAGABA colorstrategy and so fourth with CMYK, CMYKA etc.
To avoid code duplication we could have an AlphaColorstrategyTrait and let
RGBA inherit from both RGBColorStrategy and AlphaColorstrateyTrait. The
trait could be reused for CMYK with alpha.

I think it would be best to have several colorstrategies. Adding alpha (case
1 like) would then be like chaning colormode.

Adding alpha (case 2 like) would be to just add another layer. The trait
could even be reused here.

best regards
Casper Boemann



More information about the kimageshop mailing list