/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: include/domains/graphics/color/colortypes.hpp

*/

#ifndef SGX_DOMAIN_GRAPHICS_COLORTYPES_HPP
#define SGX_DOMAIN_GRAPHICS_COLORTYPES_HPP		1

tUINT32  sgxGetRGB32(const tREAL32 r, const tREAL32 g, const tREAL32 b);
tUINT32  sgxGetRGBA32(const tREAL32 r, const tREAL32 g, const tREAL32 b, const tREAL32 a);

class sgxColorRGB;
class sgxColorHSV
{
public:
	sgxColorHSV();
	sgxColorHSV(const tREAL32 vh, const tREAL32 vs, const tREAL32 vv);
	sgxColorHSV(const tREAL32 vh, const tREAL32 vs, const tREAL32 vv, const tREAL32 va);

	sgxColorRGB rgb() const;

	tREAL32 h,s,v;
};

class sgxColorRGB
{
public:
	sgxColorRGB();
	sgxColorRGB(const tREAL32 vr, const tREAL32 vg, const tREAL32 vb);
	sgxColorRGB(const tREAL32 vr, const tREAL32 vg, const tREAL32 vb, const tREAL32 va);

	sgxColorHSV hsv() const;
	
			void	asHex(sgxString &str) const;
			tUINT32	asInt() const;
			void	fromInt(const tUINT32 col);

	static	tBOOL	fromName(sgxColorRGB &col, const sgxString &str);
	static	tBOOL	fromName(sgxColorRGB &col, const char *pName);

	SGX_INLINE	bool	operator!=(const sgxColorRGB &rhs) const { return (r!=rhs.r || g!=rhs.g || b!=rhs.b)?TRUE:FALSE; }


				void	darken(const tREAL32 pc=10);
				void	lighten(const tREAL32 pc=10);

	static const sgxColorRGB	White;
	static const sgxColorRGB	LtGrey;
	static const sgxColorRGB	DkGrey;
	static const sgxColorRGB	Black;
	static const sgxColorRGB	Red;
	static const sgxColorRGB	Green;
	static const sgxColorRGB	Blue;
	static const sgxColorRGB	Yellow;
	static const sgxColorRGB	Magenta;
	static const sgxColorRGB	Cyan;

	tREAL32 r,g,b;
};

class sgxColorRGBA
{
public:
	sgxColorRGBA();
	sgxColorRGBA(const tREAL32 vr, const tREAL32 vg, const tREAL32 vb);
	sgxColorRGBA(const tREAL32 vr, const tREAL32 vg, const tREAL32 vb, const tREAL32 va);

	sgxColorRGB rgb() const {
		return sgxColorRGB(r,g,b);
	}

			void	asHex(sgxString &str) const;
			tUINT32	asInt() const;
			void	fromInt(const tUINT32 col);

	static	tBOOL	fromName(sgxColorRGBA &col, const sgxString &str);
	static	tBOOL	fromName(sgxColorRGBA &col, const char *pName);

	static	sgxColorRGBA	fromHexString(const char *pName);

	SGX_INLINE	bool operator!=(const sgxColorRGBA &rhs) const 
	{ 
		return (r!=rhs.r || g!=rhs.g || b!=rhs.b || a!=rhs.a)?TRUE:FALSE; 
	}

	static const sgxColorRGBA	White;
	static const sgxColorRGBA	LtGrey;
	static const sgxColorRGBA	DkGrey;
	static const sgxColorRGBA	Black;
	static const sgxColorRGBA	Red;
	static const sgxColorRGBA	Green;
	static const sgxColorRGBA	Blue;
	static const sgxColorRGBA	Yellow;
	static const sgxColorRGBA	Magenta;
	static const sgxColorRGBA	Cyan;

	tREAL32 r,g,b,a;
};

#endif /* SGX_DOMAIN_GRAPHICS_COLORTYPES_HPP */
