Boost GIL


Modules
scoped_channel_value

Modules

 packed_channel_value
 

Detailed Description

Traits for channels. Contains the following members:

template <typename Channel>
struct channel_traits {
using value_type = ...;
using reference = ...;
using pointer = ...;
using const_reference = ...;
using const_pointer = ...;
static const bool is_mutable;
static value_type min_value();
static value_type max_value();
};

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; } };
using bits64custom_t = scoped_channel_value<double, double_minus_half, double_plus_half>;
// channel_convert its maximum should map to the maximum
bits64custom_t x = channel_traits<bits64custom_t>::max_value();
assert(x == 0.5);
uint16_t y = channel_convert<uint16_t>(x);
assert(y == 65535);