/*------------------------------------------------------------------------------
 src/lib/djImage/pixel.cxx
 
 Copyright (c) 2004-2006 Darby Johnston.
 All rights reserved.
 Use is subject to license terms.
------------------------------------------------------------------------------*/

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

namespace dj {

const StrList deflateStr(const Pixel & in)
{
  StrList out;
  out += deflateStr(in.format(), pixelFormatStr());
  out += deflateStr(in.type(), pixelTypeStr());
  return out;
}

bool inflateStr(StrList & in, Pixel * out)
{
  DJ_ASSERT(out);
  PIXEL_FORMAT format = PIXEL_FORMAT(0);
  PIXEL_TYPE type = PIXEL_TYPE(0);
  if (! inflateStr(in, &format, pixelFormatStr())) return false;
  if (! inflateStr(in, &type, pixelTypeStr())) return false;
  out->set(format, type);
  return true;
}

Dbg & operator << (Dbg & dbg, PIXEL_TYPE in)
  { return dbg << pixelTypeStr()[in]; }
Dbg & operator << (Dbg & dbg, PIXEL_FORMAT in)
  { return dbg << pixelFormatStr()[in]; }
Dbg & operator << (Dbg & dbg, const Pixel & in)
  { return dbg << in.format() << " " << in.type(); }

}
