// // Tonemapper.hpp // AwesomeAttractorND // // Created by Joshua Moerman on 10/28/11. // Copyright 2011 Vadovas. All rights reserved. // #ifndef AwesomeAttractorND_Tonemapper_hpp #define AwesomeAttractorND_Tonemapper_hpp #include namespace Tonemappers { class Normalizer2D { unsigned int max; template void analyse(C const & canvas){ max = *std::max_element(canvas.cbegin(), canvas.cend()); } template void process(C const & canvas, I & image){ for (size_t x = 0; x < canvas.get_size(0); ++x) { for (size_t y = 0; y < canvas.get_size(1); ++y) { const double grayscale = (double) canvas[x][y] / (double) max; image << I::pixel(grayscale, grayscale, grayscale); } } } }; } #endif