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  typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<2> > >::view_t view_t;
59  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1), rowsize_in_bytes));
60 }
61 
64 template <typename IC>
65 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t
66 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, std::ptrdiff_t rowsize_in_bytes) {
67  typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t view_t;
68  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2), rowsize_in_bytes));
69 }
70 
73 template <typename IC>
74 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t
75 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) {
76  typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t view_t;
77  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3), rowsize_in_bytes));
78 }
79 
82 template <typename IC>
83 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t
84 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) {
85  typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t view_t;
86  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3,c4), rowsize_in_bytes));
87 }
88 
89 } } // namespace boost::gil
90 
91 #endif
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:84
Given a pixel iterator defining access to pixels along a row, returns the types of the corresponding ...
Definition: metafunctions.hpp:238
unnamed color
Definition: device_n.hpp:25
Represents a color space and ordering of channels in memory.
Definition: utilities.hpp:246
unnamed color layout of up to five channels
Definition: device_n.hpp:51