]>
Commit | Line | Data |
---|---|---|
92f5a8d4 TL |
1 | // |
2 | // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net> | |
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 | #include <boost/gil.hpp> | |
9 | #include <boost/gil/extension/dynamic_image/any_image.hpp> | |
10 | #include <boost/mp11.hpp> | |
11 | ||
12 | #include <tuple> | |
13 | ||
14 | namespace boost { namespace gil { | |
15 | ||
16 | namespace test { namespace fixture { | |
17 | ||
18 | using dynamic_image = gil::any_image | |
19 | < | |
20 | boost::mp11::mp_list | |
21 | < | |
22 | gil::gray8_image_t, | |
23 | gil::gray16_image_t, | |
24 | gil::gray32_image_t, | |
25 | gil::bgr8_image_t, | |
26 | gil::bgr16_image_t, | |
27 | gil::bgr32_image_t, | |
28 | gil::rgb8_image_t, | |
29 | gil::rgb16_image_t, | |
30 | gil::rgb32_image_t, | |
31 | gil::rgba8_image_t, | |
32 | gil::rgba16_image_t, | |
33 | gil::rgba32_image_t | |
34 | > | |
35 | >; | |
36 | ||
37 | template <typename Image> | |
38 | struct fill_any_view | |
39 | { | |
40 | using result_type = void; | |
41 | using pixel_t = typename Image::value_type; | |
42 | ||
43 | fill_any_view(std::initializer_list<int> dst_view_indices, pixel_t pixel_value) | |
44 | : dst_view_indices_(dst_view_indices), pixel_value_(pixel_value) | |
45 | {} | |
46 | ||
47 | template <typename View> | |
48 | void operator()(View& /*dst_view*/) { /* sink any other views here */ } | |
49 | ||
50 | void operator()(typename Image::view_t& dst_view) | |
51 | { | |
52 | // sink view of interest here | |
53 | for (auto const& i : dst_view_indices_) | |
54 | dst_view[i] = pixel_value_; | |
55 | } | |
56 | ||
57 | std::initializer_list<int> dst_view_indices_; | |
58 | pixel_t pixel_value_; | |
59 | }; | |
60 | ||
61 | }}}} // namespace boost::gil::test::fixture |