From 8db9e4cfba7de89b5492203ed1b225297be47f68 Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Sun, 22 Jan 2023 15:34:25 -0600 Subject: init --- libpng_wrapper.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 libpng_wrapper.hpp (limited to 'libpng_wrapper.hpp') diff --git a/libpng_wrapper.hpp b/libpng_wrapper.hpp new file mode 100644 index 0000000..cf95dff --- /dev/null +++ b/libpng_wrapper.hpp @@ -0,0 +1,42 @@ +#ifndef PNGWRAP_H +#define PNGWRAP_H + +#include +#include +#include + +#define PNG_FILE_ERROR 0 +#define PNG_LIBPNG_ERROR 1 + +struct rgb { + png_byte r; + png_byte g; + png_byte b; +}; + + +class png { + protected: + const int DEFAULT_BIT_DEPTH = 8; + const int DEFAULT_COLOR_TYPE = PNG_COLOR_TYPE_RGB; + const bool DEFAULT_INTERLACE = false; + const int DEFAULT_TRANSFORMS = PNG_TRANSFORM_IDENTITY; + FILE *output_fp; + png_structp png_ptr; + png_infop png_info_ptr; + png_byte **row_pointers; + + public: + //the user doesn't have a lot of control over png output settings. + //Will expand class to allow so if it's found nessesary. + ~png(); + png(std::string filename, uint32_t width, uint32_t height); + void save(); + + void set_pixel(uint32_t x, uint32_t y, png_byte r, png_byte g, png_byte b); + + uint32_t width(); + uint32_t height(); +}; + +#endif -- cgit v1.2.3