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://opensource.adobe.com/gil for most recent version including documentation.
9*/
10
11/*************************************************************************************************/
12
13#ifndef GIL_TYPEDEFS_H
14#define GIL_TYPEDEFS_H
15
16////////////////////////////////////////////////////////////////////////////////////////
17/// \file
18/// \brief Useful typedefs
19/// \author Lubomir Bourdev and Hailin Jin \n
20/// Adobe Systems Incorporated
21/// \date 2005-2007 \n Last updated on March 8, 2006
22///
23////////////////////////////////////////////////////////////////////////////////////////
24
25#include "gil_config.hpp"
26#include <boost/cstdint.hpp>
27#include "gray.hpp"
28#include "rgb.hpp"
29#include "rgba.hpp"
30#include "cmyk.hpp"
31#include "device_n.hpp"
32#include <memory>
33
34// CS = 'bgr' LAYOUT='bgr_layout_t'
35#define GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(T,CS,LAYOUT) \
36 template <typename, typename> struct pixel; \
37 template <typename, typename> struct planar_pixel_reference; \
38 template <typename, typename> struct planar_pixel_iterator; \
39 template <typename> class memory_based_step_iterator; \
40 template <typename> class point2; \
41 template <typename> class memory_based_2d_locator; \
42 template <typename> class image_view; \
43 template <typename, bool, typename> class image; \
44 typedef pixel<bits##T, LAYOUT > CS##T##_pixel_t; \
45 typedef const pixel<bits##T, LAYOUT > CS##T##c_pixel_t; \
46 typedef pixel<bits##T, LAYOUT >& CS##T##_ref_t; \
47 typedef const pixel<bits##T, LAYOUT >& CS##T##c_ref_t; \
48 typedef CS##T##_pixel_t* CS##T##_ptr_t; \
49 typedef CS##T##c_pixel_t* CS##T##c_ptr_t; \
50 typedef memory_based_step_iterator<CS##T##_ptr_t> CS##T##_step_ptr_t; \
51 typedef memory_based_step_iterator<CS##T##c_ptr_t> CS##T##c_step_ptr_t; \
52 typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##_ptr_t> > CS##T##_loc_t; \
53 typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##c_ptr_t> > CS##T##c_loc_t; \
54 typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##_step_ptr_t> > CS##T##_step_loc_t; \
55 typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##c_step_ptr_t> > CS##T##c_step_loc_t; \
56 typedef image_view<CS##T##_loc_t> CS##T##_view_t; \
57 typedef image_view<CS##T##c_loc_t> CS##T##c_view_t; \
58 typedef image_view<CS##T##_step_loc_t> CS##T##_step_view_t; \
59 typedef image_view<CS##T##c_step_loc_t> CS##T##c_step_view_t; \
60 typedef image<CS##T##_pixel_t,false,std::allocator<unsigned char> > CS##T##_image_t;
61
62// CS = 'bgr' CS_FULL = 'rgb_t' LAYOUT='bgr_layout_t'
63#define GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(T,CS,CS_FULL,LAYOUT) \
64 GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(T,CS,LAYOUT) \
65 typedef planar_pixel_reference<bits##T&,CS_FULL > CS##T##_planar_ref_t; \
66 typedef planar_pixel_reference<const bits##T&,CS_FULL > CS##T##c_planar_ref_t; \
67 typedef planar_pixel_iterator<bits##T*,CS_FULL > CS##T##_planar_ptr_t; \
68 typedef planar_pixel_iterator<const bits##T*,CS_FULL > CS##T##c_planar_ptr_t; \
69 typedef memory_based_step_iterator<CS##T##_planar_ptr_t> CS##T##_planar_step_ptr_t; \
70 typedef memory_based_step_iterator<CS##T##c_planar_ptr_t> CS##T##c_planar_step_ptr_t; \
71 typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##_planar_ptr_t> > CS##T##_planar_loc_t; \
72 typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##c_planar_ptr_t> > CS##T##c_planar_loc_t; \
73 typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##_planar_step_ptr_t> > CS##T##_planar_step_loc_t; \
74 typedef memory_based_2d_locator<memory_based_step_iterator<CS##T##c_planar_step_ptr_t> > CS##T##c_planar_step_loc_t; \
75 typedef image_view<CS##T##_planar_loc_t> CS##T##_planar_view_t; \
76 typedef image_view<CS##T##c_planar_loc_t> CS##T##c_planar_view_t; \
77 typedef image_view<CS##T##_planar_step_loc_t> CS##T##_planar_step_view_t; \
78 typedef image_view<CS##T##c_planar_step_loc_t> CS##T##c_planar_step_view_t;\
79 typedef image<CS##T##_pixel_t,true,std::allocator<unsigned char> > CS##T##_planar_image_t;
80
81#define GIL_DEFINE_BASE_TYPEDEFS(T,CS) \
82 GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(T,CS,CS##_layout_t)
83
84#define GIL_DEFINE_ALL_TYPEDEFS(T,CS) \
85 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(T,CS,CS##_t,CS##_layout_t)
86
87namespace boost { namespace gil {
88
89// forward declarations
90template <typename B, typename Mn, typename Mx> struct scoped_channel_value;
91struct float_zero;
92struct float_one;
93typedef scoped_channel_value<float,float_zero,float_one> bits32f;
94typedef uint8_t bits8;
95typedef uint16_t bits16;
96typedef uint32_t bits32;
97typedef int8_t bits8s;
98typedef int16_t bits16s;
99typedef int32_t bits32s;
100
101GIL_DEFINE_BASE_TYPEDEFS(8, gray)
102GIL_DEFINE_BASE_TYPEDEFS(8s, gray)
103GIL_DEFINE_BASE_TYPEDEFS(16, gray)
104GIL_DEFINE_BASE_TYPEDEFS(16s,gray)
105GIL_DEFINE_BASE_TYPEDEFS(32 ,gray)
106GIL_DEFINE_BASE_TYPEDEFS(32s,gray)
107GIL_DEFINE_BASE_TYPEDEFS(32f,gray)
108GIL_DEFINE_BASE_TYPEDEFS(8, bgr)
109GIL_DEFINE_BASE_TYPEDEFS(8s, bgr)
110GIL_DEFINE_BASE_TYPEDEFS(16, bgr)
111GIL_DEFINE_BASE_TYPEDEFS(16s,bgr)
112GIL_DEFINE_BASE_TYPEDEFS(32 ,bgr)
113GIL_DEFINE_BASE_TYPEDEFS(32s,bgr)
114GIL_DEFINE_BASE_TYPEDEFS(32f,bgr)
115GIL_DEFINE_BASE_TYPEDEFS(8, argb)
116GIL_DEFINE_BASE_TYPEDEFS(8s, argb)
117GIL_DEFINE_BASE_TYPEDEFS(16, argb)
118GIL_DEFINE_BASE_TYPEDEFS(16s,argb)
119GIL_DEFINE_BASE_TYPEDEFS(32, argb)
120GIL_DEFINE_BASE_TYPEDEFS(32s,argb)
121GIL_DEFINE_BASE_TYPEDEFS(32f,argb)
122GIL_DEFINE_BASE_TYPEDEFS(8, abgr)
123GIL_DEFINE_BASE_TYPEDEFS(8s, abgr)
124GIL_DEFINE_BASE_TYPEDEFS(16, abgr)
125GIL_DEFINE_BASE_TYPEDEFS(16s,abgr)
126GIL_DEFINE_BASE_TYPEDEFS(32 ,abgr)
127GIL_DEFINE_BASE_TYPEDEFS(32s,abgr)
128GIL_DEFINE_BASE_TYPEDEFS(32f,abgr)
129GIL_DEFINE_BASE_TYPEDEFS(8, bgra)
130GIL_DEFINE_BASE_TYPEDEFS(8s, bgra)
131GIL_DEFINE_BASE_TYPEDEFS(16, bgra)
132GIL_DEFINE_BASE_TYPEDEFS(16s,bgra)
133GIL_DEFINE_BASE_TYPEDEFS(32 ,bgra)
134GIL_DEFINE_BASE_TYPEDEFS(32s,bgra)
135GIL_DEFINE_BASE_TYPEDEFS(32f,bgra)
136
137GIL_DEFINE_ALL_TYPEDEFS(8, rgb)
138GIL_DEFINE_ALL_TYPEDEFS(8s, rgb)
139GIL_DEFINE_ALL_TYPEDEFS(16, rgb)
140GIL_DEFINE_ALL_TYPEDEFS(16s,rgb)
141GIL_DEFINE_ALL_TYPEDEFS(32 ,rgb)
142GIL_DEFINE_ALL_TYPEDEFS(32s,rgb)
143GIL_DEFINE_ALL_TYPEDEFS(32f,rgb)
144GIL_DEFINE_ALL_TYPEDEFS(8, rgba)
145GIL_DEFINE_ALL_TYPEDEFS(8s, rgba)
146GIL_DEFINE_ALL_TYPEDEFS(16, rgba)
147GIL_DEFINE_ALL_TYPEDEFS(16s,rgba)
148GIL_DEFINE_ALL_TYPEDEFS(32 ,rgba)
149GIL_DEFINE_ALL_TYPEDEFS(32s,rgba)
150GIL_DEFINE_ALL_TYPEDEFS(32f,rgba)
151GIL_DEFINE_ALL_TYPEDEFS(8, cmyk)
152GIL_DEFINE_ALL_TYPEDEFS(8s, cmyk)
153GIL_DEFINE_ALL_TYPEDEFS(16, cmyk)
154GIL_DEFINE_ALL_TYPEDEFS(16s,cmyk)
155GIL_DEFINE_ALL_TYPEDEFS(32 ,cmyk)
156GIL_DEFINE_ALL_TYPEDEFS(32s,cmyk)
157GIL_DEFINE_ALL_TYPEDEFS(32f,cmyk)
158
159
160template <int N> struct devicen_t;
161template <int N> struct devicen_layout_t;
162GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, dev2n, devicen_t<2>, devicen_layout_t<2>)
163GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, dev2n, devicen_t<2>, devicen_layout_t<2>)
164GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, dev2n, devicen_t<2>, devicen_layout_t<2>)
165GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s,dev2n, devicen_t<2>, devicen_layout_t<2>)
166GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32 ,dev2n, devicen_t<2>, devicen_layout_t<2>)
167GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s,dev2n, devicen_t<2>, devicen_layout_t<2>)
168GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f,dev2n, devicen_t<2>, devicen_layout_t<2>)
169
170GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, dev3n, devicen_t<3>, devicen_layout_t<3>)
171GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, dev3n, devicen_t<3>, devicen_layout_t<3>)
172GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, dev3n, devicen_t<3>, devicen_layout_t<3>)
173GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s,dev3n, devicen_t<3>, devicen_layout_t<3>)
174GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32 ,dev3n, devicen_t<3>, devicen_layout_t<3>)
175GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s,dev3n, devicen_t<3>, devicen_layout_t<3>)
176GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f,dev3n, devicen_t<3>, devicen_layout_t<3>)
177
178GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, dev4n, devicen_t<4>, devicen_layout_t<4>)
179GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, dev4n, devicen_t<4>, devicen_layout_t<4>)
180GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, dev4n, devicen_t<4>, devicen_layout_t<4>)
181GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s,dev4n, devicen_t<4>, devicen_layout_t<4>)
182GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32 ,dev4n, devicen_t<4>, devicen_layout_t<4>)
183GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s,dev4n, devicen_t<4>, devicen_layout_t<4>)
184GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f,dev4n, devicen_t<4>, devicen_layout_t<4>)
185
186GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, dev5n, devicen_t<5>, devicen_layout_t<5>)
187GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, dev5n, devicen_t<5>, devicen_layout_t<5>)
188GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, dev5n, devicen_t<5>, devicen_layout_t<5>)
189GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s,dev5n, devicen_t<5>, devicen_layout_t<5>)
190GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32 ,dev5n, devicen_t<5>, devicen_layout_t<5>)
191GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s,dev5n, devicen_t<5>, devicen_layout_t<5>)
192GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f,dev5n, devicen_t<5>, devicen_layout_t<5>)
193
194} } // namespace boost::gil
195
196#endif
197

source code of boost/boost/gil/typedefs.hpp