Boost logo

Boost :

From: Adam Badura (abadura_at_[hidden])
Date: 2005-09-28 03:11:10

> Could I just ask if something like:
> for(int i = 0; i < 3; ++i)
> if(col[i]*1.2 < col.max) col[i] *= 1.2;
> else col[i] = col.max;
> is what you mean? Something like this is the only time doing something
> to every component over a loop makes sense to me (simpler ops could be
> applied directly to the colour), and here you can just assume that the
> colour ops are by default clipping (since that makes sense).
> therefore:
> col *= 1.2;
> is equivalent.
> Presumably, there would be non-clipping colours as well?

    Yes. I thought about something like this. But there is a lot of work
(for example interpolating) which is the same for each component. Naturally
you can write thre pices of code for each component, but it is simpler,
nicer and safer to have only one code...
    I want to include clipping. In fact I am considerating 3 versions of
this type operations. One would give exception if value out of range (for
debug), one wich would clip (to eas some parts of code in which this is
needed) and on which does nothing (for speed when operation is certain to be
OK). But i still am thinkig how to do it to allow additionaly to easy change
betwean kinds of calls (when changing from debug to release). Actually the
best from what i thought is 3 functions for example "component" (clear),
"component_e" (exception), "component_c" (clip). But perhabs some good
solution may be found using templates...

    Adam Badura

Boost list run by bdawes at, gregod at, cpdaniel at, john at