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


		ColorCMYK.h


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


		Author:	Mathieu
		Date:	12/14/98

		Revision History

		when		who			what & why
		==========	==========	======================================================
		12/18/98	Frh			Added == operator, fixed copy operator parameter
		12/15/98	Mathieu		Created
	
*****************************************************************************************/


#ifndef __ColorCMYK__
#define __ColorCMYK__

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


/// \addtogroup MCImage
/// \{

/// Represents a color defined by the channels Cyan, Magenta, Yellow, BlacK, and optionally Green and Orange
///
class TColorCMYK
{
public:

			TColorCMYK	()								{fChannelCount = 4;}
			TColorCMYK	(const TColorCMYK& cmyk)		{ FromCMYK (cmyk);	}
			TColorCMYK	(uint8 count, uint16 channel[]) { FromCMYK (count, channel); }


	void	FromCMYK	(const uint8, const uint16[]);
	void	FromCMYK	(const TColorCMYK&);

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

	inline boolean operator== (const TColorCMYK& c2) const
	{
		for (int i = 0 ; i < fChannelCount ; i++)
		{
			if (fComps[i] != c2.fComps[i])
				return false;
		}
		return true;
	}

	void Init();

	TColorCMYK& operator=	(const TColorCMYK& cmyk)	{ FromCMYK(cmyk); return *this; }
	

	uint8 ChannelCount() const	{ return fChannelCount; }
	
	uint16	Cyan()		 const	{ return fComps[0]; }
	uint16	Magenta()	 const	{ return fComps[1]; }
	uint16	Yellow()	 const	{ return fComps[2]; }
	uint16	Black()		 const	{ return fComps[3]; }
	uint16	Green()		 const	{ return fComps[4]; }
	uint16	Orange()	 const	{ return fComps[5]; }
	
	uint16& Cyan()				{ return fComps[0]; }
	uint16& Magenta()			{ return fComps[1]; }
	uint16& Yellow()			{ return fComps[2]; }
	uint16& Black()				{ return fComps[3]; }
	uint16& Green()				{ return fComps[4]; }
	uint16& Orange()			{ return fComps[5]; }


private :

	uint16 fComps[16];		///< can be more than 4 channels (Hexachrome)
	uint8  fChannelCount;

};

/// \}



#endif // __ColorCMYK__