• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2013 Christian Henning
3 // Copyright 2020 Mateusz Loskot <mateusz at loskot dot net>
4 //
5 // Distributed under the Boost Software License, Version 1.0
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
8 //
9 #include <boost/gil.hpp>
10 #include <boost/gil/extension/toolbox/color_spaces/gray_alpha.hpp>
11 
12 #include <boost/core/lightweight_test.hpp>
13 
14 #include "test_utility_output_stream.hpp"
15 
16 namespace gil = boost::gil;
17 
test_gray_alpha_to_gray()18 void test_gray_alpha_to_gray()
19 {
20     gil::gray_alpha8_pixel_t a(10, 20);
21     gil::gray8_pixel_t b;
22     gil::color_convert(a, b);
23     BOOST_TEST_EQ(b, gil::gray8_pixel_t(1));
24 }
25 
test_gray_alpha_to_rgb()26 void test_gray_alpha_to_rgb()
27 {
28     gil::gray_alpha8_pixel_t a(10, 20);
29     gil::rgb8_pixel_t b;
30     gil::color_convert(a, b);
31     BOOST_TEST_EQ(b, gil::rgb8_pixel_t(1, 1, 1));
32 }
33 
test_gray_alpha_to_rgba()34 void test_gray_alpha_to_rgba()
35 {
36     gil::gray_alpha8_pixel_t a(10, 20);
37     gil::rgba8_pixel_t b;
38     gil::color_convert(a, b);
39     BOOST_TEST_EQ(b, gil::rgba8_pixel_t(10, 10, 10, 20));
40 }
41 
main()42 int main()
43 {
44     test_gray_alpha_to_gray();
45     test_gray_alpha_to_rgb();
46     test_gray_alpha_to_rgba();
47 
48     return boost::report_errors();
49 }
50