#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
