Boost GIL


device_n.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3 
4  Use, modification and distribution are subject to the Boost Software License,
5  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6  http://www.boost.org/LICENSE_1_0.txt).
7 
8  See http://stlab.adobe.com/gil for most recent version including documentation.
9 */
10 /*************************************************************************************************/
11 
12 #ifndef GIL_DEVICE_N_H
13 #define GIL_DEVICE_N_H
14 
15 
23 
24 #include <cstddef>
25 
26 #include <boost/type_traits.hpp>
27 #include <boost/config.hpp>
28 #include <boost/mpl/range_c.hpp>
29 #include <boost/mpl/vector_c.hpp>
30 
31 #include "gil_config.hpp"
32 #include "utilities.hpp"
33 #include "metafunctions.hpp"
34 
35 namespace boost { namespace gil {
36 
39 template <int N> struct devicen_color_t {};
40 
41 template <int N> struct devicen_t;
42 
45 template <> struct devicen_t<1> : public mpl::vector1<devicen_color_t<0> > {};
46 
49 template <> struct devicen_t<2> : public mpl::vector2<devicen_color_t<0>, devicen_color_t<1> > {};
50 
53 template <> struct devicen_t<3> : public mpl::vector3<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2> > {};
54 
57 template <> struct devicen_t<4> : public mpl::vector4<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2>, devicen_color_t<3> > {};
58 
61 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> > {};
62 
65 template <int N> struct devicen_layout_t : public layout<devicen_t<N> > {};
66 
69 template <typename IC>
71 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, std::ptrdiff_t rowsize_in_bytes) {
72  typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<2> > >::view_t view_t;
73  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1), rowsize_in_bytes));
74 }
75 
78 template <typename IC>
79 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t
80 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, std::ptrdiff_t rowsize_in_bytes) {
81  typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t view_t;
82  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2), rowsize_in_bytes));
83 }
84 
87 template <typename IC>
88 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t
89 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) {
90  typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t view_t;
91  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3), rowsize_in_bytes));
92 }
93 
96 template <typename IC>
97 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t
98 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) {
99  typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t view_t;
100  return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3,c4), rowsize_in_bytes));
101 }
102 
103 } } // namespace boost::gil
104 
105 #endif
metafunctions that construct types or return type properties
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:98
Given a pixel iterator defining access to pixels along a row, returns the types of the corresponding ...
Definition: metafunctions.hpp:252
unnamed color
Definition: device_n.hpp:39
Represents a color space and ordering of channels in memory.
Definition: utilities.hpp:317
GIL configuration file.
unnamed color layout of up to five channels
Definition: device_n.hpp:65
Various utilities not specific to the image library. Some are non-standard STL extensions or generic ...