1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00
SqMod/source/Base/Color3.hpp

459 lines
14 KiB
C++

#ifndef _BASE_COLOR3_HPP_
#define _BASE_COLOR3_HPP_
// ------------------------------------------------------------------------------------------------
#include "SqBase.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
/* ------------------------------------------------------------------------------------------------
*
*/
struct Color3
{
/* --------------------------------------------------------------------------------------------
* ...
*/
typedef unsigned char Value;
/* --------------------------------------------------------------------------------------------
* ...
*/
static const Color3 NIL;
static const Color3 MIN;
static const Color3 MAX;
/* --------------------------------------------------------------------------------------------
* ...
*/
static SQChar Delim;
/* --------------------------------------------------------------------------------------------
* ...
*/
Value r, g, b;
/* --------------------------------------------------------------------------------------------
*
*/
Color3();
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3(Value sv);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3(Value rv, Value gv, Value bv);
/* --------------------------------------------------------------------------------------------
*
*/
Color3(const Color3 & o);
/* --------------------------------------------------------------------------------------------
*
*/
~Color3();
/* --------------------------------------------------------------------------------------------
*
*/
Color3 & operator = (const Color3 & o);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator = (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator = (CSStr name);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator = (const Color4 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator += (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator -= (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator *= (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator /= (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator %= (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator &= (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator |= (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator ^= (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator <<= (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator >>= (const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator += (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator -= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator *= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator /= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator %= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator &= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator |= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator ^= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator <<= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator >>= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator ++ ();
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 & operator -- ();
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator ++ (int);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator -- (int);
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator + (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator - (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator * (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator / (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator % (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator & (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator | (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator ^ (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator << (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator >> (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator + (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator - (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator * (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator / (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator % (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator & (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator | (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator ^ (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator << (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator >> (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator + () const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator - () const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Color3 operator ~ () const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator == (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator != (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator < (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator > (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator <= (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator >= (const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
operator Color4 () const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Int32 Cmp(const Color3 & c) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
CSStr ToString() const;
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(Value ns);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(Value nr, Value ng, Value nb);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(const Color3 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(const Color4 & c);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(CSStr str, SQChar delim);
/* --------------------------------------------------------------------------------------------
* ...
*/
void SetCol(CSStr name);
/* --------------------------------------------------------------------------------------------
* ...
*/
Uint32 GetRGB() const;
/* --------------------------------------------------------------------------------------------
* ...
*/
void SetRGB(Uint32 p);
/* --------------------------------------------------------------------------------------------
* ...
*/
Uint32 GetRGBA() const;
/* --------------------------------------------------------------------------------------------
* ...
*/
void SetRGBA(Uint32 p);
/* --------------------------------------------------------------------------------------------
* ...
*/
Uint32 GetARGB() const;
/* --------------------------------------------------------------------------------------------
* ...
*/
void SetARGB(Uint32 p);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Generate();
/* --------------------------------------------------------------------------------------------
* ...
*/
void Generate(Value min, Value max);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Generate(Value rmin, Value rmax, Value gmin, Value gmax, Value bmin, Value bmax);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Clear()
{
r = 0, g = 0, b = 0;
}
/* --------------------------------------------------------------------------------------------
* ...
*/
void Random();
/* --------------------------------------------------------------------------------------------
* ...
*/
void Inverse();
};
} // Namespace:: SqMod
#endif // _BASE_COLOR3_HPP_