diff options
author | Brett Weiland <brett_weiland@bpcspace.com> | 2023-01-22 15:34:25 -0600 |
---|---|---|
committer | Brett Weiland <brett_weiland@bpcspace.com> | 2023-01-22 15:34:25 -0600 |
commit | 8db9e4cfba7de89b5492203ed1b225297be47f68 (patch) | |
tree | 4e21e076bbaabf7b0b37d54e0c9c2eefd8409d5f /test.cpp |
init
Diffstat (limited to 'test.cpp')
-rw-r--r-- | test.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test.cpp b/test.cpp new file mode 100644 index 0000000..bc2366c --- /dev/null +++ b/test.cpp @@ -0,0 +1,35 @@ +#include <iostream> +#include <string> +#include "libpng_wrapper.hpp" +using namespace std; + +void test_png() { + png test_image("test_png.png", 500, 500); + uint32_t w = test_image.width(); + uint32_t h = test_image.height(); + + uint32_t square_w = w / 2; + uint32_t square_h = h / 2; + uint32_t square_x = square_w; + uint32_t square_y = square_h; + + for(uint32_t y = 0; y < h; y++) { + for(uint32_t x = 0; x < w; x++) { + if((x < (w / 2)) && (y < (h / 2))) { + test_image.set_pixel(x, y, 255, 0, 0); + } + else if((x > (w / 2)) && (y < (h / 2))) { + test_image.set_pixel(x, y, 0, 255, 0); + } + else if((x < (w / 2)) && (y > (h / 2))) { + test_image.set_pixel(x, y, 0, 0, 255); + } + else if((x > (w / 2)) && (y > (h / 2))) { + test_image.set_pixel(x, y, + (255 / square_w) * (x - square_x), + (255 / square_h) * (y - square_y), + (255 / square_w) * (square_x - x)); + } + } + } +} |