absence_thelab

view src/common/color.h @ 0:1cffe3409164

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 23 Oct 2014 01:46:07 +0300
parents
children
line source
1 #ifndef _COLORS_H_
2 #define _COLORS_H_
4 #include <cmath>
5 #include "typedefs.h"
7 #ifdef _MSC_VER
8 #ifdef DOUBLE_PRECISION_MATH
9 typedef double float_t;
10 #else
11 typedef float float_t;
12 #endif // DOUBLE_PRECISION_MATH
13 #endif // _MSC_VER
15 #ifdef NUC3D_VER_DIRECT3D
17 #include "d3d8.h"
19 class Color : public D3DCOLORVALUE {
20 public:
22 #else
24 class Color {
25 public:
26 float_t r, g, b, a;
28 #endif // NUC3D_VER_DIRECT3D
30 Color(float_t intensity = 1.0f);
31 Color(float_t r, float_t g, float_t b, float_t a = 1.0f);
32 Color(unsigned int r, unsigned int g, unsigned int b, unsigned int a = 255);
33 Color(int r, int g, int b, int a = 255);
34 Color(dword pcol);
35 Color(long pcol);
37 Color operator +(const Color &col) const;
38 Color operator -(const Color &col) const;
39 Color operator *(const Color &col) const;
40 Color operator *(float_t scalar) const;
42 void operator +=(const Color &col);
43 void operator -=(const Color &col);
44 void operator *=(const Color &col);
45 void operator *=(float_t scalar);
47 dword GetPacked32() const;
48 word GetPacked16() const;
49 word GetPacked15() const;
50 byte GetNearest8(const byte **pal) const;
51 };
53 Color BlendColors(const Color &c1, const Color &c2, float_t t);
55 #endif // _COLORS_H_