]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/gil/typedefs.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / gil / typedefs.hpp
CommitLineData
92f5a8d4
TL
1//
2// Copyright 2005-2007 Adobe Systems Incorporated
3// Copyright 2018 Mateusz Loskot <mateusz@loskot.net>
4//
5// Use, modification and distribution are subject to the Boost Software License,
6// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9#ifndef BOOST_GIL_TYPEDEFS_HPP
10#define BOOST_GIL_TYPEDEFS_HPP
11
12#include <boost/gil/cmyk.hpp>
13#include <boost/gil/device_n.hpp>
14#include <boost/gil/gray.hpp>
15#include <boost/gil/point.hpp>
16#include <boost/gil/rgb.hpp>
17#include <boost/gil/rgba.hpp>
18
19#include <cstdint>
7c673cae
FG
20#include <memory>
21
92f5a8d4
TL
22// B - bits size/signedness, CM - channel model, CS - colour space, LAYOUT - pixel layout
23// Example: B = '8', CM = 'uint8_t', CS = 'bgr, LAYOUT='bgr_layout_t'
f67539c2 24#define BOOST_GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(B, CM, CS, LAYOUT) \
92f5a8d4
TL
25 template <typename, typename> struct pixel; \
26 template <typename, typename> struct planar_pixel_reference; \
27 template <typename, typename> struct planar_pixel_iterator; \
28 template <typename> class memory_based_step_iterator; \
29 template <typename> class point; \
30 template <typename> class memory_based_2d_locator; \
31 template <typename> class image_view; \
32 template <typename, bool, typename> class image; \
33 using CS##B##_pixel_t = pixel<CM, LAYOUT>; \
34 using CS##B##c_pixel_t = pixel<CM, LAYOUT> const; \
35 using CS##B##_ref_t = pixel<CM, LAYOUT>&; \
36 using CS##B##c_ref_t = pixel<CM, LAYOUT> const&; \
37 using CS##B##_ptr_t = CS##B##_pixel_t*; \
38 using CS##B##c_ptr_t = CS##B##c_pixel_t*; \
39 using CS##B##_step_ptr_t = memory_based_step_iterator<CS##B##_ptr_t>; \
40 using CS##B##c_step_ptr_t = memory_based_step_iterator<CS##B##c_ptr_t>; \
41 using CS##B##_loc_t \
42 = memory_based_2d_locator<memory_based_step_iterator<CS##B##_ptr_t>>; \
43 using CS##B##c_loc_t \
44 = memory_based_2d_locator<memory_based_step_iterator<CS##B##c_ptr_t>>; \
45 using CS##B##_step_loc_t \
46 = memory_based_2d_locator<memory_based_step_iterator<CS##B##_step_ptr_t>>; \
47 using CS##B##c_step_loc_t \
48 = memory_based_2d_locator<memory_based_step_iterator<CS##B##c_step_ptr_t>>; \
49 using CS##B##_view_t = image_view<CS##B##_loc_t>; \
50 using CS##B##c_view_t = image_view<CS##B##c_loc_t>; \
51 using CS##B##_step_view_t = image_view<CS##B##_step_loc_t>; \
52 using CS##B##c_step_view_t = image_view<CS##B##c_step_loc_t>; \
53 using CS##B##_image_t = image<CS##B##_pixel_t, false, std::allocator<unsigned char>>;
54
55// Example: B = '8', CM = 'uint8_t', CS = 'bgr' CS_FULL = 'rgb_t' LAYOUT='bgr_layout_t'
f67539c2
TL
56#define BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(B, CM, CS, CS_FULL, LAYOUT) \
57 BOOST_GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(B, CM, CS, LAYOUT) \
92f5a8d4
TL
58 using CS##B##_planar_ref_t = planar_pixel_reference<CM&, CS_FULL>; \
59 using CS##B##c_planar_ref_t = planar_pixel_reference<CM const&, CS_FULL>; \
60 using CS##B##_planar_ptr_t = planar_pixel_iterator<CM*, CS_FULL>; \
61 using CS##B##c_planar_ptr_t = planar_pixel_iterator<CM const*, CS_FULL>; \
62 using CS##B##_planar_step_ptr_t = memory_based_step_iterator<CS##B##_planar_ptr_t>; \
63 using CS##B##c_planar_step_ptr_t \
64 = memory_based_step_iterator<CS##B##c_planar_ptr_t>; \
65 using CS##B##_planar_loc_t \
66 = memory_based_2d_locator<memory_based_step_iterator<CS##B##_planar_ptr_t>>; \
67 using CS##B##c_planar_loc_t \
68 = memory_based_2d_locator<memory_based_step_iterator<CS##B##c_planar_ptr_t>>; \
69 using CS##B##_planar_step_loc_t \
70 = memory_based_2d_locator<memory_based_step_iterator<CS##B##_planar_step_ptr_t>>; \
71 using CS##B##c_planar_step_loc_t \
72 = memory_based_2d_locator<memory_based_step_iterator<CS##B##c_planar_step_ptr_t>>; \
73 using CS##B##_planar_view_t = image_view<CS##B##_planar_loc_t>; \
74 using CS##B##c_planar_view_t = image_view<CS##B##c_planar_loc_t>; \
75 using CS##B##_planar_step_view_t = image_view<CS##B##_planar_step_loc_t>; \
76 using CS##B##c_planar_step_view_t = image_view<CS##B##c_planar_step_loc_t>; \
77 using CS##B##_planar_image_t \
78 = image<CS##B##_pixel_t, true, std::allocator<unsigned char>>;
79
f67539c2
TL
80#define BOOST_GIL_DEFINE_BASE_TYPEDEFS(B, CM, CS) \
81 BOOST_GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(B, CM, CS, CS##_layout_t)
92f5a8d4 82
f67539c2
TL
83#define BOOST_GIL_DEFINE_ALL_TYPEDEFS(B, CM, CS) \
84 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(B, CM, CS, CS##_t, CS##_layout_t)
92f5a8d4 85
7c673cae
FG
86
87namespace boost { namespace gil {
88
89// forward declarations
90template <typename B, typename Mn, typename Mx> struct scoped_channel_value;
92f5a8d4
TL
91template <typename T> struct float_point_zero;
92template <typename T> struct float_point_one;
93
94//////////////////////////////////////////////////////////////////////////////////////////
95/// Built-in channel models
96//////////////////////////////////////////////////////////////////////////////////////////
97
98/// \ingroup ChannelModel
99/// \brief 8-bit unsigned integral channel type (alias from uint8_t). Models ChannelValueConcept
100using std::uint8_t;
101
102/// \ingroup ChannelModel
103/// \brief 16-bit unsigned integral channel type (alias from uint16_t). Models ChannelValueConcept
104using std::uint16_t;
105
106/// \ingroup ChannelModel
107/// \brief 32-bit unsigned integral channel type (alias from uint32_t). Models ChannelValueConcept
108using std::uint32_t;
109
110/// \ingroup ChannelModel
111/// \brief 8-bit signed integral channel type (alias from int8_t). Models ChannelValueConcept
112using std::int8_t;
113
114/// \ingroup ChannelModel
115/// \brief 16-bit signed integral channel type (alias from int16_t). Models ChannelValueConcept
116using std::int16_t;
117
118/// \ingroup ChannelModel
119/// \brief 32-bit signed integral channel type (alias from int32_t). Models ChannelValueConcept
120using std::int32_t;
121
122/// \ingroup ChannelModel
123/// \brief 32-bit floating point channel type with range [0.0f ... 1.0f]. Models ChannelValueConcept
124using float32_t = scoped_channel_value<float, float_point_zero<float>, float_point_one<float>>;
125
126/// \ingroup ChannelModel
127/// \brief 64-bit floating point channel type with range [0.0f ... 1.0f]. Models ChannelValueConcept
128using float64_t = scoped_channel_value<double, float_point_zero<double>, float_point_one<double>>;
129
f67539c2
TL
130BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, gray)
131BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, gray)
132BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, gray)
133BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, gray)
134BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, gray)
135BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, gray)
136BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, gray)
137
138BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, bgr)
139BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, bgr)
140BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, bgr)
141BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, bgr)
142BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, bgr)
143BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, bgr)
144BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, bgr)
145
146BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, argb)
147BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, argb)
148BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, argb)
149BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, argb)
150BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, argb)
151BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, argb)
152BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, argb)
153
154BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, abgr)
155BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, abgr)
156BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, abgr)
157BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, abgr)
158BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, abgr)
159BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, abgr)
160BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, abgr)
161
162BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, bgra)
163BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, bgra)
164BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, bgra)
165BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, bgra)
166BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, bgra)
167BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, bgra)
168BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, bgra)
169
170BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, rgb)
171BOOST_GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, rgb)
172BOOST_GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, rgb)
173BOOST_GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, rgb)
174BOOST_GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, rgb)
175BOOST_GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, rgb)
176BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, rgb)
177
178BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, rgba)
179BOOST_GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, rgba)
180BOOST_GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, rgba)
181BOOST_GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, rgba)
182BOOST_GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, rgba)
183BOOST_GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, rgba)
184BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, rgba)
185
186BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, cmyk)
187BOOST_GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, cmyk)
188BOOST_GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, cmyk)
189BOOST_GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, cmyk)
190BOOST_GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, cmyk)
191BOOST_GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, cmyk)
192BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, cmyk)
7c673cae
FG
193
194template <int N> struct devicen_t;
195template <int N> struct devicen_layout_t;
92f5a8d4 196
f67539c2
TL
197BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, uint8_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
198BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, int8_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
199BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, uint16_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
200BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s, int16_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
201BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32, uint32_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
202BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s, int32_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
203BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f, float32_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
204
205BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, uint8_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
206BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, int8_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
207BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, uint16_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
208BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s, int16_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
209BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32, uint32_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
210BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s, int32_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
211BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f, float32_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
212
213BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, uint8_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
214BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, int8_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
215BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, uint16_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
216BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s, int16_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
217BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32, uint32_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
218BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s, int32_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
219BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f, float32_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
220
221BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, uint8_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
222BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, int8_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
223BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, uint16_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
224BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s, int16_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
225BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32, uint32_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
226BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s, int32_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
227BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f, float32_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
92f5a8d4
TL
228
229}} // namespace boost::gil
7c673cae
FG
230
231#endif