Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/gil/typedefs.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // Copyright 2005-2007 Adobe Systems Incorporated
0003 // Copyright 2018 Mateusz Loskot <mateusz@loskot.net>
0004 //
0005 // Use, modification and distribution are subject to the Boost Software License,
0006 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 #ifndef BOOST_GIL_TYPEDEFS_HPP
0010 #define BOOST_GIL_TYPEDEFS_HPP
0011 
0012 #include <boost/gil/cmyk.hpp>
0013 #include <boost/gil/device_n.hpp>
0014 #include <boost/gil/gray.hpp>
0015 #include <boost/gil/point.hpp>
0016 #include <boost/gil/rgb.hpp>
0017 #include <boost/gil/rgba.hpp>
0018 
0019 #include <cstdint>
0020 #include <memory>
0021 #if !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
0022 #    include <memory_resource>
0023 #endif  //!defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
0024 
0025 // B - bits size/signedness, CM - channel model, CS - colour space, LAYOUT - pixel layout
0026 // Example: B = '8', CM = 'uint8_t', CS = 'bgr,  LAYOUT='bgr_layout_t'
0027 #define BOOST_GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(B, CM, CS, LAYOUT)                                 \
0028     template <typename, typename>                                                                  \
0029     struct pixel;                                                                                  \
0030     template <typename, typename>                                                                  \
0031     struct planar_pixel_reference;                                                                 \
0032     template <typename, typename>                                                                  \
0033     struct planar_pixel_iterator;                                                                  \
0034     template <typename>                                                                            \
0035     class memory_based_step_iterator;                                                              \
0036     template <typename>                                                                            \
0037     class point;                                                                                   \
0038     template <typename>                                                                            \
0039     class memory_based_2d_locator;                                                                 \
0040     template <typename>                                                                            \
0041     class image_view;                                                                              \
0042     template <typename, bool, typename>                                                            \
0043     class image;                                                                                   \
0044     using CS##B##_pixel_t = pixel<CM, LAYOUT>;                                                     \
0045     using CS##B##c_pixel_t = pixel<CM, LAYOUT> const;                                              \
0046     using CS##B##_ref_t = pixel<CM, LAYOUT>&;                                                      \
0047     using CS##B##c_ref_t = pixel<CM, LAYOUT> const&;                                               \
0048     using CS##B##_ptr_t = CS##B##_pixel_t*;                                                        \
0049     using CS##B##c_ptr_t = CS##B##c_pixel_t*;                                                      \
0050     using CS##B##_step_ptr_t = memory_based_step_iterator<CS##B##_ptr_t>;                          \
0051     using CS##B##c_step_ptr_t = memory_based_step_iterator<CS##B##c_ptr_t>;                        \
0052     using CS##B##_loc_t = memory_based_2d_locator<memory_based_step_iterator<CS##B##_ptr_t>>;      \
0053     using CS##B##c_loc_t = memory_based_2d_locator<memory_based_step_iterator<CS##B##c_ptr_t>>;    \
0054     using CS##B##_step_loc_t                                                                       \
0055         = memory_based_2d_locator<memory_based_step_iterator<CS##B##_step_ptr_t>>;                 \
0056     using CS##B##c_step_loc_t                                                                      \
0057         = memory_based_2d_locator<memory_based_step_iterator<CS##B##c_step_ptr_t>>;                \
0058     using CS##B##_view_t = image_view<CS##B##_loc_t>;                                              \
0059     using CS##B##c_view_t = image_view<CS##B##c_loc_t>;                                            \
0060     using CS##B##_step_view_t = image_view<CS##B##_step_loc_t>;                                    \
0061     using CS##B##c_step_view_t = image_view<CS##B##c_step_loc_t>;                                  \
0062     using CS##B##_image_t = image<CS##B##_pixel_t, false, std::allocator<unsigned char>>;
0063 
0064 #define BOOST_GIL_DEFINE_BASE_PMR_TYPEDEFS_INTERNAL(B, CM, CS, LAYOUT)                             \
0065     namespace pmr {                                                                                \
0066     using CS##B##_image_t                                                                          \
0067         = image<CS##B##_pixel_t, false, std::pmr::polymorphic_allocator<unsigned char>>;           \
0068     }
0069 
0070 // Example: B = '8', CM = 'uint8_t', CS = 'bgr' CS_FULL = 'rgb_t' LAYOUT='bgr_layout_t'
0071 #define BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(B, CM, CS, CS_FULL, LAYOUT)                         \
0072     BOOST_GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(B, CM, CS, LAYOUT)                                     \
0073     using CS##B##_planar_ref_t = planar_pixel_reference<CM&, CS_FULL>;                             \
0074     using CS##B##c_planar_ref_t = planar_pixel_reference<CM const&, CS_FULL>;                      \
0075     using CS##B##_planar_ptr_t = planar_pixel_iterator<CM*, CS_FULL>;                              \
0076     using CS##B##c_planar_ptr_t = planar_pixel_iterator<CM const*, CS_FULL>;                       \
0077     using CS##B##_planar_step_ptr_t = memory_based_step_iterator<CS##B##_planar_ptr_t>;            \
0078     using CS##B##c_planar_step_ptr_t = memory_based_step_iterator<CS##B##c_planar_ptr_t>;          \
0079     using CS##B##_planar_loc_t                                                                     \
0080         = memory_based_2d_locator<memory_based_step_iterator<CS##B##_planar_ptr_t>>;               \
0081     using CS##B##c_planar_loc_t                                                                    \
0082         = memory_based_2d_locator<memory_based_step_iterator<CS##B##c_planar_ptr_t>>;              \
0083     using CS##B##_planar_step_loc_t                                                                \
0084         = memory_based_2d_locator<memory_based_step_iterator<CS##B##_planar_step_ptr_t>>;          \
0085     using CS##B##c_planar_step_loc_t                                                               \
0086         = memory_based_2d_locator<memory_based_step_iterator<CS##B##c_planar_step_ptr_t>>;         \
0087     using CS##B##_planar_view_t = image_view<CS##B##_planar_loc_t>;                                \
0088     using CS##B##c_planar_view_t = image_view<CS##B##c_planar_loc_t>;                              \
0089     using CS##B##_planar_step_view_t = image_view<CS##B##_planar_step_loc_t>;                      \
0090     using CS##B##c_planar_step_view_t = image_view<CS##B##c_planar_step_loc_t>;                    \
0091     using CS##B##_planar_image_t = image<CS##B##_pixel_t, true, std::allocator<unsigned char>>;
0092 
0093 #define BOOST_GIL_DEFINE_ALL_PMR_TYPEDEFS_INTERNAL(B, CM, CS, CS_FULL, LAYOUT)                     \
0094     BOOST_GIL_DEFINE_BASE_PMR_TYPEDEFS_INTERNAL(B, CM, CS, LAYOUT)                                 \
0095     namespace pmr {                                                                                \
0096     using CS##B##_planar_image_t                                                                   \
0097         = image<CS##B##_pixel_t, true, std::pmr::polymorphic_allocator<unsigned char>>;            \
0098     }
0099 
0100 #if defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
0101 #    define BOOST_GIL_DEFINE_BASE_TYPEDEFS(B, CM, CS)                                              \
0102         BOOST_GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(B, CM, CS, CS##_layout_t)
0103 
0104 #    define BOOST_GIL_DEFINE_ALL_TYPEDEFS(B, CM, CS)                                               \
0105         BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(B, CM, CS, CS##_t, CS##_layout_t)
0106 #else
0107 #    define BOOST_GIL_DEFINE_BASE_TYPEDEFS(B, CM, CS)                                              \
0108         BOOST_GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(B, CM, CS, CS##_layout_t)                          \
0109         BOOST_GIL_DEFINE_BASE_PMR_TYPEDEFS_INTERNAL(B, CM, CS, CS##_layout_t)
0110 
0111 #    define BOOST_GIL_DEFINE_ALL_TYPEDEFS(B, CM, CS)                                               \
0112         BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(B, CM, CS, CS##_t, CS##_layout_t)                   \
0113         BOOST_GIL_DEFINE_ALL_PMR_TYPEDEFS_INTERNAL(B, CM, CS, CS##_t, CS##_layout_t)
0114 #endif //!defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
0115 
0116 namespace boost { namespace gil {
0117 
0118 // forward declarations
0119 template <typename B, typename Mn, typename Mx> struct scoped_channel_value;
0120 template <typename T> struct float_point_zero;
0121 template <typename T> struct float_point_one;
0122 
0123 //////////////////////////////////////////////////////////////////////////////////////////
0124 ///  Built-in channel models
0125 //////////////////////////////////////////////////////////////////////////////////////////
0126 
0127 /// \ingroup ChannelModel
0128 /// \brief 8-bit unsigned integral channel type (alias from uint8_t). Models ChannelValueConcept
0129 using std::uint8_t;
0130 
0131 /// \ingroup ChannelModel
0132 /// \brief 16-bit unsigned integral channel type (alias from uint16_t). Models ChannelValueConcept
0133 using std::uint16_t;
0134 
0135 /// \ingroup ChannelModel
0136 /// \brief 32-bit unsigned integral channel type  (alias from uint32_t). Models ChannelValueConcept
0137 using std::uint32_t;
0138 
0139 /// \ingroup ChannelModel
0140 /// \brief 8-bit signed integral channel type (alias from int8_t). Models ChannelValueConcept
0141 using std::int8_t;
0142 
0143 /// \ingroup ChannelModel
0144 /// \brief 16-bit signed integral channel type (alias from int16_t). Models ChannelValueConcept
0145 using std::int16_t;
0146 
0147 /// \ingroup ChannelModel
0148 /// \brief 32-bit signed integral channel type (alias from int32_t). Models ChannelValueConcept
0149 using std::int32_t;
0150 
0151 /// \ingroup ChannelModel
0152 /// \brief 32-bit floating point channel type with range [0.0f ... 1.0f]. Models ChannelValueConcept
0153 using float32_t = scoped_channel_value<float, float_point_zero<float>, float_point_one<float>>;
0154 
0155 /// \ingroup ChannelModel
0156 /// \brief 64-bit floating point channel type with range [0.0f ... 1.0f]. Models ChannelValueConcept
0157 using float64_t = scoped_channel_value<double, float_point_zero<double>, float_point_one<double>>;
0158 
0159 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, gray)
0160 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, gray)
0161 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, gray)
0162 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, gray)
0163 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, gray)
0164 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, gray)
0165 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, gray)
0166 
0167 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, bgr)
0168 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, bgr)
0169 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, bgr)
0170 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, bgr)
0171 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, bgr)
0172 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, bgr)
0173 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, bgr)
0174 
0175 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, argb)
0176 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, argb)
0177 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, argb)
0178 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, argb)
0179 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, argb)
0180 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, argb)
0181 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, argb)
0182 
0183 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, abgr)
0184 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, abgr)
0185 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, abgr)
0186 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, abgr)
0187 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, abgr)
0188 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, abgr)
0189 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, abgr)
0190 
0191 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, bgra)
0192 BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, bgra)
0193 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, bgra)
0194 BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, bgra)
0195 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, bgra)
0196 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, bgra)
0197 BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, bgra)
0198 
0199 BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, rgb)
0200 BOOST_GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, rgb)
0201 BOOST_GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, rgb)
0202 BOOST_GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, rgb)
0203 BOOST_GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, rgb)
0204 BOOST_GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, rgb)
0205 BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, rgb)
0206 
0207 BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, rgba)
0208 BOOST_GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, rgba)
0209 BOOST_GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, rgba)
0210 BOOST_GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, rgba)
0211 BOOST_GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, rgba)
0212 BOOST_GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, rgba)
0213 BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, rgba)
0214 
0215 BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, cmyk)
0216 BOOST_GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, cmyk)
0217 BOOST_GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, cmyk)
0218 BOOST_GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, cmyk)
0219 BOOST_GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, cmyk)
0220 BOOST_GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, cmyk)
0221 BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, cmyk)
0222 
0223 template <int N> struct devicen_t;
0224 template <int N> struct devicen_layout_t;
0225 
0226 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, uint8_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
0227 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, int8_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
0228 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, uint16_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
0229 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s, int16_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
0230 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32, uint32_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
0231 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s, int32_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
0232 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f, float32_t, dev2n, devicen_t<2>, devicen_layout_t<2>)
0233 
0234 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, uint8_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
0235 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, int8_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
0236 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, uint16_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
0237 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s, int16_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
0238 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32, uint32_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
0239 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s, int32_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
0240 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f, float32_t, dev3n, devicen_t<3>, devicen_layout_t<3>)
0241 
0242 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, uint8_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
0243 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, int8_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
0244 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, uint16_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
0245 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s, int16_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
0246 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32, uint32_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
0247 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s, int32_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
0248 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f, float32_t, dev4n, devicen_t<4>, devicen_layout_t<4>)
0249 
0250 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8, uint8_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
0251 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(8s, int8_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
0252 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16, uint16_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
0253 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(16s, int16_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
0254 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32, uint32_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
0255 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32s, int32_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
0256 BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(32f, float32_t, dev5n, devicen_t<5>, devicen_layout_t<5>)
0257 
0258 }} // namespace boost::gil
0259 
0260 #endif