#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)); } } } }