From 8e1d7c4e484ef43dddc5074055727694ceb0e37b Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 14 May 2016 16:28:50 +0200 Subject: Extract stream management into `ppm_pixel_stream`, provide Cartesian coordinates --- src/imgen.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/imgen.h') diff --git a/src/imgen.h b/src/imgen.h index 5ddbaf6..35b798d 100644 --- a/src/imgen.h +++ b/src/imgen.h @@ -1,16 +1,30 @@ #include #include +#include #include namespace imgen { using color = std::tuple; +class ppm_pixel_stream { + public: + ppm_pixel_stream(const std::string& path, + const std::size_t width, + const std::size_t height); + + ppm_pixel_stream& operator<<(const color& value); + + private: + std::ofstream stream_; + +}; + void write_ppm( - const std::string& path, - const std::size_t sizeX, - const std::size_t sizeY, - std::function generator + const std::string& path, + const std::size_t sizeX, + const std::size_t sizeY, + std::function generator ); } -- cgit v1.2.3