
Lubomir Bourdev wrote:
The fact that GIL doesn't provide campling makes me argue it is not a mature library. It's such a basic need (I get this from reading the book!)
To clamp a channel in GIL you can just say:
T channel; T clamped = std::min(channel, channel_max_value<T>());
But that's not how things work in practice. When the data are already stored as type T, overflow has already occured. Moreover, the possibility of overflow typically arises deep inside some algorithm, where you cannot simply call std::min(), but need another mechanism (e.g. promotion traits). Ulli -- ________________________________________________________________ | | | Ullrich Koethe Universitaet Hamburg / University of Hamburg | | FB Informatik / Dept. of Informatics | | AB Kognitive Systeme / Cognitive Systems Group | | | | Phone: +49 (0)40 42883-2573 Vogt-Koelln-Str. 30 | | Fax: +49 (0)40 42883-2572 D - 22527 Hamburg | | Email: u.koethe@computer.org Germany | | koethe@informatik.uni-hamburg.de | | WWW: http://kogs-www.informatik.uni-hamburg.de/~koethe/ | |________________________________________________________________|