#ifndef _DNG_H_
#define _DNG_H_


/*
  Example usage of the class:
  ---------------------------

  DNG * dng = new DNG();
  dng->setFile((char *)"test.dng");
  dng->setWidth(640);
  dng->setHeight(480);
  dng->setColorID(DNG_COLORID_RGB);
  uint8_t * data = (uint8_t *)malloc(dng->getWidth() * dng->getHeight() * 3);
  memset(data, 0, dng->getWidth() * dng->getHeight() * 3);
  for(int y = 0; y < dng->getHeight()/3; y++) {
    for(int x = 0; x < dng->getWidth(); x++) {
      data[y*dng->getWidth()*3 + x*3 + 0] = 0xff;
    }
  }
  for(int y = dng->getHeight()/3; y < 2*dng->getHeight()/3; y++) {
    for(int x = 0; x < dng->getWidth(); x++) {
      data[y*dng->getWidth()*3 + x*3 + 1] = 0xff;
    }
  }
  for(int y = 2*dng->getHeight()/3; y < 3*dng->getHeight()/3; y++) {
    for(int x = 0; x < dng->getWidth(); x++) {
      data[y*dng->getWidth()*3 + x*3 + 2] = 0xff;
    }
  }
  dng->writeFile(data);
  delete dng;
*/

#include <tiffio.h>

enum {
  DNG_COLORID_RGB = 100,
  DNG_COLORID_RAW16 = 101,
  DNG_COLORID_RAW8 = 102
};

class DNG {

 private:
  TIFF * tif;
  int ImageWidth;
  int ImageHeight;
  int BitsPerSample;
  int SamplesPerPixel;
  int ColorID;
  int IsBigEndian(void);
  
 public:
  DNG();
  ~DNG();

  int setWidth(int);
  int setHeight(int);
  int getWidth(void);
  int getHeight(void);
  void setColorID(int);
  int setFile(char *);
  int writeFile(void *);

};

#endif
