2#include "../Containers/String.hpp"
6 template <
class T,
int TMax>
12 #pragma warning(suppress: 4201)
17 IColor(
float color[4]) :
r(color[0]),
g(color[1]),
b(color[2]),
a(color[3]) { }
22 return Color(
r + other.
r,
g + other.
g,
b + other.
b,
a + other.
a);
27 return Color(
r + other.
r,
g + other.
g,
b + other.
b,
a + other.
a);
32 return Color(
r - other.
r,
g - other.
g,
b - other.
b,
a - other.
a);
37 return Color(
r - other.
r,
g - other.
g,
b - other.
b,
a - other.
a);
42 return Color((1 - time) *
r + other.
r * time, (1 - time) *
g + other.
g * time, (1 - time) *
b + other.
b * time, (1 - time) *
a + other.
a * time);
54#define SSCANF sscanf_s
60 if (hex[0] ==
'#') hex.
Erase(0);
61 int r = 255,
g = 255,
b = 255,
a = 255;
67 else if (hex.
Length() == 8)
69 SSCANF(*hex,
"%02x%02x%02x%02x", &
r, &
g, &
b, &
a);
72 return IColor((
r / 255.0f) *
static_cast<float>(TMax), (
g / 255.0f) *
static_cast<float>(TMax), (
b / 255.0f) *
static_cast<float>(TMax), (
a / 255.0f) *
static_cast<float>(TMax));
79 template <
class T,
int TMax>
82 template <
class T,
int TMax>
85 template <
class T,
int TMax>
88 template <
class T,
int TMax>
91 template <
class T,
int TMax>
94 template <
class T,
int TMax>
#define SSCANF
Definition Color.hpp:56
uint32 Length()
Definition String.hpp:25
void Erase(uint32 index, uint32 amount=1)
Definition String.hpp:31
IColor< float, 1 > FloatColor
Definition Color.hpp:76
IColor< uint8, 255 > UInt8Color
Definition Color.hpp:77
IColor operator-(IColor &other)
Definition Color.hpp:30
T r
Definition Color.hpp:13
IColor(T r, T g, T b, T a=TMax)
Definition Color.hpp:16
static IColor White
Definition Color.hpp:49
IColor Lerp(IColor &other, float time) const
Definition Color.hpp:40
static IColor Black
Definition Color.hpp:50
static IColor Green
Definition Color.hpp:47
T g
Definition Color.hpp:13
IColor operator+(IColor &other)
Definition Color.hpp:20
static IColor Clear
Definition Color.hpp:51
T d[4]
Definition Color.hpp:11
IColor(float color[4])
Definition Color.hpp:17
T b
Definition Color.hpp:13
T a
Definition Color.hpp:13
IColor()
Definition Color.hpp:18
static IColor FromHex(String hex)
Definition Color.hpp:58
static IColor Red
Definition Color.hpp:46
static IColor Blue
Definition Color.hpp:48