subimage_test.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // Copyright 2013 Christian Henning
  3. //
  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
  7. //
  8. #ifndef BOOST_GIL_IO_TEST_SUBIMAGE_TEST_HPP
  9. #define BOOST_GIL_IO_TEST_SUBIMAGE_TEST_HPP
  10. #include <boost/gil.hpp>
  11. using namespace std;
  12. using namespace boost;
  13. using namespace gil;
  14. template< typename Image
  15. , typename Format
  16. >
  17. void run_subimage_test( string filename
  18. , const point_t& top_left
  19. , const point_t& dimension
  20. )
  21. {
  22. Image original, subimage;
  23. read_image( filename
  24. , original
  25. , Format()
  26. );
  27. image_read_settings< Format > settings( top_left
  28. , dimension
  29. );
  30. read_image( filename
  31. , subimage
  32. , settings
  33. );
  34. BOOST_CHECK( equal_pixels( const_view( subimage )
  35. , subimage_view( const_view( original )
  36. , top_left
  37. , dimension
  38. )
  39. )
  40. );
  41. }
  42. #endif // BOOST_GIL_IO_TEST_SUBIMAGE_TEST_HPP