1 // 2 // Copyright 2005-2007 Adobe Systems Incorporated 3 // 4 // Distributed under the Boost Software License, Version 1.0 5 // See accompanying file LICENSE_1_0.txt or copy at 6 // http://www.boost.org/LICENSE_1_0.txt 7 // 8 #ifndef BOOST_GIL_CONCEPTS_PIXEL_BASED_HPP 9 #define BOOST_GIL_CONCEPTS_PIXEL_BASED_HPP 10 11 #include <boost/gil/concepts/basic.hpp> 12 #include <boost/gil/concepts/channel.hpp> 13 #include <boost/gil/concepts/color.hpp> 14 #include <boost/gil/concepts/concept_check.hpp> 15 #include <boost/gil/concepts/fwd.hpp> 16 17 #include <cstddef> 18 19 #if defined(BOOST_CLANG) 20 #pragma clang diagnostic push 21 #pragma clang diagnostic ignored "-Wunknown-pragmas" 22 #pragma clang diagnostic ignored "-Wunused-local-typedefs" 23 #endif 24 25 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 26 #pragma GCC diagnostic push 27 #pragma GCC diagnostic ignored "-Wunused-local-typedefs" 28 #endif 29 30 namespace boost { namespace gil { 31 32 /// \ingroup PixelBasedConcept 33 /// \brief Concept for all pixel-based GIL constructs. 34 /// 35 /// Pixel-based constructs include pixels, iterators, locators, views and 36 /// images whose value type is a pixel. 37 /// 38 /// \code 39 /// concept PixelBasedConcept<typename T> 40 /// { 41 /// typename color_space_type<T>; 42 /// where Metafunction<color_space_type<T> >; 43 /// where ColorSpaceConcept<color_space_type<T>::type>; 44 /// typename channel_mapping_type<T>; 45 /// where Metafunction<channel_mapping_type<T> >; 46 /// where ChannelMappingConcept<channel_mapping_type<T>::type>; 47 /// typename is_planar<T>; 48 /// where Metafunction<is_planar<T> >; 49 /// where SameType<is_planar<T>::type, bool>; 50 /// }; 51 /// \endcode 52 template <typename P> 53 struct PixelBasedConcept 54 { constraintsboost::gil::PixelBasedConcept55 void constraints() 56 { 57 using color_space_t = typename color_space_type<P>::type; 58 gil_function_requires<ColorSpaceConcept<color_space_t>>(); 59 60 using channel_mapping_t = typename channel_mapping_type<P>::type ; 61 gil_function_requires<ChannelMappingConcept<channel_mapping_t>>(); 62 63 static const bool planar = is_planar<P>::value; 64 ignore_unused_variable_warning(planar); 65 66 // This is not part of the concept, but should still work 67 static const std::size_t nc = num_channels<P>::value; 68 ignore_unused_variable_warning(nc); 69 } 70 }; 71 72 /// \brief Concept for homogeneous pixel-based GIL constructs 73 /// \ingroup PixelBasedConcept 74 /// \code 75 /// concept HomogeneousPixelBasedConcept<PixelBasedConcept T> 76 /// { 77 /// typename channel_type<T>; 78 /// where Metafunction<channel_type<T>>; 79 /// where ChannelConcept<channel_type<T>::type>; 80 /// }; 81 /// \endcode 82 template <typename P> 83 struct HomogeneousPixelBasedConcept 84 { constraintsboost::gil::HomogeneousPixelBasedConcept85 void constraints() 86 { 87 gil_function_requires<PixelBasedConcept<P>>(); 88 89 using channel_t = typename channel_type<P>::type; 90 gil_function_requires<ChannelConcept<channel_t>>(); 91 } 92 }; 93 94 }} // namespace boost::gil 95 96 #if defined(BOOST_CLANG) 97 #pragma clang diagnostic pop 98 #endif 99 100 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900) 101 #pragma GCC diagnostic pop 102 #endif 103 104 #endif 105