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

#ifndef DJ_COLOR_H
#define DJ_COLOR_H
#include <djPixelData.h>

namespace dj {

// Color.
//
class Color : public PixelData {
public:

  Color();
  Color(const Pixel &);
  Color(PIXEL_FORMAT, PIXEL_TYPE);
  Color(PixelF32 l);
  Color(PixelF32 l, PixelF32 a);
  Color(PixelF32 r, PixelF32 g, PixelF32 b);
  Color(PixelF32 r, PixelF32 g, PixelF32 b, PixelF32 a);

  // Set.
  //
  void set(const Pixel &);
  void set(PIXEL_FORMAT, PIXEL_TYPE);
  void u8(PixelU8, int);
  void u16(PixelU16, int);
  void f32(PixelF32, int);

  // Get.
  //
  PixelU8 u8(int) const;
  PixelU16 u16(int) const;
  PixelF32 f32(int) const;
  
  // Comparison.
  //
  bool operator == (const Color &) const;
  bool operator != (const Color &) const;

private:

  void set(const Vec2i &, const Pixel &);
};

// Conversion.
//
void convert(const Color &, Color *);

// Serialize.
//
const StrList deflateStr(const Color &);
bool inflateStr(StrList &, Color *);

}

#endif
