mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-03 21:51:55 -07:00
Normalize color storage
Colors are now normalized to 0 - 1 values instead of 0 - 255 causes calculations to be simpler and generally cleans up the codebase.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
CColor::CColor() {}
|
||||
|
||||
CColor::CColor(float r, float g, float b, float a) {
|
||||
RASSERT(r <= 1.f && g <= 1.f && b <= 1.f && a <= 1.f, "un-normalized color assignment");
|
||||
this->r = r;
|
||||
this->g = g;
|
||||
this->b = b;
|
||||
@@ -11,10 +12,10 @@ CColor::CColor(float r, float g, float b, float a) {
|
||||
}
|
||||
|
||||
CColor::CColor(uint64_t hex) {
|
||||
this->r = RED(hex) * 255.f;
|
||||
this->g = GREEN(hex) * 255.f;
|
||||
this->b = BLUE(hex) * 255.f;
|
||||
this->a = ALPHA(hex) * 255.f;
|
||||
this->r = RED(hex);
|
||||
this->g = GREEN(hex);
|
||||
this->b = BLUE(hex);
|
||||
this->a = ALPHA(hex);
|
||||
}
|
||||
|
||||
uint64_t CColor::getAsHex() {
|
||||
|
Reference in New Issue
Block a user