Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
kth_semantic_element_type, kth_semantic_element_reference_type, kth_semantic_element_const_reference_type, semantic_at_c

semantic_at_c: Semantic channel accessors More...

Classes

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

Functions

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. More...
 
template<int K, typename ColorBase >
kth_semantic_element_const_reference_type
< ColorBase, K >::type 
boost::gil::semantic_at_c (const ColorBase &p)
 A constant accessor to the K-th semantic element of a color base. More...
 

Detailed Description

semantic_at_c: Semantic channel accessors

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.

Example:

// 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
// 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);

Function Documentation

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)
inline
template<int K, typename ColorBase >
kth_semantic_element_const_reference_type< ColorBase, K >::type boost::gil::semantic_at_c ( const ColorBase &  p)
inline

#include <boost_1_57_0/boost/gil/color_base.hpp>

A constant accessor to the K-th semantic element of a color base.

References boost::gil::kth_semantic_element_const_reference_type< ColorBase, K >::get().