/*------------------------------------------------------------------------------
 src/plugin/djImageIoTiff/base.cxx
 
 Copyright (c) 2004-2006 Darby Johnston.
 All rights reserved.
 Use is subject to license terms.
------------------------------------------------------------------------------*/

//#define DJ_DBG
#include "base.h"

namespace djImageIoTiff {

Header::Header() :
  width(0), height(0),
  photometric(0), samples(0), sampleDepth(0), sampleFormat(0),
  extraSamples(0), extraSamplesSize(0),
  orient(0), compress(0), channels(0)
{
  colormap[0] = 0;
  colormap[1] = 0;
  colormap[2] = 0;
}

#ifdef DJ_DBG

static Str _orientDbg(int in)
{
  switch (in) {
    case ORIENTATION_TOPLEFT: return Str("top left");
    case ORIENTATION_TOPRIGHT: return Str("top right");
    case ORIENTATION_BOTRIGHT: return Str("bottom right");
    case ORIENTATION_BOTLEFT: return Str("bottom left");
    case ORIENTATION_LEFTTOP: return Str("left top");
    case ORIENTATION_RIGHTTOP: return Str("right top");
    case ORIENTATION_RIGHTBOT: return Str("right bottom");
    case ORIENTATION_LEFTBOT: return Str("left bottom");
  }
  return Str();
}

static Str _compressDbg(int in)
{
  switch (in) {
    case COMPRESSION_NONE: return Str("none");
    case COMPRESSION_LZW: return Str("lzw");
    case COMPRESSION_PACKBITS: return Str("pack bits");
  }
  return Str();
}

static Str _channelsDbg(int in)
{
  switch (in) {
    case PLANARCONFIG_CONTIG: return Str("contiguous");
    case PLANARCONFIG_SEPARATE: return Str("seperate");
  }
  return Str();
}

#endif

void dbg(const Header & in)
{
  DJ_DBG_FNC("djImageIoTiff::Header");
  DJ_DBG_PRN("size = " << int(in.width) << " " << int(in.height));
  DJ_DBG_PRN("photometric = " << int(in.photometric));
  DJ_DBG_PRN("samples = " << int(in.samples));
  DJ_DBG_PRN("sample depth = " << int(in.sampleDepth));
  DJ_DBG_PRN("sample format = " << int(in.sampleFormat));
  DJ_DBG_PRN("extra samples = " << int(in.extraSamplesSize));
  DJ_DBG_PRN("orient = " << _orientDbg(in.orient));
  DJ_DBG_PRN("compress = " << _compressDbg(in.compress));
  DJ_DBG_PRN("channels = " << _channelsDbg(in.channels));
}

}
