2022-03-31 17:50:00 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-02-27 13:32:38 +01:00
|
|
|
#include <cstdint>
|
2022-03-31 17:50:00 +02:00
|
|
|
|
|
|
|
class CColor {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
2022-03-31 17:50:00 +02:00
|
|
|
CColor();
|
2023-11-11 01:52:40 +01:00
|
|
|
CColor(float r, float g, float b, float a);
|
2022-03-31 17:50:00 +02:00
|
|
|
CColor(uint64_t);
|
|
|
|
|
2023-01-05 19:25:45 +01:00
|
|
|
float r = 0, g = 0, b = 0, a = 1.f;
|
2022-03-31 17:50:00 +02:00
|
|
|
|
2024-04-05 22:23:06 +02:00
|
|
|
uint32_t getAsHex();
|
2022-04-23 21:47:16 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
CColor operator-(const CColor& c2) const {
|
2023-02-27 13:32:38 +01:00
|
|
|
return CColor(r - c2.r, g - c2.g, b - c2.b, a - c2.a);
|
2022-04-23 21:47:16 +02:00
|
|
|
}
|
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
CColor operator+(const CColor& c2) const {
|
2022-04-23 21:47:16 +02:00
|
|
|
return CColor(r + c2.r, g + c2.g, b + c2.b, a + c2.a);
|
|
|
|
}
|
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
CColor operator*(const float& v) const {
|
2022-04-23 21:47:16 +02:00
|
|
|
return CColor(r * v, g * v, b * v, a * v);
|
|
|
|
}
|
2022-09-25 20:07:48 +02:00
|
|
|
|
2022-05-12 11:27:31 +02:00
|
|
|
bool operator==(const CColor& c2) const {
|
|
|
|
return r == c2.r && g == c2.g && b == c2.b && a == c2.a;
|
|
|
|
}
|
2023-11-11 01:52:40 +01:00
|
|
|
|
|
|
|
CColor stripA() const {
|
|
|
|
return {r, g, b, 1};
|
|
|
|
}
|
2022-09-25 20:07:48 +02:00
|
|
|
};
|