
#ifndef SPECTRE_MATH_COLOR_H
#define SPECTRE_MATH_COLOR_H

#include "Vector3.h"
#include "Vector4.h"

// Basic structure representing a color in 32bit RGBA
struct Color
{
public :
	unsigned char r, g, b, a;

	// Predefined colors
	static const Color Black;
	static const Color White;
	static const Color Red;
	static const Color Green;
	static const Color Blue;
	static const Color Transparant;

	Color(unsigned char red = 0, unsigned char green = 0, unsigned char blue = 0, unsigned char alpha = 255);

	// Assignment
	Color(const Color& color);

	Color& operator=(const Color& color);

	// Convert to RGB float.
	// Each component is clamped to the range [0.0f, 1.0f]
	Vector3f toRGBf() const;

	// Convert to RGBA float.
	// Each component is clamped to the range [0.0f, 1.0f]
	Vector4f toRGBAf() const;
};

// ---------
//  Compare
// ---------
bool operator ==(const Color& a, const Color& b);
bool operator !=(const Color& a, const Color& b);

// ------------
//  Arithmetic
// ------------
Color operator +(const Color& a, const Color& b);
Color operator -(const Color& a, const Color& b);
Color operator /(const Color& a, const Color& b);
Color operator *(const Color& a, const Color& b);

Color& operator +=(Color& a, const Color& b);
Color& operator -=(Color& a, const Color& b);
Color& operator /=(Color& a, const Color& b);
Color& operator *=(Color& a, const Color& b);

// -------------------
//  Scalar arithmetic
// -------------------
Color operator +(const Color& a, unsigned int s);
Color operator -(const Color& a, unsigned int s);
Color operator /(const Color& a, unsigned int s);
Color operator *(const Color& a, unsigned int s);

#endif /* SPECTRE_MATH_COLOR_H */
