]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/gil/test/extension/dynamic_image/test_fixture.hpp
import quincy beta 17.1.0
[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>
92f5a8d4
TL
10
11#include <tuple>
12
13namespace boost { namespace gil {
14
15namespace test { namespace fixture {
16
17using dynamic_image = gil::any_image
18<
20effc67
TL
19 gil::gray8_image_t,
20 gil::gray16_image_t,
21 gil::gray32_image_t,
22 gil::bgr8_image_t,
23 gil::bgr16_image_t,
24 gil::bgr32_image_t,
25 gil::rgb8_image_t,
26 gil::rgb16_image_t,
27 gil::rgb32_image_t,
28 gil::rgba8_image_t,
29 gil::rgba16_image_t,
30 gil::rgba32_image_t
92f5a8d4
TL
31>;
32
33template <typename Image>
34struct fill_any_view
35{
36 using result_type = void;
37 using pixel_t = typename Image::value_type;
38
39 fill_any_view(std::initializer_list<int> dst_view_indices, pixel_t pixel_value)
40 : dst_view_indices_(dst_view_indices), pixel_value_(pixel_value)
41 {}
42
43 template <typename View>
44 void operator()(View& /*dst_view*/) { /* sink any other views here */ }
45
46 void operator()(typename Image::view_t& dst_view)
47 {
48 // sink view of interest here
49 for (auto const& i : dst_view_indices_)
50 dst_view[i] = pixel_value_;
51 }
52
53 std::initializer_list<int> dst_view_indices_;
54 pixel_t pixel_value_;
55};
56
57}}}} // namespace boost::gil::test::fixture