8 #ifndef BOOST_GIL_IO_DYNAMIC_IO_NEW_HPP 9 #define BOOST_GIL_IO_DYNAMIC_IO_NEW_HPP 11 #include <boost/gil/extension/dynamic_image/dynamic_image_all.hpp> 13 #include <boost/gil/detail/mp11.hpp> 14 #include <boost/gil/io/error.hpp> 16 #include <type_traits> 18 namespace boost {
namespace gil {
23 struct construct_matched_t
25 template <
typename Images,
typename Pred>
26 static bool apply(any_image<Images>& img, Pred pred)
28 if (pred.template apply<mp11::mp_at_c<Images, N-1>>())
30 using image_t = mp11::mp_at_c<Images, N-1>;
36 return construct_matched_t<N-1>::apply(img, pred);
40 struct construct_matched_t<0>
42 template <
typename Images,
typename Pred>
43 static bool apply(any_image<Images>&,Pred) {
return false; }
49 template <
typename IsSupported,
typename OpClass>
50 class dynamic_io_fnobj
55 template <
typename View>
56 void apply(View
const&
view, std::true_type) { _op->apply(
view); }
58 template <
typename View,
typename Info>
59 void apply(View
const&
view, Info
const & info,
const std::true_type) { _op->apply(
view, info); }
61 template <
typename View>
62 void apply(View
const& , std::false_type)
64 io_error(
"dynamic_io: unsupported view type for the given file format");
67 template <
typename View,
typename Info >
68 void apply(View
const& , Info
const& ,
const std::false_type)
70 io_error(
"dynamic_io: unsupported view type for the given file format");
74 dynamic_io_fnobj(OpClass* op) : _op(op) {}
76 using result_type = void;
78 template <
typename View>
79 void operator()(View
const&
view)
81 apply(
view,
typename IsSupported::template apply<View>::type());
84 template<
typename View,
typename Info >
85 void operator()(View
const&
view, Info
const& info)
87 apply(
view, info,
typename IsSupported::template apply<View>::type());
95 template <
typename Images,
typename Pred>
96 inline bool construct_matched(any_image<Images>& img, Pred pred)
98 constexpr
auto size = mp11::mp_size<Images>::value;
99 return detail::construct_matched_t<size>::apply(img, pred);
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:535