diff --git a/ImageStreams/main.cpp b/ImageStreams/main.cpp index bd28338..ab2a082 100644 --- a/ImageStreams/main.cpp +++ b/ImageStreams/main.cpp @@ -57,6 +57,27 @@ void test3(std::string filename){ image << typename ImageType::pixel(nice_rand()); } +template +void test4(std::string filename){ + size_t width = 1024; + size_t height = 768; + + std::vector r1(width, 0); + std::vector r2(width, 0); + + r1[width/2] = 1; + + ImageType image(width, height, filename); + for(int y = 0; y < height; ++y){ + for(auto x : r1) image << typename ImageType::pixel((double)x); + + r1.swap(r2); + for(int x = 1; x < width-1; ++x){ + r1[x] = (r2[x-1] || r2[x] || r2[x+1]) && !(r2[x-1] && r2[x] && r2[x+1]); + } + } +} + int main(int argc, const char * argv[]){ test>("test.png"); test>("test.bmp"); @@ -66,5 +87,8 @@ int main(int argc, const char * argv[]){ test3>("test_3.png"); test3>("test_3.bmp"); + + test4>("test_4.png"); + test4>("test_4.bmp"); }