]>
Commit | Line | Data |
---|---|---|
92f5a8d4 TL |
1 | // |
2 | // Copyright 2013 Christian Henning | |
3 | // Copyright 2013 Davide Anastasia <davideanastasia@users.sourceforge.net> | |
f67539c2 | 4 | // Copyright 2020 Mateusz Loskot <mateusz at loskot dot net> |
92f5a8d4 TL |
5 | // |
6 | // Distributed under the Boost Software License, Version 1.0 | |
7 | // See accompanying file LICENSE_1_0.txt or copy at | |
8 | // http://www.boost.org/LICENSE_1_0.txt | |
9 | // | |
10 | #include <boost/gil.hpp> | |
11 | #include <boost/gil/extension/toolbox/color_converters/rgb_to_luminance.hpp> | |
12 | ||
f67539c2 | 13 | #include <boost/core/lightweight_test.hpp> |
92f5a8d4 | 14 | |
f67539c2 TL |
15 | #include "test_utility_output_stream.hpp" |
16 | ||
17 | namespace gil = boost::gil; | |
92f5a8d4 TL |
18 | |
19 | struct double_zero { static double apply() { return 0.0; } }; | |
20 | struct double_one { static double apply() { return 1.0; } }; | |
21 | ||
f67539c2 TL |
22 | using gray64f_pixel_t = gil::pixel<double, gil::gray_layout_t>; |
23 | using rgb64f_pixel_t = gil::pixel<double, gil::rgb_layout_t>; | |
92f5a8d4 | 24 | |
f67539c2 | 25 | void test_rgb_to_luminance() |
92f5a8d4 | 26 | { |
f67539c2 | 27 | rgb64f_pixel_t a(10, 20, 30); |
92f5a8d4 | 28 | gray64f_pixel_t b; |
f67539c2 TL |
29 | gil::color_convert(a, b); |
30 | BOOST_TEST_EQ(b, b); | |
92f5a8d4 TL |
31 | } |
32 | ||
f67539c2 TL |
33 | int main() |
34 | { | |
35 | test_rgb_to_luminance(); | |
36 | ||
37 | return ::boost::report_errors(); | |
38 | } |