Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
scoped_channel_value

A channel adaptor that modifies the range of the source channel. More...

Classes

struct  boost::gil::scoped_channel_value< BaseChannelValue, MinVal, MaxVal >
 A channel adaptor that modifies the range of the source channel. More...
 

Detailed Description

A channel adaptor that modifies the range of the source channel.

Models: ChannelValueConcept

Example:

// Create a double channel with range [-0.5 .. 0.5]
struct double_minus_half { static double apply() { return -0.5; } };
struct double_plus_half { static double apply() { return 0.5; } };
typedef scoped_channel_value<double, double_minus_half, double_plus_half> bits64custom_t;
// channel_convert its maximum should map to the maximum
assert(x == 0.5);
bits16 y = channel_convert<bits16>(x);
assert(y == 65535);