Boost GIL


device_n.hpp
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_DEVICE_N_HPP
9 #define BOOST_GIL_DEVICE_N_HPP
10 
11 #include <boost/gil/metafunctions.hpp>
12 #include <boost/gil/utilities.hpp>
13 
14 #include <boost/config.hpp>
15 #include <boost/mpl/range_c.hpp>
16 #include <boost/mpl/vector_c.hpp>
17 #include <boost/type_traits.hpp>
18 
19 #include <cstddef>
20 
21 namespace boost { namespace gil {
22 
25 template <int N> struct devicen_color_t {};
26 
27 template <int N> struct devicen_t;
28 
31 template <> struct devicen_t<1> : public mpl::vector1<devicen_color_t<0> > {};
32 
35 template <> struct devicen_t<2> : public mpl::vector2<devicen_color_t<0>, devicen_color_t<1> > {};
36 
39 template <> struct devicen_t<3> : public mpl::vector3<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2> > {};
40 
43 template <> struct devicen_t<4> : public mpl::vector4<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2>, devicen_color_t<3> > {};
44 
47 template <> struct devicen_t<5> : public mpl::vector5<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2>, devicen_color_t<3>, devicen_color_t<4> > {};
48 
51 template <int N> struct devicen_layout_t : public layout<devicen_t<N> > {};
52 
55 template <typename IC>
57 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, std::ptrdiff_t rowsize_in_bytes)
58 {
59  using view_t = typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<2>>>::view_t;
60  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1), rowsize_in_bytes));
61 }
62 
65 template <typename IC>
67 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, std::ptrdiff_t rowsize_in_bytes)
68 {
69  using view_t = typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3>>>::view_t;
70  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2), rowsize_in_bytes));
71 }
72 
75 template <typename IC>
77 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, IC c3, std::ptrdiff_t rowsize_in_bytes)
78 {
79  using view_t = typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4>>>::view_t;
80  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3), rowsize_in_bytes));
81 }
82 
85 template <typename IC>
87 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, IC c3, IC c4, std::ptrdiff_t rowsize_in_bytes)
88 {
89  using view_t = typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5>>>::view_t;
90  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3,c4), rowsize_in_bytes));
91 }
92 
93 } } // namespace boost::gil
94 
95 #endif
Definition: algorithm.hpp:30
type_from_x_iterator< planar_pixel_iterator< IC, devicen_t< 5 > > >::view_t planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, IC c3, IC c4, std::ptrdiff_t rowsize_in_bytes)
from 5-channel planar data
Definition: device_n.hpp:87
Given a pixel iterator defining access to pixels along a row, returns the types of the corresponding ...
Definition: metafunctions.hpp:239
unnamed color
Definition: device_n.hpp:25
Represents a color space and ordering of channels in memory.
Definition: utilities.hpp:247
unnamed color layout of up to five channels
Definition: device_n.hpp:51