]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/gil/test/extension/dynamic_image/test_fixture.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / gil / test / extension / dynamic_image / test_fixture.hpp
CommitLineData
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
14namespace boost { namespace gil {
15
16namespace test { namespace fixture {
17
18using 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
37template <typename Image>
38struct 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