diff options
author | Keuin <[email protected]> | 2022-04-11 12:07:58 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-04-11 12:08:11 +0800 |
commit | a15c8f6b3658095eb50da4bd75da697e37dbe033 (patch) | |
tree | ef4ec60e5c80b3c9031d60fe7caff52b331eb3e8 /main_image_output.cpp | |
parent | cdb0bdfc60481708ab1a9707c0e1e4458e6396bf (diff) |
Implement bitmap and PPM serialization (with a demo program).
Diffstat (limited to 'main_image_output.cpp')
-rw-r--r-- | main_image_output.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/main_image_output.cpp b/main_image_output.cpp new file mode 100644 index 0000000..10301da --- /dev/null +++ b/main_image_output.cpp @@ -0,0 +1,20 @@ +// +// Created by Keuin on 2022/4/11. +// + +#include <iostream> +#include "bitmap.h" + +// write a test .PPM image +int main() { + bitmap8b image{256, 256}; + pixel8b p{}; + for (int x = 0; x < 256; ++x) { + for (int y = 0; y < 256; ++y) { + p.r = x; + p.b = y; + image.set(x, y, p); + } + } + image.write_plain_ppm(std::cout); +}
\ No newline at end of file |