Chris@16
|
1 /*
|
Chris@16
|
2 Copyright 2005-2007 Adobe Systems Incorporated
|
Chris@16
|
3
|
Chris@16
|
4 Use, modification and distribution are subject to the Boost Software License,
|
Chris@16
|
5 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
6 http://www.boost.org/LICENSE_1_0.txt).
|
Chris@16
|
7
|
Chris@16
|
8 See http://stlab.adobe.com/gil for most recent version including documentation.
|
Chris@16
|
9 */
|
Chris@16
|
10 /*************************************************************************************************/
|
Chris@16
|
11
|
Chris@16
|
12 #ifndef GIL_DEVICE_N_H
|
Chris@16
|
13 #define GIL_DEVICE_N_H
|
Chris@16
|
14
|
Chris@16
|
15
|
Chris@16
|
16 ////////////////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
17 /// \file
|
Chris@16
|
18 /// \brief Support for color space of N channels and variants
|
Chris@16
|
19 /// \author Lubomir Bourdev and Hailin Jin \n
|
Chris@16
|
20 /// Adobe Systems Incorporated
|
Chris@16
|
21 /// \date 2005-2009 \n Last updated on February 20, 2009
|
Chris@16
|
22 ////////////////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
23
|
Chris@16
|
24 #include <cstddef>
|
Chris@16
|
25 #include "gil_config.hpp"
|
Chris@16
|
26 #include "utilities.hpp"
|
Chris@16
|
27 #include "metafunctions.hpp"
|
Chris@16
|
28 #include <boost/type_traits.hpp>
|
Chris@16
|
29 #include <boost/mpl/range_c.hpp>
|
Chris@16
|
30 #include <boost/mpl/vector_c.hpp>
|
Chris@16
|
31
|
Chris@16
|
32 namespace boost { namespace gil {
|
Chris@16
|
33
|
Chris@16
|
34 /// \brief unnamed color
|
Chris@16
|
35 /// \ingroup ColorNameModel
|
Chris@16
|
36 template <int N> struct devicen_color_t {};
|
Chris@16
|
37
|
Chris@16
|
38 template <int N> struct devicen_t;
|
Chris@16
|
39
|
Chris@16
|
40 /// \brief unnamed color space of one channel
|
Chris@16
|
41 /// \ingroup ColorSpaceModel
|
Chris@16
|
42 template <> struct devicen_t<1> : public mpl::vector1<devicen_color_t<0> > {};
|
Chris@16
|
43
|
Chris@16
|
44 /// \brief unnamed color space of two channels
|
Chris@16
|
45 /// \ingroup ColorSpaceModel
|
Chris@16
|
46 template <> struct devicen_t<2> : public mpl::vector2<devicen_color_t<0>, devicen_color_t<1> > {};
|
Chris@16
|
47
|
Chris@16
|
48 /// \brief unnamed color space of three channels
|
Chris@16
|
49 /// \ingroup ColorSpaceModel
|
Chris@16
|
50 template <> struct devicen_t<3> : public mpl::vector3<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2> > {};
|
Chris@16
|
51
|
Chris@16
|
52 /// \brief unnamed color space of four channels
|
Chris@16
|
53 /// \ingroup ColorSpaceModel
|
Chris@16
|
54 template <> struct devicen_t<4> : public mpl::vector4<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2>, devicen_color_t<3> > {};
|
Chris@16
|
55
|
Chris@16
|
56 /// \brief unnamed color space of five channels
|
Chris@16
|
57 /// \ingroup ColorSpaceModel
|
Chris@16
|
58 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> > {};
|
Chris@16
|
59
|
Chris@16
|
60 /// \brief unnamed color layout of up to five channels
|
Chris@16
|
61 /// \ingroup LayoutModel
|
Chris@16
|
62 template <int N> struct devicen_layout_t : public layout<devicen_t<N> > {};
|
Chris@16
|
63
|
Chris@16
|
64 /// \ingroup ImageViewConstructors
|
Chris@16
|
65 /// \brief from 2-channel planar data
|
Chris@16
|
66 template <typename IC>
|
Chris@16
|
67 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<2> > >::view_t
|
Chris@16
|
68 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, std::ptrdiff_t rowsize_in_bytes) {
|
Chris@16
|
69 typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<2> > >::view_t view_t;
|
Chris@16
|
70 return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1), rowsize_in_bytes));
|
Chris@16
|
71 }
|
Chris@16
|
72
|
Chris@16
|
73 /// \ingroup ImageViewConstructors
|
Chris@16
|
74 /// \brief from 3-channel planar data
|
Chris@16
|
75 template <typename IC>
|
Chris@16
|
76 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t
|
Chris@16
|
77 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, std::ptrdiff_t rowsize_in_bytes) {
|
Chris@16
|
78 typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t view_t;
|
Chris@16
|
79 return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2), rowsize_in_bytes));
|
Chris@16
|
80 }
|
Chris@16
|
81
|
Chris@16
|
82 /// \ingroup ImageViewConstructors
|
Chris@16
|
83 /// \brief from 4-channel planar data
|
Chris@16
|
84 template <typename IC>
|
Chris@16
|
85 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t
|
Chris@16
|
86 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) {
|
Chris@16
|
87 typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t view_t;
|
Chris@16
|
88 return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3), rowsize_in_bytes));
|
Chris@16
|
89 }
|
Chris@16
|
90
|
Chris@16
|
91 /// \ingroup ImageViewConstructors
|
Chris@16
|
92 /// \brief from 5-channel planar data
|
Chris@16
|
93 template <typename IC>
|
Chris@16
|
94 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t
|
Chris@16
|
95 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) {
|
Chris@16
|
96 typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t view_t;
|
Chris@16
|
97 return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3,c4), rowsize_in_bytes));
|
Chris@16
|
98 }
|
Chris@16
|
99
|
Chris@16
|
100 } } // namespace boost::gil
|
Chris@16
|
101
|
Chris@16
|
102 #endif
|