2 // Copyright 2010 Fabien Castan, Christian Henning
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 #ifndef BOOST_GIL_EXTENSION_TOOLBOX_CHANNEL_VIEW_HPP
9 #define BOOST_GIL_EXTENSION_TOOLBOX_CHANNEL_VIEW_HPP
11 #include <boost/gil/image_view_factory.hpp>
16 template <typename Channel, typename View>
17 struct channel_type_to_index
19 static constexpr int value = detail::type_to_index
21 typename color_space_type<View>::type, // color (Boost.MP11-compatible list)
22 Channel // channel type
23 >::value; // index of the channel in the color (Boost.MP11-compatible list)
26 template<typename Channel, typename View>
27 struct channel_view_type : kth_channel_view_type
29 channel_type_to_index<Channel, View>::value,
33 static constexpr int index = channel_type_to_index
39 using parent_t = kth_channel_view_type<index, View>;
40 using type = typename parent_t::type;
42 static type make( const View& src )
44 return parent_t::make( src );
48 /// \ingroup ImageViewTransformationsKthChannel
49 template<typename Channel, typename View>
50 auto channel_view(View const& src)
51 -> typename channel_view_type<Channel, View>::type
53 return channel_view_type<Channel, View>::make(src);
56 }} // namespace boost::gil