KisIterator, quantum and pixels

Casper Boemann cbr at
Mon Jul 5 20:34:30 CEST 2004

> > Which is in fact similar to my proposal. But I use C technique, because
> > true class can't reserve a runtime dynamic number of bytes as part of
> > class structure. Inside the colorstrategy the pixeldata can be cast to a
> > specific class, if it feels better.
> Which is the reason for using templates, I guess, because then you can let
> compiler make the decision based on the pixel type.

No templates are compiletime decisions, and we need dynamic behaviour unless
you want to duplicate the codebase for every imagetype.

What is needed is a baseclass with dynamic size. Furthermore the baseclass
is not allowed to have any internal state of virtual functions as they would
take up memory. Classes doesn't allow that - it's simply impossible.

What I propose is the next best thing.(the only way) It's actually a
strategy pattern, and very OO. There are no switches or anything.

> channel: an iterator that skips the channels the caller isn't interested

If I understand you correctly it's still a pixel iterator. One that goes
from pixel to pixel. What you want is to extract specific channel info from
each pixel. That is not the job of the iterator but should be defered to the
colorstrategy. (as only the colorstrategy should know what to extract)

Still we need an abstract way to define channels so that from an ui point of
view all colorstrategies can be managed in a similar way. By the way the
spotcolorchannel and alpha channels of photoshop are not channels they are
actually special forms of layers (non movable and always on top of the
normal layers). If you have photoshop then try to select one of those "extra
channels" while selecting layers. You can't - they are mutually exclusive.
Anther hint is that those "extra channels" can be stacked in different
order. On the other hand the layermasks of layers are actually true

> kernel is a (often small) array of values used in convolution ops. An
> of using a kernel for edge enhancement is at

sure, but an iterator for a kernel is perhabs overkill, but I don't dispute

Best regards
Casper Boemann

More information about the kimageshop mailing list