kth_semantic_element_type, kth_semantic_element_reference_type, kth_semantic_element_const_reference_type, semantic_at_c
[Algorithms and Utility Functions]

Detailed Description

Support for accessing the elements of a color base by semantic index.

The semantic index of an element is the index of its color in the color space. Semantic indexing allows for proper pairing of elements of color bases independent on their layout. For example, red is the first semantic element of a color base regardless of whether it has an RGB layout or a BGR layout. All GIL color base algorithms taking multiple color bases use semantic indexing to access their elements.


// 16-bit BGR pixel, 4 bits for the blue, 3 bits for the green, 2 bits for the red channel and 7 unused bits
typedef packed_pixel_type<uint16_t, mpl::vector3_c<unsigned,4,3,2>, bgr_layout_t>::type bgr432_pixel_t;

// A reference to its red channel. Although the red channel is the third, its semantic index is 0 in the RGB color space
typedef kth_semantic_element_reference_type<bgr432_pixel_t, 0>::type red_channel_reference_t;

// Initialize the pixel to black
bgr432_pixel_t red_pixel(0,0,0);

// Set the red channel to 100%
red_channel_reference_t red_channel = semantic_at_c<0>(red_pixel);
red_channel = channel_traits<red_channel_reference_t>::max_value();       


struct  kth_semantic_element_type
 Specifies the type of the K-th semantic element of a color base. More...
struct  kth_semantic_element_reference_type
 Specifies the return type of the mutable semantic_at_c<K>(color_base);. More...
struct  kth_semantic_element_const_reference_type
 Specifies the return type of the constant semantic_at_c<K>(color_base);. More...


template<int K, typename ColorBase>
disable_if< is_const < ColorBase >,
typename kth_semantic_element_reference_type<
ColorBase, K >::type >::type 
boost::gil::semantic_at_c (ColorBase &p)
 A mutable accessor to the K-th semantic element of a color base.
template<int K, typename ColorBase>
ColorBase, K >::type 
boost::gil::semantic_at_c (const ColorBase &p)
 A constant accessor to the K-th semantic element of a color base.

Generated on Thu Nov 8 21:53:20 2007 for Generic Image Library by  doxygen 1.4.4