#ifndef IMAGE_H
#define IMAGE_H


#include <stdint.h>


class Image
{
public:
  Image();
  Image(const char* a_fileName);
  Image(int width, int height, int bytesPerPixel);
  ~Image();

  int width()                  { return m_width; }
  int height()                 { return m_height; }
  uint32_t pixel(int x, int y) { return m_scanLines[y][x]; }

  bool save(const char* a_fileName);

private:
  void init(int width, int height, int bytesPerPixel);
  bool initFromPng(FILE* a_file);
  bool initFromJpg(FILE* a_file);
  bool saveToPng(FILE* a_file);
  bool saveToJpg(FILE* a_file);
  int m_width;
  int m_height;
  int m_bytesPerPixel;
  uint32_t** m_scanLines;
};


#endif // IMAGE_H

