]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/gil/device_n.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / gil / device_n.hpp
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
16 ////////////////////////////////////////////////////////////////////////////////////////
17 /// \file
18 /// \brief Support for color space of N channels and variants
19 /// \author Lubomir Bourdev and Hailin Jin \n
20 /// Adobe Systems Incorporated
21 /// \date 2005-2009 \n Last updated on February 20, 2009
22 ////////////////////////////////////////////////////////////////////////////////////////
23
24 #include <cstddef>
25 #include "gil_config.hpp"
26 #include "utilities.hpp"
27 #include "metafunctions.hpp"
28 #include <boost/type_traits.hpp>
29 #include <boost/mpl/range_c.hpp>
30 #include <boost/mpl/vector_c.hpp>
31
32 namespace boost { namespace gil {
33
34 /// \brief unnamed color
35 /// \ingroup ColorNameModel
36 template <int N> struct devicen_color_t {};
37
38 template <int N> struct devicen_t;
39
40 /// \brief unnamed color space of one channel
41 /// \ingroup ColorSpaceModel
42 template <> struct devicen_t<1> : public mpl::vector1<devicen_color_t<0> > {};
43
44 /// \brief unnamed color space of two channels
45 /// \ingroup ColorSpaceModel
46 template <> struct devicen_t<2> : public mpl::vector2<devicen_color_t<0>, devicen_color_t<1> > {};
47
48 /// \brief unnamed color space of three channels
49 /// \ingroup ColorSpaceModel
50 template <> struct devicen_t<3> : public mpl::vector3<devicen_color_t<0>, devicen_color_t<1>, devicen_color_t<2> > {};
51
52 /// \brief unnamed color space of four channels
53 /// \ingroup ColorSpaceModel
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> > {};
55
56 /// \brief unnamed color space of five channels
57 /// \ingroup ColorSpaceModel
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> > {};
59
60 /// \brief unnamed color layout of up to five channels
61 /// \ingroup LayoutModel
62 template <int N> struct devicen_layout_t : public layout<devicen_t<N> > {};
63
64 /// \ingroup ImageViewConstructors
65 /// \brief from 2-channel planar data
66 template <typename IC>
67 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<2> > >::view_t
68 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, std::ptrdiff_t rowsize_in_bytes) {
69 typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<2> > >::view_t view_t;
70 return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1), rowsize_in_bytes));
71 }
72
73 /// \ingroup ImageViewConstructors
74 /// \brief from 3-channel planar data
75 template <typename IC>
76 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t
77 planar_devicen_view(std::size_t width, std::size_t height, IC c0, IC c1, IC c2, std::ptrdiff_t rowsize_in_bytes) {
78 typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<3> > >::view_t view_t;
79 return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2), rowsize_in_bytes));
80 }
81
82 /// \ingroup ImageViewConstructors
83 /// \brief from 4-channel planar data
84 template <typename IC>
85 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t
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) {
87 typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<4> > >::view_t view_t;
88 return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3), rowsize_in_bytes));
89 }
90
91 /// \ingroup ImageViewConstructors
92 /// \brief from 5-channel planar data
93 template <typename IC>
94 inline typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t
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) {
96 typedef typename type_from_x_iterator<planar_pixel_iterator<IC,devicen_t<5> > >::view_t view_t;
97 return view_t(width, height, typename view_t::locator(typename view_t::x_iterator(c0,c1,c2,c3,c4), rowsize_in_bytes));
98 }
99
100 } } // namespace boost::gil
101
102 #endif