2 // Copyright 2013 Christian Henning
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
8 #ifndef BOOST_GIL_IO_TEST_COLOR_SPACE_WRITE_TEST_HPP
9 #define BOOST_GIL_IO_TEST_COLOR_SPACE_WRITE_TEST_HPP
11 #include <boost/gil.hpp>
13 #ifndef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
14 #include <boost/core/ignore_unused.hpp>
18 #include "cmp_view.hpp"
20 template< typename Tag >
21 void color_space_write_test( const std::string& file_name_1
22 , const std::string& file_name_2
25 using namespace boost::gil;
27 rgb8_image_t rgb( 320, 200 );
28 bgr8_image_t bgr( 320, 200 );
30 fill_pixels( view(rgb), rgb8_pixel_t( 0, 0, 255 ));
31 fill_pixels( view(bgr), bgr8_pixel_t(255, 0, 0 ));
33 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
34 write_view( file_name_1, view( rgb ), Tag() );
35 write_view( file_name_2, view( bgr ), Tag() );
36 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
38 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
42 read_image( file_name_1, rgb_1, Tag() );
43 read_image( file_name_2, rgb_2, Tag() );
45 cmp_view( view( rgb_1 ), view( rgb_2 ));
46 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
48 #ifndef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
49 boost::ignore_unused(file_name_1);
50 boost::ignore_unused(file_name_2);