Iterator requirements

Casper Boemann cbr at boemann.dk
Tue Jul 6 12:18:10 CEST 2004


> > For reasons I have already stated it is no good to return a pixel class.
> > Trust me on this one.
> >
>
> Well, it does work for Vigra, I guess that it can be done in C++.

well vigra doesn't do it dynamically. It does it through templating which
means that it has an image class for each pixel type !

We could do that, but as we have already decided to use color strategies and
a single paintdevice we need to do it the way I have described.

That does NOT mean that we cannot have a pixel class and specific
subclasses. If (and this is important) we only use them WITHIN the color
strategies. It may be a help in code reusage among related colorstrategies.
I may not, but even from a estetically point of view we might do it anyway.
No extra members or virtual functions though - but nonvirtual functions are
ok.

Please note that from all other classes it still needs to be QUANTUM *,
unless we really what to make a total redesign of our code base (which I
don't advocate).

Even the color strategies public funtions need to take QUANTUM * as input
and do the cast as their first thing like:

LabColorStrategy::doSomething(QUANTUM *pixeldata)
{
   LabPixel *pixel = (LabPixel *)pixeldata;

   //then the rest of the function can forget about pixeldata and only work
on pixel.
}

best regards
Casper Boemann



More information about the kimageshop mailing list