File indexing completed on 2025-01-18 09:36:55
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_GIL_CONCEPTS_IMAGE_HPP
0009 #define BOOST_GIL_CONCEPTS_IMAGE_HPP
0010
0011 #include <boost/gil/concepts/basic.hpp>
0012 #include <boost/gil/concepts/concept_check.hpp>
0013 #include <boost/gil/concepts/fwd.hpp>
0014 #include <boost/gil/concepts/image_view.hpp>
0015 #include <boost/gil/concepts/point.hpp>
0016 #include <boost/gil/detail/mp11.hpp>
0017
0018 #include <type_traits>
0019
0020 #if defined(BOOST_CLANG)
0021 #pragma clang diagnostic push
0022 #pragma clang diagnostic ignored "-Wunknown-pragmas"
0023 #pragma clang diagnostic ignored "-Wunused-local-typedefs"
0024 #endif
0025
0026 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
0027 #pragma GCC diagnostic push
0028 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
0029 #endif
0030
0031 namespace boost { namespace gil {
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056 template <typename Image>
0057 struct RandomAccessNDImageConcept
0058 {
0059 void constraints()
0060 {
0061 gil_function_requires<Regular<Image>>();
0062
0063 using view_t = typename Image::view_t;
0064 gil_function_requires<MutableRandomAccessNDImageViewConcept<view_t>>();
0065
0066 using const_view_t = typename Image::const_view_t;
0067 using pixel_t = typename Image::value_type;
0068 using point_t = typename Image::point_t;
0069 gil_function_requires<PointNDConcept<point_t>>();
0070
0071 const_view_t cv = const_view(image);
0072 ignore_unused_variable_warning(cv);
0073 view_t v = view(image);
0074 ignore_unused_variable_warning(v);
0075
0076 pixel_t fill_value;
0077 point_t pt = image.dimensions();
0078 Image image1(pt);
0079 Image image2(pt, 1);
0080 Image image3(pt, fill_value, 1);
0081 image.recreate(pt);
0082 image.recreate(pt, 1);
0083 image.recreate(pt, fill_value, 1);
0084 }
0085 Image image;
0086 };
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108 template <typename Image>
0109 struct RandomAccess2DImageConcept
0110 {
0111 void constraints()
0112 {
0113 gil_function_requires<RandomAccessNDImageConcept<Image>>();
0114 using x_coord_t = typename Image::x_coord_t;
0115 using y_coord_t = typename Image::y_coord_t;
0116 using value_t = typename Image::value_type;
0117
0118 gil_function_requires<MutableRandomAccess2DImageViewConcept<typename Image::view_t>>();
0119
0120 x_coord_t w=image.width();
0121 y_coord_t h=image.height();
0122 value_t fill_value;
0123 Image im1(w,h);
0124 Image im2(w,h,1);
0125 Image im3(w,h,fill_value,1);
0126 image.recreate(w,h);
0127 image.recreate(w,h,1);
0128 image.recreate(w,h,fill_value,1);
0129 }
0130 Image image;
0131 };
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143 template <typename Image>
0144 struct ImageConcept
0145 {
0146 void constraints()
0147 {
0148 gil_function_requires<RandomAccess2DImageConcept<Image>>();
0149 gil_function_requires<MutableImageViewConcept<typename Image::view_t>>();
0150 using coord_t = typename Image::coord_t;
0151 static_assert(num_channels<Image>::value == mp11::mp_size<typename color_space_type<Image>::type>::value, "");
0152
0153 static_assert(std::is_same<coord_t, typename Image::x_coord_t>::value, "");
0154 static_assert(std::is_same<coord_t, typename Image::y_coord_t>::value, "");
0155 }
0156 Image image;
0157 };
0158
0159 }}
0160
0161 #if defined(BOOST_CLANG)
0162 #pragma clang diagnostic pop
0163 #endif
0164
0165 #if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
0166 #pragma GCC diagnostic pop
0167 #endif
0168
0169 #endif