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_CMP_VIEW_HPP
9 #define BOOST_GIL_IO_TEST_CMP_VIEW_HPP
11 #include <boost/gil.hpp>
13 template< typename View_1, typename View_2 >
14 void cmp_view( const View_1& v1
18 if( v1.dimensions() != v2.dimensions() )
20 throw std::runtime_error( "Images are not equal." );
23 typename View_1::x_coord_t width = v1.width();
24 typename View_1::y_coord_t height = v1.height();
26 for( typename View_1::y_coord_t y = 0; y < height; ++y )
28 const typename View_1::x_iterator src_it = v1.row_begin( y );
29 const typename View_2::x_iterator dst_it = v2.row_begin( y );
31 for( typename View_1::x_coord_t x = 0; x < width; ++x )
33 if( *src_it != *dst_it )
35 throw std::runtime_error( "Images are not equal." );