CColor: fix getAsHex

This commit is contained in:
Vaxry 2024-04-05 21:23:06 +01:00
parent 094bce8118
commit b5b1c0137d
2 changed files with 3 additions and 3 deletions

View file

@ -21,6 +21,6 @@ CColor::CColor(uint64_t hex) {
this->a = ALPHA(hex); this->a = ALPHA(hex);
} }
uint64_t CColor::getAsHex() { uint32_t CColor::getAsHex() {
return ((int)a) * 0x1000000 + ((int)r) * 0x10000 + ((int)g) * 0x100 + ((int)b) * 0x1; return (uint32_t)(a * 255.f) * 0x1000000 + (uint32_t)(r * 255.f) * 0x10000 + (uint32_t)(g * 255.f) * 0x100 + (uint32_t)(b * 255.f) * 0x1;
} }

View file

@ -10,7 +10,7 @@ class CColor {
float r = 0, g = 0, b = 0, a = 1.f; float r = 0, g = 0, b = 0, a = 1.f;
uint64_t getAsHex(); uint32_t getAsHex();
CColor operator-(const CColor& c2) const { CColor operator-(const CColor& c2) const {
return CColor(r - c2.r, g - c2.g, b - c2.b, a - c2.a); return CColor(r - c2.r, g - c2.g, b - c2.b, a - c2.a);