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_SCANLINE_READ_TEST_HPP
9 #define BOOST_GIL_IO_TEST_SCANLINE_READ_TEST_HPP
11 #include <boost/gil.hpp>
13 #include "cmp_view.hpp"
15 template< typename Image
18 void test_scanline_reader( const char* file_name )
20 using namespace boost::gil;
22 // read image using scanline_read_iterator
23 using reader_t = scanline_reader
25 typename get_read_device<char const*, FormatTag>::type,
29 reader_t reader = make_scanline_reader( file_name, FormatTag() );
31 Image dst( reader._info._width, reader._info._height );
33 using iterator_t = typename reader_t::iterator_t;
35 iterator_t it = reader.begin();
36 iterator_t end = reader.end();
38 for( int row = 0; it != end; ++it, ++row )
40 copy_pixels( interleaved_view( reader._info._width
42 , ( typename Image::view_t::x_iterator ) *it
43 , reader._scanline_length
45 , subimage_view( view( dst )
56 read_image( file_name, img, FormatTag() );
58 cmp_view( view( dst ), view( img ) );
61 #endif // BOOST_GIL_IO_TEST_SCANLINE_READ_TEST_HPP