From 8db9e4cfba7de89b5492203ed1b225297be47f68 Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Sun, 22 Jan 2023 15:34:25 -0600 Subject: init --- test.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test.cpp (limited to 'test.cpp') 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 +#include +#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)); + } + } + } +} -- cgit v1.2.3