summaryrefslogtreecommitdiff
path: root/libpng_wrapper.hpp
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@bpcspace.com>2023-01-22 15:34:25 -0600
committerBrett Weiland <brett_weiland@bpcspace.com>2023-01-22 15:34:25 -0600
commit8db9e4cfba7de89b5492203ed1b225297be47f68 (patch)
tree4e21e076bbaabf7b0b37d54e0c9c2eefd8409d5f /libpng_wrapper.hpp
init
Diffstat (limited to 'libpng_wrapper.hpp')
-rw-r--r--libpng_wrapper.hpp42
1 files changed, 42 insertions, 0 deletions
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 <string>
+#include <array>
+#include <png.h>
+
+#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