• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2013 Christian Henning
3 // Copyright 2013 Davide Anastasia <davideanastasia@users.sourceforge.net>
4 // Copyright 2020 Mateusz Loskot <mateusz at loskot dot net>
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 
13 #include <boost/core/lightweight_test.hpp>
14 
15 #include "test_utility_output_stream.hpp"
16 
17 namespace gil = boost::gil;
18 
applydouble_zero19 struct double_zero { static double apply() { return 0.0; } };
applydouble_one20 struct double_one  { static double apply() { return 1.0; } };
21 
22 using gray64f_pixel_t = gil::pixel<double, gil::gray_layout_t>;
23 using rgb64f_pixel_t = gil::pixel<double, gil::rgb_layout_t>;
24 
test_rgb_to_luminance()25 void test_rgb_to_luminance()
26 {
27     rgb64f_pixel_t a(10, 20, 30);
28     gray64f_pixel_t b;
29     gil::color_convert(a, b);
30     BOOST_TEST_EQ(b, b);
31 }
32 
main()33 int main()
34 {
35     test_rgb_to_luminance();
36 
37     return ::boost::report_errors();
38 }
39