• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
3 //
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
7 //
8 #ifndef BOOST_GIL_RGB_HPP
9 #define BOOST_GIL_RGB_HPP
10 
11 #include <boost/gil/metafunctions.hpp>
12 #include <boost/gil/planar_pixel_iterator.hpp>
13 #include <boost/gil/detail/mp11.hpp>
14 
15 #include <cstddef>
16 #include <type_traits>
17 
18 namespace boost { namespace gil {
19 
20 /// \addtogroup ColorNameModel
21 /// \{
22 
23 /// \brief Red
24 struct red_t {};
25 
26 /// \brief Green
27 struct green_t {};
28 
29 /// \brief Blue
30 struct blue_t {};
31 /// \}
32 
33 /// \ingroup ColorSpaceModel
34 using rgb_t = mp11::mp_list<red_t, green_t, blue_t>;
35 
36 /// \ingroup LayoutModel
37 using rgb_layout_t = layout<rgb_t>;
38 
39 /// \ingroup LayoutModel
40 using bgr_layout_t = layout<rgb_t, mp11::mp_list_c<int, 2, 1, 0>>;
41 
42 /// \ingroup ImageViewConstructors
43 /// \brief from raw RGB planar data
44 template <typename IC>
45 inline
planar_rgb_view(std::size_t width,std::size_t height,IC r,IC g,IC b,std::ptrdiff_t rowsize_in_bytes)46 auto planar_rgb_view(
47     std::size_t width, std::size_t height,
48     IC r, IC g, IC b,
49     std::ptrdiff_t rowsize_in_bytes)
50     -> typename type_from_x_iterator<planar_pixel_iterator<IC, rgb_t> >::view_t
51 {
52     using view_t = typename type_from_x_iterator<planar_pixel_iterator<IC, rgb_t>>::view_t;
53 
54     return view_t(
55         width, height,
56         typename view_t::locator(
57             planar_pixel_iterator<IC, rgb_t>(r, g, b),
58             rowsize_in_bytes));
59 }
60 
61 }}  // namespace boost::gil
62 
63 #endif
64