Color: Add setters for the red, green and blue components.

This commit is contained in:
Andreas Kling 2019-06-16 15:09:11 +02:00
parent 1db169244a
commit 017c0f87b4
Notes: sideshowbarker 2024-07-19 13:34:37 +09:00

View file

@ -58,6 +58,24 @@ public:
m_value |= value << 24;
}
void set_red(byte value)
{
m_value &= 0xff00ffff;
m_value |= value << 16;
}
void set_green(byte value)
{
m_value &= 0xffff00ff;
m_value |= value << 8;
}
void set_blue(byte value)
{
m_value &= 0xffffff00;
m_value |= value;
}
Color with_alpha(byte alpha)
{
return Color((m_value & 0x00ffffff) | alpha << 24);