////////////////////////////////////////////////////////////////////////////////
// Color.h
// Copyright Bjoern Ganster
// Developed since 2000
////////////////////////////////////////////////////////////////////////////////

#ifndef Color__h
#define Color__h

#include "BGBase.h"
#include "BGCPString.h"

typedef float ColorBase;

class Color: public VirtualClass {
public:
	ColorBase r, g, b, a;

	// Constructor
	Color(ColorBase red = 1.0f, ColorBase green = 1.0f, ColorBase blue = 1.0f, ColorBase transparency = 1.0f);

	// Destructor
	~Color();

	// Produce a random color
	static Color random(ColorBase transparency = 1.0f);

	// Apply
	void glColor() const;

	// Binary addition
	Color operator+(const Color& c) const;

	// Binary multiplication
	Color operator*(const Color& c) const;

	// Multiplication with scalar
	Color operator*(ColorBase f) const;

	// Comparison with Color
	bool operator ==(const Color& c) const;

	bool operator!=(const Color& c) const;

	static Color red();
	static Color green();
	static Color blue();
	static Color white();
	static Color black();
};

////////////////////////////////////////////////////////////////////////////////
// Parse hex. color entries such as ff ff ff (white), 80 80 80 (grey) or ff 00 00 (red)

Color parseColor (const BGCPString& line);

////////////////////////////////////////////////////////////////////////////////

Color interpolateColor(ColorBase val, ColorBase minVal, 
   ColorBase maxVal, const Color& minColor, const Color& maxColor);

#endif
