aboutsummaryrefslogtreecommitdiff
path: root/src/imgen.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2016-05-14 16:28:50 +0200
committerAdrian Kummerlaender2016-05-14 16:28:50 +0200
commit8e1d7c4e484ef43dddc5074055727694ceb0e37b (patch)
tree1fa2f85c723b37fd6c0a1ed81b1d488a9389bffd /src/imgen.h
parent0bc5575e0f744bfc3f5047e4a163cd1940864964 (diff)
downloadvoronoi-8e1d7c4e484ef43dddc5074055727694ceb0e37b.tar
voronoi-8e1d7c4e484ef43dddc5074055727694ceb0e37b.tar.gz
voronoi-8e1d7c4e484ef43dddc5074055727694ceb0e37b.tar.bz2
voronoi-8e1d7c4e484ef43dddc5074055727694ceb0e37b.tar.lz
voronoi-8e1d7c4e484ef43dddc5074055727694ceb0e37b.tar.xz
voronoi-8e1d7c4e484ef43dddc5074055727694ceb0e37b.tar.zst
voronoi-8e1d7c4e484ef43dddc5074055727694ceb0e37b.zip
Extract stream management into `ppm_pixel_stream`, provide Cartesian coordinates
Diffstat (limited to 'src/imgen.h')
-rw-r--r--src/imgen.h22
1 files changed, 18 insertions, 4 deletions
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 <string>
#include <utility>
+#include <fstream>
#include <functional>
namespace imgen {
using color = std::tuple<std::uint8_t, std::uint8_t, std::uint8_t>;
+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<color(std::size_t, std::size_t)> generator
+ const std::string& path,
+ const std::size_t sizeX,
+ const std::size_t sizeY,
+ std::function<color(std::ptrdiff_t, std::ptrdiff_t)> generator
);
}