/****************************************************************************************


		ColorLab.h


		Copyright: (c) 2001 Eovia Corp. All rights reserved.


		Author:	Mathieu
		Date:	01/25/98

		Revision History

		when		who			what & why
		==========	==========	======================================================
		01/25/98	Mathieu		Created
	
*****************************************************************************************/


#ifndef __ColorLab__
#define __ColorLab__

#include "MCBasicTypes.h"
#include "MCAssert.h"


/// \addtogroup MCImage
/// \{

/// Represents a color in the LAB space
///
/// \verbatim
/// storage format : uint16, as defined in the ICC specs
/// L     :    0   : 0x0	, 100.0 : 0xFF00,		100.39 : 0xFFFF
/// a*,b* : -128.0 : 0x0	, 0.0   : 0x8000.		127.0  : 0xFF00    
/// \endverbatim 
///
class TColorLab
{
public:

	TColorLab ()							{}
	TColorLab (const TColorLab& lab)		{FromLab (lab);}
	TColorLab (const uint16[]);
	TColorLab (const uint16, const uint16, const uint16);

	void	FromLab		(const TColorLab&);

	uint16& operator[]	(int8 i)			{ MCAssert((i >= 0) && (i < 3)); return fComps[i]; }
	uint16  operator[]	(int8 i) const		{ MCAssert((i >= 0) && (i < 3)); return fComps[i]; }


	inline boolean		operator==	(const TColorLab& c2) const
	{
		return (fComps[0] == c2.fComps[0] && fComps[1] == c2.fComps[1] && fComps[2] == c2.fComps[2]);
	}


		   TColorLab&	operator=	(const TColorLab& lab) { FromLab(lab); return *this; }	

	uint16  L()		const	{ return fComps[0]; }
	uint16  A()		const	{ return fComps[1]; }
	uint16  B()		const	{ return fComps[2]; }
	
	uint16& L()				{ return fComps[0]; }
	uint16& A()				{ return fComps[1]; }
	uint16& B()				{ return fComps[2]; }


private :

	uint16 fComps[3];		

};

/// \}


#endif // __ColorLab__